Make sure to remove backstackChangeListener when finished.

This commit is contained in:
Dmitry Brant 2017-05-26 16:32:00 -04:00
parent bb5a6691f1
commit dea43c04b9
3 changed files with 13 additions and 10 deletions

View file

@ -43,7 +43,6 @@ public class LoginActivity extends AccountAuthenticatorActivity {
app = CommonsApplication.getInstance();
setContentView(R.layout.activity_login);
final LoginActivity that = this;
loginButton = (Button) findViewById(R.id.loginButton);
Button signupButton = (Button) findViewById(R.id.signupButton);
@ -62,12 +61,14 @@ public class LoginActivity extends AccountAuthenticatorActivity {
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
that.performLogin();
performLogin();
}
});
signupButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { that.signUp(v); }
public void onClick(View v) {
signUp(v);
}
});
}
@ -115,7 +116,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
protected void onResume() {
super.onResume();
if (prefs.getBoolean("firstrun", true)) {
this.startWelcomeIntent();
startWelcomeIntent();
prefs.edit().putBoolean("firstrun", false).apply();
}
if (app.getCurrentAccount() != null) {

View file

@ -81,6 +81,7 @@ public class ContributionsActivity
@Override
protected void onDestroy() {
getSupportFragmentManager().removeOnBackStackChangedListener(this);
super.onDestroy();
if(isUploadServiceConnected) {
unbindService(uploadServiceConnection);

View file

@ -115,7 +115,7 @@ public class MultipleShareActivity
Timber.d("Multiple upload begins");
final ProgressDialog dialog = new ProgressDialog(MultipleShareActivity.this);
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setIndeterminate(false);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setMax(photosList.size());
@ -145,12 +145,12 @@ public class MultipleShareActivity
uploadsList.setImageOnlyMode(true);
categorizationFragment = (CategorizationFragment) this.getSupportFragmentManager().findFragmentByTag("categorization");
categorizationFragment = (CategorizationFragment) getSupportFragmentManager().findFragmentByTag("categorization");
if(categorizationFragment == null) {
categorizationFragment = new CategorizationFragment();
}
// FIXME: Stops the keyboard from being shown 'stale' while moving out of this fragment into the next
View target = this.getCurrentFocus();
View target = getCurrentFocus();
if (target != null) {
InputMethodManager imm = (InputMethodManager) target.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(target.getWindowToken(), 0);
@ -221,18 +221,19 @@ public class MultipleShareActivity
@Override
protected void onDestroy() {
super.onDestroy();
getSupportFragmentManager().removeOnBackStackChangedListener(this);
uploadController.cleanup();
}
private void showDetail(int i) {
if(mediaDetails == null ||!mediaDetails.isVisible()) {
mediaDetails = new MediaDetailPagerFragment(true);
this.getSupportFragmentManager()
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.uploadsFragmentContainer, mediaDetails)
.addToBackStack(null)
.commit();
this.getSupportFragmentManager().executePendingTransactions();
getSupportFragmentManager().executePendingTransactions();
}
mediaDetails.showImage(i);
}
@ -267,7 +268,7 @@ public class MultipleShareActivity
uploadsList = (MultipleUploadListFragment) getSupportFragmentManager().findFragmentByTag("uploadsList");
if(uploadsList == null) {
uploadsList = new MultipleUploadListFragment();
this.getSupportFragmentManager()
getSupportFragmentManager()
.beginTransaction()
.add(R.id.uploadsFragmentContainer, uploadsList, "uploadsList")
.commit();