use of com.keylesspalace.tusky.interfaces.LinkListener in project Tusky by Vavassor.
the class AccountActivity method onObtainAccountSuccess.
private void onObtainAccountSuccess(Account account) {
loadedAccount = account;
TextView username = (TextView) findViewById(R.id.account_username);
TextView displayName = (TextView) findViewById(R.id.account_display_name);
TextView note = (TextView) findViewById(R.id.account_note);
String usernameFormatted = String.format(getString(R.string.status_username_format), account.username);
username.setText(usernameFormatted);
displayName.setText(account.getDisplayName());
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(account.getDisplayName());
String subtitle = String.format(getString(R.string.status_username_format), account.username);
getSupportActionBar().setSubtitle(subtitle);
}
boolean useCustomTabs = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("customTabs", true);
LinkHelper.setClickableText(note, account.note, null, useCustomTabs, new LinkListener() {
@Override
public void onViewTag(String tag) {
Intent intent = new Intent(AccountActivity.this, ViewTagActivity.class);
intent.putExtra("hashtag", tag);
startActivity(intent);
}
@Override
public void onViewAccount(String id) {
Intent intent = new Intent(AccountActivity.this, AccountActivity.class);
intent.putExtra("id", id);
startActivity(intent);
}
});
if (account.locked) {
accountLockedView.setVisibility(View.VISIBLE);
} else {
accountLockedView.setVisibility(View.GONE);
}
Picasso.with(this).load(account.avatar).placeholder(R.drawable.avatar_default).error(R.drawable.avatar_error).into(avatar);
Picasso.with(this).load(account.header).placeholder(R.drawable.account_header_default).into(header);
NumberFormat nf = NumberFormat.getInstance();
// Add counts to the tabs in the TabLayout.
String[] counts = { nf.format(Integer.parseInt(account.statusesCount)), nf.format(Integer.parseInt(account.followingCount)), nf.format(Integer.parseInt(account.followersCount)) };
for (int i = 0; i < tabLayout.getTabCount(); i++) {
TabLayout.Tab tab = tabLayout.getTabAt(i);
if (tab != null) {
View view = tab.getCustomView();
if (view != null) {
TextView total = (TextView) view.findViewById(R.id.total);
total.setText(counts[i]);
}
}
}
}
use of com.keylesspalace.tusky.interfaces.LinkListener in project Tusky by tuskyapp.
the class AccountActivity method onObtainAccountSuccess.
private void onObtainAccountSuccess(Account account) {
loadedAccount = account;
TextView username = findViewById(R.id.account_username);
TextView displayName = findViewById(R.id.account_display_name);
TextView note = findViewById(R.id.account_note);
String usernameFormatted = String.format(getString(R.string.status_username_format), account.getUsername());
username.setText(usernameFormatted);
displayName.setText(account.getName());
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(account.getName());
String subtitle = String.format(getString(R.string.status_username_format), account.getUsername());
getSupportActionBar().setSubtitle(subtitle);
}
LinkHelper.setClickableText(note, account.getNote(), null, new LinkListener() {
@Override
public void onViewTag(String tag) {
Intent intent = new Intent(AccountActivity.this, ViewTagActivity.class);
intent.putExtra("hashtag", tag);
startActivity(intent);
}
@Override
public void onViewAccount(String id) {
Intent intent = new Intent(AccountActivity.this, AccountActivity.class);
intent.putExtra("id", id);
startActivity(intent);
}
});
if (account.getLocked()) {
accountLockedView.setVisibility(View.VISIBLE);
} else {
accountLockedView.setVisibility(View.GONE);
}
Picasso.with(this).load(account.getAvatar()).placeholder(R.drawable.avatar_default).into(avatar);
Picasso.with(this).load(account.getHeader()).placeholder(R.drawable.account_header_default).into(header);
NumberFormat numberFormat = NumberFormat.getNumberInstance();
String followersCount = numberFormat.format(account.getFollowersCount());
String followingCount = numberFormat.format(account.getFollowingCount());
String statusesCount = numberFormat.format(account.getStatusesCount());
followersTextView.setText(getString(R.string.title_x_followers, followersCount));
followingTextView.setText(getString(R.string.title_x_following, followingCount));
statusesTextView.setText(getString(R.string.title_x_statuses, statusesCount));
}
Aggregations