Add bookmark dialog: Category suggestion on 0 characters added.
This commit is contained in:
parent
5a495b1913
commit
268f41ea34
2 changed files with 43 additions and 3 deletions
|
@ -31,11 +31,10 @@
|
|||
android:layout_marginTop="@dimen/dialog_elements_vertical_margin"
|
||||
android:text="@string/favourites_edit_dialog_category"/>
|
||||
|
||||
<AutoCompleteTextView
|
||||
<net.osmand.plus.widgets.AutoCompleteTextViewEx
|
||||
android:id="@+id/Category"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:completionThreshold="1"/>
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package net.osmand.plus.widgets;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
|
||||
public class AutoCompleteTextViewEx extends AutoCompleteTextView {
|
||||
public AutoCompleteTextViewEx(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AutoCompleteTextViewEx(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public AutoCompleteTextViewEx(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public AutoCompleteTextViewEx(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enoughToFilter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
|
||||
super.onFocusChanged(focused, direction, previouslyFocusedRect);
|
||||
if (focused && getAdapter() != null) {
|
||||
performFiltering(getText(), 0);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue