Merge pull request #1496 from GaidamakUA/bookmark_dialog

Add bookmark dialog: Category suggestion on 0 characters added.
This commit is contained in:
vshcherb 2015-07-27 01:09:29 +02:00
commit d0efae8c15
2 changed files with 43 additions and 3 deletions

View file

@ -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"

View file

@ -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);
}
}
}