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/res/layout/fragment_game_drawer.xml b/src/pandroid/app/src/main/res/layout/fragment_game_drawer.xml index e2cd045d5..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,106 +1,97 @@ - - + - - - - - - + android:layout_height="match_parent" + android:orientation="vertical"> + - - + + + + + + + + - - + android:layout_marginBottom="20dp"> + + + + + + - + + 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"/> - - - - - - - - - - - + - + 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 @@ + + + + + + + + + + + + + + + + +