mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2024-12-24 15:30:46 +01:00
fixed wrong swipe to dismiss item and caused quick search bar to crash
This commit is contained in:
parent
9c49095354
commit
2eed865318
@ -105,7 +105,7 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
|
||||
|
||||
@Override
|
||||
public boolean canDismiss(int position) {
|
||||
return position < getHistorySize(mSearchQuery.getText());
|
||||
return mUsersSearchAdapter.canDismiss(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -285,41 +285,9 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
|
||||
|
||||
}
|
||||
|
||||
static class HeaderItem implements SuggestionItem {
|
||||
|
||||
static final int ITEM_VIEW_TYPE = 1;
|
||||
|
||||
@Override
|
||||
public void bindView(SuggestionsAdapter adapter, View view, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType() {
|
||||
return ITEM_VIEW_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(QuickSearchBarActivity activity, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemLayoutResource() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static class SearchHistoryItem extends BaseClickableItem {
|
||||
|
||||
static final int ITEM_VIEW_TYPE = 1;
|
||||
static final int ITEM_VIEW_TYPE = 0;
|
||||
private final long mCursorId;
|
||||
private final String mQuery;
|
||||
|
||||
@ -369,7 +337,7 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
|
||||
|
||||
static class SavedSearchItem extends BaseClickableItem {
|
||||
|
||||
static final int ITEM_VIEW_TYPE = 2;
|
||||
static final int ITEM_VIEW_TYPE = 1;
|
||||
private final String mQuery;
|
||||
|
||||
public SavedSearchItem(String query) {
|
||||
@ -405,7 +373,7 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
|
||||
|
||||
static class UserSuggestionItem extends BaseClickableItem {
|
||||
|
||||
static final int ITEM_VIEW_TYPE = 3;
|
||||
static final int ITEM_VIEW_TYPE = 2;
|
||||
private final ParcelableUser mUser;
|
||||
|
||||
public UserSuggestionItem(Cursor c, CachedIndices i, long accountId) {
|
||||
@ -503,6 +471,10 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
}
|
||||
|
||||
public boolean canDismiss(int position) {
|
||||
return getItemViewType(position) == SearchHistoryItem.ITEM_VIEW_TYPE;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class StringUtils {
|
||||
|
||||
public static boolean startsWithIgnoreCase(@NonNull String string, @NonNull String prefix,
|
||||
int start) {
|
||||
if (prefix.length() > string.length()) return false;
|
||||
return regionMatchesIgnoreCase(string, start, prefix, 0, prefix.length());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user