Fix lyrics loading crashing
This commit is contained in:
parent
4e6b900706
commit
1d2b32ac8c
4 changed files with 14 additions and 4 deletions
|
@ -184,7 +184,8 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadBiography(
|
private fun loadBiography(
|
||||||
name: String, lang: String? = Locale.getDefault().language
|
name: String,
|
||||||
|
lang: String? = Locale.getDefault().language
|
||||||
) {
|
) {
|
||||||
biography = null
|
biography = null
|
||||||
this.lang = lang
|
this.lang = lang
|
||||||
|
|
|
@ -19,6 +19,7 @@ import code.name.monkey.retromusic.model.Genre
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsView
|
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsView
|
||||||
|
import code.name.monkey.retromusic.util.DensityUtil
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import com.afollestad.materialcab.MaterialCab
|
import com.afollestad.materialcab.MaterialCab
|
||||||
|
@ -44,10 +45,16 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkIsEmpty() {
|
private fun checkIsEmpty() {
|
||||||
|
checkForPadding()
|
||||||
emptyEmoji.text = getEmojiByUnicode(0x1F631)
|
emptyEmoji.text = getEmojiByUnicode(0x1F631)
|
||||||
empty?.visibility = if (songAdapter.itemCount == 0) View.VISIBLE else View.GONE
|
empty?.visibility = if (songAdapter.itemCount == 0) View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkForPadding() {
|
||||||
|
val height = DensityUtil.dip2px(this, 52f)
|
||||||
|
recyclerView.setPadding(0, 0, 0, (height))
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
setDrawUnderStatusBar()
|
setDrawUnderStatusBar()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -127,7 +134,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
|
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
|
||||||
if (cab != null && cab!!.isActive) cab!!.finish()
|
if (cab != null && cab!!.isActive) cab?.finish()
|
||||||
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes).setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ATHUtil.resolveColor(this, R.attr.colorSurface))).start(callback)
|
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes).setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ATHUtil.resolveColor(this, R.attr.colorSurface))).start(callback)
|
||||||
return cab!!
|
return cab!!
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
|
||||||
toolbar.setBackgroundColor(toolbarColor)
|
toolbar.setBackgroundColor(toolbarColor)
|
||||||
tabs.setBackgroundColor(toolbarColor)
|
tabs.setBackgroundColor(toolbarColor)
|
||||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||||
|
setSupportActionBar(toolbar)
|
||||||
tabs.setupWithViewPager(viewPager)
|
tabs.setupWithViewPager(viewPager)
|
||||||
tabs.setSelectedTabIndicator(TintHelper.createTintedDrawable(ContextCompat.getDrawable(this, R.drawable.tab_indicator), ThemeStore.accentColor(this)))
|
tabs.setSelectedTabIndicator(TintHelper.createTintedDrawable(ContextCompat.getDrawable(this, R.drawable.tab_indicator), ThemeStore.accentColor(this)))
|
||||||
tabs.setTabTextColors(ATHUtil.resolveColor(this, android.R.attr.textColorSecondary), ThemeStore.accentColor(this))
|
tabs.setTabTextColors(ATHUtil.resolveColor(this, android.R.attr.textColorSecondary), ThemeStore.accentColor(this))
|
||||||
|
@ -137,7 +137,8 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
if (item.itemId == android.R.id.home) {
|
if (item.itemId == android.R.id.home) {
|
||||||
onBackPressed()
|
finish()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/container"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
|
Loading…
Reference in a new issue