From 790ccdaba69ea4b0a670994a84393f7f71a87776 Mon Sep 17 00:00:00 2001 From: inorichi Date: Tue, 29 Sep 2015 14:40:36 +0200 Subject: [PATCH] Download button --- .../mangafeed/data/helpers/PreferencesHelper.java | 8 ++++++++ .../mangafeed/data/managers/MangaManager.java | 2 -- .../mangafeed/presenter/LibraryPresenter.java | 14 +++++++++++++- .../mangafeed/ui/adapter/ChapterListHolder.java | 5 +++++ .../drawable-hdpi/ic_file_download_black_24dp.png | Bin 0 -> 148 bytes .../drawable-hdpi/ic_file_download_black_48dp.png | Bin 0 -> 173 bytes .../drawable-mdpi/ic_file_download_black_24dp.png | Bin 0 -> 114 bytes .../drawable-mdpi/ic_file_download_black_48dp.png | Bin 0 -> 144 bytes .../ic_file_download_black_24dp.png | Bin 0 -> 144 bytes .../ic_file_download_black_48dp.png | Bin 0 -> 209 bytes .../ic_file_download_black_24dp.png | Bin 0 -> 173 bytes .../ic_file_download_black_48dp.png | Bin 0 -> 264 bytes .../ic_file_download_black_24dp.png | Bin 0 -> 209 bytes .../ic_file_download_black_48dp.png | Bin 0 -> 305 bytes app/src/main/res/layout/activity_manga_detail.xml | 11 ++++++----- 15 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_file_download_black_24dp.png create mode 100644 app/src/main/res/drawable-hdpi/ic_file_download_black_48dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_file_download_black_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_file_download_black_48dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_file_download_black_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_file_download_black_48dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_file_download_black_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_file_download_black_48dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_file_download_black_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_file_download_black_48dp.png 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 cab0d887c5..46b43e153e 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 2ac56abe7e..5a1b49e8a4 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 27065254b9..ff21dab68a 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 ecd42bfd8b..0157a1261b 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 0000000000000000000000000000000000000000..d9aacea4c67e78f5e6d75b133befa380f6d849c2 GIT binary patch literal 148 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K8w5N+>NCo5DOB;Ea6-1Z=`wwaK zlr7#Ec`0zmrbkLnzs~>VT)6(!jYHeM3V+#XxRBFz+79ba7X-_-E8Go47Mzgi>REWg wMe|>k`#dLBo!|pTtSxP|xh8TPw&^vD-tvEwul@ZBw1t7e)78&qol`;+0AD0DVgLXD literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..ce97c85dfa3544a0246aa9604effbfd8a9b8d75f GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhawN<3X0Ln;{Gp4-UCWXRBZq37JQ z<#+XSgBE;>Xqc?B^YPCZXI|4Q0T80z@JOXzdv<3r#1fAyL;U#1&qKZB>MpUXO@geCyfj6=8p literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..c2c845e8494bcc13406458c6ed3b1f9fd8618a1d GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1OHUWakP60R38@G6Onq4g7bP0l+XkK5V;_b literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..f5afb24dc5724aefabc49520b22dfcb761e6dac2 GIT binary patch literal 144 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}b0Da8DP)a=3ghylE3c2%xjXsc0z{Fyzw{Joqi?vh|k>Fb%|&7*ZgcX-Cywh rKBv-wx%XKF1wV;r<(2c81cdTS$sUS|W!^RgXa$3(tDnm{r-UW|Z)a=3ghylE3c2%xjXsc0z{Fyzw{Joqi?vh|k>Fb%|&7*ZgcX-Cywh rKBv-wx%XKF1wV;r<(2c81cdTS$sUS|W!^RgXa$3(tDnm{r-UW|ZXqc?B^YPCZXI|4Q0T80z@JOXzdv<3r#1fAyL;U#1&qKZB>MpUXO@geCyfj6=8p literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..7024677f63ba5654061138cb6c887d6cbd8cd16e GIT binary patch literal 264 zcmeAS@N?(olHy`uVBq!ia0vp^6F``W8A#63;L-+CoB=)|u0R?Bnv-810J4}%g8YIR z{x`I|+SLQ(uJ&|s45?szdv0SUOCS%!Mc0Bxu0Z?gHIFYW-NE_w^^uEqmZmx{jtZaI zdX0I{x%J<_F7GwFm9e<@6VJZ9z&QuMmtJOQry9=^}c(P=<~# tlyP_xISf79`&DxfRxf6E`Jb`&EA#8N7|*_%oGT#zc)I$ztaD0e0syc5W^Dif literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..8c83bffa7e4443c2f9bc5c037152366bbd2b2a8c GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeG3?%1&o4*=JaR&H=xB_ViXik240LWr43GxeO z_}|d-YF7`CTjJ^B7*fIb_UuMphX4_Wz@K-epY(rm$rSOv5x&UEQI+e--EU&)I|8Rx zn`YUVUt2QqqO7p8jPYX2Y1uALFv!Bh(&V7xf`I2(I$9v`=tPEz0uwjrB`PNJK1xr$ eb^X}yRc5jUbNLGR3)cYcXYh3Ob6Mw<&;$VajYK&B literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..065bcf7202b39f5c5451ddb96b5217da0a93922c GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^2SAvK8A$4HYMBD0I0Jk_T!AzMG$+420Aw+j1o;Is z{BLM^wW|lnz2fQO7*fIb_WVNLLkSWLflbK*ZofD-EiUPN7ae)zKTF>P>-tA`SFNhs z|8vE|RSO~Dp~SZ+K7aoAPd|LvpxeH?{Vs=akHJA0p}@!?(7*sE1P*ct^e})3GFb{> zlNmXL8w@}M(0B~ikFJ2w$IBKz{NKK6l~xJUlCNorP75UWf;{f&>gTe~DWM4f!R=%M literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_manga_detail.xml b/app/src/main/res/layout/activity_manga_detail.xml index 2e7fcfb1ae..5de20a8c4b 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"> - +