Links in user bios can be clicked on.

main
Vavassor 8 years ago
parent 62ff735878
commit cad060282b
  1. 12
      app/src/main/java/com/keylesspalace/tusky/AccountActivity.java
  2. 3
      app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java

@ -28,6 +28,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Spanned; import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -110,7 +111,9 @@ public class AccountActivity extends AppCompatActivity {
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);
for (int i = 0; i < tabLayout.getTabCount(); i++) { for (int i = 0; i < tabLayout.getTabCount(); i++) {
TabLayout.Tab tab = tabLayout.getTabAt(i); TabLayout.Tab tab = tabLayout.getTabAt(i);
tab.setCustomView(adapter.getTabView(i)); if (tab != null) {
tab.setCustomView(adapter.getTabView(i));
}
} }
} }
@ -166,6 +169,7 @@ public class AccountActivity extends AppCompatActivity {
note.setText(account.note); note.setText(account.note);
note.setLinksClickable(true); note.setLinksClickable(true);
note.setMovementMethod(LinkMovementMethod.getInstance());
ImageLoader imageLoader = VolleySingleton.getInstance(this).getImageLoader(); ImageLoader imageLoader = VolleySingleton.getInstance(this).getImageLoader();
if (!account.avatar.isEmpty()) { if (!account.avatar.isEmpty()) {
@ -187,8 +191,10 @@ public class AccountActivity extends AppCompatActivity {
TabLayout.Tab tab = tabLayout.getTabAt(i); TabLayout.Tab tab = tabLayout.getTabAt(i);
if (tab != null) { if (tab != null) {
View view = tab.getCustomView(); View view = tab.getCustomView();
TextView total = (TextView) view.findViewById(R.id.total); if (view != null) {
total.setText(counts[i]); TextView total = (TextView) view.findViewById(R.id.total);
total.setText(counts[i]);
}
} }
} }
} }

@ -106,7 +106,8 @@ public class StatusViewHolder extends RecyclerView.ViewHolder {
public void setContent(Spanned content, Status.Mention[] mentions, public void setContent(Spanned content, Status.Mention[] mentions,
final StatusActionListener listener) { final StatusActionListener listener) {
// Redirect URLSpan's in the status content to the listener for viewing tag pages. /* Redirect URLSpan's in the status content to the listener for viewing tag pages and
* account pages. */
SpannableStringBuilder builder = new SpannableStringBuilder(content); SpannableStringBuilder builder = new SpannableStringBuilder(content);
URLSpan[] urlSpans = content.getSpans(0, content.length(), URLSpan.class); URLSpan[] urlSpans = content.getSpans(0, content.length(), URLSpan.class);
for (URLSpan span : urlSpans) { for (URLSpan span : urlSpans) {

Loading…
Cancel
Save