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 bd402b52..3506e054 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.annotation.Nullable; 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 class DrawerFragment extends Fragment implements DrawerLayout.DrawerListe ((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 class DrawerFragment extends Fragment implements DrawerLayout.DrawerListe } } + 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 class DrawerFragment extends Fragment implements DrawerLayout.DrawerListe 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 e2cd045d..c4a698ea 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:paddingLeft="10dp" + android:paddingRight="10dp" + android:minHeight="190dp" + android:background="?colorSurfaceVariant"> - + + + + + + + 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 9fd3264a..00000000 --- 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 b6dd4897..00000000 --- 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 00000000..12fa6d47 --- /dev/null +++ b/src/pandroid/app/src/main/res/menu/game_drawer_settings.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + +