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 00000000..c832502c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_share.png differ 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 00000000..31ebd45a Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_share.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_share.png b/app/src/main/res/drawable-xhdpi/ic_share.png new file mode 100644 index 00000000..4560123d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_share.png differ 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 00000000..df3f943f Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_share.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_share.png b/app/src/main/res/drawable-xxxhdpi/ic_share.png new file mode 100644 index 00000000..43c930eb Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_share.png differ 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