Refactored UI code

This commit is contained in:
SSimco 2024-10-14 20:53:08 +03:00
parent 82f0a24e80
commit c68665a1b4
30 changed files with 161 additions and 142 deletions

View File

@ -276,7 +276,7 @@ public class EmulationFragment extends Fragment implements PopupMenu.OnMenuItemC
toastMessage(R.string.input_mode_default); toastMessage(R.string.input_mode_default);
}); });
settingsMenu = new PopupMenu(requireContext(), binding.emulationSettingsButton); settingsMenu = new PopupMenu(requireContext(), binding.emulationSettingsButton);
settingsMenu.getMenuInflater().inflate(R.menu.menu_emulation_in_game, settingsMenu.getMenu()); settingsMenu.getMenuInflater().inflate(R.menu.emulation, settingsMenu.getMenu());
settingsMenu.setOnMenuItemClickListener(EmulationFragment.this); settingsMenu.setOnMenuItemClickListener(EmulationFragment.this);
binding.emulationSettingsButton.setOnClickListener(v -> settingsMenu.show()); binding.emulationSettingsButton.setOnClickListener(v -> settingsMenu.show());
var menu = settingsMenu.getMenu(); var menu = settingsMenu.getMenu();

View File

@ -12,6 +12,8 @@ import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ListAdapter; import androidx.recyclerview.widget.ListAdapter;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.card.MaterialCardView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -103,7 +105,7 @@ public class GameAdapter extends ListAdapter<Game, GameAdapter.ViewHolder> {
public static class ViewHolder extends RecyclerView.ViewHolder { public static class ViewHolder extends RecyclerView.ViewHolder {
ImageView icon; ImageView icon;
TextView text; TextView text;
ImageView favoriteIcon; MaterialCardView favoriteIcon;
public ViewHolder(View itemView) { public ViewHolder(View itemView) {
super(itemView); super(itemView);

View File

@ -1,11 +1,10 @@
package info.cemu.Cemu.gameview; package info.cemu.Cemu.gameview;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -16,6 +15,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.SearchView;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.fragment.NavHostFragment;
@ -24,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.HashSet; import java.util.HashSet;
import java.util.Objects;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.FragmentGamesBinding; import info.cemu.Cemu.databinding.FragmentGamesBinding;
@ -64,13 +65,14 @@ public class GamesFragment extends Fragment {
currentGamePaths = gamePaths; currentGamePaths = gamePaths;
NativeGameTitles.reloadGameTitles(); NativeGameTitles.reloadGameTitles();
} }
gameAdapter.setFilterText(null);
} }
@Override @Override
public void onCreateContextMenu(@NonNull ContextMenu menu, @NonNull View v, @Nullable ContextMenu.ContextMenuInfo menuInfo) { public void onCreateContextMenu(@NonNull ContextMenu menu, @NonNull View v, @Nullable ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo); super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = requireActivity().getMenuInflater(); MenuInflater inflater = requireActivity().getMenuInflater();
inflater.inflate(R.menu.menu_game, menu); inflater.inflate(R.menu.game, menu);
Game selectedGame = gameAdapter.getSelectedGame(); Game selectedGame = gameAdapter.getSelectedGame();
menu.findItem(R.id.favorite).setChecked(selectedGame.isFavorite()); menu.findItem(R.id.favorite).setChecked(selectedGame.isFavorite());
menu.findItem(R.id.remove_shader_caches).setEnabled(NativeGameTitles.titleHasShaderCacheFiles(selectedGame.titleId())); menu.findItem(R.id.remove_shader_caches).setEnabled(NativeGameTitles.titleHasShaderCacheFiles(selectedGame.titleId()));
@ -125,7 +127,28 @@ public class GamesFragment extends Fragment {
Intent intent = new Intent(requireActivity(), SettingsActivity.class); Intent intent = new Intent(requireActivity(), SettingsActivity.class);
startActivity(intent); startActivity(intent);
}); });
View rootView = binding.getRoot(); binding.searchBar.inflateMenu(R.menu.game_list);
var searchMenuItem = binding.searchBar.getMenu().findItem(R.id.action_search);
binding.searchBar.setOnClickListener(v -> searchMenuItem.expandActionView());
SearchView searchView = (SearchView) Objects.requireNonNull(searchMenuItem.getActionView());
View searchPlate = searchView.findViewById(androidx.appcompat.R.id.search_plate);
if (searchPlate != null) {
searchPlate.setBackgroundColor(Color.TRANSPARENT);
}
searchView.setQueryHint(getString(R.string.search_games));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
gameAdapter.setFilterText(query);
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
gameAdapter.setFilterText(newText);
return true;
}
});
binding.gamesSwipeRefresh.setOnRefreshListener(() -> { binding.gamesSwipeRefresh.setOnRefreshListener(() -> {
if (refreshing) return; if (refreshing) return;
@ -137,22 +160,9 @@ public class GamesFragment extends Fragment {
gameListViewModel.refreshGames(); gameListViewModel.refreshGames();
}); });
recyclerView.setAdapter(gameAdapter); recyclerView.setAdapter(gameAdapter);
binding.searchText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
gameAdapter.setFilterText(charSequence.toString());
}
@Override return binding.getRoot();
public void afterTextChanged(Editable editable) {
}
});
return rootView;
} }
} }

