Refactored common layout & update game item text size

This commit is contained in:
SSimco
2024-07-09 19:28:02 +03:00
parent 3f5d6eda66
commit 987cb7799b
17 changed files with 32 additions and 152 deletions
@@ -12,13 +12,13 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import info.cemu.Cemu.databinding.FragmentAudioSettingsBinding;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding;
public class AudioSettingsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
FragmentAudioSettingsBinding binding = FragmentAudioSettingsBinding.inflate(inflater, container, false);
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
@@ -72,7 +72,7 @@ public class AudioSettingsFragment extends Fragment {
value -> (int) value + "%");
genericRecyclerViewAdapter.addRecyclerViewItem(padVolumeSlider);
binding.audioSettingsRecyclerView.setAdapter(genericRecyclerViewAdapter);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot();
}
@@ -15,7 +15,7 @@ import androidx.fragment.app.Fragment;
import java.util.HashMap;
import java.util.Map;
import info.cemu.Cemu.databinding.FragmentControllerInputsBinding;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding;
public class ControllerInputsFragment extends Fragment {
public static final String CONTROLLER_INDEX = "ControllerIndex";
@@ -94,8 +94,8 @@ public class ControllerInputsFragment extends Fragment {
setControllerInputs(NativeLibrary.getControllerMappings(controllerIndex));
FragmentControllerInputsBinding binding = FragmentControllerInputsBinding.inflate(inflater, container, false);
binding.controllerInputsRecyclerView.setAdapter(genericRecyclerViewAdapter);
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot();
}
@@ -13,13 +13,10 @@ import androidx.navigation.NavController;
import androidx.navigation.fragment.NavHostFragment;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.stream.IntStream;
import info.cemu.Cemu.databinding.FragmentGraphicPacksBinding;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding;
public class GraphicPacksFragment extends Fragment {
private final GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
@@ -40,8 +37,8 @@ public class GraphicPacksFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
FragmentGraphicPacksBinding binding = FragmentGraphicPacksBinding.inflate(inflater, container, false);
binding.graphicPacksRecyclerView.setAdapter(genericRecyclerViewAdapter);
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot();
}
@@ -38,7 +38,7 @@ import java.util.List;
import java.util.Objects;
import java.util.Optional;
import info.cemu.Cemu.databinding.FragmentGraphicPacksRootBinding;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
@@ -157,8 +157,8 @@ public class GraphicPacksRootFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
FragmentGraphicPacksRootBinding binding = FragmentGraphicPacksRootBinding.inflate(inflater, container, false);
binding.graphicPacksRootRecyclerView.setAdapter(this.genericRecyclerViewAdapter);
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false);
binding.recyclerView.setAdapter(this.genericRecyclerViewAdapter);
requireActivity().addMenuProvider(new MenuProvider() {
@Override
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
@@ -181,13 +181,13 @@ public class GraphicPacksRootFragment extends Fragment {
searchMenuItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(@NonNull MenuItem item) {
binding.graphicPacksRootRecyclerView.setAdapter(graphicPacksRecyclerViewAdapter);
binding.recyclerView.setAdapter(graphicPacksRecyclerViewAdapter);
return true;
}
@Override
public boolean onMenuItemActionCollapse(@NonNull MenuItem item) {
binding.graphicPacksRootRecyclerView.setAdapter(genericRecyclerViewAdapter);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return true;
}
});
@@ -11,13 +11,13 @@ import androidx.fragment.app.Fragment;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import info.cemu.Cemu.databinding.FragmentGraphicsSettingsBinding;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding;
public class GraphicsSettingsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
FragmentGraphicsSettingsBinding binding = FragmentGraphicsSettingsBinding.inflate(inflater, container, false);
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
@@ -40,7 +40,7 @@ public class GraphicsSettingsFragment extends Fragment {
CheckboxRecyclerViewItem accurateBarriersCheckbox = new CheckboxRecyclerViewItem(getString(R.string.accurate_barriers), getString(R.string.accurate_barriers_description), NativeLibrary.getAccurateBarriers(), NativeLibrary::setAccurateBarriers);
genericRecyclerViewAdapter.addRecyclerViewItem(accurateBarriersCheckbox);
binding.graphicsSettingsRecyclerView.setAdapter(genericRecyclerViewAdapter);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot();
}
}
@@ -15,7 +15,7 @@ import androidx.fragment.app.Fragment;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import info.cemu.Cemu.databinding.FragmentInputOverlaySettingsBinding;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding;
public class InputOverlaySettingsFragment extends Fragment {
@@ -35,7 +35,7 @@ public class InputOverlaySettingsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
var binding = FragmentInputOverlaySettingsBinding.inflate(inflater, container, false);
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
CheckboxRecyclerViewItem inputOverlayCheckbox = new CheckboxRecyclerViewItem(
@@ -94,7 +94,7 @@ public class InputOverlaySettingsFragment extends Fragment {
)
);
binding.inputOverlaySettingsRecyclerView.setAdapter(genericRecyclerViewAdapter);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot();
}
@@ -11,7 +11,7 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import info.cemu.Cemu.databinding.FragmentInputSettingsBinding;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding;
public class InputSettingsFragment extends Fragment {
@@ -19,7 +19,7 @@ public class InputSettingsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
FragmentInputSettingsBinding binding = FragmentInputSettingsBinding.inflate(inflater, container, false);
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
genericRecyclerViewAdapter.addRecyclerViewItem(new SimpleButtonRecyclerViewItem(getString(R.string.input_overlay_settings), () -> NavHostFragment.findNavController(InputSettingsFragment.this).navigate(R.id.action_inputSettingsFragment_to_inputOverlaySettingsFragment)));
@@ -37,7 +37,7 @@ public class InputSettingsFragment extends Fragment {
});
genericRecyclerViewAdapter.addRecyclerViewItem(buttonRecyclerViewItem);
}
binding.inputSettingsRecyclerView.setAdapter(genericRecyclerViewAdapter);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot();
}
}
@@ -12,13 +12,14 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import info.cemu.Cemu.databinding.FragmentOverlaySettingsBinding;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding;
public class OverlaySettingsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
FragmentOverlaySettingsBinding binding = FragmentOverlaySettingsBinding.inflate(inflater, container, false);
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
@@ -67,7 +68,7 @@ public class OverlaySettingsFragment extends Fragment {
NativeLibrary::setOverlayVRAMUsageEnabled);
genericRecyclerViewAdapter.addRecyclerViewItem(vramUsageCheckbox);
binding.audioSettingsRecyclerView.setAdapter(genericRecyclerViewAdapter);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot();
}
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context=".ControllerInputsFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/controller_inputs_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="16dp"
android:scrollbars="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".GraphicPacksFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/graphic_packs_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:context=".InputSettingsFragment" />
</FrameLayout>
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".GraphicPacksRootFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/graphic_packs_root_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:context=".InputSettingsFragment" />
</FrameLayout>
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".GraphicsSettingsFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/graphics_settings_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</FrameLayout>
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".InputOverlaySettingsFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/input_overlay_settings_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</FrameLayout>
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/input_settings_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:context=".InputSettingsFragment" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AudioSettingsFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/audio_settings_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</FrameLayout>
@@ -1,17 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AudioSettingsFragment">
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/audio_settings_recycler_view"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</FrameLayout>
@@ -18,6 +18,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="8dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:textSize="24sp" />
</LinearLayout>