Skip to content

Commit

Permalink
Translate drawer, and remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielBRDeveloper committed Dec 27, 2023
1 parent 7bfff6e commit 9971250
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
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;
Expand All @@ -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));
Expand All @@ -48,8 +47,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);

open();
}

@Override
Expand All @@ -74,9 +71,7 @@ public void open(){
}

@Override
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {

}
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {}

@Override
public void onDrawerOpened(@NonNull View drawerView) {
Expand All @@ -90,9 +85,7 @@ public void onDrawerClosed(@NonNull View drawerView) {
}

@Override
public void onDrawerStateChanged(int newState) {

}
public void onDrawerStateChanged(int newState) {}

@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Expand Down
32 changes: 19 additions & 13 deletions src/pandroid/app/src/main/res/layout/fragment_game_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,53 @@
<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>

<androidx.appcompat.widget.LinearLayoutCompat
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>

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/pandroid/app/src/main/res/menu/game_drawer_actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
3 changes: 3 additions & 0 deletions src/pandroid/app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
3 changes: 3 additions & 0 deletions src/pandroid/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 9971250

Please sign in to comment.