From 701251df34d85d24833383d7f9ce0d1f87b8364c Mon Sep 17 00:00:00 2001 From: Ezerous Date: Tue, 6 Mar 2018 17:00:50 +0200 Subject: [PATCH] Added share button in TopicActivity --- .../mthmmy/activities/topic/TopicActivity.java | 10 ++++++++-- app/src/main/res/drawable-hdpi/ic_share.png | Bin 0 -> 541 bytes app/src/main/res/drawable-mdpi/ic_share.png | Bin 0 -> 365 bytes app/src/main/res/drawable-xhdpi/ic_share.png | Bin 0 -> 675 bytes app/src/main/res/drawable-xxhdpi/ic_share.png | Bin 0 -> 1068 bytes app/src/main/res/drawable-xxxhdpi/ic_share.png | Bin 0 -> 1404 bytes app/src/main/res/layout/activity_topic.xml | 1 + app/src/main/res/menu/topic_menu.xml | 6 ++++++ app/src/main/res/values/strings.xml | 1 + 9 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_share.png create mode 100644 app/src/main/res/drawable-mdpi/ic_share.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_share.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_share.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_share.png diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java index cf3d7c8e..f8e7ea01 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java @@ -15,7 +15,6 @@ import android.text.Html; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.method.LinkMovementMethod; -import android.text.method.ScrollingMovementMethod; import android.text.style.ClickableSpan; import android.text.style.URLSpan; import android.util.SparseArray; @@ -103,6 +102,7 @@ public class TopicActivity extends BaseActivity { * bundle one and gets rendered in the toolbar. */ private String parsedTitle; + private String topicPageUrl; private RecyclerView recyclerView; /** * Holds the url of this page @@ -195,7 +195,7 @@ public class TopicActivity extends BaseActivity { Bundle extras = getIntent().getExtras(); topicTitle = extras.getString(BUNDLE_TOPIC_TITLE); - String topicPageUrl = extras.getString(BUNDLE_TOPIC_URL); + topicPageUrl = extras.getString(BUNDLE_TOPIC_URL); ThmmyPage.PageCategory target = ThmmyPage.resolvePageCategory( Uri.parse(topicPageUrl)); if (!target.is(ThmmyPage.PageCategory.TOPIC)) { @@ -310,6 +310,12 @@ public class TopicActivity extends BaseActivity { AlertDialog dialog = builder.create(); dialog.show(); return true; + case R.id.menu_share: + Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND); + sendIntent.setType("text/plain"); + sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, topicPageUrl); + startActivity(Intent.createChooser(sendIntent, "Share via")); + return true; default: return super.onOptionsItemSelected(item); } diff --git a/app/src/main/res/drawable-hdpi/ic_share.png b/app/src/main/res/drawable-hdpi/ic_share.png new file mode 100644 index 0000000000000000000000000000000000000000..c832502c0795518af86607a24ad356c81c94e3d1 GIT binary patch literal 541 zcmV+&0^i*NZC3l3&y1i`>tkL)~;J7g#SJuurP$ zP_N)v6GAQAD-pPD@Uf?t#QT~MJM3>TE)?oz!T1YzusgZf2;rl67KwFn3p>UoHJ#tV zP9)aB1#H4ayv*gVVNVlc+i_F>=LftinZ-}opIj;zTflOOM9eBSHYJti$Mr7`#e0(k zTb5-)2(K$F-4z#7CT*1u_%{jr_k*c?PKNOUQ;iAbQuBKM^D*x=k?cdHX7ye-&-HTX fvT=pxgcSS+uVT0(g3>Ua00000NkvXXu0mjfT@3ZL literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_share.png b/app/src/main/res/drawable-mdpi/ic_share.png new file mode 100644 index 0000000000000000000000000000000000000000..31ebd45aa7dab0e094060670dfe8ca15723ee2b4 GIT binary patch literal 365 zcmV-z0h0cSP)1kVYj6)1 z3L<3c&-fnYr(rJNN!f#J?66(ZxeLhghgHpzFI1>I`_Q z2KBdf^J;EQ_L2}49=q~wO=LZD`d-fg5K1gb-@-qtB_x02HmNBmw|Il$S*RS+IJav z6j8ubSwGo&N-qWTA%v|>HlNF~Y+Jn(n_8z7%|a_WNm2j?LkJ=+dA(LHQD7(T;!ni* zPd|y}o7E-EM~ahr8O3qDuOs#wH}J4RKHWx!evFrhO=6&E*NHQj#?RuI#wm2B5Z{5Z z;vcT%1BTXJsu|FMVR;y<vowv0ON(E#EZg21r8rWi(UwqE zz?+DE;K*uaTFMG0F+9Nj)b1gKRV|~xFlr;LMpn0xea98leH2{JBD!!|zN{`yi?vZ= zvZTl_I4ec6j0HpT#95C|IEjwbo|T{nBbX~Gk1>I3 zIF!1E5JCtzink?2EZ}Ozup6}zUhv8nf)RYHxFcoUPVN5>^vWMMV_&OmxLy7LK1LKU zTGm&RFqdW7WC-DN#3lR6PNYnun_JOI$^u?Qw0*v27ApmV5p&>RYTvrZgJ2`Br}ivG zzCYZmT75Lw$dY}bS&IC7!HE#U-r}d1A%w9k%O=uUwQ2Kz@E4F4M)jplRPg`+002ov JPDHLkV1fsqF>e3> literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_share.png b/app/src/main/res/drawable-xxhdpi/ic_share.png new file mode 100644 index 0000000000000000000000000000000000000000..df3f943f175688e2f3187fbfb35bcde184dc2882 GIT binary patch literal 1068 zcmV+{1k?M8P)Z#~Qey8#L@(^fm~B8bw5unFp>h%sZvj2SbgtEAcqlmZ(fVq-+CiioAXua8Bq1>M=%)fPe#=?3pumM% z1D8j{^AS;^kNKiNjJX3I$AJRneV{Tw=fOSLRnQpNUR&45U@>09*}~>@d#j<@Mr^|2 z46)x}VgPd{u)4O!p}|V*%@BIHXJWz%e4g=}9k{u+#-YG6yp72|BF}1WyT#MQScf-p z5NCRyAMqB}*U&XGScsSLcOPTU;~gxoopWpSZjoOyZjJp|Q#;?*z`gRy_K}{6-R$7eOQN97b=z-6`d z6bIiIFlb+G9m9~@gq0YQ-%=n(>*N~L-SRskxdvqoxcg9I(B3+^29-F=z8za|Wr0|8 z3u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z zDI(Gkk@rMoTRMkz34pI1{_^+u_OEPge#tI3J<%O}vq^x5Ly0S=Uygb#fC93(I4ziO5`AAl@DBi2`u3-iVCq9ZbrAg2km(eRHg%Up@KZ~&NPveh z+M~;z{wcgEAKgBn6_|a(fQa;q$aHx*$x;%DL?V$$Boc{4Vf+tt##j;dq>Z`&0000< KMNUMnLSTYPnwJ>> literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_topic.xml b/app/src/main/res/layout/activity_topic.xml index e7aa2a66..cb98088e 100644 --- a/app/src/main/res/layout/activity_topic.xml +++ b/app/src/main/res/layout/activity_topic.xml @@ -21,6 +21,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" + app:contentInsetStartWithNavigation="0dp" app:popupTheme="@style/ToolbarTheme"> + + Last post on: %1$s + Share Post author Post subject Post