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.
This commit is contained in:
◱ PixelyIon 2020-04-20 01:40:28 +05:30 committed by ◱ PixelyIon
parent a0b9a635ca
commit 1c54bff215
4 changed files with 15 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.graphics.drawable.toBitmap import androidx.core.graphics.drawable.toBitmap
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import emu.skyline.EmulationActivity import emu.skyline.EmulationActivity
import emu.skyline.R import emu.skyline.R
@ -35,6 +36,16 @@ class AppDialog(val item: AppItem? = null) : BottomSheetDialogFragment() {
return requireActivity().layoutInflater.inflate(R.layout.app_dialog, container) 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 * This fills all the dialog with the information from [item] if it is valid and setup all user interaction
*/ */

View File

@ -66,11 +66,12 @@ class MainActivity : AppCompatActivity(), View.OnClickListener, View.OnLongClick
runOnUiThread { runOnUiThread {
if (!foundCurrent) { if (!foundCurrent) {
adapter.addHeader(loader.format.name) adapter.addHeader(loader.format.name)
foundCurrent = true
} }
adapter.addItem(AppItem(entry)) adapter.addItem(AppItem(entry))
} }
foundCurrent = true
} }
document.close() document.close()

View File

@ -20,6 +20,6 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:textColor="#5fffffff" /> android:textColor="#9fffff00" />
</RelativeLayout> </RelativeLayout>

View File

@ -25,7 +25,7 @@
<!-- Settings --> <!-- Settings -->
<string name="emulator">Emulator</string> <string name="emulator">Emulator</string>
<string name="search_location">Search Location</string> <string name="search_location">Search Location</string>
<string name="layout_type">Game Container Layout</string> <string name="layout_type">Game Display Layout</string>
<string name="select_action">Always Show Game Information</string> <string name="select_action">Always Show Game Information</string>
<string name="select_action_desc_on">Game information will be shown on clicking a game</string> <string name="select_action_desc_on">Game information will be shown on clicking a game</string>
<string name="select_action_desc_off">Game information will only be shown on long-clicking a game</string> <string name="select_action_desc_off">Game information will only be shown on long-clicking a game</string>