Download button

This commit is contained in:
inorichi 2015-09-29 14:40:36 +02:00
parent 59fa396eeb
commit 790ccdaba6
15 changed files with 32 additions and 8 deletions

View File

@ -18,4 +18,12 @@ public class PreferencesHelper {
mPref.edit().clear().apply();
}
public boolean isFirstRun() {
return mPref.getBoolean("firstrun", true);
}
public void setNotFirstRun() {
mPref.edit().putBoolean("firstrun", false).commit();
}
}

View File

@ -44,8 +44,6 @@ public class MangaManager extends BaseManager {
m.thumbnail_url="http://example.com/pic.png";
m.title="One Piece";
insert(m).subscribe();
m.title="Berserk";
insert(m).subscribe();
}
}

View File

@ -6,6 +6,7 @@ import javax.inject.Inject;
import eu.kanade.mangafeed.App;
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
import eu.kanade.mangafeed.data.models.Manga;
import eu.kanade.mangafeed.ui.activity.MangaDetailActivity;
import eu.kanade.mangafeed.view.LibraryView;
@ -18,11 +19,22 @@ public class LibraryPresenter {
private LibraryView view;
@Inject
public DatabaseHelper db;
DatabaseHelper db;
@Inject
PreferencesHelper prefs;
public LibraryPresenter(LibraryView view) {
this.view = view;
App.getComponent(view.getActivity()).inject(this);
//TODO remove, only for testing
if (prefs.isFirstRun()) {
db.manga.createDummyManga();
db.chapter.createDummyChapters();
prefs.setNotFirstRun();
}
}
public void onMangaClick(EasyAdapter<Manga> adapter, int position) {

View File

@ -1,6 +1,7 @@
package eu.kanade.mangafeed.ui.adapter;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import eu.kanade.mangafeed.R;
@ -16,11 +17,15 @@ public class ChapterListHolder extends ItemViewHolder<Chapter> {
@ViewId(R.id.chapter_title)
TextView title;
@ViewId(R.id.chapter_download_image)
ImageView download_icon;
public ChapterListHolder(View view) {
super(view);
}
public void onSetValues(Chapter chapter, PositionInfo positionInfo) {
title.setText(chapter.name);
download_icon.setImageResource(R.drawable.ic_file_download_black_48dp);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

View File

@ -1,18 +1,19 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="eu.kanade.mangafeed.ui.activity.MangaDetailActivity">
tools:context="eu.kanade.mangafeed.ui.activity.MangaDetailActivity"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"/>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/manga_chapters_list"
tools:listitem="@layout/item_chapter"
android:height="?android:listPreferredItemHeight"/>
</RelativeLayout>
</LinearLayout>