mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
Cleanup code, search with preceeding %
This commit is contained in:
parent
59067f9f8b
commit
ba61e69a7d
@ -245,7 +245,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer
|
|||||||
String whereArgs[] = null;
|
String whereArgs[] = null;
|
||||||
if (mCurQuery != null) {
|
if (mCurQuery != null) {
|
||||||
where = KeychainContract.UserIds.USER_ID + " LIKE ?";
|
where = KeychainContract.UserIds.USER_ID + " LIKE ?";
|
||||||
whereArgs = new String[]{mCurQuery+"%"};
|
whereArgs = new String[]{"%" + mCurQuery + "%"};
|
||||||
}
|
}
|
||||||
// Now create and return a CursorLoader that will take care of
|
// Now create and return a CursorLoader that will take care of
|
||||||
// creating a Cursor for the data being displayed.
|
// creating a Cursor for the data being displayed.
|
||||||
@ -352,7 +352,6 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
|
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
|
||||||
|
|
||||||
// Get the searchview
|
// Get the searchview
|
||||||
MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search);
|
MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search);
|
||||||
mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
|
mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
|
||||||
@ -361,7 +360,6 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer
|
|||||||
mSearchView.setOnQueryTextListener(this);
|
mSearchView.setOnQueryTextListener(this);
|
||||||
|
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -374,8 +372,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer
|
|||||||
// Called when the action bar search text has changed. Update
|
// Called when the action bar search text has changed. Update
|
||||||
// the search filter, and restart the loader to do a new query
|
// the search filter, and restart the loader to do a new query
|
||||||
// with this filter.
|
// with this filter.
|
||||||
String newQuery = !TextUtils.isEmpty(s) ? s : null;
|
mCurQuery = !TextUtils.isEmpty(s) ? s : null;
|
||||||
mCurQuery = newQuery;
|
|
||||||
getLoaderManager().restartLoader(0, null, this);
|
getLoaderManager().restartLoader(0, null, this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -204,22 +204,6 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T
|
|||||||
inMasterKeyList += ")";
|
inMasterKeyList += ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (searchString != null && searchString.trim().length() > 0) {
|
|
||||||
// String[] chunks = searchString.trim().split(" +");
|
|
||||||
// qb.appendWhere("(EXISTS (SELECT tmp." + UserIds._ID + " FROM " + UserIds.TABLE_NAME
|
|
||||||
// + " AS tmp WHERE " + "tmp." + UserIds.KEY_ID + " = " + Keys.TABLE_NAME + "."
|
|
||||||
// + Keys._ID);
|
|
||||||
// for (int i = 0; i < chunks.length; ++i) {
|
|
||||||
// qb.appendWhere(" AND tmp." + UserIds.USER_ID + " LIKE ");
|
|
||||||
// qb.appendWhereEscapeString("%" + chunks[i] + "%");
|
|
||||||
// }
|
|
||||||
// qb.appendWhere("))");
|
|
||||||
//
|
|
||||||
// if (inIdList != null) {
|
|
||||||
// qb.appendWhere(" OR (" + inIdList + ")");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
String orderBy = UserIds.USER_ID + " ASC";
|
String orderBy = UserIds.USER_ID + " ASC";
|
||||||
if (inMasterKeyList != null) {
|
if (inMasterKeyList != null) {
|
||||||
// sort by selected master keys
|
// sort by selected master keys
|
||||||
@ -229,7 +213,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T
|
|||||||
String whereArgs[] = null;
|
String whereArgs[] = null;
|
||||||
if (mCurQuery != null) {
|
if (mCurQuery != null) {
|
||||||
where = UserIds.USER_ID + " LIKE ?";
|
where = UserIds.USER_ID + " LIKE ?";
|
||||||
whereArgs = new String[]{mCurQuery+"%"};
|
whereArgs = new String[]{"%" + mCurQuery + "%"};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now create and return a CursorLoader that will take care of
|
// Now create and return a CursorLoader that will take care of
|
||||||
@ -274,8 +258,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable editable) {
|
public void afterTextChanged(Editable editable) {
|
||||||
String newQuery = !TextUtils.isEmpty(editable.toString()) ? editable.toString() : null;
|
mCurQuery = !TextUtils.isEmpty(editable.toString()) ? editable.toString() : null;
|
||||||
mCurQuery = newQuery;
|
|
||||||
getLoaderManager().restartLoader(0, null, this);
|
getLoaderManager().restartLoader(0, null, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user