Merge pull request #404 from GabrielBRDeveloper/ishan-reviews

MaterialUI: Review ishan pr
This commit is contained in:
wheremyfoodat 2024-02-11 19:03:20 +00:00 committed by GitHub
commit 641c23e58c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 205 additions and 166 deletions

View file

@ -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;
@ -46,8 +48,7 @@ public class DrawerFragment extends Fragment implements DrawerLayout.DrawerListe
((AppCompatTextView)view.findViewById(R.id.game_title)).setText(game.getTitle());
((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);
((NavigationView)view.findViewById(R.id.menu)).setNavigationItemSelectedListener(this);
}
@Override
@ -106,6 +107,9 @@ 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) {
boolean isLandscape = getResources().getDisplayMetrics().widthPixels > getResources().getDisplayMetrics().heightPixels;
requireActivity().setRequestedOrientation(isLandscape ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT : ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
return false;

View file

@ -182,4 +182,4 @@ public class LuaDialogFragment extends BottomDialogFragment {
return FileUtils.getLastModified(absolutePath());
}
}
}
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="16dp"/>
<solid android:color="#FFF"/>
</shape>

View file

@ -0,0 +1,9 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?colorOnSurface">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<corners android:radius="9dp" />
<solid android:color="#FFFF" />
</shape>
</item>
</ripple>

View file

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="8dp"/>
<solid android:color="#FFF"/>
</shape>
</item>
</selector>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp"/>
<solid android:color="#FFF"/>
</shape>

View file

@ -28,4 +28,4 @@
style="@style/ThemedNavigationBottom"
android:background="@drawable/color_surface"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -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">
@ -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"
@ -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>

View file

@ -1,105 +1,94 @@
<?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">
android:layout_height="match_parent"
android:orientation="vertical">
<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>
<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">
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:minHeight="190dp"
android:background="?colorSurfaceVariant">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/game_title"
android:layout_width="wrap_content"
<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"
app:strokeWidth="0px">
<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"/>
android:layout_marginBottom="20dp">
<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.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:textSize="19sp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<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>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
</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/menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
app:menu="@menu/game_drawer"
android:background="?colorSurface"
android:theme="@style/Widget.App.NavigationView"
app:subheaderTextAppearance="@style/TextAppearanceGameDrawerSubTitle"/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/actions"
style="@style/TextAppearanceGameDrawerSubTitle"/>
</LinearLayout>
<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>
</ScrollView>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.drawerlayout.widget.DrawerLayout>

View file

@ -1,5 +1,6 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -12,14 +13,15 @@
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/add_rom"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:layout_width="58dp"
android:layout_height="58dp"
android:layout_margin="22dp"
android:background="@drawable/medium_card_background"
android:layout_gravity="end|bottom"
android:src="@drawable/ic_add"
android:gravity="center"
android:tint="?colorOnPrimary"
android:background="@drawable/simple_card_background"
android:backgroundTint="?colorPrimary"/>
android:elevation="5dp"
app:backgroundTint="?colorPrimary"/>
</FrameLayout>
</FrameLayout>

View file

@ -11,14 +11,14 @@
android:layout_height="64dp"
android:paddingHorizontal="20dp">
<androidx.appcompat.widget.AppCompatEditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/search_bar"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="center"
android:hint="@string/search"
android:paddingEnd="10dp"
android:paddingStart="50dp"
android:hint="@string/search"
android:textSize="16sp"
android:background="@drawable/search_bar_background"
android:backgroundTint="?colorSurfaceVariant" />
@ -46,4 +46,4 @@
</FrameLayout>
</LinearLayout>
</LinearLayout>

View file

@ -4,13 +4,16 @@
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">
<androidx.cardview.widget.CardView
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp">
app:cardCornerRadius="10dp"
app:strokeWidth="0dp">
<com.panda3ds.pandroid.view.gamesgrid.GameIconView
android:id="@+id/icon"
@ -19,23 +22,25 @@
android:scaleType="centerCrop"
android:background="?colorSurfaceVariant"/>
</androidx.cardview.widget.CardView>
</com.google.android.material.card.MaterialCardView>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?colorOnSurface"
android:text="@string/app_name"
android:layout_marginTop="8dp"
android:textStyle="bold"
android:gravity="center"/>
android:gravity="center"
android:layout_marginTop="10dp"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="10sp"
android:textSize="11sp"
android:alpha="0.75"
android:gravity="center"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>

