Android: Finish basic overlay controller implementation

This commit is contained in:
Connor McLaughlin 2019-12-09 21:42:07 +10:00
parent 5d91c011a6
commit 35bbde6d71
16 changed files with 468 additions and 24 deletions

View file

@ -85,20 +85,6 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
hide(); hide();
} }
}; };
/**
* Touch listener to use for in-layout UI controls to delay hiding the
* system UI. This is to prevent the jarring behavior of controls going away
* while interacting with activity UI.
*/
private final View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (AUTO_HIDE) {
delayedHide(AUTO_HIDE_DELAY_MILLIS);
}
return false;
}
};
@Override @Override
public void surfaceCreated(SurfaceHolder holder) { public void surfaceCreated(SurfaceHolder holder) {
@ -143,16 +129,13 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
} }
mVisible = true; mVisible = true;
mContentView = (SurfaceView) findViewById(R.id.fullscreen_content); mContentView = findViewById(R.id.fullscreen_content);
Log.e("EmulationActivity", "adding callback");
mContentView.getHolder().addCallback(this); mContentView.getHolder().addCallback(this);
// Set up the user interaction to manually show or hide the system UI.
mContentView.setOnClickListener(new View.OnClickListener() { mContentView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
toggle(); if (mVisible)
hide();
} }
}); });
@ -188,12 +171,14 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
private void toggle() { @Override
public void onBackPressed() {
if (mVisible) { if (mVisible) {
hide(); finish();
} else { return;
show();
} }
show();
} }
private void hide() { private void hide() {

View file

@ -44,10 +44,16 @@ public class TouchscreenControllerView extends FrameLayout implements Touchscree
linkButton(view, R.id.controller_button_right, "Right"); linkButton(view, R.id.controller_button_right, "Right");
linkButton(view, R.id.controller_button_down, "Down"); linkButton(view, R.id.controller_button_down, "Down");
linkButton(view, R.id.controller_button_left, "Left"); linkButton(view, R.id.controller_button_left, "Left");
linkButton(view, R.id.controller_button_l1, "L1");
linkButton(view, R.id.controller_button_l2, "L2");
linkButton(view, R.id.controller_button_select, "Select");
linkButton(view, R.id.controller_button_start, "Start");
linkButton(view, R.id.controller_button_triangle, "Triangle"); linkButton(view, R.id.controller_button_triangle, "Triangle");
linkButton(view, R.id.controller_button_circle, "Circle"); linkButton(view, R.id.controller_button_circle, "Circle");
linkButton(view, R.id.controller_button_cross, "Cross"); linkButton(view, R.id.controller_button_cross, "Cross");
linkButton(view, R.id.controller_button_square, "Square"); linkButton(view, R.id.controller_button_square, "Square");
linkButton(view, R.id.controller_button_r1, "R1");
linkButton(view, R.id.controller_button_r2, "R2");
} }
private void linkButton(View view, int id, String buttonName) private void linkButton(View view, int id, String buttonName)

View file

@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="M0.6615,0.6614L25.7969,0.6614v11.9063L0.6615,12.5677Z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="0.26458332"
android:fillColor="#00000000"
android:strokeColor="#e6e6e6"
android:strokeLineCap="round"/>
<path
android:pathData="m9.6928,4.0428h0.6959v4.5579h2.5046v0.5857L9.6928,9.1863Z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#000000"
android:strokeColor="#e6e6e6"
android:fillAlpha="0"/>
<path
android:pathData="m13.8028,8.6007h1.1369v-3.924l-1.2368,0.2481v-0.6339l1.2299,-0.248h0.6959v4.5579h1.1369v0.5857h-2.9628z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#000000"
android:strokeColor="#e6e6e6"
android:fillAlpha="0"/>
</vector>

View file

@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="M0.6615,0.6614L25.7969,0.6614v11.9063L0.6615,12.5677Z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="0.26458332"
android:fillColor="#4d4d4d"
android:strokeColor="#e6e6e6"
android:strokeLineCap="round"/>
<path
android:pathData="m9.6928,4.0428h0.6959v4.5579h2.5046v0.5857L9.6928,9.1863Z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#1a1a1a"
android:strokeColor="#000000"
android:fillAlpha="1"/>
<path
android:pathData="m13.8028,8.6007h1.1369v-3.924l-1.2368,0.2481v-0.6339l1.2299,-0.248h0.6959v4.5579h1.1369v0.5857h-2.9628z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#1a1a1a"
android:strokeColor="#000000"
android:fillAlpha="1"/>
</vector>

View file

