Links in user bios can be clicked on.

This commit is contained in:
Vavassor 2017-02-01 15:20:39 -05:00
parent 62ff735878
commit cad060282b
2 changed files with 11 additions and 4 deletions

View file

@ -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,9 +111,11 @@ 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);
if (tab != null) {
tab.setCustomView(adapter.getTabView(i)); tab.setCustomView(adapter.getTabView(i));
} }
} }
}
private void obtainAccount() { private void obtainAccount() {
String endpoint = String.format(getString(R.string.endpoint_accounts), accountId); String endpoint = String.format(getString(R.string.endpoint_accounts), accountId);
@ -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,11 +191,13 @@ 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();
if (view != null) {
TextView total = (TextView) view.findViewById(R.id.total); TextView total = (TextView) view.findViewById(R.id.total);
total.setText(counts[i]); total.setText(counts[i]);
} }
} }
} }
}
private void onObtainAccountFailure() { private void onObtainAccountFailure() {
//TODO: help //TODO: help

View file

@ -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) {