View File

@ -14,7 +14,7 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.guibasecomponents.ToggleRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.ToggleRecyclerViewItem;
import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter;
import info.cemu.Cemu.guibasecomponents.SelectionAdapter; import info.cemu.Cemu.guibasecomponents.SelectionAdapter;
@ -37,7 +37,7 @@ public class InputOverlaySettingsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); var binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter(); GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
ToggleRecyclerViewItem inputOverlayToggle = new ToggleRecyclerViewItem( ToggleRecyclerViewItem inputOverlayToggle = new ToggleRecyclerViewItem(

View File

@ -14,7 +14,7 @@ import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.fragment.NavHostFragment;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.features.DocumentsProvider; import info.cemu.Cemu.features.DocumentsProvider;
import info.cemu.Cemu.guibasecomponents.ButtonRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.ButtonRecyclerViewItem;
import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter;
@ -23,7 +23,7 @@ import info.cemu.Cemu.guibasecomponents.SimpleButtonRecyclerViewItem;
public class SettingsFragment extends Fragment { public class SettingsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
GenericRecyclerViewLayoutBinding binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); LayoutGenericRecyclerViewBinding binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter(); GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
genericRecyclerViewAdapter.addRecyclerViewItem(new SimpleButtonRecyclerViewItem(getString(R.string.open_cemu_folder), this::openCemuFolder)); genericRecyclerViewAdapter.addRecyclerViewItem(new SimpleButtonRecyclerViewItem(getString(R.string.open_cemu_folder), this::openCemuFolder));

View File

@ -13,7 +13,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.guibasecomponents.ToggleRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.ToggleRecyclerViewItem;
import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter;
import info.cemu.Cemu.guibasecomponents.SelectionAdapter; import info.cemu.Cemu.guibasecomponents.SelectionAdapter;
@ -33,7 +33,7 @@ public class AudioSettingsFragment extends Fragment {
} }
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); var binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter(); GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();

View File

