mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #11521 from t895/adjust-grid-options
Android: Simplify the grid options dialog fragment
This commit is contained in:
commit
e65167f9cd
@ -9,7 +9,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
|
|||||||
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting
|
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting
|
||||||
import android.widget.CompoundButton
|
import android.widget.CompoundButton
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import org.dolphinemu.dolphinemu.R
|
||||||
import org.dolphinemu.dolphinemu.databinding.FragmentGridOptionsBinding
|
import org.dolphinemu.dolphinemu.databinding.FragmentGridOptionsBinding
|
||||||
import org.dolphinemu.dolphinemu.databinding.FragmentGridOptionsTvBinding
|
import org.dolphinemu.dolphinemu.databinding.FragmentGridOptionsTvBinding
|
||||||
import org.dolphinemu.dolphinemu.features.settings.model.NativeConfig
|
import org.dolphinemu.dolphinemu.features.settings.model.NativeConfig
|
||||||
@ -43,31 +43,17 @@ class GridOptionDialogFragment : BottomSheetDialogFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
// Pins fragment to the top of the dialog ensures the dialog is expanded in landscape by default
|
||||||
|
if (!resources.getBoolean(R.bool.hasTouch)) {
|
||||||
|
BottomSheetBehavior.from<View>(view.parent as View).state =
|
||||||
|
BottomSheetBehavior.STATE_EXPANDED
|
||||||
|
}
|
||||||
|
|
||||||
if (activity is AppCompatActivity) {
|
if (activity is AppCompatActivity) {
|
||||||
setUpCoverButtons()
|
setUpCoverButtons()
|
||||||
setUpTitleButtons()
|
setUpTitleButtons()
|
||||||
|
|
||||||
// Pins fragment to the top of the dialog ensures the dialog is expanded in landscape by default
|
|
||||||
BottomSheetBehavior.from<View>(mBindingMobile.gridSheet).state =
|
|
||||||
BottomSheetBehavior.STATE_EXPANDED
|
|
||||||
dialog?.setOnShowListener {
|
|
||||||
val dialog = it as BottomSheetDialog
|
|
||||||
mBindingMobile.gridSheet.let { sheet ->
|
|
||||||
dialog.behavior.peekHeight = sheet.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
setUpCoverButtonsTv()
|
setUpCoverButtonsTv()
|
||||||
|
|
||||||
// Pins fragment to the top of the dialog ensures the dialog is expanded in landscape by default
|
|
||||||
BottomSheetBehavior.from<View>(mBindingTv.gridSheet).state =
|
|
||||||
BottomSheetBehavior.STATE_EXPANDED
|
|
||||||
dialog?.setOnShowListener {
|
|
||||||
val dialog = it as BottomSheetDialog
|
|
||||||
mBindingTv.gridSheet.let { sheet ->
|
|
||||||
dialog.behavior.peekHeight = sheet.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="@dimen/spacing_xtralarge"
|
android:paddingBottom="@dimen/spacing_xtralarge">
|
||||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
|
||||||
|
|
||||||
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
|
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/dolphin_surface">
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:id="@+id/grid_sheet"
|
android:id="@+id/grid_sheet"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/root_download_covers"
|
android:id="@+id/root_download_covers"
|
||||||
@ -30,6 +30,7 @@
|
|||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:text="@string/download_game_covers"
|
android:text="@string/download_game_covers"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
|
android:textColor="@color/dolphin_onSurface"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/switch_download_covers"
|
app:layout_constraintBottom_toBottomOf="@+id/switch_download_covers"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/switch_download_covers"
|
app:layout_constraintEnd_toStartOf="@+id/switch_download_covers"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user