From bf8dd4180b2445ee9190fc72a1a291cafb60f286 Mon Sep 17 00:00:00 2001 From: "Igor B. Poretsky" Date: Tue, 1 Mar 2016 20:31:54 +0300 Subject: [PATCH] Implemented category choice dialog when adding favourites in accessibility mode. --- OsmAnd/res/layout/favorite_edit_dialog.xml | 1 + OsmAnd/res/values-ru/strings.xml | 1 + OsmAnd/res/values/strings.xml | 1 + .../osmand/plus/dialogs/FavoriteDialogs.java | 24 ++++++++++++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/layout/favorite_edit_dialog.xml b/OsmAnd/res/layout/favorite_edit_dialog.xml index 0399ebb38a..a8ce7b3c5a 100644 --- a/OsmAnd/res/layout/favorite_edit_dialog.xml +++ b/OsmAnd/res/layout/favorite_edit_dialog.xml @@ -26,6 +26,7 @@ android:selectAllOnFocus="true"/> Введите имя Введите категорию Введите описание + Выберите категорию diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index db96f17269..4f289d00ef 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -10,6 +10,7 @@ PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Choose category Enter name Enter category Enter description diff --git a/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java b/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java index b44d10ab34..61a0eddc3d 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java @@ -16,6 +16,7 @@ import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.EditText; import android.widget.ListView; +import android.widget.TextView; import android.widget.Toast; import net.osmand.AndroidUtils; @@ -105,12 +106,33 @@ public class FavoriteDialogs { final EditText description = (EditText) v.findViewById(R.id.description); final AutoCompleteTextView cat = (AutoCompleteTextView) v.findViewById(R.id.Category); List gs = helper.getFavoriteGroups(); - String[] list = new String[gs.size()]; + final String[] list = new String[gs.size()]; for (int i = 0; i < list.length; i++) { list[i] = gs.get(i).name; } cat.setAdapter(new ArrayAdapter(activity, R.layout.list_textview, list)); + if (((OsmandApplication)activity.getApplication()).accessibilityEnabled()) { + final TextView textButton = (TextView)v.findViewById(R.id.TextButton); + textButton.setClickable(true); + textButton.setFocusable(true); + textButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + AlertDialog.Builder b = new AlertDialog.Builder(activity); + b.setTitle(R.string.access_category_choice); + b.setItems(list, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + cat.setText(list[which]); + } + }); + b.setNegativeButton(R.string.shared_string_cancel, null); + b.show(); + } + }); + } + builder.setNegativeButton(R.string.shared_string_cancel, null); builder.setNeutralButton(R.string.update_existing, new DialogInterface.OnClickListener(){