From 1c54bff2156f7d69cbf3d582ec60313938d34435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=97=B1=20PixelyIon?= Date: Mon, 20 Apr 2020 01:40:28 +0530 Subject: [PATCH] Make `AppDialog` Expand Fully and Fix Race in `MainActivity::addEntries` This commit mainly fixes the issue with `AppDialog` where it didn't expand fully in landscape leading to UX issues. In addition, a race condition was fixed in `MainActivity::addEntries`, in regards to `foundCurrent` being returned incorrectly. The text in the performance counters were also made yellow and much more opaque. --- app/src/main/java/emu/skyline/AppDialog.kt | 11 +++++++++++ app/src/main/java/emu/skyline/MainActivity.kt | 3 ++- app/src/main/res/layout/emu_activity.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/emu/skyline/AppDialog.kt b/app/src/main/java/emu/skyline/AppDialog.kt index f78e793e..96f3225b 100644 --- a/app/src/main/java/emu/skyline/AppDialog.kt +++ b/app/src/main/java/emu/skyline/AppDialog.kt @@ -15,6 +15,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.graphics.drawable.toBitmap +import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialogFragment import emu.skyline.EmulationActivity import emu.skyline.R @@ -35,6 +36,16 @@ class AppDialog(val item: AppItem? = null) : BottomSheetDialogFragment() { return requireActivity().layoutInflater.inflate(R.layout.app_dialog, container) } + /** + * This expands the bottom sheet so that it's fully visible + */ + override fun onStart() { + super.onStart() + + val behavior = BottomSheetBehavior.from(requireView().parent as View) + behavior.state = BottomSheetBehavior.STATE_EXPANDED + } + /** * This fills all the dialog with the information from [item] if it is valid and setup all user interaction */ diff --git a/app/src/main/java/emu/skyline/MainActivity.kt b/app/src/main/java/emu/skyline/MainActivity.kt index c4371115..18c7a8ee 100644 --- a/app/src/main/java/emu/skyline/MainActivity.kt +++ b/app/src/main/java/emu/skyline/MainActivity.kt @@ -66,11 +66,12 @@ class MainActivity : AppCompatActivity(), View.OnClickListener, View.OnLongClick runOnUiThread { if (!foundCurrent) { adapter.addHeader(loader.format.name) - foundCurrent = true } adapter.addItem(AppItem(entry)) } + + foundCurrent = true } document.close() diff --git a/app/src/main/res/layout/emu_activity.xml b/app/src/main/res/layout/emu_activity.xml index 68713c92..90fbff51 100644 --- a/app/src/main/res/layout/emu_activity.xml +++ b/app/src/main/res/layout/emu_activity.xml @@ -20,6 +20,6 @@ android:layout_alignParentTop="true" android:layout_marginStart="5dp" android:layout_marginTop="5dp" - android:textColor="#5fffffff" /> + android:textColor="#9fffff00" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 25d95041..9f52ba03 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -25,7 +25,7 @@ Emulator Search Location - Game Container Layout + Game Display Layout Always Show Game Information Game information will be shown on clicking a game Game information will only be shown on long-clicking a game