BearND has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177161

Change subject: Check if EditSectionActivity is finished
......................................................................

Check if EditSectionActivity is finished

Bug: T73299
Change-Id: I438a77d2116237016bb2a4fd73e4f82e7adb2a0d
---
M wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java
1 file changed, 11 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/61/177161/1

diff --git 
a/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java 
b/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java
index 44a7ea2..b4d511a 100644
--- a/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java
+++ b/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java
@@ -71,7 +71,6 @@
 
     private String sectionWikitext;
 
-    private SyntaxHighlighter syntaxHighlighter;
     private EditText sectionText;
     private boolean sectionTextModified = false;
     private boolean sectionTextFirstLoad = true;
@@ -79,7 +78,6 @@
     private View sectionProgress;
     private View sectionContainer;
     private View sectionError;
-    private Button sectionErrorRetry;
 
     private View abusefilterContainer;
     private ImageView abuseFilterImage;
@@ -93,8 +91,6 @@
     private EditPreviewFragment editPreviewFragment;
 
     private EditSummaryFragment editSummaryFragment;
-
-    private TextView editLicenseText;
 
     private EditFunnel funnel;
 
@@ -125,13 +121,13 @@
         sectionText = (EditText) findViewById(R.id.edit_section_text);
 
         if (app.getReleaseType() != WikipediaApp.RELEASE_PROD) {
-            syntaxHighlighter = new SyntaxHighlighter(this, sectionText);
+            new SyntaxHighlighter(this, sectionText);
         }
 
         sectionProgress = findViewById(R.id.edit_section_load_progress);
         sectionContainer = findViewById(R.id.edit_section_container);
         sectionError = findViewById(R.id.edit_section_error);
-        sectionErrorRetry = (Button) 
findViewById(R.id.edit_section_error_retry);
+        Button sectionErrorRetry = (Button) 
findViewById(R.id.edit_section_error_retry);
 
         abusefilterContainer = 
findViewById(R.id.edit_section_abusefilter_container);
         abuseFilterImage = (ImageView) 
findViewById(R.id.edit_section_abusefilter_image);
@@ -213,7 +209,7 @@
     }
 
     private void updateEditLicenseText() {
-        editLicenseText = (TextView) 
findViewById(R.id.edit_section_license_text);
+        TextView editLicenseText = (TextView) 
findViewById(R.id.edit_section_license_text);
         if (app.getUserInfoStorage().isLoggedIn()) {
             
editLicenseText.setText(Html.fromHtml(getString(R.string.edit_save_action_license_logged_in)));
         } else {
@@ -288,7 +284,9 @@
                 new DoEditTask(EditSectionActivity.this, title, 
sectionText.getText().toString(), sectionID, token, summaryText) {
                     @Override
                     public void onBeforeExecute() {
-                        progressDialog.show();
+                        if (!isFinishing()) {
+                            progressDialog.show();
+                        }
                     }
 
                     @Override
@@ -298,7 +296,7 @@
 
                     @Override
                     public void onCatch(Throwable caught) {
-                        if (!progressDialog.isShowing()) {
+                        if (isFinishing() || !progressDialog.isShowing()) {
                             // no longer attached to activity!
                             return;
                         }
@@ -315,7 +313,7 @@
 
                     @Override
                     public void onFinish(EditingResult result) {
-                        if (!progressDialog.isShowing()) {
+                        if (isFinishing() || !progressDialog.isShowing()) {
                             // no longer attached to activity!
                             return;
                         }
@@ -363,6 +361,9 @@
 
             @Override
             public void onTokenFailed(Throwable caught) {
+                if (isFinishing()) {
+                    return;
+                }
                 if (!(caught instanceof ApiException)) {
                     throw new RuntimeException(caught);
                 }

-- 
To view, visit https://gerrit.wikimedia.org/r/177161
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I438a77d2116237016bb2a4fd73e4f82e7adb2a0d
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND <bsitzm...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to