encryptkeycompletionview: don't use prefix
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui.widget;
|
package org.sufficientlysecure.keychain.ui.widget;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@@ -37,7 +38,6 @@ import android.view.inputmethod.InputMethodManager;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.tokenautocomplete.TokenCompleteTextView;
|
import com.tokenautocomplete.TokenCompleteTextView;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
@@ -55,7 +55,6 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView<KeyItem>
|
|||||||
|
|
||||||
private KeyAdapter mAdapter;
|
private KeyAdapter mAdapter;
|
||||||
private LoaderManager mLoaderManager;
|
private LoaderManager mLoaderManager;
|
||||||
private CharSequence mPrefix;
|
|
||||||
|
|
||||||
public EncryptKeyCompletionView(Context context) {
|
public EncryptKeyCompletionView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -73,20 +72,12 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView<KeyItem>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
setPrefix(getContext().getString(R.string.label_to) + " ");
|
|
||||||
|
|
||||||
allowDuplicates(false);
|
allowDuplicates(false);
|
||||||
|
|
||||||
mAdapter = new KeyAdapter(getContext(), null, 0);
|
mAdapter = new KeyAdapter(getContext(), null, 0);
|
||||||
setAdapter(mAdapter);
|
setAdapter(mAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPrefix(CharSequence p) {
|
|
||||||
// this one is private in the superclass, but we need it here
|
|
||||||
mPrefix = p;
|
|
||||||
super.setPrefix(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected View getViewForObject(KeyItem keyItem) {
|
protected View getViewForObject(KeyItem keyItem) {
|
||||||
LayoutInflater l = LayoutInflater.from(getContext());
|
LayoutInflater l = LayoutInflater.from(getContext());
|
||||||
@@ -173,13 +164,10 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView<KeyItem>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void performFiltering(@NonNull CharSequence text, int start, int end, int keyCode) {
|
protected void performFiltering(@NonNull CharSequence text, int start, int end, int keyCode) {
|
||||||
super.performFiltering(text, start, end, keyCode);
|
// super.performFiltering(text, start, end, keyCode);
|
||||||
if (start < mPrefix.length()) {
|
|
||||||
start = mPrefix.length();
|
|
||||||
}
|
|
||||||
String query = text.subSequence(start, end).toString();
|
String query = text.subSequence(start, end).toString();
|
||||||
if (TextUtils.isEmpty(query) || query.length() < 2) {
|
if (TextUtils.isEmpty(query) || query.length() < 2) {
|
||||||
mLoaderManager.destroyLoader(0);
|
mAdapter.swapCursor(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
|||||||
Reference in New Issue
Block a user