Android: Reduce Submenu height by 25 percent

This commit is contained in:
Ryan Meredith 2020-03-30 05:15:50 -04:00
parent fba1e3c7ca
commit 4e0fc6cfe5
5 changed files with 40 additions and 23 deletions

View File

@ -7,10 +7,9 @@ public final class SubmenuSetting extends SettingsItem
{
private MenuTag mMenuKey;
public SubmenuSetting(String key, Setting setting, int titleId, int descriptionId,
MenuTag menuKey)
public SubmenuSetting(String key, Setting setting, int titleId, MenuTag menuKey)
{
super(key, null, setting, titleId, descriptionId);
super(key, null, setting, titleId, 0);
mMenuKey = menuKey;
}

View File

@ -105,7 +105,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
return new SliderViewHolder(view, this);
case SettingsItem.TYPE_SUBMENU:
view = inflater.inflate(R.layout.list_item_setting, parent, false);
view = inflater.inflate(R.layout.list_item_setting_submenu, parent, false);
return new SubmenuViewHolder(view, this);
case SettingsItem.TYPE_INPUT_BINDING:

View File

@ -216,14 +216,14 @@ public final class SettingsFragmentPresenter
private void addConfigSettings(ArrayList<SettingsItem> sl)
{
sl.add(new SubmenuSetting(null, null, R.string.general_submenu, 0, MenuTag.CONFIG_GENERAL));
sl.add(new SubmenuSetting(null, null, R.string.interface_submenu, 0, MenuTag.CONFIG_INTERFACE));
sl.add(new SubmenuSetting(null, null, R.string.audio_submenu, 0, MenuTag.CONFIG_AUDIO));
sl.add(new SubmenuSetting(null, null, R.string.paths_submenu, 0, MenuTag.CONFIG_PATHS));
sl.add(new SubmenuSetting(null, null, R.string.gamecube_submenu, 0, MenuTag.CONFIG_GAME_CUBE));
sl.add(new SubmenuSetting(null, null, R.string.wii_submenu, 0, MenuTag.CONFIG_WII));
sl.add(new SubmenuSetting(null, null, R.string.advanced_submenu, 0, MenuTag.CONFIG_ADVANCED));
sl.add(new SubmenuSetting(null, null, R.string.debug_submenu, 0, MenuTag.DEBUG));
sl.add(new SubmenuSetting(null, null, R.string.general_submenu, MenuTag.CONFIG_GENERAL));
sl.add(new SubmenuSetting(null, null, R.string.interface_submenu, MenuTag.CONFIG_INTERFACE));
sl.add(new SubmenuSetting(null, null, R.string.audio_submenu, MenuTag.CONFIG_AUDIO));
sl.add(new SubmenuSetting(null, null, R.string.paths_submenu, MenuTag.CONFIG_PATHS));
sl.add(new SubmenuSetting(null, null, R.string.gamecube_submenu, MenuTag.CONFIG_GAME_CUBE));
sl.add(new SubmenuSetting(null, null, R.string.wii_submenu, MenuTag.CONFIG_WII));
sl.add(new SubmenuSetting(null, null, R.string.advanced_submenu, MenuTag.CONFIG_ADVANCED));
sl.add(new SubmenuSetting(null, null, R.string.debug_submenu, MenuTag.DEBUG));
sl.add(new HeaderSetting(null, null, R.string.gametdb_thanks, 0));
}
@ -499,8 +499,8 @@ public final class SettingsFragmentPresenter
R.array.aspectRatioValues, 0, aspectRatio));
sl.add(new HeaderSetting(null, null, R.string.graphics_enhancements_and_hacks, 0));
sl.add(new SubmenuSetting(null, null, R.string.enhancements_submenu, 0, MenuTag.ENHANCEMENTS));
sl.add(new SubmenuSetting(null, null, R.string.hacks_submenu, 0, MenuTag.HACKS));
sl.add(new SubmenuSetting(null, null, R.string.enhancements_submenu, MenuTag.ENHANCEMENTS));
sl.add(new SubmenuSetting(null, null, R.string.hacks_submenu, MenuTag.HACKS));
}
private void addEnhanceSettings(ArrayList<SettingsItem> sl)
@ -589,7 +589,7 @@ public final class SettingsFragmentPresenter
helper.SupportsExtension("GL_ANDROID_extension_pack_es31a")))
{
sl.add(new SubmenuSetting(SettingsFile.KEY_STEREO_MODE, null, R.string.stereoscopy_submenu,
R.string.stereoscopy_submenu_description, MenuTag.STEREOSCOPY));
MenuTag.STEREOSCOPY));
}
}

View File

@ -13,7 +13,6 @@ public final class SubmenuViewHolder extends SettingViewHolder
private SubmenuSetting mItem;
private TextView mTextSettingName;
private TextView mTextSettingDescription;
public SubmenuViewHolder(View itemView, SettingsAdapter adapter)
{
@ -24,7 +23,6 @@ public final class SubmenuViewHolder extends SettingViewHolder
protected void findViews(View root)
{
mTextSettingName = (TextView) root.findViewById(R.id.text_setting_name);
mTextSettingDescription = (TextView) root.findViewById(R.id.text_setting_description);
}
@Override
@ -33,11 +31,6 @@ public final class SubmenuViewHolder extends SettingViewHolder
mItem = (SubmenuSetting) item;
mTextSettingName.setText(item.getNameId());
if (item.getDescriptionId() > 0)
{
mTextSettingDescription.setText(item.getDescriptionId());
}
}
@Override
@ -45,4 +38,4 @@ public final class SubmenuViewHolder extends SettingViewHolder
{
getAdapter().onSubmenuClick(mItem);
}
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="54dp"
android:background="?android:attr/selectableItemBackground"
android:focusable="true"
android:clickable="true">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/TextAppearance.AppCompat.Headline"
tools:text="Setting Name"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_large"
android:id="@+id/text_setting_name"
android:textSize="16sp"/>
</RelativeLayout>