Translate drawer, and remove redundant code

This commit is contained in:
Gabriel 2023-12-27 09:47:35 -04:00
parent 7bfff6eafd
commit 9971250009
5 changed files with 30 additions and 25 deletions

View file

@ -16,7 +16,6 @@ import androidx.fragment.app.Fragment;
import com.google.android.material.navigation.NavigationView;
import com.panda3ds.pandroid.AlberDriver;
import com.panda3ds.pandroid.R;
import com.panda3ds.pandroid.app.BaseActivity;
import com.panda3ds.pandroid.data.game.GameMetadata;
import com.panda3ds.pandroid.utils.GameUtils;
import com.panda3ds.pandroid.view.gamesgrid.GameIconView;
@ -27,7 +26,7 @@ public class DrawerFragment extends Fragment implements DrawerLayout.DrawerListe
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
drawerContainer = ((BaseActivity)requireActivity()).findViewById(R.id.drawer_container);
drawerContainer = requireActivity().findViewById(R.id.drawer_container);
drawerContainer.removeDrawerListener(this);
drawerContainer.addDrawerListener(this);
drawerContainer.setScrimColor(Color.argb(160, 0,0,0));
@ -48,8 +47,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);
open();
}
@Override
@ -74,9 +71,7 @@ public class DrawerFragment extends Fragment implements DrawerLayout.DrawerListe
}
@Override
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
}
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {}
@Override
public void onDrawerOpened(@NonNull View drawerView) {
@ -90,9 +85,7 @@ public class DrawerFragment extends Fragment implements DrawerLayout.DrawerListe
}
@Override
public void onDrawerStateChanged(int newState) {
}
public void onDrawerStateChanged(int newState) {}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {

View file

@ -10,23 +10,25 @@
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="start|center"
android:orientation="vertical"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:minHeight="100dp"
android:minHeight="190dp"
android:background="?colorSurfaceVariant">
<androidx.cardview.widget.CardView
android:layout_width="64dp"
android:layout_height="64dp"
app:cardCornerRadius="10dp">
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" />
android:background="?colorSurface"/>
</androidx.cardview.widget.CardView>
@ -34,23 +36,27 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="10dp">
android:gravity="center"
android:layout_marginBottom="20dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/game_title"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="?colorOnSurfaceVariant"
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
android:paddingBottom="4dp"
android:gravity="center"
android:textStyle="bold"
android:textSize="19sp"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/game_publisher"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="?colorOnSurfaceVariant"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
android:textSize="14sp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
@ -69,7 +75,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Actions"
android:text="@string/actions"
style="@style/TextAppearanceGameDrawerSubTitle"/>
<com.google.android.material.navigation.NavigationView

View file

@ -3,9 +3,9 @@
<item
android:id="@+id/resume"
android:icon="@drawable/ic_shortcut"
android:title="Resume"/>
android:title="@string/resume"/>
<item
android:id="@+id/exit"
android:icon="@drawable/ic_exit"
android:title="Exit"/>
android:title="@string/exit"/>
</menu>

View file

@ -24,4 +24,7 @@
<string name="light">Claro</string>
<string name="dark">Escuro</string>
<string name="black">Preto</string>
<string name="actions">Ações</string>
<string name="exit">Sair</string>
<string name="resume">Continuar</string>
</resources>

View file

@ -25,4 +25,7 @@
<string name="light">Light</string>
<string name="dark">Dark</string>
<string name="black">Black</string>
<string name="actions">Actions</string>
<string name="exit">Exit</string>
<string name="resume">Resume</string>
</resources>