Change osmand keyboard
This commit is contained in:
parent
00e25c7ee4
commit
b5592c462c
11 changed files with 124 additions and 68 deletions
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_action_add_photos" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/ic_action_aircraft"/>
|
||||
</selector>
|
5
OsmAnd/res/drawable/keyboard_item_control_dark_bg.xml
Normal file
5
OsmAnd/res/drawable/keyboard_item_control_dark_bg.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/keyboard_item_control_dark_bg_pressed" android:state_pressed="true"/>
|
||||
<item android:drawable="@color/keyboard_item_control_dark_bg"/>
|
||||
</selector>
|
5
OsmAnd/res/drawable/keyboard_item_control_light_bg.xml
Normal file
5
OsmAnd/res/drawable/keyboard_item_control_light_bg.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/keyboard_item_control_light_bg_pressed" android:state_pressed="true"/>
|
||||
<item android:drawable="@color/keyboard_item_control_light_bg"/>
|
||||
</selector>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/keyboard_text_color_light_pressed" android:state_pressed="true"/>
|
||||
<item android:color="@color/keyboard_text_color_light"/>
|
||||
<item android:color="@color/keyboard_item_text_color_light_pressed" android:state_pressed="true"/>
|
||||
<item android:color="@color/keyboard_item_text_color_light"/>
|
||||
</selector>
|
|
@ -169,7 +169,7 @@
|
|||
android:layout_weight="1"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:horizontalSpacing="1dp"
|
||||
android:numColumns="3"
|
||||
android:numColumns="4"
|
||||
android:stretchMode="columnWidth"
|
||||
android:verticalSpacing="1dp"/>
|
||||
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:id="@+id/keyboard_item"
|
||||
android:textAllCaps="true"
|
||||
android:id="@+id/keyboard_item_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.8"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingTop="6dp"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/keyboard_item_text_color"
|
||||
tools:text="3"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/keyboard_item_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="center"
|
||||
android:layout_gravity="center"
|
||||
tools:src="@drawable/ic_action_aircraft"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -166,7 +166,6 @@
|
|||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
tools:visibility="gone"
|
||||
android:id="@+id/keyboard_layout"
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
|
@ -181,7 +180,7 @@
|
|||
android:horizontalSpacing="1dp"
|
||||
android:verticalSpacing="1dp"
|
||||
android:stretchMode="columnWidth"
|
||||
android:numColumns="3"/>
|
||||
android:numColumns="4"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/keyboard_divider"
|
||||
|
@ -195,33 +194,34 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/show_hide_keyboard_icon"
|
||||
android:padding="@dimen/content_padding"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:src="@drawable/ic_action_arrow_down"/>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:id="@+id/add_marker_button"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="3"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/keyboard_item_text_color"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/shared_string_add"/>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/show_hide_keyboard_icon"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="center"
|
||||
tools:src="@drawable/ic_action_arrow_down"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:orientation="vertical">
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp">
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:id="@+id/keyboard_item"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="0.8"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/keyboard_item_text_color"
|
||||
tools:text="3"/>
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/keyboard_item_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingTop="6dp"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/keyboard_item_text_color"
|
||||
tools:text="3"/>
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/keyboard_item_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="center"
|
||||
android:layout_gravity="center"
|
||||
tools:src="@drawable/ic_action_aircraft"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -264,10 +264,13 @@
|
|||
|
||||
<color name="marker_circle_button_color_dark">#525e66</color>
|
||||
|
||||
<color name="keyboard_text_color_light">#545454</color>
|
||||
<color name="keyboard_text_color_light_pressed">#ffffff</color>
|
||||
|
||||
<color name="keyboard_text_color_dark">#ffffff</color>
|
||||
<color name="keyboard_item_text_color_light">#545454</color>
|
||||
<color name="keyboard_item_text_color_light_pressed">#ffffff</color>
|
||||
<color name="keyboard_item_text_color_dark">#ffffff</color>
|
||||
<color name="keyboard_item_control_light_bg">#f2f2f2</color>
|
||||
<color name="keyboard_item_control_light_bg_pressed">#536dfe</color>
|
||||
<color name="keyboard_item_control_dark_bg">#f2f2f2</color>
|
||||
<color name="keyboard_item_control_dark_bg_pressed">#536dfe</color>
|
||||
|
||||
<color name="coordinate_input_status_bar_color">#4257c9</color>
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@
|
|||
|
||||
<item name="popupMenuStyle">@style/PopupMenuDark</item>
|
||||
|
||||
<item name="keyboard_item_text_color">@color/keyboard_text_color_dark</item>
|
||||
<item name="keyboard_item_text_color">@color/keyboard_item_text_color_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
|
||||
|
|
|
@ -72,8 +72,10 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
public static final String GO_TO_NEXT_FIELD = "go_to_next_field";
|
||||
public static final String ACCURACY = "accuracy";
|
||||
|
||||
private static final int CLEAR_BUTTON_POSITION = 9;
|
||||
private static final int DELETE_BUTTON_POSITION = 11;
|
||||
private static final int CLEAR_BUTTON_POSITION = 3;
|
||||
private static final int MINUS_BUTTON_POSITION = 7;
|
||||
private static final int BACKSPACE_BUTTON_POSITION = 11;
|
||||
private static final int SWITCH_TO_NEXT_INPUT_BUTTON_POSITION = 15;
|
||||
private static final String LATITUDE_LABEL = "latitude";
|
||||
private static final String LONGITUDE_LABEL = "longitude";
|
||||
private static final String NAME_LABEL = "name";
|
||||
|
@ -246,10 +248,10 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
AndroidUtils.setBackground(mapActivity, keyboardLayout, !lightTheme, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
}
|
||||
|
||||
String[] keyboardItems = new String[] { "1", "2", "3",
|
||||
"4", "5", "6",
|
||||
"7", "8", "9",
|
||||
getString(R.string.shared_string_clear), "0", "\u21e6" };
|
||||
Object[] keyboardItems = new Object[] { "1", "2", "3", getString(R.string.shared_string_clear),
|
||||
"4", "5", "6", "-",
|
||||
"7", "8", "9", "\u21e6",
|
||||
".", "0", ":", R.drawable.input_coordinate_keyboard_backspace };
|
||||
final GridView keyboardGrid = (GridView) mainView.findViewById(R.id.keyboard_grid_view);
|
||||
final KeyboardAdapter keyboardAdapter = new KeyboardAdapter(mapActivity, keyboardItems);
|
||||
keyboardGrid.setAdapter(keyboardAdapter);
|
||||
|
@ -263,7 +265,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
case CLEAR_BUTTON_POSITION:
|
||||
focusedEditText.setText("");
|
||||
break;
|
||||
case DELETE_BUTTON_POSITION:
|
||||
case BACKSPACE_BUTTON_POSITION:
|
||||
String str = focusedEditText.getText().toString();
|
||||
if (str.length() > 0) {
|
||||
str = str.substring(0, str.length() - 1);
|
||||
|
@ -271,8 +273,11 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
focusedEditText.setSelection(str.length());
|
||||
}
|
||||
break;
|
||||
case SWITCH_TO_NEXT_INPUT_BUTTON_POSITION:
|
||||
switchToNextInput(focusedEditText.getId());
|
||||
break;
|
||||
default:
|
||||
focusedEditText.append(keyboardAdapter.getItem(i));
|
||||
focusedEditText.append((String) keyboardAdapter.getItem(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -726,9 +731,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
}
|
||||
}
|
||||
|
||||
private class KeyboardAdapter extends ArrayAdapter<String> {
|
||||
private class KeyboardAdapter extends ArrayAdapter<Object> {
|
||||
|
||||
KeyboardAdapter(@NonNull Context context, @NonNull String[] objects) {
|
||||
KeyboardAdapter(@NonNull Context context, @NonNull Object[] objects) {
|
||||
super(context, 0, objects);
|
||||
}
|
||||
|
||||
|
@ -737,7 +742,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.input_coordinate_keyboard_item, parent, false);
|
||||
convertView.setBackgroundResource(lightTheme ? R.drawable.keyboard_item_light_bg : R.drawable.keyboard_item_dark_bg);
|
||||
}
|
||||
if (!orientationPortrait) {
|
||||
int keyboardViewHeight = mainView.findViewById(R.id.keyboard_grid_view).getMeasuredHeight();
|
||||
|
@ -745,14 +749,33 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
int spaceForKeys = keyboardViewHeight - 3 * dividerHeight;
|
||||
convertView.setMinimumHeight(spaceForKeys / 4);
|
||||
}
|
||||
TextView keyboardItem = (TextView) convertView.findViewById(R.id.keyboard_item);
|
||||
if (position == CLEAR_BUTTON_POSITION) {
|
||||
TextViewCompat.setAutoSizeTextTypeWithDefaults(keyboardItem, TextViewCompat.AUTO_SIZE_TEXT_TYPE_NONE);
|
||||
keyboardItem.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.default_list_text_size));
|
||||
boolean controlButton = position == CLEAR_BUTTON_POSITION
|
||||
|| position == MINUS_BUTTON_POSITION
|
||||
|| position == BACKSPACE_BUTTON_POSITION
|
||||
|| position == SWITCH_TO_NEXT_INPUT_BUTTON_POSITION;
|
||||
if (controlButton) {
|
||||
convertView.setBackgroundResource(lightTheme ? R.drawable.keyboard_item_control_light_bg : R.drawable.keyboard_item_control_dark_bg);
|
||||
} else {
|
||||
TextViewCompat.setAutoSizeTextTypeWithDefaults(keyboardItem, TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM);
|
||||
convertView.setBackgroundResource(lightTheme ? R.drawable.keyboard_item_light_bg : R.drawable.keyboard_item_dark_bg);
|
||||
}
|
||||
TextView keyboardItemText = (TextView) convertView.findViewById(R.id.keyboard_item_text);
|
||||
ImageView keyboardItemImage = (ImageView) convertView.findViewById(R.id.keyboard_item_image);
|
||||
Object item = getItem(position);
|
||||
if (item instanceof String) {
|
||||
if (position == CLEAR_BUTTON_POSITION) {
|
||||
TextViewCompat.setAutoSizeTextTypeWithDefaults(keyboardItemText, TextViewCompat.AUTO_SIZE_TEXT_TYPE_NONE);
|
||||
keyboardItemText.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.default_list_text_size));
|
||||
} else {
|
||||
TextViewCompat.setAutoSizeTextTypeWithDefaults(keyboardItemText, TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM);
|
||||
}
|
||||
keyboardItemImage.setVisibility(View.GONE);
|
||||
keyboardItemText.setVisibility(View.VISIBLE);
|
||||
keyboardItemText.setText((String) getItem(position));
|
||||
} else if (item instanceof Integer) {
|
||||
keyboardItemText.setVisibility(View.GONE);
|
||||
keyboardItemImage.setVisibility(View.VISIBLE);
|
||||
keyboardItemImage.setImageResource((Integer) item);
|
||||
}
|
||||
keyboardItem.setText(getItem(position));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue