Android: Implement RetroAchievements

This commit is contained in:
Connor McLaughlin
2021-03-13 21:14:05 +10:00
parent 0f1dc93eaa
commit c182edf196
26 changed files with 1225 additions and 63 deletions

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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_height="match_parent">
<RelativeLayout
android:id="@+id/navigation_header_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<ImageView
android:id="@+id/icon"
android:layout_width="70dp"
android:layout_height="70dp"
android:foregroundGravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
tools:srcCompat="@drawable/ic_media_cdrom" />
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Game Title"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/icon"
android:layout_alignParentEnd="true" />
<TextView
android:id="@+id/summary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="You have unlocked %d of %d achievements, earning %d of %d possible points."
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:layout_below="@+id/title"
android:layout_toRightOf="@+id/icon"
android:layout_alignParentEnd="true" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="16dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_below="@+id/summary"
android:layout_toRightOf="@+id/icon"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:layout_below="@+id/navigation_header_container"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>

View File

@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="280dp"
>
<LinearLayout
android:id="@+id/panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:text="@string/achievement_settings_login_title"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:text="@string/achievement_settings_login_help"
/>
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:inputType="textVisiblePassword"
android:nextFocusDown="@+id/password"
android:imeOptions="actionNext"
android:singleLine="true"
android:hint="@string/achievement_settings_login_username_hint"
/>
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:singleLine="true"
android:hint="@string/achievement_settings_login_password_hint"
/>
<TextView
android:id="@+id/error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="4dp"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:id="@+id/buttonPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="?android:attr/dividerHorizontal"
android:dividerPadding="0dip"
android:minHeight="48dp"
android:orientation="vertical"
android:showDividers="beginning"
android:padding="5dp"
>
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="locale"
android:orientation="horizontal"
tools:ignore="UselessParent"
>
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:id="@+id/cancel"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:focusable="true"
android:maxLines="2"
android:minHeight="48dp"
android:text="@string/achievement_settings_login_cancel_button"
android:textSize="14sp" />
<Button
android:id="@+id/login"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:focusable="true"
android:maxLines="2"
android:minHeight="48dp"
android:text="@string/achievement_settings_login_login_button"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminateOnly="true"
android:visibility="gone"
/>
</FrameLayout>

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/linearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="?android:attr/selectableItemBackground">
<ImageView
android:id="@+id/icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:foregroundGravity="center_vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@drawable/ic_media_cdrom" />
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="80dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Achievement Title"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="80dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingBottom="8px"
android:text="Achievement Description"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toBottomOf="@+id/title" />
<ImageView
android:id="@+id/locked_icon"
android:layout_width="32dp"
android:layout_height="28dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="24dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingBottom="8px"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_baseline_lock_24" />
<TextView
android:id="@+id/points"
android:layout_width="64dp"
android:layout_height="16dp"
android:layout_marginEnd="8dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="5 Points"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:srcCompat="@drawable/ic_star_5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/locked_icon" />
</androidx.constraintlayout.widget.ConstraintLayout>