View file

@ -1,43 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start|center"
android:padding="5dp">
<androidx.appcompat.widget.LinearLayoutCompat
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/simple_card_background"
android:backgroundTint="?colorSurfaceVariant"
android:orientation="vertical"
android:gravity="center"
android:padding="10dp">
app:cardBackgroundColor="?attr/colorSurfaceVariant"
android:layout_gravity="center"
android:layout_margin="10dp"
app:strokeWidth="0px"
app:cardCornerRadius="8dp">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginHorizontal="5dp"
android:scaleType="fitCenter"
android:tint="?colorOnSurfaceVariant"
android:alpha="0.5"
android:padding="14dp"
android:src="@drawable/ic_code"
android:layout_marginBottom="14dp"/>
<TextView
android:id="@+id/title"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="15sp"
android:gravity="center"/>
android:orientation="vertical"
android:gravity="center"
android:padding="10dp">
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginHorizontal="5dp"
android:scaleType="fitCenter"
android:alpha="0.5"
android:padding="14dp"
android:src="@drawable/ic_code"
android:tint="?attr/colorOnSurfaceVariant"
android:layout_marginBottom="14dp"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="15sp"
android:gravity="center"/>
<androidx.appcompat.widget.AppCompatImageButton
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/edit"
android:layout_width="40dp"
android:layout_height="40dp"
@ -46,7 +54,6 @@
android:padding="10dp"
android:tint="?colorOnSurfaceVariant"
android:layout_gravity="end|top"
android:background="#0000"
android:backgroundTint="#0000"
android:layout_margin="10dp"/>
</FrameLayout>
</FrameLayout>

View file

@ -2,6 +2,7 @@
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="320dp"
android:layout_marginTop="22dp"
android:orientation="vertical"
android:gravity="center">
@ -26,4 +27,4 @@
android:alpha="0.5"
android:textColor="?colorOnSurface"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>

View file

@ -0,0 +1,34 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
android:divider="@null"
android:dividerHeight="0dp">
<item
android:id="@+id/header_actions"
android:title="@string/actions">
<menu>
<item
android:id="@+id/resume"
android:icon="@drawable/ic_shortcut"
android:title="@string/resume" />
<item
android:id="@+id/exit"
android:icon="@drawable/ic_exit"
android:title="@string/exit"/>
</menu>
</item>
<item
android:id="@+id/header_others"
android:title="@string/others">
<menu>
<item
android:id="@+id/change_orientation"
android:icon="@drawable/ic_rotate_screen"
android:title="@string/rotate" />
<item
android:id="@+id/lua_script"
android:icon="@drawable/ic_code"
android:title="@string/lua_script" />
</menu>
</item>
</menu>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/resume"
android:icon="@drawable/ic_shortcut"
android:title="@string/resume"/>
<item
android:id="@+id/exit"
android:icon="@drawable/ic_exit"
android:title="@string/exit"/>
</menu>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/lua_script"
android:icon="@drawable/ic_code"
android:title="@string/lua_script"/>
</menu>

View file

@ -54,4 +54,5 @@
<string name="pref_shader_jit_title">Shader Jit</string>
<string name="pref_shader_jit_summary">Usar recompilador de shaders.</string>
<string name="graphics">Gráficos</string>
<string name="rotate">Rotacionar</string>
</resources>

View file

@ -55,4 +55,5 @@
<string name="pref_shader_jit_title">Shader JIT</string>
<string name="pref_shader_jit_summary">Use shader recompiler.</string>
<string name="graphics">Graphics</string>
<string name="rotate">Rotate</string>
</resources>

View file

@ -42,6 +42,10 @@
<style name="Theme.Pandroid" parent="Base.Theme.Pandroid"/>
<style name="Widget.App.NavigationView" parent="Widget.Material3.NavigationView">
<item name="android:listDivider">@android:color/transparent</item>
</style>
<style name="Theme.Pandroid.Custom" parent="Theme.Pandroid">
<item name="android:textColor">?colorOnSurface</item>
<item name="android:textSize">16sp</item>