@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="M0.6615,0.6614L25.7969,0.6614v11.9063L0.6615,12.5677Z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="0.26458332"
android:fillColor="#00000000"
android:strokeColor="#e6e6e6"
android:strokeLineCap="round"/>
<path
android:pathData="m9.6928,4.0428h0.6959v4.5579h2.5046v0.5857L9.6928,9.1863Z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#000000"
android:strokeColor="#e6e6e6"
android:fillAlpha="0"/>
<path
android:pathData="m14.2816,8.6007h2.4288v0.5857h-3.2659v-0.5857q0.3962,-0.41 1.0783,-1.099 0.6856,-0.6925 0.8613,-0.8923 0.3342,-0.3755 0.4651,-0.6339 0.1344,-0.2618 0.1344,-0.5133 0,-0.41 -0.2894,-0.6683 -0.2859,-0.2584 -0.7476,-0.2584 -0.3273,0 -0.6925,0.1137 -0.3617,0.1137 -0.7751,0.3445v-0.7028q0.4203,-0.1688 0.7855,-0.2549 0.3652,-0.0861 0.6683,-0.0861 0.7993,0 1.2747,0.3996 0.4754,0.3996 0.4754,1.068 0,0.3169 -0.1206,0.6029 -0.1171,0.2825 -0.4306,0.6683 -0.0861,0.0999 -0.5478,0.5788 -0.4616,0.4754 -1.3022,1.3333z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#000000"
android:strokeColor="#e6e6e6"
android:fillAlpha="0"/>
</vector>

View file

@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="M0.6615,0.6614L25.7969,0.6614v11.9063L0.6615,12.5677Z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="0.26458332"
android:fillColor="#4d4d4d"
android:strokeColor="#e6e6e6"
android:strokeLineCap="round"/>
<path
android:pathData="m9.6928,4.0428h0.6959v4.5579h2.5046v0.5857L9.6928,9.1863Z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#1a1a1a"
android:strokeColor="#000000"
android:fillAlpha="1"/>
<path
android:pathData="m14.2816,8.6007h2.4288v0.5857h-3.2659v-0.5857q0.3962,-0.41 1.0783,-1.099 0.6856,-0.6925 0.8613,-0.8923 0.3342,-0.3755 0.4651,-0.6339 0.1344,-0.2618 0.1344,-0.5133 0,-0.41 -0.2894,-0.6683 -0.2859,-0.2584 -0.7476,-0.2584 -0.3273,0 -0.6925,0.1137 -0.3617,0.1137 -0.7751,0.3445v-0.7028q0.4203,-0.1688 0.7855,-0.2549 0.3652,-0.0861 0.6683,-0.0861 0.7993,0 1.2747,0.3996 0.4754,0.3996 0.4754,1.068 0,0.3169 -0.1206,0.6029 -0.1171,0.2825 -0.4306,0.6683 -0.0861,0.0999 -0.5478,0.5788 -0.4616,0.4754 -1.3022,1.3333z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#1a1a1a"
android:strokeColor="#000000"
android:fillAlpha="1"/>
</vector>

View file

@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="M0.6615,0.6614L25.7969,0.6614v11.9063L0.6615,12.5677Z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="0.26458332"
android:fillColor="#00000000"
android:strokeColor="#e6e6e6"
android:strokeLineCap="round"/>
<path
android:pathData="m11.6703,6.8213q0.2239,0.0758 0.4341,0.3238 0.2136,0.248 0.4272,0.6821l0.7062,1.4056h-0.7476l-0.658,-1.3195q-0.2549,-0.5168 -0.4961,-0.6856 -0.2377,-0.1688 -0.6511,-0.1688L9.927,7.059v2.1739L9.2311,9.2329v-5.1435h1.571q0.8819,0 1.316,0.3686 0.4341,0.3686 0.4341,1.1128 0,0.4858 -0.2274,0.8062 -0.2239,0.3204 -0.6546,0.4444zM9.927,4.6612v1.8259h0.8751q0.503,0 0.7579,-0.2308 0.2584,-0.2343 0.2584,-0.6856 0,-0.4513 -0.2584,-0.6787 -0.2549,-0.2308 -0.7579,-0.2308z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#000000"
android:strokeColor="#e6e6e6"
android:fillAlpha="0"/>
<path
android:pathData="m14.3195,8.6472h1.1369v-3.924l-1.2368,0.2481v-0.6339l1.2299,-0.248h0.6959v4.5579h1.1369v0.5857h-2.9628z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#000000"
android:strokeColor="#e6e6e6"
android:fillAlpha="0"/>
</vector>

View file

