Fix tablet layout crashing
This commit is contained in:
parent
dac7bd16b7
commit
4e48e10be0
17 changed files with 103 additions and 141 deletions
|
@ -11,7 +11,6 @@ import code.name.monkey.retromusic.R
|
|||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
|
||||
import kotlinx.android.synthetic.main.activity_settings.appBarLayout
|
||||
import kotlinx.android.synthetic.main.activity_settings.detailContentFrame
|
||||
import kotlinx.android.synthetic.main.activity_settings.toolbar
|
||||
|
||||
class SettingsActivity : AbsBaseActivity() {
|
||||
|
@ -45,17 +44,17 @@ class SettingsActivity : AbsBaseActivity() {
|
|||
|
||||
fun setupFragment(fragment: Fragment, @StringRes titleName: Int) {
|
||||
val fragmentTransaction = fragmentManager
|
||||
.beginTransaction()
|
||||
.setCustomAnimations(R.anim.sliding_in_left, R.anim.sliding_out_right, android.R.anim.slide_in_left, android.R.anim.slide_out_right)
|
||||
.beginTransaction()
|
||||
.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.addToBackStack(null)
|
||||
fragmentTransaction.commit()
|
||||
} else {
|
||||
fragmentTransaction.replace(R.id.detailContentFrame, fragment, fragment.tag)
|
||||
fragmentTransaction.commit()
|
||||
}
|
||||
fragmentTransaction.replace(R.id.contentFrame, fragment, fragment.tag)
|
||||
fragmentTransaction.addToBackStack(null)
|
||||
fragmentTransaction.commit()
|
||||
|
||||
TransitionManager.beginDelayedTransition(appBarLayout)
|
||||
setTitle(titleName)
|
||||
|
|
|
@ -27,7 +27,6 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
|||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
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.playPauseButton
|
||||
|
@ -159,20 +158,10 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment(), OnSharedPref
|
|||
}
|
||||
|
||||
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) {
|
||||
playPauseButton.setImageResource(playResIcon)
|
||||
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
|
||||
} else {
|
||||
playPauseButton.setImageResource(pauseResIcon)
|
||||
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue