diff --git a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/PandroidApplication.java b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/PandroidApplication.java index 02fbbbcc3..b9693b3a9 100644 --- a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/PandroidApplication.java +++ b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/PandroidApplication.java @@ -9,6 +9,8 @@ import com.panda3ds.pandroid.R; import com.panda3ds.pandroid.data.config.GlobalConfig; import com.panda3ds.pandroid.input.InputMap; +import com.google.android.material.color.DynamicColors; +import com.google.android.material.color.DynamicColorsOptions; import com.panda3ds.pandroid.utils.GameUtils; @@ -24,6 +26,11 @@ public void onCreate() { GameUtils.initialize(); InputMap.initialize(); AlberDriver.Setup(); + + DynamicColorsOptions dynamicColorsOptions = new DynamicColorsOptions.Builder() + .build(); + + DynamicColors.applyToActivitiesIfAvailable(this, dynamicColorsOptions); } public static int getThemeId() { diff --git a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/game/DrawerFragment.java b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/game/DrawerFragment.java index bd402b525..3506e0546 100644 --- a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/game/DrawerFragment.java +++ b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/game/DrawerFragment.java @@ -12,6 +12,8 @@ import androidx.appcompat.widget.AppCompatTextView; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; +import android.content.pm.ActivityInfo; +import android.content.res.Configuration; import com.google.android.material.navigation.NavigationView; import com.panda3ds.pandroid.AlberDriver; @@ -47,7 +49,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat ((AppCompatTextView)view.findViewById(R.id.game_publisher)).setText(game.getPublisher()); ((NavigationView)view.findViewById(R.id.action_navigation)).setNavigationItemSelectedListener(this); - ((NavigationView)view.findViewById(R.id.others_navigation)).setNavigationItemSelectedListener(this); } @Override @@ -80,6 +81,17 @@ public void close() { } } + private void changeScreenOrientation() { + int currentOrientation = getResources().getConfiguration().orientation; + + // Change the orientation + if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { + requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + } else { + requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + } +} + @Override public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {} @@ -106,6 +118,8 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) { requireActivity().finish(); } else if (id == R.id.lua_script){ new LuaDialogFragment().show(getParentFragmentManager(), null); + } else if (id == R.id.change_orientation) { + changeScreenOrientation(); } return false; diff --git a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/game/LuaDialogFragment.java b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/game/LuaDialogFragment.java index 1db9f9c76..e7da87bfb 100644 --- a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/game/LuaDialogFragment.java +++ b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/game/LuaDialogFragment.java @@ -12,6 +12,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.button.MaterialButton; import com.panda3ds.pandroid.AlberDriver; import com.panda3ds.pandroid.R; @@ -182,4 +183,4 @@ private long lastModified() { return FileUtils.getLastModified(absolutePath()); } } -} \ No newline at end of file +} diff --git a/src/pandroid/app/src/main/res/drawable/rounded_selectable_item_background.xml b/src/pandroid/app/src/main/res/drawable/rounded_selectable_item_background.xml new file mode 100644 index 000000000..fad2fe967 --- /dev/null +++ b/src/pandroid/app/src/main/res/drawable/rounded_selectable_item_background.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/src/pandroid/app/src/main/res/layout/activity_main.xml b/src/pandroid/app/src/main/res/layout/activity_main.xml index 6de640209..8ab31afd6 100644 --- a/src/pandroid/app/src/main/res/layout/activity_main.xml +++ b/src/pandroid/app/src/main/res/layout/activity_main.xml @@ -7,6 +7,14 @@ android:layout_height="match_parent" tools:context=".app.MainActivity"> + + - \ No newline at end of file + diff --git a/src/pandroid/app/src/main/res/layout/dialog_lua_scripts.xml b/src/pandroid/app/src/main/res/layout/dialog_lua_scripts.xml index 69a9d0a46..b04848797 100644 --- a/src/pandroid/app/src/main/res/layout/dialog_lua_scripts.xml +++ b/src/pandroid/app/src/main/res/layout/dialog_lua_scripts.xml @@ -1,9 +1,9 @@ - @@ -12,7 +12,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - + - \ No newline at end of file + diff --git a/src/pandroid/app/src/main/res/layout/fragment_game_drawer.xml b/src/pandroid/app/src/main/res/layout/fragment_game_drawer.xml index fa81a503f..c4a698eac 100644 --- a/src/pandroid/app/src/main/res/layout/fragment_game_drawer.xml +++ b/src/pandroid/app/src/main/res/layout/fragment_game_drawer.xml @@ -1,105 +1,97 @@ - - - + - - - - - - + android:layout_height="match_parent" + android:orientation="vertical"> - + - - + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + android:orientation="vertical" + android:gravity="start" + android:layout_marginTop="195dp"> - - - - - - - - - - - + app:menu="@menu/game_drawer_settings" + android:background="?colorSurface" + android:theme="@style/Widget.App.NavigationView" + app:subheaderTextAppearance="@style/TextAppearanceGameDrawerSubTitle"/> - + - \ No newline at end of file + diff --git a/src/pandroid/app/src/main/res/layout/fragment_games.xml b/src/pandroid/app/src/main/res/layout/fragment_games.xml index ee69fdc8a..0538aeb6b 100644 --- a/src/pandroid/app/src/main/res/layout/fragment_games.xml +++ b/src/pandroid/app/src/main/res/layout/fragment_games.xml @@ -1,6 +1,9 @@ - + android:gravity="center" + app:rippleColor="?colorOnSurfaceVariant" + app:backgroundTint="?colorPrimary" + tools:ignore="PrivateResource"/> - \ No newline at end of file + diff --git a/src/pandroid/app/src/main/res/layout/fragment_search.xml b/src/pandroid/app/src/main/res/layout/fragment_search.xml index 5872a4043..c887b9878 100644 --- a/src/pandroid/app/src/main/res/layout/fragment_search.xml +++ b/src/pandroid/app/src/main/res/layout/fragment_search.xml @@ -9,16 +9,17 @@ + android:paddingHorizontal="20dp" + android:background="?colorSurfaceVariant"> - @@ -46,4 +47,4 @@ - \ No newline at end of file + diff --git a/src/pandroid/app/src/main/res/layout/holder_game.xml b/src/pandroid/app/src/main/res/layout/holder_game.xml index b2d46d1b4..fd14573fc 100644 --- a/src/pandroid/app/src/main/res/layout/holder_game.xml +++ b/src/pandroid/app/src/main/res/layout/holder_game.xml @@ -4,13 +4,17 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" + android:foreground="@drawable/rounded_selectable_item_background" + android:focusable="true" android:orientation="vertical" android:padding="15dp"> - + android:layout_margin="10dp" + app:shapeAppearance="?attr/shapeAppearanceCornerLarge"> - + - \ No newline at end of file + diff --git a/src/pandroid/app/src/main/res/layout/holder_lua_script.xml b/src/pandroid/app/src/main/res/layout/holder_lua_script.xml index a1865c3f4..071d3c8cc 100644 --- a/src/pandroid/app/src/main/res/layout/holder_lua_script.xml +++ b/src/pandroid/app/src/main/res/layout/holder_lua_script.xml @@ -1,43 +1,50 @@ - + app:cardBackgroundColor="?attr/colorSurfaceVariant" + app:cardCornerRadius="8dp" + android:layout_gravity="center" + android:layout_margin="10dp"> - - - + android:orientation="vertical" + android:gravity="center" + android:padding="10dp"> + + - + + + - - - \ No newline at end of file + diff --git a/src/pandroid/app/src/main/res/layout/preference_simple_about.xml b/src/pandroid/app/src/main/res/layout/preference_simple_about.xml index 9364de36b..cf6370b9f 100644 --- a/src/pandroid/app/src/main/res/layout/preference_simple_about.xml +++ b/src/pandroid/app/src/main/res/layout/preference_simple_about.xml @@ -2,6 +2,7 @@ @@ -26,4 +27,4 @@ android:alpha="0.5" android:textColor="?colorOnSurface"/> - \ No newline at end of file + diff --git a/src/pandroid/app/src/main/res/menu/game_drawer_actions.xml b/src/pandroid/app/src/main/res/menu/game_drawer_actions.xml deleted file mode 100644 index 9fd3264a1..000000000 --- a/src/pandroid/app/src/main/res/menu/game_drawer_actions.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/pandroid/app/src/main/res/menu/game_drawer_others.xml b/src/pandroid/app/src/main/res/menu/game_drawer_others.xml deleted file mode 100644 index b6dd48976..000000000 --- a/src/pandroid/app/src/main/res/menu/game_drawer_others.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/pandroid/app/src/main/res/menu/game_drawer_settings.xml b/src/pandroid/app/src/main/res/menu/game_drawer_settings.xml new file mode 100644 index 000000000..12fa6d479 --- /dev/null +++ b/src/pandroid/app/src/main/res/menu/game_drawer_settings.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + diff --git a/src/pandroid/app/src/main/res/values/themes.xml b/src/pandroid/app/src/main/res/values/themes.xml index 2ade71029..f37ca3683 100644 --- a/src/pandroid/app/src/main/res/values/themes.xml +++ b/src/pandroid/app/src/main/res/values/themes.xml @@ -26,6 +26,10 @@ + - \ No newline at end of file +