@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="M0.6615,0.6614L25.7969,0.6614v11.9063L0.6615,12.5677Z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="0.26458332"
android:fillColor="#4d4d4d"
android:strokeColor="#e6e6e6"
android:strokeLineCap="round"/>
<path
android:pathData="m11.6703,6.8213q0.2239,0.0758 0.4341,0.3238 0.2136,0.248 0.4272,0.6821l0.7062,1.4056h-0.7476l-0.658,-1.3195q-0.2549,-0.5168 -0.4961,-0.6856 -0.2377,-0.1688 -0.6511,-0.1688L9.927,7.059v2.1739L9.2311,9.2329v-5.1435h1.571q0.8819,0 1.316,0.3686 0.4341,0.3686 0.4341,1.1128 0,0.4858 -0.2274,0.8062 -0.2239,0.3204 -0.6546,0.4444zM9.927,4.6612v1.8259h0.8751q0.503,0 0.7579,-0.2308 0.2584,-0.2343 0.2584,-0.6856 0,-0.4513 -0.2584,-0.6787 -0.2549,-0.2308 -0.7579,-0.2308z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#1a1a1a"
android:strokeColor="#000000"
android:fillAlpha="1"/>
<path
android:pathData="m14.3195,8.6472h1.1369v-3.924l-1.2368,0.2481v-0.6339l1.2299,-0.248h0.6959v4.5579h1.1369v0.5857h-2.9628z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#1a1a1a"
android:strokeColor="#000000"
android:fillAlpha="1"/>
</vector>

View file

@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="M0.6615,0.6614L25.7969,0.6614v11.9063L0.6615,12.5677Z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="0.26458332"
android:fillColor="#00000000"
android:strokeColor="#e6e6e6"
android:strokeLineCap="round"/>
<path
android:pathData="m11.6703,6.8213q0.2239,0.0758 0.4341,0.3238 0.2136,0.248 0.4272,0.6821l0.7062,1.4056h-0.7476l-0.658,-1.3195q-0.2549,-0.5168 -0.4961,-0.6856 -0.2377,-0.1688 -0.6511,-0.1688L9.927,7.059v2.1739L9.2311,9.2329v-5.1435h1.571q0.8819,0 1.316,0.3686 0.4341,0.3686 0.4341,1.1128 0,0.4858 -0.2274,0.8062 -0.2239,0.3204 -0.6546,0.4444zM9.927,4.6612v1.8259h0.8751q0.503,0 0.7579,-0.2308 0.2584,-0.2343 0.2584,-0.6856 0,-0.4513 -0.2584,-0.6787 -0.2549,-0.2308 -0.7579,-0.2308z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#000000"
android:strokeColor="#e6e6e6"
android:fillAlpha="0"/>
<path
android:pathData="m14.7984,8.6472h2.4288v0.5857h-3.2659v-0.5857q0.3962,-0.41 1.0783,-1.099 0.6856,-0.6925 0.8613,-0.8923 0.3342,-0.3755 0.4651,-0.6339 0.1344,-0.2618 0.1344,-0.5133 0,-0.41 -0.2894,-0.6683 -0.2859,-0.2584 -0.7476,-0.2584 -0.3273,0 -0.6925,0.1137 -0.3617,0.1137 -0.7751,0.3445v-0.7028q0.4203,-0.1688 0.7855,-0.2549 0.3652,-0.0861 0.6683,-0.0861 0.7993,0 1.2747,0.3996 0.4754,0.3996 0.4754,1.068 0,0.3169 -0.1206,0.6029 -0.1171,0.2825 -0.4306,0.6683 -0.0861,0.0999 -0.5478,0.5788 -0.4616,0.4754 -1.3022,1.3333z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#000000"
android:strokeColor="#e6e6e6"
android:fillAlpha="0"/>
</vector>

View file

