Fix tablet layout crashing

This commit is contained in:
h4h13 2020-02-17 21:11:32 +05:30
parent dac7bd16b7
commit 4e48e10be0
17 changed files with 103 additions and 141 deletions

View file

@ -11,7 +11,6 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
import kotlinx.android.synthetic.main.activity_settings.appBarLayout import kotlinx.android.synthetic.main.activity_settings.appBarLayout
import kotlinx.android.synthetic.main.activity_settings.detailContentFrame
import kotlinx.android.synthetic.main.activity_settings.toolbar import kotlinx.android.synthetic.main.activity_settings.toolbar
class SettingsActivity : AbsBaseActivity() { class SettingsActivity : AbsBaseActivity() {
@ -45,17 +44,17 @@ class SettingsActivity : AbsBaseActivity() {
fun setupFragment(fragment: Fragment, @StringRes titleName: Int) { fun setupFragment(fragment: Fragment, @StringRes titleName: Int) {
val fragmentTransaction = fragmentManager val fragmentTransaction = fragmentManager
.beginTransaction() .beginTransaction()
.setCustomAnimations(R.anim.sliding_in_left, R.anim.sliding_out_right, android.R.anim.slide_in_left, android.R.anim.slide_out_right) .setCustomAnimations(
R.anim.sliding_in_left,
R.anim.sliding_out_right,
android.R.anim.slide_in_left,
android.R.anim.slide_out_right
)
if (detailContentFrame == null) { fragmentTransaction.replace(R.id.contentFrame, fragment, fragment.tag)
fragmentTransaction.replace(R.id.contentFrame, fragment, fragment.tag) fragmentTransaction.addToBackStack(null)
fragmentTransaction.addToBackStack(null) fragmentTransaction.commit()
fragmentTransaction.commit()
} else {
fragmentTransaction.replace(R.id.detailContentFrame, fragment, fragment.tag)
fragmentTransaction.commit()
}
TransitionManager.beginDelayedTransition(appBarLayout) TransitionManager.beginDelayedTransition(appBarLayout)
setTitle(titleName) setTitle(titleName)

View file

@ -27,7 +27,6 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.ViewUtil import code.name.monkey.retromusic.util.ViewUtil
import kotlinx.android.synthetic.main.fragment_player_playback_controls.nextButton import kotlinx.android.synthetic.main.fragment_player_playback_controls.nextButton
import kotlinx.android.synthetic.main.fragment_player_playback_controls.playPauseButton import kotlinx.android.synthetic.main.fragment_player_playback_controls.playPauseButton
@ -159,20 +158,10 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment(), OnSharedPref
} }
private fun updatePlayPauseDrawableState() { private fun updatePlayPauseDrawableState() {
val playResIcon = if (RetroUtil.isTablet()) {
R.drawable.ic_play_arrow_white_64dp
} else {
R.drawable.ic_play_arrow_white_24dp
}
val pauseResIcon = if (RetroUtil.isTablet()) {
R.drawable.ic_pause_white_64dp
} else {
R.drawable.ic_pause_white_64dp
}
if (MusicPlayerRemote.isPlaying) { if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(playResIcon) playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else { } else {
playPauseButton.setImageResource(pauseResIcon) playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
} }
} }

View file

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2019 Hemanth Savarala.
~
~ Licensed under the GNU General Public License v3
~
~ This is free software: you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See the GNU General Public License for more details.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout 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">
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/contentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2" />
<FrameLayout
android:id="@+id/detailContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:liftOnScroll="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:title="@string/action_settings" />
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -1,37 +1,36 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.gridlayout.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.gridlayout.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:grid="http://schemas.android.com/apk/res-auto" xmlns:grid="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
grid:alignmentMode="alignBounds">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="4dp" android:padding="8dp"
android:orientation="vertical" grid:alignmentMode="alignBounds">
grid:layout_column="0"
grid:layout_columnWeight="1"
grid:layout_row="0">
<include layout="@layout/card_retro_info"/> <LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:orientation="vertical"
grid:layout_column="0"
grid:layout_columnWeight="1"
grid:layout_row="0">
<include layout="@layout/card_credit"/> <include layout="@layout/card_credit" />
</LinearLayout>
<LinearLayout <include layout="@layout/card_social" />
android:layout_width="0dp" </LinearLayout>
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:orientation="vertical"
grid:layout_column="1"
grid:layout_columnWeight="1"
grid:layout_row="0">
<include layout="@layout/card_social"/> <LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:orientation="vertical"
grid:layout_column="1"
grid:layout_columnWeight="1"
grid:layout_row="0">
<include layout="@layout/card_other"/> <include layout="@layout/card_retro_info" />
</LinearLayout> <include layout="@layout/card_other" />
</LinearLayout>
</androidx.gridlayout.widget.GridLayout> </androidx.gridlayout.widget.GridLayout>

View file

@ -13,7 +13,12 @@
<code.name.monkey.appthemehelper.common.views.ATEAccentTextView <code.name.monkey.appthemehelper.common.views.ATEAccentTextView
android:id="@+id/sb1" android:id="@+id/sb1"
style="@style/SubTitleTextAppearance" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingTop="?attr/listPreferredItemPaddingStart"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="?attr/listPreferredItemPaddingEnd"
android:text="@string/credit_title" android:text="@string/credit_title"
android:textAppearance="@style/TextViewOverline" android:textAppearance="@style/TextViewOverline"
android:textColor="?colorAccent" android:textColor="?colorAccent"

View file

@ -13,7 +13,12 @@
<code.name.monkey.appthemehelper.common.views.ATEAccentTextView <code.name.monkey.appthemehelper.common.views.ATEAccentTextView
android:id="@+id/sb4" android:id="@+id/sb4"
style="@style/SubTitleTextAppearance" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingTop="?attr/listPreferredItemPaddingStart"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="?attr/listPreferredItemPaddingEnd"
android:text="@string/others" android:text="@string/others"
android:textAppearance="@style/TextViewOverline" android:textAppearance="@style/TextViewOverline"
android:textColor="?colorAccent" android:textColor="?colorAccent"

View file

@ -14,7 +14,12 @@
<code.name.monkey.appthemehelper.common.views.ATEAccentTextView <code.name.monkey.appthemehelper.common.views.ATEAccentTextView
android:id="@+id/sb2" android:id="@+id/sb2"
style="@style/SubTitleTextAppearance" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingTop="?attr/listPreferredItemPaddingStart"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="?attr/listPreferredItemPaddingEnd"
android:text="@string/support_development" android:text="@string/support_development"
android:textAppearance="@style/TextViewOverline" android:textAppearance="@style/TextViewOverline"
android:textColor="?colorAccent" android:textColor="?colorAccent"

View file

@ -13,7 +13,12 @@
<code.name.monkey.appthemehelper.common.views.ATEAccentTextView <code.name.monkey.appthemehelper.common.views.ATEAccentTextView
android:id="@+id/sb3" android:id="@+id/sb3"
style="@style/SubTitleTextAppearance" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingTop="?attr/listPreferredItemPaddingStart"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="?attr/listPreferredItemPaddingEnd"
android:text="@string/social" android:text="@string/social"
android:textAppearance="@style/TextViewOverline" android:textAppearance="@style/TextViewOverline"
android:textColor="?colorAccent" android:textColor="?colorAccent"

View file

@ -18,9 +18,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/rectSelector" android:background="?attr/rectSelector"
android:minHeight="72dp" android:minHeight="?attr/listPreferredItemHeight"
android:orientation="horizontal" android:paddingStart="?attr/listPreferredItemPaddingStart"
android:padding="16dp" android:paddingTop="16dp"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="PrivateResource"> tools:ignore="PrivateResource">
@ -65,7 +67,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="52dp" /> app:layout_constraintGuide_begin="@dimen/list_pref_guideline_begin" />
<LinearLayout <LinearLayout
android:id="@android:id/widget_frame" android:id="@android:id/widget_frame"

View file

@ -18,9 +18,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/rectSelector" android:background="?attr/rectSelector"
android:minHeight="72dp" android:minHeight="?attr/listPreferredItemHeight"
android:orientation="horizontal" android:paddingStart="?attr/listPreferredItemPaddingStart"
android:padding="16dp" android:paddingTop="16dp"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="PrivateResource"> tools:ignore="PrivateResource">
@ -65,6 +67,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="56dp" /> app:layout_constraintGuide_begin="@dimen/list_pref_guideline_begin" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -18,9 +18,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/rectSelector" android:background="?attr/rectSelector"
android:minHeight="72dp" android:minHeight="?attr/listPreferredItemHeight"
android:orientation="horizontal" android:paddingStart="?attr/listPreferredItemPaddingStart"
android:padding="16dp" android:paddingTop="16dp"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="PrivateResource"> tools:ignore="PrivateResource">
@ -46,13 +48,13 @@
app:layout_constraintStart_toStartOf="@+id/guideline_front_margin" app:layout_constraintStart_toStartOf="@+id/guideline_front_margin"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:maxLines="@string/grid_size_1" tools:maxLines="@string/grid_size_1"
tools:text="@tools:sample/lorem" /> tools:text="@tools:sample/lorem/random" />
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_front_margin" android:id="@+id/guideline_front_margin"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="52dp" /> app:layout_constraintGuide_begin="@dimen/list_pref_guideline_begin" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -18,9 +18,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/rectSelector" android:background="?attr/rectSelector"
android:minHeight="72dp" android:minHeight="?attr/listPreferredItemHeight"
android:orientation="horizontal" android:paddingStart="?attr/listPreferredItemPaddingStart"
android:padding="16dp" android:paddingTop="16dp"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="PrivateResource"> tools:ignore="PrivateResource">
@ -65,7 +67,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="52dp" /> app:layout_constraintGuide_begin="@dimen/list_pref_guideline_begin" />
<SeekBar <SeekBar
android:id="@+id/seekbar" android:id="@+id/seekbar"

View file

@ -18,9 +18,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/rectSelector" android:background="?attr/rectSelector"
android:minHeight="72dp" android:minHeight="?attr/listPreferredItemHeight"
android:orientation="horizontal" android:paddingStart="?attr/listPreferredItemPaddingStart"
android:padding="16dp" android:paddingTop="16dp"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="16dp"
tools:ignore="PrivateResource"> tools:ignore="PrivateResource">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
@ -67,7 +69,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="56dp" /> app:layout_constraintGuide_begin="@dimen/list_pref_guideline_begin" />
<code.name.monkey.appthemehelper.common.views.ATESwitch <code.name.monkey.appthemehelper.common.views.ATESwitch
android:id="@android:id/checkbox" android:id="@android:id/checkbox"

View file

@ -18,8 +18,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/rectSelector" android:background="?attr/rectSelector"
android:orientation="horizontal" android:minHeight="?attr/listPreferredItemHeight"
android:padding="16dp" android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingTop="16dp"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="16dp"
tools:ignore="PrivateResource"> tools:ignore="PrivateResource">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
@ -53,7 +56,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="52dp" /> app:layout_constraintGuide_begin="@dimen/list_pref_guideline_begin" />
<code.name.monkey.appthemehelper.common.views.ATESwitch <code.name.monkey.appthemehelper.common.views.ATESwitch
android:id="@android:id/checkbox" android:id="@android:id/checkbox"

View file

@ -21,7 +21,7 @@
android:id="@android:id/title" android:id="@android:id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="70dp" android:paddingStart="@dimen/pref_title_padding"
android:paddingTop="16dp" android:paddingTop="16dp"
android:paddingEnd="16dp" android:paddingEnd="16dp"
android:textAppearance="@style/TextViewOverline" android:textAppearance="@style/TextViewOverline"

View file

@ -4,4 +4,5 @@
<dimen name="toolbar_margin_vertical">16dp</dimen> <dimen name="toolbar_margin_vertical">16dp</dimen>
<dimen name="item_song_height">64dp</dimen> <dimen name="item_song_height">64dp</dimen>
<dimen name="button_padding_vertical">16dp</dimen> <dimen name="button_padding_vertical">16dp</dimen>
<dimen name="pref_title_padding">80dp</dimen>
</resources> </resources>

View file

@ -48,4 +48,6 @@
<dimen name="button_corner">24dp</dimen> <dimen name="button_corner">24dp</dimen>
<dimen name="bottom_sheet_peek_1_height">56dp</dimen> <dimen name="bottom_sheet_peek_1_height">56dp</dimen>
<dimen name="bottom_sheet_peek_2_height">32dp</dimen> <dimen name="bottom_sheet_peek_2_height">32dp</dimen>
<dimen name="list_pref_guideline_begin">56dp</dimen>
<dimen name="pref_title_padding">70dp</dimen>
</resources> </resources>