GameDetailsDialog: Convert layout to ConstraintLayout
This also removes the FAB from GameDetailsDialog. It was previously outside of the visible area and thus unusable.
This commit is contained in:
parent
4f1511043c
commit
2e13353201
|
@ -80,6 +80,7 @@ dependencies {
|
||||||
implementation 'androidx.exifinterface:exifinterface:1.1.0'
|
implementation 'androidx.exifinterface:exifinterface:1.1.0'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'com.google.android.material:material:1.0.0'
|
implementation 'com.google.android.material:material:1.0.0'
|
||||||
|
|
||||||
// Android TV UI libraries.
|
// Android TV UI libraries.
|
||||||
|
|
|
@ -10,10 +10,7 @@ import android.widget.TextView;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
|
||||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||||
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
||||||
import org.dolphinemu.dolphinemu.utils.PicassoUtils;
|
import org.dolphinemu.dolphinemu.utils.PicassoUtils;
|
||||||
|
@ -52,8 +49,6 @@ public final class GameDetailsDialog extends DialogFragment
|
||||||
TextView textGameId = contents.findViewById(R.id.text_game_id);
|
TextView textGameId = contents.findViewById(R.id.text_game_id);
|
||||||
TextView textRevision = contents.findViewById(R.id.text_revision);
|
TextView textRevision = contents.findViewById(R.id.text_revision);
|
||||||
|
|
||||||
FloatingActionButton buttonLaunch = contents.findViewById(R.id.button_launch);
|
|
||||||
|
|
||||||
String country = getResources().getStringArray(R.array.countryNames)[gameFile.getCountry()];
|
String country = getResources().getStringArray(R.array.countryNames)[gameFile.getCountry()];
|
||||||
String description = gameFile.getDescription();
|
String description = gameFile.getDescription();
|
||||||
|
|
||||||
|
@ -68,12 +63,6 @@ public final class GameDetailsDialog extends DialogFragment
|
||||||
textGameId.setText(gameFile.getGameId());
|
textGameId.setText(gameFile.getGameId());
|
||||||
textRevision.setText(Integer.toString(gameFile.getRevision()));
|
textRevision.setText(Integer.toString(gameFile.getRevision()));
|
||||||
|
|
||||||
buttonLaunch.setOnClickListener(view ->
|
|
||||||
{
|
|
||||||
// Start the emulation activity and send the path of the clicked ROM to it.
|
|
||||||
EmulationActivity.launch(getActivity(), gameFile);
|
|
||||||
});
|
|
||||||
|
|
||||||
PicassoUtils.loadGameBanner(banner, gameFile);
|
PicassoUtils.loadGameBanner(banner, gameFile);
|
||||||
|
|
||||||
builder.setView(contents);
|
builder.setView(contents);
|
||||||
|
|
|
@ -1,149 +1,137 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/frameLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="24dp"
|
android:paddingStart="24dp"
|
||||||
android:paddingEnd="24dp"
|
android:paddingEnd="24dp"
|
||||||
android:paddingBottom="24dp"
|
android:paddingBottom="24dp"
|
||||||
android:transitionName="card_game">
|
android:transitionName="card_game">
|
||||||
|
|
||||||
<RelativeLayout
|
<TextView
|
||||||
android:layout_width="480dp"
|
android:id="@+id/text_game_title"
|
||||||
android:layout_height="wrap_content">
|
style="@android:style/TextAppearance.Material.Headline"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
tools:text="Rhythm Heaven Fever"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_description"
|
||||||
|
style="@android:style/TextAppearance.Material.Caption"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
tools:text="Zany rhythm action!"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/text_game_title" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/banner"
|
android:id="@+id/banner"
|
||||||
android:layout_width="144dp"
|
android:layout_width="144dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_below="@+id/text_description"
|
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
tools:src="@drawable/no_banner"/>
|
tools:src="@drawable/no_banner"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
<TextView
|
app:layout_constraintTop_toBottomOf="@id/text_description" />
|
||||||
android:id="@+id/text_game_title"
|
|
||||||
style="@android:style/TextAppearance.Material.Headline"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
tools:text="Rhythm Heaven Fever"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_description"
|
|
||||||
style="@android:style/TextAppearance.Material.Caption"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignEnd="@+id/text_game_title"
|
|
||||||
android:layout_alignStart="@+id/text_game_title"
|
|
||||||
android:layout_below="@+id/text_game_title"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
tools:text="Zany rhythm action!"/>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/divider"
|
android:id="@+id/divider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_alignParentLeft="true"
|
android:background="#1F000000"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_marginTop="32dp"
|
||||||
android:layout_below="@+id/banner"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_marginTop="16dp"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:background="#1F000000"/>
|
app:layout_constraintTop_toBottomOf="@id/banner" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon_country"
|
android:id="@+id/icon_country"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_alignStart="@+id/banner"
|
|
||||||
android:layout_alignTop="@+id/divider"
|
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:padding="6dp"
|
android:padding="6dp"
|
||||||
android:src="@drawable/ic_country"/>
|
android:src="@drawable/ic_country"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/divider" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon_company"
|
android:id="@+id/icon_company"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_alignStart="@+id/icon_country"
|
android:layout_marginTop="24dp"
|
||||||
android:layout_below="@+id/icon_country"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:padding="6dp"
|
android:padding="6dp"
|
||||||
android:src="@drawable/ic_company"/>
|
android:src="@drawable/ic_company"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/icon_country" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon_game_id"
|
android:id="@+id/icon_game_id"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_alignStart="@+id/icon_company"
|
android:layout_marginTop="24dp"
|
||||||
android:layout_below="@+id/icon_company"
|
android:padding="6dp"
|
||||||
android:layout_marginTop="16dp"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:padding="6dp"/>
|
app:layout_constraintTop_toBottomOf="@id/icon_company" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon_revision"
|
android:id="@+id/icon_revision"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_alignStart="@+id/icon_game_id"
|
android:layout_marginTop="24dp"
|
||||||
android:layout_below="@+id/icon_game_id"
|
android:padding="6dp"
|
||||||
android:layout_marginTop="16dp"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:padding="6dp"/>
|
app:layout_constraintTop_toBottomOf="@id/icon_game_id"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_country"
|
android:id="@+id/text_country"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_toEndOf="@+id/icon_country"
|
|
||||||
android:layout_alignBottom="@+id/icon_country"
|
|
||||||
android:layout_alignTop="@+id/icon_country"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
tools:text="United States"/>
|
tools:text="United States"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/icon_country"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/icon_country"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/icon_country" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_company"
|
android:id="@+id/text_company"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/icon_company"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_alignStart="@+id/text_country"
|
|
||||||
android:layout_alignTop="@+id/icon_company"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
tools:text="Nintendo"/>
|
tools:text="Nintendo"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/icon_company"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/icon_company"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/icon_company" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_game_id"
|
android:id="@+id/text_game_id"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/icon_game_id"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_alignStart="@+id/text_company"
|
|
||||||
android:layout_alignTop="@+id/icon_game_id"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
tools:text="SOME01"/>
|
tools:text="SOME01"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/icon_game_id"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/icon_game_id"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/icon_game_id" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_revision"
|
android:id="@+id/text_revision"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/icon_revision"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_alignStart="@+id/text_game_id"
|
|
||||||
android:layout_alignTop="@+id/icon_revision"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
tools:text="0"/>
|
tools:text="0"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/icon_revision"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/icon_revision"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/icon_revision" />
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:id="@+id/button_launch"
|
|
||||||
android:layout_width="56dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:layout_alignEnd="@+id/text_game_title"
|
|
||||||
android:layout_marginBottom="-28dp"
|
|
||||||
android:src="@drawable/ic_play"
|
|
||||||
android:stateListAnimator="@animator/button_elevation"
|
|
||||||
app:rippleColor="?android:colorPrimaryDark"
|
|
||||||
app:borderWidth="0dp"
|
|
||||||
app:elevation="6dp"
|
|
||||||
app:pressedTranslationZ="12dp"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
Loading…
Reference in New Issue