Fix keyboard item height
This commit is contained in:
parent
8a57b4d1a2
commit
d8e5de37fe
3 changed files with 44 additions and 53 deletions
|
@ -1,30 +0,0 @@
|
||||||
<?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">
|
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatTextView
|
|
||||||
android:id="@+id/keyboard_item_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
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:tint="?attr/keyboard_item_text_color"
|
|
||||||
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>
|
|
|
@ -1,27 +1,40 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="56dp">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatTextView
|
<View
|
||||||
android:id="@+id/keyboard_item_text"
|
android:id="@+id/keyboard_item_top_spacing"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:gravity="center"
|
android:layout_weight="0.3"/>
|
||||||
android:paddingBottom="6dp"
|
|
||||||
android:paddingTop="6dp"
|
|
||||||
android:textAllCaps="true"
|
|
||||||
android:textColor="?attr/keyboard_item_text_color"
|
|
||||||
tools:text="3"/>
|
|
||||||
|
|
||||||
<ImageView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:tint="?attr/keyboard_item_text_color"
|
android:id="@+id/keyboard_item_text"
|
||||||
android:id="@+id/keyboard_item_image"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_weight="0.4"
|
||||||
android:scaleType="center"
|
android:gravity="center"
|
||||||
android:layout_gravity="center"
|
android:textAllCaps="true"
|
||||||
tools:src="@drawable/ic_action_backspace_fill"/>
|
android:textColor="?attr/keyboard_item_text_color"
|
||||||
|
tools:text="3"/>
|
||||||
|
|
||||||
</FrameLayout>
|
<View
|
||||||
|
android:id="@+id/keyboard_item_bottom_spacing"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="0.3"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/keyboard_item_image"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:tint="?attr/keyboard_item_text_color"
|
||||||
|
tools:src="@drawable/ic_action_backspace_fill"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -789,6 +789,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
int dividerHeight = AndroidUtils.dpToPx(getContext(), 1);
|
int dividerHeight = AndroidUtils.dpToPx(getContext(), 1);
|
||||||
int spaceForKeys = keyboardViewHeight - 3 * dividerHeight;
|
int spaceForKeys = keyboardViewHeight - 3 * dividerHeight;
|
||||||
convertView.setMinimumHeight(spaceForKeys / 4);
|
convertView.setMinimumHeight(spaceForKeys / 4);
|
||||||
|
} else {
|
||||||
|
convertView.setMinimumHeight(AndroidUtils.dpToPx(getContext(), 56));
|
||||||
}
|
}
|
||||||
boolean controlButton = position == CLEAR_BUTTON_POSITION
|
boolean controlButton = position == CLEAR_BUTTON_POSITION
|
||||||
|| position == MINUS_BUTTON_POSITION
|
|| position == MINUS_BUTTON_POSITION
|
||||||
|
@ -799,6 +801,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
} else {
|
} else {
|
||||||
convertView.setBackgroundResource(lightTheme ? R.drawable.keyboard_item_light_bg : R.drawable.keyboard_item_dark_bg);
|
convertView.setBackgroundResource(lightTheme ? R.drawable.keyboard_item_light_bg : R.drawable.keyboard_item_dark_bg);
|
||||||
}
|
}
|
||||||
|
View keyboardItemTopSpacing = convertView.findViewById(R.id.keyboard_item_top_spacing);
|
||||||
|
View keyboardItemBottomSpacing = convertView.findViewById(R.id.keyboard_item_bottom_spacing);
|
||||||
TextView keyboardItemText = (TextView) convertView.findViewById(R.id.keyboard_item_text);
|
TextView keyboardItemText = (TextView) convertView.findViewById(R.id.keyboard_item_text);
|
||||||
ImageView keyboardItemImage = (ImageView) convertView.findViewById(R.id.keyboard_item_image);
|
ImageView keyboardItemImage = (ImageView) convertView.findViewById(R.id.keyboard_item_image);
|
||||||
Object item = getItem(position);
|
Object item = getItem(position);
|
||||||
|
@ -810,9 +814,13 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
TextViewCompat.setAutoSizeTextTypeWithDefaults(keyboardItemText, TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM);
|
TextViewCompat.setAutoSizeTextTypeWithDefaults(keyboardItemText, TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM);
|
||||||
}
|
}
|
||||||
keyboardItemImage.setVisibility(View.GONE);
|
keyboardItemImage.setVisibility(View.GONE);
|
||||||
|
keyboardItemTopSpacing.setVisibility(View.VISIBLE);
|
||||||
|
keyboardItemBottomSpacing.setVisibility(View.VISIBLE);
|
||||||
keyboardItemText.setVisibility(View.VISIBLE);
|
keyboardItemText.setVisibility(View.VISIBLE);
|
||||||
keyboardItemText.setText((String) getItem(position));
|
keyboardItemText.setText((String) getItem(position));
|
||||||
} else if (item instanceof Integer) {
|
} else if (item instanceof Integer) {
|
||||||
|
keyboardItemTopSpacing.setVisibility(View.GONE);
|
||||||
|
keyboardItemBottomSpacing.setVisibility(View.GONE);
|
||||||
keyboardItemText.setVisibility(View.GONE);
|
keyboardItemText.setVisibility(View.GONE);
|
||||||
keyboardItemImage.setVisibility(View.VISIBLE);
|
keyboardItemImage.setVisibility(View.VISIBLE);
|
||||||
keyboardItemImage.setImageResource((Integer) item);
|
keyboardItemImage.setImageResource((Integer) item);
|
||||||
|
|
Loading…
Reference in a new issue