Brion VIBBER has uploaded a new change for review.

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

Change subject: [Gingerbread] Disable crashy AutoCompleteTextView in edit 
summary
......................................................................

[Gingerbread] Disable crashy AutoCompleteTextView in edit summary

Leaving it on for ICS and later, just disabling the autocomplete
on Gingerbread by not setting the adapter.

For some reason the autocomplete popup view crashes on
Gingerbread. This seems to be related to styles but I
can't quite figure out why.

This call in AutoCompleteTextView.buildDropDown ends up failing:

            mDropDownList.setSelector(mDropDownListHighlight);

because mDropDownListHighlight seems to be null instead
of an expected drawable, and that ends up failing when used.

But the styles *look* ok, and I don't see any missing drawables
related to that style...

Change-Id: I96dfdb3b63adca6ccc4bf043d03c8224905fbf23
---
M 
wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
1 file changed, 35 insertions(+), 20 deletions(-)


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

diff --git 
a/wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
 
b/wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
index 7d2dc77..504164c 100644
--- 
a/wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
+++ 
b/wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
@@ -30,28 +30,43 @@
             }
         });
 
-        adapter = new EditSummaryAdapter(activity, null, true);
-        summaryEdit.setAdapter(adapter);
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+            // For some reason the autocomplete popup view crashes on
+            // Gingerbread. This seems to be related to styles but I
+            // can't quite figure out why.
+            //
+            // This call in AutoCompleteTextView.buildDropDown ends up failing:
+            //
+            //             mDropDownList.setSelector(mDropDownListHighlight);
+            //
+            // because mDropDownListHighlight seems to be null instead
+            // of an expected drawable, and that ends up failing when used.
+
+            adapter = new EditSummaryAdapter(activity, null, true);
+            summaryEdit.setAdapter(adapter);
+
+            adapter.setFilterQueryProvider(new FilterQueryProvider() {
+                @Override
+                public Cursor runQuery(CharSequence charSequence) {
+                    ContentProviderClient client = 
activity.getContentResolver().acquireContentProviderClient(EditSummary.PERSISTANCE_HELPER.getBaseContentURI());
+                    try {
+                        return client.query(
+                                
EditSummary.PERSISTANCE_HELPER.getBaseContentURI(),
+                                null,
+                                "summary LIKE ?",
+                                new String[] {charSequence + "%"},
+                                "lastUsed DESC");
+                    } catch (RemoteException e) {
+                        // This shouldn't really be happening
+                        throw new RuntimeException(e);
+                    }
+                }
+            });
+        } else {
+            adapter = null;
+        }
 
         Utils.setTextDirection(summaryEdit, title.getSite().getLanguage());
-
-        adapter.setFilterQueryProvider(new FilterQueryProvider() {
-            @Override
-            public Cursor runQuery(CharSequence charSequence) {
-                ContentProviderClient client = 
activity.getContentResolver().acquireContentProviderClient(EditSummary.PERSISTANCE_HELPER.getBaseContentURI());
-                try {
-                    return client.query(
-                            EditSummary.PERSISTANCE_HELPER.getBaseContentURI(),
-                            null,
-                            "summary LIKE ?",
-                            new String[] {charSequence + "%"},
-                            "lastUsed DESC");
-                } catch (RemoteException e) {
-                    // This shouldn't really be happening
-                    throw new RuntimeException(e);
-                }
-            }
-        });
     }
 
     public void show() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96dfdb3b63adca6ccc4bf043d03c8224905fbf23
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

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

Reply via email to