diff --git a/app/src/main/java/eu/kanade/mangafeed/data/helpers/PreferencesHelper.java b/app/src/main/java/eu/kanade/mangafeed/data/helpers/PreferencesHelper.java index cab0d887c..46b43e153 100644 --- a/app/src/main/java/eu/kanade/mangafeed/data/helpers/PreferencesHelper.java +++ b/app/src/main/java/eu/kanade/mangafeed/data/helpers/PreferencesHelper.java @@ -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(); + } + } diff --git a/app/src/main/java/eu/kanade/mangafeed/data/managers/MangaManager.java b/app/src/main/java/eu/kanade/mangafeed/data/managers/MangaManager.java index 2ac56abe7..5a1b49e8a 100644 --- a/app/src/main/java/eu/kanade/mangafeed/data/managers/MangaManager.java +++ b/app/src/main/java/eu/kanade/mangafeed/data/managers/MangaManager.java @@ -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(); } } diff --git a/app/src/main/java/eu/kanade/mangafeed/presenter/LibraryPresenter.java b/app/src/main/java/eu/kanade/mangafeed/presenter/LibraryPresenter.java index 27065254b..ff21dab68 100644 --- a/app/src/main/java/eu/kanade/mangafeed/presenter/LibraryPresenter.java +++ b/app/src/main/java/eu/kanade/mangafeed/presenter/LibraryPresenter.java @@ -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 adapter, int position) { diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/ChapterListHolder.java b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/ChapterListHolder.java index ecd42bfd8..0157a1261 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/ChapterListHolder.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/ChapterListHolder.java @@ -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 { @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); } } diff --git a/app/src/main/res/drawable-hdpi/ic_file_download_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_file_download_black_24dp.png new file mode 100644 index 000000000..d9aacea4c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_file_download_black_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_file_download_black_48dp.png b/app/src/main/res/drawable-hdpi/ic_file_download_black_48dp.png new file mode 100644 index 000000000..ce97c85df Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_file_download_black_48dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_file_download_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_file_download_black_24dp.png new file mode 100644 index 000000000..c2c845e84 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_file_download_black_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_file_download_black_48dp.png b/app/src/main/res/drawable-mdpi/ic_file_download_black_48dp.png new file mode 100644 index 000000000..f5afb24dc Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_file_download_black_48dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_file_download_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_file_download_black_24dp.png new file mode 100644 index 000000000..f5afb24dc Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_file_download_black_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_file_download_black_48dp.png b/app/src/main/res/drawable-xhdpi/ic_file_download_black_48dp.png new file mode 100644 index 000000000..8c83bffa7 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_file_download_black_48dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_file_download_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_file_download_black_24dp.png new file mode 100644 index 000000000..ce97c85df Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_file_download_black_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_file_download_black_48dp.png b/app/src/main/res/drawable-xxhdpi/ic_file_download_black_48dp.png new file mode 100644 index 000000000..7024677f6 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_file_download_black_48dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_file_download_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_file_download_black_24dp.png new file mode 100644 index 000000000..8c83bffa7 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_file_download_black_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_file_download_black_48dp.png b/app/src/main/res/drawable-xxxhdpi/ic_file_download_black_48dp.png new file mode 100644 index 000000000..065bcf720 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_file_download_black_48dp.png differ diff --git a/app/src/main/res/layout/activity_manga_detail.xml b/app/src/main/res/layout/activity_manga_detail.xml index 2e7fcfb1a..5de20a8c4 100644 --- a/app/src/main/res/layout/activity_manga_detail.xml +++ b/app/src/main/res/layout/activity_manga_detail.xml @@ -1,18 +1,19 @@ - + tools:context="eu.kanade.mangafeed.ui.activity.MangaDetailActivity" + android:orientation="vertical"> - +