From 51f406e20c4b3db04a9719f86c0c934b452de50a Mon Sep 17 00:00:00 2001 From: Amine Date: Sat, 11 Nov 2017 20:39:56 +0100 Subject: [PATCH] New action bar. Closes #103. --- app/build.gradle | 3 +- app/src/main/AndroidManifest.xml | 3 +- .../bou/readerforselfoss/ReaderActivity.kt | 93 ++++--- .../bou/readerforselfoss/SourcesActivity.kt | 3 +- .../bou/readerforselfoss/utils/LinksUtils.kt | 4 +- app/src/main/res/drawable-hdpi/ic_add.png | Bin 0 -> 134 bytes .../res/drawable-hdpi/ic_add_black_24dp.png | Bin 124 -> 0 bytes .../drawable-hdpi/ic_chrome_reader_mode.png | Bin 0 -> 216 bytes .../res/drawable-hdpi/ic_open_in_browser.png | Bin 0 -> 204 bytes app/src/main/res/drawable-mdpi/ic_add.png | Bin 0 -> 116 bytes .../res/drawable-mdpi/ic_add_black_24dp.png | Bin 86 -> 0 bytes .../drawable-mdpi/ic_chrome_reader_mode.png | Bin 0 -> 136 bytes .../res/drawable-mdpi/ic_open_in_browser.png | Bin 0 -> 157 bytes app/src/main/res/drawable-xhdpi/ic_add.png | Bin 0 -> 168 bytes .../res/drawable-xhdpi/ic_add_black_24dp.png | Bin 108 -> 0 bytes .../drawable-xhdpi/ic_chrome_reader_mode.png | Bin 0 -> 171 bytes .../res/drawable-xhdpi/ic_open_in_browser.png | Bin 0 -> 230 bytes app/src/main/res/drawable-xxhdpi/ic_add.png | Bin 0 -> 242 bytes .../res/drawable-xxhdpi/ic_add_black_24dp.png | Bin 114 -> 0 bytes .../drawable-xxhdpi/ic_chrome_reader_mode.png | Bin 0 -> 263 bytes .../drawable-xxhdpi/ic_open_in_browser.png | Bin 0 -> 318 bytes app/src/main/res/drawable-xxxhdpi/ic_add.png | Bin 0 -> 500 bytes .../drawable-xxxhdpi/ic_add_black_24dp.png | Bin 119 -> 0 bytes .../ic_chrome_reader_mode.png | Bin 0 -> 296 bytes .../drawable-xxxhdpi/ic_open_in_browser.png | Bin 0 -> 408 bytes app/src/main/res/layout/activity_reader.xml | 243 +++++++++--------- app/src/main/res/layout/activity_sources.xml | 13 +- app/src/main/res/menu/reader_toolbar.xml | 25 ++ app/src/main/res/values/strings.xml | 3 + 29 files changed, 197 insertions(+), 193 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_add.png delete mode 100644 app/src/main/res/drawable-hdpi/ic_add_black_24dp.png create mode 100644 app/src/main/res/drawable-hdpi/ic_chrome_reader_mode.png create mode 100644 app/src/main/res/drawable-hdpi/ic_open_in_browser.png create mode 100644 app/src/main/res/drawable-mdpi/ic_add.png delete mode 100644 app/src/main/res/drawable-mdpi/ic_add_black_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_chrome_reader_mode.png create mode 100644 app/src/main/res/drawable-mdpi/ic_open_in_browser.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_add.png delete mode 100644 app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_chrome_reader_mode.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_open_in_browser.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_add.png delete mode 100644 app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_chrome_reader_mode.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_open_in_browser.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_add.png delete mode 100644 app/src/main/res/drawable-xxxhdpi/ic_add_black_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_chrome_reader_mode.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_open_in_browser.png create mode 100644 app/src/main/res/menu/reader_toolbar.xml diff --git a/app/build.gradle b/app/build.gradle index 6ca8ff0..1edfc02 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -143,7 +143,6 @@ dependencies { // Material-ish things compile 'com.ashokvarma.android:bottom-navigation-bar:2.0.3' - compile 'com.melnykov:floatingactionbutton:1.3.0' compile 'com.github.jd-alexander:LikeButton:0.2.1' compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' compile 'org.sufficientlysecure:html-textview:3.5' @@ -167,6 +166,8 @@ dependencies { // Github issues reporter compile 'com.heinrichreimersoftware:android-issue-reporter:1.3.1' + + compile 'com.github.rubensousa:floatingtoolbar:1.5.1' } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a501c0b..051fa71 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -65,8 +65,7 @@ + android:name=".ReaderActivity"> getContentFromMercury(customTabsIntent) + R.id.share_action -> this@ReaderActivity.shareLink(url) + R.id.open_action -> this@ReaderActivity.openItemUrl( + url, + contentText, + contentImage, + contentTitle, + contentSource, + customTabsIntent, + false, + false, + this@ReaderActivity) + else -> Unit + } + } + + override fun onItemLongClick(item: MenuItem?) { + } + }) + + if (contentText.isEmptyOrNullOrNullString()) { getContentFromMercury(customTabsIntent) } else { @@ -91,27 +121,7 @@ class ReaderActivity : DragDismissActivity() { .load(contentImage) .apply(RequestOptions.fitCenterTransform()) .into(image) - - shareBtn.setOnClickListener { - this@ReaderActivity.shareLink(url) - } - - browserBtn.setOnClickListener { - this@ReaderActivity.openItemUrl( - url, - contentText, - contentImage, - contentTitle, - contentSource, - customTabsIntent, - false, - false, - this@ReaderActivity) - } - - hideProgressBar() } - return v } private fun getContentFromMercury(customTabsIntent: CustomTabsIntent) { @@ -124,6 +134,7 @@ class ReaderActivity : DragDismissActivity() { if (response.body() != null && response.body()!!.content != null && response.body()!!.content.isNotEmpty()) { source.text = response.body()!!.domain title.text = response.body()!!.title + this@ReaderActivity.url = response.body()!!.url if (response.body()!!.content != null && !response.body()!!.content.isEmpty()) { try { content.text = Html.fromHtml(response.body()!!.content, HtmlHttpImageGetter(content, null, true), null) @@ -141,24 +152,6 @@ class ReaderActivity : DragDismissActivity() { .apply(RequestOptions.fitCenterTransform()) .into(image) - shareBtn.setOnClickListener { - this@ReaderActivity.shareLink(response.body()!!.url) - } - - browserBtn.setOnClickListener { - this@ReaderActivity.openItemUrl( - response.body()!!.url, - contentText, - contentImage, - contentTitle, - contentSource, - customTabsIntent, - false, - false, - this@ReaderActivity) - } - - hideProgressBar() } else openInBrowserAfterFailing() } diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt index f265cf9..277b707 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt @@ -3,6 +3,7 @@ package apps.amine.bou.readerforselfoss import android.content.Intent import android.os.Bundle import android.preference.PreferenceManager +import android.support.design.widget.FloatingActionButton import android.support.v7.app.AppCompatActivity import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.RecyclerView @@ -12,7 +13,6 @@ import apps.amine.bou.readerforselfoss.adapters.SourcesListAdapter import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi import apps.amine.bou.readerforselfoss.api.selfoss.Sources import com.ftinc.scoop.Scoop -import com.melnykov.fab.FloatingActionButton import retrofit2.Call import retrofit2.Callback import retrofit2.Response @@ -41,7 +41,6 @@ class SourcesActivity : AppCompatActivity() { val api = SelfossApi(this, this@SourcesActivity, prefs.getBoolean("isSelfSignedCert", false), prefs.getBoolean("should_log_everything", false)) var items: ArrayList = ArrayList() - mFab.attachToRecyclerView(mRecyclerView) mRecyclerView.setHasFixedSize(true) mRecyclerView.layoutManager = mLayoutManager diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/utils/LinksUtils.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/utils/LinksUtils.kt index 09216b3..cbb21e0 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/utils/LinksUtils.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/utils/LinksUtils.kt @@ -61,11 +61,11 @@ fun Context.openItemUrlInternally(linkDecoded: String, if (articleViewer) { val intent = Intent(this, ReaderActivity::class.java) - DragDismissIntentBuilder(this) + /*DragDismissIntentBuilder(this) .setFullscreenOnTablets(true) // defaults to false, tablets will have padding on each side .setDragElasticity(DragDismissIntentBuilder.DragElasticity.NORMAL) // Larger elasticities will make it easier to dismiss. .setDrawUnderStatusBar(true) - .build(intent) + .build(intent)*/ intent.putExtra("url", linkDecoded) diff --git a/app/src/main/res/drawable-hdpi/ic_add.png b/app/src/main/res/drawable-hdpi/ic_add.png new file mode 100644 index 0000000000000000000000000000000000000000..7800ba33d627ceed4ab719da9cd8ce23ec437f50 GIT binary patch literal 134 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCUr!gukcwMxZ*1gbFc4sJ_#S_2 zi=+a}Kg)xR>oyqX8t-HTDguHCt{uz}7K4H82V(|pMmHWP|G^zrFstG^^W;Nye|k0wldT1B8K;v!{z=NCji^0d}{88U+a%3{LE) zc(W3I@VD?TX6u!5iTdQ+%zl7P_JBaSLWcds4UNy(0^e=DSmGkkBjwV6s9vOpiQ(Iw WlC8ByowtC-F?hQAxvX|k0wldT1B8Lpd`}n0kcwN$2@XFY}9J|TeJe` OR0dC1KbLh*2~7ZjUQaLp literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_open_in_browser.png b/app/src/main/res/drawable-hdpi/ic_open_in_browser.png new file mode 100644 index 0000000000000000000000000000000000000000..5e9318639dfd0ca212a557005b0405000ff56f23 GIT binary patch literal 204 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8LpWKS2zkcwMxuR3xyC*?eC_9``@ARWH@7cEUTC9eD3mlxI&*OGR%e7b;#X80_i^B6o`{an^LB{Ts5 D>mE&J literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_add.png b/app/src/main/res/drawable-mdpi/ic_add.png new file mode 100644 index 0000000000000000000000000000000000000000..ed40b2b21627006beb1e6fa808e20b2304b557eb GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzYfl%)kcwMxuWjUHP!M1~@MeF> znmG=xQ@EGZuJibqIeRuQ1H*wwjgkxu4fTw>Kj|F+>HX8fz;N7};aHVL;lI$d7eEmP MPgg&ebxsLQ09S`3zyJUM literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_add_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_add_black_24dp.png deleted file mode 100644 index 23bf119211e02b139ad2e0961bc71662ce1caf1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 86 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1Sx*L2`{{=buP z{lDMNCIZW4SmK;a5?CW*n1p35c>haJP&Aa<@L}Z}m7rXOyZp`PFNa+D(DmZVFQ!EY k=bvEt_h|q71!pcW{Mq38ZjK?BJJ4tbPgg&ebxsLQ09z$8_5c6? literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_open_in_browser.png b/app/src/main/res/drawable-mdpi/ic_open_in_browser.png new file mode 100644 index 0000000000000000000000000000000000000000..312f7afcae46544ece7a26098bf165bbc952cc38 GIT binary patch literal 157 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_+i6i*k&kcwM(CpmI881S%sZ+7~7 z(Qf-&^{{M5sf$tUSlPd76St{7B|!TaJYD@<);T3K F0RXD+IVk`D literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_add.png b/app/src/main/res/drawable-xhdpi/ic_add.png new file mode 100644 index 0000000000000000000000000000000000000000..185be8a769b4b5dccc8ca553f2f698fa5a801099 GIT binary patch literal 168 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=`JOJ0Ar-gY-rC5?V8Fxd_;&x6 zOYK(zopr04XFQCIA2c literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png deleted file mode 100644 index 3191d5283e981b9eecdcaa54feda419515ef656f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}a}tV^0^ykP61P7Z(aL7zi*O{Br+` z`;vw;dk$=HXVkVR^_;bx1E`8&^BsGK4=F%~hW8~_)0*>!J6N0?fLsPoS3j3^P62u`0 zV~vi7!+uY}&c#fL%RS1Xl>3jGZ8L0{z#dVd;t?p2@cWzKr6X>I{_7jpH!V>*5xU_( z$fC#5TpAVe2GRdFHYggWw4Irt`D4X`jP-qvt`ADCe-}Pp(U7w9eBzopr0O$uo_W%F@ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_open_in_browser.png b/app/src/main/res/drawable-xhdpi/ic_open_in_browser.png new file mode 100644 index 0000000000000000000000000000000000000000..4ecaa05f7bb76297ebbb421f47dbf1646b3a3201 GIT binary patch literal 230 zcmVVL=LpZNEZVW1(;)i6#>VAR9FK30l=#wfJYa#06hDs0U+DyU;}tNOke`| zcwWH*5MBvj0NA{Bz}=<=eE|Ya2P|KH;?er&!KI02JS@XpI8da{`Sq* g_+Fs|2si<71FXjJy>K>ljsO4v07*qoM6N<$f=>)y!~g&Q literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_add.png b/app/src/main/res/drawable-xxhdpi/ic_add.png new file mode 100644 index 0000000000000000000000000000000000000000..2ab780a89de78daeb3faaf82d295a0007449cbe9 GIT binary patch literal 242 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGoJ3U<-Ln>~)y>^h7!GMF=@LRmq z+y&>mxMW_69gx@ZT&eHQz~I2Zz`?-4$e_T$z{1eLz#zcDzyuQfb1j#FI8ecEPzqOh nF96QO&p@}7L530LjD$$`Hy8gfbhUB40GZ+G>gTe~DWM4f^m`)q literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png deleted file mode 100644 index a84106b01fd4402e5d15b08c496a75b76e811999..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xf3?%cF6p=fS?83{ F1OO~S9V-9; diff --git a/app/src/main/res/drawable-xxhdpi/ic_chrome_reader_mode.png b/app/src/main/res/drawable-xxhdpi/ic_chrome_reader_mode.png new file mode 100644 index 0000000000000000000000000000000000000000..1797eb53637992b824654c6a08791b1a6df0af61 GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhaw&Uv~xhE&{od()Sz*+8J};hIOX zw~V{w7GD3%9<{eC;7)CCx7eask)@JTzt8UFzQ{f|pb%#%Xy06w{tqC%C(>iemtz%!c@7>r0^cjPv LtDnm{r-UW|WU^`~ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_open_in_browser.png b/app/src/main/res/drawable-xxhdpi/ic_open_in_browser.png new file mode 100644 index 0000000000000000000000000000000000000000..72f373f55a487c501fe8366d02c468abb4e1de6f GIT binary patch literal 318 zcmV-E0m1%>P)gx?20FQc8XL$n0tqBg z5}*VUNT6>(Xlp_s+3rL!k~!|G5*w}_6sDCKmrLQ&qPK18v+uxeb)@ z-~!rlX1{!?gM)UQ+i!!e7cgs+K!KtV0eW4T-IC ziobUSd{mfstJ&ksqIb4U7cSV$n3`ZD((~z4t%0<4>w`Z>)r>YrF#?T%gPJYNGLzP* zx0!3bel-95^YypiZj(G#C$YO-aD8r4A4d_}hCbGJzyF!^yf)aC7<1~ysqE!5gp2nk zTQc96-ukcBXq}-uLnZT#sr$c0ym9{+C0@)j!MfqJ2ZJ~xhXVtXKm&sS1Cs*-2Lq!5 z0}D=$ok2scD?>Eno;<;i_Uy==^4RoSYhQ}~{v2<)E%jsn z;UAKm3Uy^YJD-+6+jH#Bb77x1=jSJHNo{=pxA?o!^0_~6eVXqdu+zT2&+zHo>(jp1 zGR ztg4)AslPnC>d$f=6ODf6s>qW^&+jv5{-EXLpzdv|m|(^_!|6a4*M^n``O+J8zrO7U z+6@CLjPC#CK%5)Q3=AK{n1HO=5)2Gxh9I#G>>v^Zo-sbt|9f*+nPpqUHIW5;j7t}; zK0Z5dOqO5b8(Q>7HgLtoB~NSg{d!j|PM_b=(eWa` Zn(<}zv}=X(e>p$~db;|#taD0e0s!mEZ}I>D literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_open_in_browser.png b/app/src/main/res/drawable-xxxhdpi/ic_open_in_browser.png new file mode 100644 index 0000000000000000000000000000000000000000..40f55c2ed2a16ebe44ffb22ae7acf28ccd67d036 GIT binary patch literal 408 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%&M7z!>l8;uunK>+P+;tV0e0$3E_n zW2E(u~8Z#vrTs=7-|2{mpgpm-y+W4iL=@SoH!I)1f1NG ztY5#)YCb#npx(8c*JhP0)nETM=%zSn%HOD%XYl^;s-0{I_Q@ zzgQP<%J}7dUC>qrlU=G|ybP-4UqA6(INaQ6!))?0M|C}eubtc}Wrs-hm`Y}i-xKuw z8ANN-Cx|=T{3I`!#ymye-Z!Gg*gV)CYz35<$8bWn;#BN`%k1;?)-lZg*>FxYVLtzj zr~+n=ZJLrbZ|^ePJEc}0ZM~CW&+SzuKX&)-cZv`Zcyu>@s{i``Hr(vi$FJYG(-2+r m`OWeFzb`YM<3=|8=vUVDPL~z^?ISLLggssTT-G@yGywo}=$n}U literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_reader.xml b/app/src/main/res/layout/activity_reader.xml index 9a60d71..205125b 100644 --- a/app/src/main/res/layout/activity_reader.xml +++ b/app/src/main/res/layout/activity_reader.xml @@ -1,141 +1,128 @@ - + android:layout_height="match_parent"> - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + app:layout_constraintLeft_toLeftOf="parent" + android:layout_gravity="end|bottom|right"> - + + + android:paddingBottom="@dimen/activity_vertical_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:src="@drawable/ic_add" + app:backgroundTint="?attr/colorAccent" + app:rippleColor="?attr/colorAccentDark" /> + - + - - - diff --git a/app/src/main/res/layout/activity_sources.xml b/app/src/main/res/layout/activity_sources.xml index 9d1e825..a6f1b8c 100644 --- a/app/src/main/res/layout/activity_sources.xml +++ b/app/src/main/res/layout/activity_sources.xml @@ -1,6 +1,6 @@ - - - + android:layout_marginRight="16dp" /> + diff --git a/app/src/main/res/menu/reader_toolbar.xml b/app/src/main/res/menu/reader_toolbar.xml new file mode 100644 index 0000000..3127f7c --- /dev/null +++ b/app/src/main/res/menu/reader_toolbar.xml @@ -0,0 +1,25 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e21a684..94f6210 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -158,4 +158,7 @@ ReaderforSelfoss Report a bug The items number should be an integer. + Read more + Open in browser + Share \ No newline at end of file