@ -29,7 +29,7 @@ import java.util.stream.Stream;
import info.cemu.Cemu.nativeinterface.NativeSettings; import info.cemu.Cemu.nativeinterface.NativeSettings;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
public class GamePathsFragment extends Fragment { public class GamePathsFragment extends Fragment {
private ActivityResultLauncher<Intent> folderSelectionLauncher; private ActivityResultLauncher<Intent> folderSelectionLauncher;
@ -69,14 +69,14 @@ public class GamePathsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
GenericRecyclerViewLayoutBinding binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); LayoutGenericRecyclerViewBinding binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
binding.recyclerView.setAdapter(gamePathAdapter); binding.recyclerView.setAdapter(gamePathAdapter);
gamesPaths = NativeSettings.getGamesPaths(); gamesPaths = NativeSettings.getGamesPaths();
gamePathAdapter.submitList(gamesPaths); gamePathAdapter.submitList(gamesPaths);
requireActivity().addMenuProvider(new MenuProvider() { requireActivity().addMenuProvider(new MenuProvider() {
@Override @Override
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) { public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
menuInflater.inflate(R.menu.menu_game_paths, menu); menuInflater.inflate(R.menu.game_paths, menu);
} }
@Override @Override

View File

@ -17,7 +17,7 @@ import java.util.Objects;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter;
import info.cemu.Cemu.guibasecomponents.SingleSelectionRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.SingleSelectionRecyclerViewItem;
import info.cemu.Cemu.guibasecomponents.StringSelectionAdapter; import info.cemu.Cemu.guibasecomponents.StringSelectionAdapter;
@ -42,7 +42,7 @@ public class GraphicPacksFragment extends Fragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); var binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter); binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot(); return binding.getRoot();

View File

@ -39,7 +39,7 @@ import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.guibasecomponents.FilterableRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.FilterableRecyclerViewAdapter;
import info.cemu.Cemu.nativeinterface.FileCallbacks; import info.cemu.Cemu.nativeinterface.FileCallbacks;
import info.cemu.Cemu.nativeinterface.NativeGameTitles; import info.cemu.Cemu.nativeinterface.NativeGameTitles;
@ -173,12 +173,12 @@ public class GraphicPacksRootFragment extends Fragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); var binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
binding.recyclerView.setAdapter(this.genericRecyclerViewAdapter); binding.recyclerView.setAdapter(this.genericRecyclerViewAdapter);
requireActivity().addMenuProvider(new MenuProvider() { requireActivity().addMenuProvider(new MenuProvider() {
@Override @Override
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) { public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
menuInflater.inflate(R.menu.menu_graphic_packs, menu); menuInflater.inflate(R.menu.graphic_packs, menu);
var searchMenuItem = menu.findItem(R.id.action_graphic_packs_search); var searchMenuItem = menu.findItem(R.id.action_graphic_packs_search);
SearchView searchView = (SearchView) Objects.requireNonNull(searchMenuItem.getActionView()); SearchView searchView = (SearchView) Objects.requireNonNull(searchMenuItem.getActionView());
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

View File

@ -12,7 +12,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.guibasecomponents.ToggleRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.ToggleRecyclerViewItem;
import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter;
import info.cemu.Cemu.guibasecomponents.SelectionAdapter; import info.cemu.Cemu.guibasecomponents.SelectionAdapter;
@ -51,7 +51,7 @@ public class GraphicsSettingsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); var binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter(); GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();

View File

@ -16,7 +16,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter;
import info.cemu.Cemu.guibasecomponents.HeaderRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.HeaderRecyclerViewItem;
import info.cemu.Cemu.guibasecomponents.SingleSelectionRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.SingleSelectionRecyclerViewItem;
@ -100,7 +100,7 @@ public class ControllerInputsFragment extends Fragment {
setControllerInputs(NativeInput.getControllerMappings(controllerIndex)); setControllerInputs(NativeInput.getControllerMappings(controllerIndex));
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); var binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
binding.recyclerView.setAdapter(genericRecyclerViewAdapter); binding.recyclerView.setAdapter(genericRecyclerViewAdapter);
return binding.getRoot(); return binding.getRoot();

View File

@ -12,7 +12,7 @@ import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.fragment.NavHostFragment;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.guibasecomponents.ButtonRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.ButtonRecyclerViewItem;
import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter;
import info.cemu.Cemu.guibasecomponents.SimpleButtonRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.SimpleButtonRecyclerViewItem;
@ -23,7 +23,7 @@ public class InputSettingsFragment extends Fragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); var binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter(); 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))); genericRecyclerViewAdapter.addRecyclerViewItem(new SimpleButtonRecyclerViewItem(getString(R.string.input_overlay_settings), () -> NavHostFragment.findNavController(InputSettingsFragment.this).navigate(R.id.action_inputSettingsFragment_to_inputOverlaySettingsFragment)));

View File

