android: frontend: game_list: Tweak game cards.

This commit is contained in:
bunnei 2020-03-08 14:38:08 -04:00
parent 62bad16dbf
commit 716df842e4
3 changed files with 28 additions and 3 deletions

View File

@ -3,13 +3,18 @@ package org.citra.citra_android.adapters;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.graphics.Rect;
import android.os.Build;
import android.os.SystemClock;
import android.support.annotation.RequiresApi;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.citra.citra_android.R;
import org.citra.citra_android.activities.EmulationActivity;
import org.citra.citra_android.model.GameDatabase;
@ -66,6 +71,7 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
* @param holder A ViewHolder representing the view we're recycling.
* @param position The position of the 'new' view in the dataset.
*/
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public void onBindViewHolder(GameViewHolder holder, int position) {
if (mDatasetValid) {
@ -76,6 +82,9 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
holder.textGameTitle.setText(mCursor.getString(GameDatabase.GAME_COLUMN_TITLE).replaceAll("[\\t\\n\\r]+"," "));
holder.textCompany.setText(mCursor.getString(GameDatabase.GAME_COLUMN_COMPANY));
final Path gamePath = Paths.get(mCursor.getString(GameDatabase.GAME_COLUMN_PATH));
holder.textFileName.setText(gamePath.getFileName().toString());
// TODO These shouldn't be necessary once the move to a DB-based model is complete.
holder.gameId = mCursor.getString(GameDatabase.GAME_COLUMN_GAME_ID);
holder.path = mCursor.getString(GameDatabase.GAME_COLUMN_PATH);

View File

@ -15,6 +15,7 @@ public class GameViewHolder extends RecyclerView.ViewHolder {
public ImageView imageScreenshot;
public TextView textGameTitle;
public TextView textCompany;
public TextView textFileName;
public String gameId;
@ -34,5 +35,6 @@ public class GameViewHolder extends RecyclerView.ViewHolder {
imageScreenshot = itemView.findViewById(R.id.image_game_screen);
textGameTitle = itemView.findViewById(R.id.text_game_title);
textCompany = itemView.findViewById(R.id.text_company);
textFileName = itemView.findViewById(R.id.text_filename);
}
}

View File

@ -18,8 +18,8 @@
<ImageView
android:id="@+id/image_game_screen"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="56dp"
android:layout_height="56dp"
android:adjustViewBounds="false"
android:cropToPadding="false"
android:scaleType="fitCenter"
@ -51,15 +51,29 @@
style="@android:style/TextAppearance.Material.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="@+id/image_game_screen"
app:layout_constraintStart_toStartOf="@+id/text_game_title"
app:layout_constraintTop_toBottomOf="@+id/text_game_title"
app:layout_constraintVertical_bias="0.842"
tools:text="Nintendo" />
<TextView
android:id="@+id/text_filename"
style="@android:style/TextAppearance.Material.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="@+id/image_game_screen"
app:layout_constraintStart_toStartOf="@+id/text_game_title"
app:layout_constraintTop_toBottomOf="@+id/text_game_title"
app:layout_constraintVertical_bias="0.0"
tools:text="Pilotwings_Resort.cxi" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>