Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material you option test #15

Closed
wants to merge 14 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {}

Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -182,4 +183,4 @@ private long lastModified() {
return FileUtils.getLastModified(absolutePath());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<corners android:radius="9dp" />
<solid android:color="@android:color/black" />
</shape>
</item>
</ripple>
10 changes: 9 additions & 1 deletion src/pandroid/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
android:layout_height="match_parent"
tools:context=".app.MainActivity">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurfaceVariant"
android:minHeight="?attr/actionBarSize"
app:title="@string/app_name" />

<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container"
android:layout_width="0dp"
Expand All @@ -26,4 +34,4 @@
app:menu="@menu/main_activity_navigation"
style="@style/ThemedNavigationBottom"/>

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
19 changes: 9 additions & 10 deletions src/pandroid/app/src/main/res/layout/dialog_lua_scripts.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
Expand All @@ -12,7 +12,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">


<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -31,35 +30,35 @@

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.appcompat.widget.LinearLayoutCompat
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical"
android:layout_gravity="bottom|center">

<androidx.appcompat.widget.AppCompatButton
<com.google.android.material.button.MaterialButton
android:id="@+id/open_file"
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="@string/open_file"
android:layout_margin="5dp"
android:textColor="?colorOnPrimary"
android:backgroundTint="?colorPrimary"
app:backgroundTint="?colorPrimary"
android:background="@drawable/simple_card_background"/>

<androidx.appcompat.widget.AppCompatButton
<com.google.android.material.button.MaterialButton
android:id="@+id/create"
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="@string/create_new"
android:layout_margin="5dp"
android:textColor="?colorOnSurfaceVariant"
android:backgroundTint="?colorSurfaceVariant"
app:backgroundTint="?colorSurfaceVariant"
android:background="@drawable/simple_card_background"
android:layout_marginBottom="10dp"/>

</androidx.appcompat.widget.LinearLayoutCompat>
</LinearLayout>

</FrameLayout>

</androidx.appcompat.widget.LinearLayoutCompat>
</LinearLayout>
164 changes: 78 additions & 86 deletions src/pandroid/app/src/main/res/layout/fragment_game_drawer.xml
Original file line number Diff line number Diff line change
@@ -1,105 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="?colorSurface">


<androidx.appcompat.widget.LinearLayoutCompat
<!-- Main content layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:minHeight="190dp"
android:background="?colorSurfaceVariant">

<androidx.cardview.widget.CardView
android:layout_width="90dp"
android:layout_height="90dp"
app:cardCornerRadius="10dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">

<com.panda3ds.pandroid.view.gamesgrid.GameIconView
android:id="@+id/game_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?colorSurface"/>

</androidx.cardview.widget.CardView>
android:layout_height="match_parent"
android:orientation="vertical">

<androidx.appcompat.widget.LinearLayoutCompat
<!-- Game related content -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_marginBottom="20dp">

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/game_title"
android:layout_width="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:minHeight="190dp"
android:background="?colorSurfaceVariant">

<com.google.android.material.card.MaterialCardView
android:layout_width="90dp"
android:layout_height="90dp"
app:cardCornerRadius="10dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">

<com.panda3ds.pandroid.view.gamesgrid.GameIconView
android:id="@+id/game_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?colorSurface"/>

</com.google.android.material.card.MaterialCardView>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="?colorOnSurfaceVariant"
android:paddingBottom="4dp"
android:orientation="vertical"
android:gravity="center"
android:textStyle="bold"
android:textSize="19sp"/>

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/game_publisher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="?colorOnSurfaceVariant"
android:textSize="14sp"/>

</androidx.appcompat.widget.LinearLayoutCompat>

</androidx.appcompat.widget.LinearLayoutCompat>

<ScrollView
android:layout_width="match_parent"
android:layout_marginBottom="20dp">

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/game_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="?colorOnSurfaceVariant"
android:paddingBottom="4dp"
android:gravity="center"
android:textStyle="bold"
android:ellipsize="marquee"
style="?attr/textAppearanceTitleSmall"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:textSize="19sp"/>

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/game_publisher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="?colorOnSurfaceVariant"
android:textSize="14sp"/>

</LinearLayout>

</LinearLayout>

</LinearLayout>

<!-- Drawer content layout -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
android:orientation="vertical"
android:gravity="start"
android:layout_marginTop="195dp">

<androidx.appcompat.widget.LinearLayoutCompat
<com.google.android.material.navigation.NavigationView
android:id="@+id/action_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/actions"
style="@style/TextAppearanceGameDrawerSubTitle"/>

<com.google.android.material.navigation.NavigationView
android:id="@+id/action_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/game_drawer_actions"
android:background="?colorSurface"/>

<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/others"
style="@style/TextAppearanceGameDrawerSubTitle"/>

<com.google.android.material.navigation.NavigationView
android:id="@+id/others_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/game_drawer_others"
android:background="?colorSurface"/>

</androidx.appcompat.widget.LinearLayoutCompat>
app:menu="@menu/game_drawer_settings"
android:background="?colorSurface"
android:theme="@style/Widget.App.NavigationView"
app:subheaderTextAppearance="@style/TextAppearanceGameDrawerSubTitle"/>

</ScrollView>
</LinearLayout>

</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.drawerlayout.widget.DrawerLayout>
21 changes: 12 additions & 9 deletions src/pandroid/app/src/main/res/layout/fragment_games.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?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_marginTop="60dp"
android:layout_height="match_parent">

<com.panda3ds.pandroid.view.gamesgrid.GamesGridView
Expand All @@ -10,16 +13,16 @@
android:paddingStart="15dp"
android:paddingEnd="15dp"/>

<androidx.appcompat.widget.AppCompatImageButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_rom"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_gravity="end|bottom"
android:src="@drawable/ic_add"
android:tint="?colorOnPrimary"
android:background="@drawable/simple_card_background"
android:backgroundTint="?colorPrimary"/>
android:gravity="center"
app:rippleColor="?colorOnSurfaceVariant"
app:backgroundTint="?colorPrimary"
tools:ignore="PrivateResource"/>

</FrameLayout>
</FrameLayout>
Loading
Loading