@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="M0.6615,0.6614L25.7969,0.6614v11.9063L0.6615,12.5677Z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="0.26458332"
android:fillColor="#4d4d4d"
android:strokeColor="#e6e6e6"
android:strokeLineCap="round"/>
<path
android:pathData="m11.6703,6.8213q0.2239,0.0758 0.4341,0.3238 0.2136,0.248 0.4272,0.6821l0.7062,1.4056h-0.7476l-0.658,-1.3195q-0.2549,-0.5168 -0.4961,-0.6856 -0.2377,-0.1688 -0.6511,-0.1688L9.927,7.059v2.1739L9.2311,9.2329v-5.1435h1.571q0.8819,0 1.316,0.3686 0.4341,0.3686 0.4341,1.1128 0,0.4858 -0.2274,0.8062 -0.2239,0.3204 -0.6546,0.4444zM9.927,4.6612v1.8259h0.8751q0.503,0 0.7579,-0.2308 0.2584,-0.2343 0.2584,-0.6856 0,-0.4513 -0.2584,-0.6787 -0.2549,-0.2308 -0.7579,-0.2308z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#1a1a1a"
android:strokeColor="#000000"
android:fillAlpha="1"/>
<path
android:pathData="m14.7984,8.6472h2.4288v0.5857h-3.2659v-0.5857q0.3962,-0.41 1.0783,-1.099 0.6856,-0.6925 0.8613,-0.8923 0.3342,-0.3755 0.4651,-0.6339 0.1344,-0.2618 0.1344,-0.5133 0,-0.41 -0.2894,-0.6683 -0.2859,-0.2584 -0.7476,-0.2584 -0.3273,0 -0.6925,0.1137 -0.3617,0.1137 -0.7751,0.3445v-0.7028q0.4203,-0.1688 0.7855,-0.2549 0.3652,-0.0861 0.6683,-0.0861 0.7993,0 1.2747,0.3996 0.4754,0.3996 0.4754,1.068 0,0.3169 -0.1206,0.6029 -0.1171,0.2825 -0.4306,0.6683 -0.0861,0.0999 -0.5478,0.5788 -0.4616,0.4754 -1.3022,1.3333z"
android:strokeAlpha="1"
android:strokeWidth="0.13229167"
android:fillColor="#1a1a1a"
android:strokeColor="#000000"
android:fillAlpha="1"/>
</vector>

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="m0.6615,0.6614v11.9063L25.7969,12.5677v-11.9063z"
android:strokeAlpha="1"
android:strokeLineJoin="miter"
android:strokeWidth="0.26458332"
android:fillColor="#00000000"
android:strokeColor="#6e6e6f"
android:strokeLineCap="butt"/>
</vector>

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="m0.6615,0.6614v11.9063L25.7969,12.5677v-11.9063z"
android:strokeAlpha="1"
android:strokeLineJoin="miter"
android:strokeWidth="0.26458332"
android:fillColor="#4d4d4d"
android:strokeColor="#6e6e6f"
android:strokeLineCap="butt"/>
</vector>

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="m0.6615,0.6614v11.9063l25.1354,-5.9531z"
android:strokeAlpha="0.94117647"
android:strokeLineJoin="miter"
android:strokeWidth="0.265"
android:fillColor="#00000000"
android:strokeColor="#6e6e6f"
android:strokeLineCap="butt"/>
</vector>

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="50dp"
android:viewportWidth="26.458332"
android:viewportHeight="13.229165">
<path
android:pathData="m0.6615,0.6614v11.9063l25.1354,-5.9531z"
android:strokeAlpha="0.94117647"
android:strokeLineJoin="miter"
android:strokeWidth="0.265"
android:fillColor="#4d4d4d"
android:strokeColor="#6e6e6f"
android:strokeLineCap="butt"/>
</vector>

View file

@ -0,0 +1,167 @@
<?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/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_r2"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_marginEnd="60dp"
android:layout_marginBottom="280dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:pressedDrawable="@drawable/ic_controller_r2_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_r2_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_r1"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_marginEnd="60dp"
android:layout_marginBottom="220dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:pressedDrawable="@drawable/ic_controller_r1_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_r1_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_right"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="120dp"
android:layout_marginBottom="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:pressedDrawable="@drawable/ic_controller_right_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_right_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_up"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="70dp"
android:layout_marginBottom="130dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:pressedDrawable="@drawable/ic_controller_up_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_up_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_l1"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_marginStart="60dp"
android:layout_marginBottom="220dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:pressedDrawable="@drawable/ic_controller_l1_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_l1_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_l2"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_marginStart="60dp"
android:layout_marginBottom="280dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:pressedDrawable="@drawable/ic_controller_l2_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_l2_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_left"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="20dp"
android:layout_marginBottom="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:pressedDrawable="@drawable/ic_controller_left_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_left_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_down"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="70dp"
android:layout_marginBottom="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:pressedDrawable="@drawable/ic_controller_down_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_down_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_start"
android:layout_width="40dp"
android:layout_height="25dp"
android:layout_marginStart="80dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:pressedDrawable="@drawable/ic_controller_start_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_start_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_select"
android:layout_width="40dp"
android:layout_height="25dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:pressedDrawable="@drawable/ic_controller_select_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_select_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_cross"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="70dp"
android:layout_marginBottom="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:pressedDrawable="@drawable/ic_controller_cross_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_cross_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_square"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="120dp"
android:layout_marginBottom="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:pressedDrawable="@drawable/ic_controller_square_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_square_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_triangle"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="70dp"
android:layout_marginBottom="130dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:pressedDrawable="@drawable/ic_controller_triangle_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_triangle_button" />
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
android:id="@+id/controller_button_circle"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:pressedDrawable="@drawable/ic_controller_circle_button_pressed"
app:unpressedDrawable="@drawable/ic_controller_circle_button" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,6 @@
<resources>
<declare-styleable name="TouchscreenControllerButtonView">
<attr name="unpressedDrawable" format="color|reference" />
<attr name="pressedDrawable" format="color|reference" />
</declare-styleable>
</resources>