mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-29 04:17:12 +01:00
Fix lifecycle for ViewUser/ViewCommunity activities
This commit is contained in:
parent
171338f492
commit
81e2fdcf91
@ -10,6 +10,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
@ -391,6 +392,23 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
Log.e("ViewSubredditDetail", "onStart");
|
||||
if (communityData != null) {
|
||||
setupVisibleElements();
|
||||
} else {
|
||||
fetchSubredditData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mFetchSubredditInfoSuccess = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (sectionsPagerAdapter != null) {
|
||||
|
@ -246,6 +246,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
private String mAccountName;
|
||||
private String mAccountQualifiedName;
|
||||
private String username;
|
||||
|
||||
private String qualifiedName;
|
||||
private String description;
|
||||
private boolean subscriptionReady = false;
|
||||
@ -320,7 +321,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
mFetchUserInfoSuccess = savedInstanceState.getBoolean(FETCH_USER_INFO_STATE);
|
||||
mMessageId = savedInstanceState.getInt(MESSAGE_FULLNAME_STATE);
|
||||
mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE);
|
||||
qualifiedName = savedInstanceState.getString(NEW_ACCOUNT_QUALIFIED_NAME_STATE);
|
||||
qualifiedName = savedInstanceState.getString("qualified_name");
|
||||
}
|
||||
|
||||
checkNewAccountAndInitializeViewPager();
|
||||
@ -332,6 +333,22 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
if (mUserData != null) {
|
||||
setupVisibleElements();
|
||||
} else {
|
||||
fetchUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mFetchUserInfoSuccess = false;
|
||||
}
|
||||
|
||||
private void setupVisibleElements() {
|
||||
Resources resources = getResources();
|
||||
String title = username;
|
||||
@ -1134,7 +1151,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
@Override
|
||||
public void onFetchUserDataSuccess(UserData userData, int inboxCount) {
|
||||
mUserData = userData;
|
||||
username = userData.getName();
|
||||
username = userData.getDisplayName();
|
||||
setupVisibleElements();
|
||||
FetchBlockedThings.fetchBlockedThings(mRetrofit.getRetrofit(), mAccessToken, mAccountQualifiedName, new FetchBlockedThings.FetchBlockedThingsListener() {
|
||||
|
||||
@ -1361,7 +1378,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
outState.putBoolean(FETCH_USER_INFO_STATE, mFetchUserInfoSuccess);
|
||||
outState.putInt(MESSAGE_FULLNAME_STATE, mMessageId);
|
||||
outState.putString(NEW_ACCOUNT_NAME_STATE, mNewAccountName);
|
||||
outState.getString(NEW_ACCOUNT_QUALIFIED_NAME_STATE, mAccountQualifiedName);
|
||||
outState.putString(NEW_ACCOUNT_QUALIFIED_NAME_STATE, mAccountQualifiedName);
|
||||
outState.putString("qualified_name", qualifiedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user