From dbb266388216f793ae6cf0a38a333f14094b59dc Mon Sep 17 00:00:00 2001 From: Vavassor Date: Thu, 26 Jan 2017 19:34:32 -0500 Subject: [PATCH] Links and tags in statuses are now clickable and open suitable pages. Mentions are also, incidentally, but still link to the account page for that user in the browser. This should be changed to an in-app account page when that's finished, but it's actually fairly suitable fallback behaviour for now. --- app/src/main/AndroidManifest.xml | 1 + .../tusky/NotificationsFragment.java | 4 ++ .../com/keylesspalace/tusky/SFragment.java | 6 ++ .../tusky/StatusActionListener.java | 1 + .../keylesspalace/tusky/StatusViewHolder.java | 41 +++++++++++-- .../keylesspalace/tusky/TimelineFragment.java | 60 ++++++++++++++----- .../keylesspalace/tusky/ViewTagActivity.java | 46 ++++++++++++++ .../tusky/ViewThreadFragment.java | 4 ++ app/src/main/res/layout/activity_view_tag.xml | 38 ++++++++++++ app/src/main/res/values/strings.xml | 3 + 10 files changed, 185 insertions(+), 19 deletions(-) create mode 100644 app/src/main/java/com/keylesspalace/tusky/ViewTagActivity.java create mode 100644 app/src/main/res/layout/activity_view_tag.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5467b865..3053a174 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,6 +34,7 @@ android:windowSoftInputMode="stateVisible|adjustResize" /> + . */ + +package com.keylesspalace.tusky; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; + +public class ViewTagActivity extends AppCompatActivity { + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_view_tag); + + String hashtag = getIntent().getStringExtra("hashtag"); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + ActionBar bar = getSupportActionBar(); + if (bar != null) { + bar.setTitle(String.format(getString(R.string.title_tag), hashtag)); + } + + FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); + Fragment fragment = TimelineFragment.newInstance(TimelineFragment.Kind.TAG, hashtag); + fragmentTransaction.add(R.id.fragment_container, fragment); + fragmentTransaction.commit(); + } +} diff --git a/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java b/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java index 9dbfd61a..ccc6e392 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java @@ -140,4 +140,8 @@ public class ViewThreadFragment extends SFragment implements StatusActionListene public void onViewThread(int position) { super.viewThread(adapter.getItem(position)); } + + public void onViewTag(String tag) { + super.viewTag(tag); + } } diff --git a/app/src/main/res/layout/activity_view_tag.xml b/app/src/main/res/layout/activity_view_tag.xml new file mode 100644 index 00000000..9b24139d --- /dev/null +++ b/app/src/main/res/layout/activity_view_tag.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + \ 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 62e1aa81..eb471228 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -5,6 +5,8 @@ oauth2redirect com.keylesspalace.tusky.PREFERENCES + content://com.keylesspalace.tusky.viewtagactivity/%s + /api/v1/statuses /api/v1/media /api/v1/timelines/home @@ -53,6 +55,7 @@ Notifications Public Thread + #%s \@%s %s boosted