Skip to content

Commit

Permalink
survey: refactor towards more stability (fixes #2673) (#2679)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Okuro3499 and dogi authored Nov 6, 2023
1 parent eb3ea76 commit d3010d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1133
versionName "0.11.33"
versionCode 1134
versionName "0.11.34"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.util.Calendar;
import java.util.Locale;
import java.util.Objects;

import io.realm.Realm;

Expand Down Expand Up @@ -80,7 +81,9 @@ private void initViews() {
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_cancel:
dismiss();
if (isAdded()) {
Objects.requireNonNull(getDialog()).dismiss();
}
break;
case R.id.btn_submit:
submitForm();
Expand Down Expand Up @@ -122,10 +125,14 @@ private void submitForm() {
}
}, () -> {
Utilities.toast(MainApplication.context, getString(R.string.user_profile_updated));
dismiss();
if (isAdded()) {
Objects.requireNonNull(getDialog()).dismiss();
}
}, error -> {
Utilities.toast(MainApplication.context, getString(R.string.unable_to_update_user));
dismiss();
if (isAdded()) {
Objects.requireNonNull(getDialog()).dismiss();
}
});
} else {
final JsonObject user = new JsonObject();
Expand All @@ -148,7 +155,9 @@ private void saveSubmission(JsonObject user) {
submissions.setUser(user.toString());
submissions.setStatus("complete");
mRealm.commitTransaction();
dismiss();
if (isAdded()) {
Objects.requireNonNull(getDialog()).dismiss();
}
}

@Override
Expand Down

0 comments on commit d3010d9

Please sign in to comment.