@ -12,7 +12,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import info.cemu.Cemu.R; import info.cemu.Cemu.R;
import info.cemu.Cemu.databinding.GenericRecyclerViewLayoutBinding; import info.cemu.Cemu.databinding.LayoutGenericRecyclerViewBinding;
import info.cemu.Cemu.guibasecomponents.ToggleRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.ToggleRecyclerViewItem;
import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter; import info.cemu.Cemu.guibasecomponents.GenericRecyclerViewAdapter;
import info.cemu.Cemu.guibasecomponents.HeaderRecyclerViewItem; import info.cemu.Cemu.guibasecomponents.HeaderRecyclerViewItem;
@ -45,7 +45,7 @@ public class OverlaySettingsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
var binding = GenericRecyclerViewLayoutBinding.inflate(inflater, container, false); var binding = LayoutGenericRecyclerViewBinding.inflate(inflater, container, false);
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter(); GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();

View File

@ -1,6 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp" android:width="24dp"
android:height="48dp" android:height="24dp"
android:viewportWidth="960" android:viewportWidth="960"
android:viewportHeight="960" android:viewportHeight="960"
android:tint="?attr/colorControlNormal"> android:tint="?attr/colorControlNormal">

View File

@ -7,10 +7,16 @@
android:orientation="vertical" android:orientation="vertical"
tools:context=".gameview.GameDetailsFragment"> tools:context=".gameview.GameDetailsFragment">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/game_details_toolbar" <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" /> android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/game_details_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -7,10 +7,15 @@
android:orientation="vertical" android:orientation="vertical"
tools:context=".gameview.GameProfileEditFragment"> tools:context=".gameview.GameProfileEditFragment">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.AppBarLayout
android:id="@+id/game_edit_profile_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" /> android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/game_edit_profile_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"

View File

@ -13,67 +13,52 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:orientation="horizontal">
<com.google.android.material.card.MaterialCardView <LinearLayout
style="?attr/materialCardViewFilledStyle" android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_alignParentStart="true"
android:layout_margin="8dp"
android:layout_marginEnd="328dp"
android:layout_toStartOf="@+id/settings_button"
app:cardCornerRadius="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/settings_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_marginHorizontal="8dp"
android:importantForAccessibility="no"
android:src="@drawable/ic_search" />
<EditText
android:id="@+id/search_text"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="@string/search_games"
android:importantForAutofill="no"
android:inputType="text"
android:maxWidth="300dp"
android:maxLines="1" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.button.MaterialButton
android:id="@+id/settings_button"
style="?attr/materialIconButtonFilledStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:orientation="horizontal">
android:layout_gravity="end"
android:contentDescription="@string/settings" <com.google.android.material.card.MaterialCardView
android:gravity="center_vertical" style="?attr/materialCardViewFilledStyle"
app:icon="@drawable/ic_settings" android:layout_width="0dp"
app:iconSize="24dp" android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent" android:layout_marginStart="10dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginTop="4dp"
app:layout_constraintTop_toTopOf="parent" /> android:layout_marginEnd="10dp"
</androidx.constraintlayout.widget.ConstraintLayout> android:layout_marginBottom="4dp"
android:layout_weight="1"
app:cardCornerRadius="24dp"
app:strokeWidth="0dp">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/search_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.8"
app:contentInsetEnd="0dp"
app:contentInsetEndWithActions="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:navigationIcon="@drawable/ic_search"
app:title="@string/search_games" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.button.MaterialButton
android:id="@+id/settings_button"
style="?attr/materialIconButtonFilledStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:contentDescription="@string/settings"
android:gravity="center_vertical"
app:icon="@drawable/ic_settings"
app:iconSize="24dp" />
</LinearLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/games_recycler_view" android:id="@+id/games_recycler_view"
@ -83,6 +68,7 @@
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout" app:layout_constraintTop_toBottomOf="@+id/constraintLayout"
app:spanCount="@integer/games_view_span_count" /> app:spanCount="@integer/games_view_span_count"
tools:listitem="@layout/layout_game" />
</LinearLayout> </LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -29,15 +29,25 @@
android:scaleType="fitXY" /> android:scaleType="fitXY" />
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<ImageView <com.google.android.material.card.MaterialCardView
android:id="@+id/game_favorite_icon" android:id="@+id/game_favorite_icon"
android:layout_width="32dp" style="?attr/materialCardViewFilledStyle"
android:layout_height="32dp" android:layout_width="wrap_content"
android:contentDescription="@string/game_favorite_description" android:layout_height="wrap_content"
android:src="@drawable/ic_favorite" android:layout_margin="2dp"
app:cardCornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:tint="?android:attr/colorPrimary" /> app:strokeWidth="0dp">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@string/game_favorite_description"
android:src="@drawable/ic_favorite"
app:tint="?android:attr/colorPrimary" />
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView

