Fixes a crash that can occur when entering or rotating within the profile page. Closes #43
This commit is contained in:
parent
eef0f82e96
commit
5fd9b6732d
3 changed files with 21 additions and 7 deletions
|
@ -44,6 +44,7 @@ import com.keylesspalace.tusky.entity.Relationship;
|
|||
import com.pkmmte.view.CircularImageView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -72,8 +73,12 @@ public class AccountActivity extends BaseActivity {
|
|||
setContentView(R.layout.activity_account);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
accountId = savedInstanceState.getString("accountId");
|
||||
} else {
|
||||
Intent intent = getIntent();
|
||||
accountId = intent.getStringExtra("id");
|
||||
}
|
||||
|
||||
SharedPreferences preferences = getSharedPreferences(
|
||||
getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
|
||||
|
@ -178,6 +183,12 @@ public class AccountActivity extends BaseActivity {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
outState.putString("accountId", accountId);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
private void onObtainAccountSuccess(Account account) {
|
||||
loadedAccount = account;
|
||||
|
||||
|
@ -213,7 +224,7 @@ public class AccountActivity extends BaseActivity {
|
|||
.placeholder(R.drawable.account_header_missing)
|
||||
.into(header);
|
||||
|
||||
java.text.NumberFormat nf = java.text.NumberFormat.getInstance();
|
||||
NumberFormat nf = NumberFormat.getInstance();
|
||||
|
||||
// Add counts to the tabs in the TabLayout.
|
||||
String[] counts = {
|
||||
|
|
|
@ -243,9 +243,11 @@ public class MainActivity extends BaseActivity {
|
|||
long drawerItemIdentifier = drawerItem.getIdentifier();
|
||||
|
||||
if (drawerItemIdentifier == 0) {
|
||||
if (loggedInAccountId != null) {
|
||||
Intent intent = new Intent(MainActivity.this, AccountActivity.class);
|
||||
intent.putExtra("id", loggedInAccountId);
|
||||
startActivity(intent);
|
||||
}
|
||||
} else if (drawerItemIdentifier == 1) {
|
||||
Intent intent = new Intent(MainActivity.this, FavouritesActivity.class);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -261,7 +262,7 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe
|
|||
}
|
||||
String wholeMessage = String.format(format, displayName);
|
||||
final SpannableStringBuilder str = new SpannableStringBuilder(wholeMessage);
|
||||
str.setSpan(new android.text.style.StyleSpan(Typeface.BOLD), 0, displayName.length(),
|
||||
str.setSpan(new StyleSpan(Typeface.BOLD), 0, displayName.length(),
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
message.setText(str);
|
||||
statusContent.setText(status.content);
|
||||
|
|
Loading…
Reference in a new issue