aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2013-09-09 13:19:43 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2013-09-09 13:19:43 +0200
commitaae87b894f72a719a850ec32ad6944bd5c743331 (patch)
treeb5a221fcb529c07b309f5bde0563155df28a472c /libraries/ActionBarSherlock/src/com/actionbarsherlock/widget
parent5b6880d2e34f4c8a4bfba87b5ce53d3c6727b744 (diff)
downloadopen-keychain-aae87b894f72a719a850ec32ad6944bd5c743331.tar.gz
open-keychain-aae87b894f72a719a850ec32ad6944bd5c743331.tar.bz2
open-keychain-aae87b894f72a719a850ec32ad6944bd5c743331.zip
Update actionbarsherlock from 4.2 to 4.4
Diffstat (limited to 'libraries/ActionBarSherlock/src/com/actionbarsherlock/widget')
-rw-r--r--libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/ActivityChooserView.java18
-rw-r--r--libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SearchView.java4
-rw-r--r--libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java33
3 files changed, 46 insertions, 9 deletions
diff --git a/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/ActivityChooserView.java b/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/ActivityChooserView.java
index e19ea9e9e..7eb7330e4 100644
--- a/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/ActivityChooserView.java
+++ b/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/ActivityChooserView.java
@@ -395,7 +395,11 @@ class ActivityChooserView extends ViewGroup implements ActivityChooserModelClien
super.onAttachedToWindow();
ActivityChooserModel dataModel = mAdapter.getDataModel();
if (dataModel != null) {
- dataModel.registerObserver(mModelDataSetOberver);
+ try {
+ dataModel.registerObserver(mModelDataSetOberver);
+ } catch (IllegalStateException e) {
+ // Related to #557.
+ }
}
mIsAttachedToWindow = true;
}
@@ -522,6 +526,9 @@ class ActivityChooserView extends ViewGroup implements ActivityChooserModelClien
mDefaultActionButtonContentDescription, label);
mDefaultActivityButton.setContentDescription(contentDescription);
}
+
+ // Work-around for #415.
+ mAdapter.setShowDefaultActivity(false, false);
} else {
mDefaultActivityButton.setVisibility(View.GONE);
}
@@ -644,7 +651,8 @@ class ActivityChooserView extends ViewGroup implements ActivityChooserModelClien
private int mMaxActivityCount = MAX_ACTIVITY_COUNT_DEFAULT;
- private boolean mShowDefaultActivity;
+ // Work-around for #415.
+ private boolean mShowDefaultActivity = true;
private boolean mHighlightDefaultActivity;
@@ -661,7 +669,11 @@ class ActivityChooserView extends ViewGroup implements ActivityChooserModelClien
}
mDataModel = dataModel;
if (dataModel != null && isShown()) {
- dataModel.registerObserver(mModelDataSetOberver);
+ try {
+ dataModel.registerObserver(mModelDataSetOberver);
+ } catch (IllegalStateException e) {
+ // Related to #557.
+ }
}
notifyDataSetChanged();
}
diff --git a/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SearchView.java b/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SearchView.java
index c9e7897d4..fb8319645 100644
--- a/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SearchView.java
+++ b/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SearchView.java
@@ -1623,8 +1623,8 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
private void forceSuggestionQuery() {
try {
- Method before = SearchAutoComplete.class.getMethod("doBeforeTextChanged");
- Method after = SearchAutoComplete.class.getMethod("doAfterTextChanged");
+ Method before = AutoCompleteTextView.class.getDeclaredMethod("doBeforeTextChanged");
+ Method after = AutoCompleteTextView.class.getDeclaredMethod("doAfterTextChanged");
before.setAccessible(true);
after.setAccessible(true);
before.invoke(mQueryTextView);
diff --git a/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java b/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java
index bd5cbd718..82d4f0c42 100644
--- a/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java
+++ b/libraries/ActionBarSherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java
@@ -66,6 +66,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
static final int REFINE_ALL = 2;
private SearchManager mSearchManager;
+ private SearchableInfo mSearchable;
private SearchView mSearchView;
private Context mProviderContext;
private WeakHashMap<String, Drawable.ConstantState> mOutsideDrawablesCache;
@@ -94,12 +95,13 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
//private static final long DELETE_KEY_POST_DELAY = 500L;
public SuggestionsAdapter(Context context, SearchView searchView,
- SearchableInfo mSearchable, WeakHashMap<String, Drawable.ConstantState> outsideDrawablesCache) {
+ SearchableInfo searchable, WeakHashMap<String, Drawable.ConstantState> outsideDrawablesCache) {
super(context,
R.layout.abs__search_dropdown_item_icons_2line,
null, // no initial cursor
true); // auto-requery
mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
+ mSearchable = searchable;
mProviderContext = mContext;
mSearchView = searchView;
@@ -199,25 +201,48 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
}
public Cursor getSuggestions(String query, int limit) {
+ if (mSearchable == null) {
+ return null;
+ }
+
+ String authority = mSearchable.getSuggestAuthority();
+ if (authority == null) {
+ return null;
+ }
+
Uri.Builder uriBuilder = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
+ .authority(authority)
.query("") // TODO: Remove, workaround for a bug in Uri.writeToParcel()
.fragment(""); // TODO: Remove, workaround for a bug in Uri.writeToParcel()
+ // if content path provided, insert it now
+ final String contentPath = mSearchable.getSuggestPath();
+ if (contentPath != null) {
+ uriBuilder.appendEncodedPath(contentPath);
+ }
+
// append standard suggestion query path
uriBuilder.appendPath(SearchManager.SUGGEST_URI_PATH_QUERY);
+ // get the query selection, may be null
+ String selection = mSearchable.getSuggestSelection();
// inject query, either as selection args or inline
- uriBuilder.appendPath(query);
+ String[] selArgs = null;
+ if (selection != null) { // use selection if provided
+ selArgs = new String[] { query };
+ } else { // no selection, use REST pattern
+ uriBuilder.appendPath(query);
+ }
if (limit > 0) {
- uriBuilder.appendQueryParameter(SearchManager.SUGGEST_PARAMETER_LIMIT, String.valueOf(limit));
+ uriBuilder.appendQueryParameter("limit", String.valueOf(limit));
}
Uri uri = uriBuilder.build();
// finally, make the query
- return mContext.getContentResolver().query(uri, null, null, null, null);
+ return mContext.getContentResolver().query(uri, null, selection, selArgs, null);
}
public void close() {