mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:35:12 +01:00
Add visibility toggle for osc
This commit is contained in:
parent
f479aeb4ac
commit
7b13f2d387
@ -14,6 +14,7 @@ import android.os.*
|
||||
import android.util.Log
|
||||
import android.view.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isInvisible
|
||||
import emu.skyline.input.*
|
||||
import emu.skyline.loader.getRomFormat
|
||||
@ -224,10 +225,15 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
game_view.setOnTouchListener(this)
|
||||
|
||||
// Hide on screen controls when first controller is not set
|
||||
on_screen_controller_view.isInvisible = !InputManager.controllers[0]!!.type.firstController || !settings.onScreenControl
|
||||
on_screen_controller_view.isGone = !InputManager.controllers[0]!!.type.firstController || !settings.onScreenControl
|
||||
on_screen_controller_view.setOnButtonStateChangedListener(::onButtonStateChanged)
|
||||
on_screen_controller_view.setOnStickStateChangedListener(::onStickStateChanged)
|
||||
|
||||
on_screen_controller_toggle.isGone = on_screen_controller_toggle.isGone
|
||||
on_screen_controller_toggle.setOnClickListener {
|
||||
on_screen_controller_view.isInvisible = !on_screen_controller_view.isInvisible
|
||||
}
|
||||
|
||||
executeApplication(intent.data!!)
|
||||
}
|
||||
|
||||
|
10
app/src/main/res/drawable/ic_show.xml
Normal file
10
app/src/main/res/drawable/ic_show.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000"
|
||||
android:pathData="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" />
|
||||
</vector>
|
@ -1,15 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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"
|
||||
android:keepScreenOn="true"
|
||||
tools:background="@android:color/black"
|
||||
tools:context=".EmulationActivity">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/game_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent"
|
||||
tools:visibility="invisible" />
|
||||
|
||||
<emu.skyline.input.onscreen.OnScreenControllerView
|
||||
android:id="@+id/on_screen_controller_view"
|
||||
@ -23,4 +26,14 @@
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="#9fffff00" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/on_screen_controller_toggle"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_show"
|
||||
app:tint="#40FFFFFF"
|
||||
tools:ignore="ContentDescription" />
|
||||
</FrameLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user