View File

@ -3,14 +3,14 @@
<item <item
android:id="@+id/favorite" android:id="@+id/favorite"
android:checkable="true" android:checkable="true"
android:title="Favorite" /> android:title="@string/game_favorite" />
<item <item
android:id="@+id/game_profile" android:id="@+id/game_profile"
android:title="Edit game profile" /> android:title="@string/edit_game_profile" />
<item <item
android:id="@+id/remove_shader_caches" android:id="@+id/remove_shader_caches"
android:title="Remove shader caches" /> android:title="@string/remove_shader_caches" />
<item <item
android:id="@+id/about_title" android:id="@+id/about_title"
android:title="About title" /> android:title="@string/about_title" />
</menu> </menu>

View File

@ -0,0 +1,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_search"
android:visible="false"
app:actionViewClass="androidx.appcompat.widget.SearchView"
app:showAsAction="collapseActionView|ifRoom" />
</menu>

View File

@ -1,9 +0,0 @@
<menu 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">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>

View File

@ -8,7 +8,7 @@
android:id="@+id/inputSettingsFragment" android:id="@+id/inputSettingsFragment"
android:name="info.cemu.Cemu.settings.input.InputSettingsFragment" android:name="info.cemu.Cemu.settings.input.InputSettingsFragment"
android:label="@string/input_settings" android:label="@string/input_settings"
tools:layout="@layout/generic_recycler_view_layout"> tools:layout="@layout/layout_generic_recycler_view">
<action <action
android:id="@+id/action_inputSettingsFragment_to_controllerInputsFragment" android:id="@+id/action_inputSettingsFragment_to_controllerInputsFragment"
app:destination="@id/controllerInputsFragment" /> app:destination="@id/controllerInputsFragment" />
@ -20,7 +20,7 @@
android:id="@+id/graphicPacksRootFragment" android:id="@+id/graphicPacksRootFragment"
android:name="info.cemu.Cemu.settings.graphicpacks.GraphicPacksRootFragment" android:name="info.cemu.Cemu.settings.graphicpacks.GraphicPacksRootFragment"
android:label="@string/graphic_packs" android:label="@string/graphic_packs"
tools:layout="@layout/generic_recycler_view_layout"> tools:layout="@layout/layout_generic_recycler_view">
<action <action
android:id="@+id/action_graphicPacksRootFragment_to_graphicPacksFragment" android:id="@+id/action_graphicPacksRootFragment_to_graphicPacksFragment"
app:destination="@id/graphicPacksFragment" /> app:destination="@id/graphicPacksFragment" />
@ -29,7 +29,7 @@
android:id="@+id/graphicPacksFragment" android:id="@+id/graphicPacksFragment"
android:name="info.cemu.Cemu.settings.graphicpacks.GraphicPacksFragment" android:name="info.cemu.Cemu.settings.graphicpacks.GraphicPacksFragment"
android:label="{title}" android:label="{title}"
tools:layout="@layout/generic_recycler_view_layout"> tools:layout="@layout/layout_generic_recycler_view">
<action <action
android:id="@+id/action_graphicPacksFragment_self" android:id="@+id/action_graphicPacksFragment_self"
app:destination="@id/graphicPacksFragment" /> app:destination="@id/graphicPacksFragment" />
@ -42,7 +42,7 @@
android:id="@+id/settingsFragment" android:id="@+id/settingsFragment"
android:name="info.cemu.Cemu.settings.SettingsFragment" android:name="info.cemu.Cemu.settings.SettingsFragment"
android:label="@string/settings" android:label="@string/settings"
tools:layout="@layout/generic_recycler_view_layout"> tools:layout="@layout/layout_generic_recycler_view">
<action <action
android:id="@+id/action_settingsFragment_to_inputSettingsFragment" android:id="@+id/action_settingsFragment_to_inputSettingsFragment"
app:destination="@id/inputSettingsFragment" /> app:destination="@id/inputSettingsFragment" />
@ -65,30 +65,30 @@
<fragment <fragment
android:id="@+id/controllerInputsFragment" android:id="@+id/controllerInputsFragment"
android:name="info.cemu.Cemu.settings.input.ControllerInputsFragment" android:name="info.cemu.Cemu.settings.input.ControllerInputsFragment"
tools:layout="@layout/generic_recycler_view_layout" /> tools:layout="@layout/layout_generic_recycler_view" />
<fragment <fragment
android:id="@+id/graphicsSettingsFragment" android:id="@+id/graphicsSettingsFragment"
android:name="info.cemu.Cemu.settings.graphics.GraphicsSettingsFragment" android:name="info.cemu.Cemu.settings.graphics.GraphicsSettingsFragment"
android:label="@string/graphics_settings" android:label="@string/graphics_settings"
tools:layout="@layout/generic_recycler_view_layout" /> tools:layout="@layout/layout_generic_recycler_view" />
<fragment <fragment
android:id="@+id/audioSettingsFragment" android:id="@+id/audioSettingsFragment"
android:name="info.cemu.Cemu.settings.audio.AudioSettingsFragment" android:name="info.cemu.Cemu.settings.audio.AudioSettingsFragment"
android:label="@string/audio_settings" android:label="@string/audio_settings"
tools:layout="@layout/generic_recycler_view_layout" /> tools:layout="@layout/layout_generic_recycler_view" />
<fragment <fragment
android:id="@+id/overlaySettingsFragment" android:id="@+id/overlaySettingsFragment"
android:name="info.cemu.Cemu.settings.overlay.OverlaySettingsFragment" android:name="info.cemu.Cemu.settings.overlay.OverlaySettingsFragment"
android:label="@string/overlay_settings" android:label="@string/overlay_settings"
tools:layout="@layout/generic_recycler_view_layout" /> tools:layout="@layout/layout_generic_recycler_view" />
<fragment <fragment
android:id="@+id/inputOverlaySettingsFragment" android:id="@+id/inputOverlaySettingsFragment"
android:name="info.cemu.Cemu.inputoverlay.InputOverlaySettingsFragment" android:name="info.cemu.Cemu.inputoverlay.InputOverlaySettingsFragment"
android:label="@string/input_overlay_settings" android:label="@string/input_overlay_settings"
tools:layout="@layout/generic_recycler_view_layout" /> tools:layout="@layout/layout_generic_recycler_view" />
<fragment <fragment
android:id="@+id/gamePathsFragment" android:id="@+id/gamePathsFragment"
android:name="info.cemu.Cemu.settings.gamespath.GamePathsFragment" android:name="info.cemu.Cemu.settings.gamespath.GamePathsFragment"
android:label="@string/game_paths_settings" android:label="@string/game_paths_settings"
tools:layout="@layout/generic_recycler_view_layout" /> tools:layout="@layout/layout_generic_recycler_view" />
</navigation> </navigation>

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<style name="Base.Theme.MyApplication" parent="Theme.Material3.DynamicColors.Dark"> <style name="Base.Theme.Cemu" parent="Theme.Material3.DynamicColors.Dark">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Cemu" parent="Base.Theme.MyApplication"> <style name="Theme.Cemu" parent="Base.Theme.Cemu">
<!-- Transparent system bars for edge-to-edge. --> <!-- Transparent system bars for edge-to-edge. -->
<item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>

View File

@ -223,4 +223,5 @@
<string name="cpu_mode">CPU mode</string> <string name="cpu_mode">CPU mode</string>
<string name="thread_quantum">Thread quantum</string> <string name="thread_quantum">Thread quantum</string>
<string name="audio_latency">Latency</string> <string name="audio_latency">Latency</string>
<string name="game_favorite">Favorite</string>
</resources> </resources>

View File

@ -1,9 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<style name="Base.Theme.MyApplication" parent="Theme.Material3.DynamicColors.Light"> <style name="Base.Theme.Cemu" parent="Theme.Material3.DynamicColors.Light">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="Theme.Cemu" parent="Base.Theme.MyApplication" /> <style name="Theme.Cemu" parent="Base.Theme.Cemu" />
</resources> </resources>