Fixed edit & search lyrics buttons
This commit is contained in:
parent
13573882a1
commit
e5acb1e132
3 changed files with 28 additions and 16 deletions
|
@ -60,6 +60,9 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) {
|
|||
private val binding get() = _binding!!
|
||||
private lateinit var song: Song
|
||||
|
||||
val mainActivity: MainActivity
|
||||
get() = activity as MainActivity
|
||||
|
||||
private lateinit var lyricsSectionsAdapter: LyricsSectionsAdapter
|
||||
|
||||
private val googleSearchLrcUrl: String
|
||||
|
@ -119,9 +122,21 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) {
|
|||
|
||||
binding.tabLyrics.setSelectedTabIndicatorColor(accentColor())
|
||||
binding.tabLyrics.setTabTextColors(textColorSecondary(), accentColor())
|
||||
binding.editButton.accentColor()
|
||||
binding.editButton.setOnClickListener {
|
||||
when (binding.lyricsPager.currentItem) {
|
||||
0 -> {
|
||||
editSyncedLyrics()
|
||||
}
|
||||
1 -> {
|
||||
editNormalLyrics()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupToolbar() {
|
||||
mainActivity.setSupportActionBar(binding.toolbar)
|
||||
binding.toolbar.setBackgroundColor(surfaceColor())
|
||||
ToolbarContentTintHelper.colorBackButton(binding.toolbar)
|
||||
binding.toolbar.setNavigationOnClickListener {
|
||||
|
@ -167,15 +182,6 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) {
|
|||
else -> googleSearchLrcUrl
|
||||
}
|
||||
)
|
||||
} else if (item.itemId == R.id.action_edit) {
|
||||
when (binding.lyricsPager.currentItem) {
|
||||
0 -> {
|
||||
editSyncedLyrics()
|
||||
}
|
||||
1 -> {
|
||||
editNormalLyrics()
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
android:fitsSystemWindows="true"
|
||||
android:paddingBottom="@dimen/mini_player_height">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarLayout"
|
||||
|
@ -70,4 +71,15 @@
|
|||
app:tabIndicatorFullWidth="false"
|
||||
app:tabIndicatorHeight="5dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/edit_button"
|
||||
style="@style/Widget.Material3.FloatingActionButton.Primary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:srcCompat="@drawable/ic_edit" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,15 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_edit"
|
||||
android:icon="@drawable/ic_edit"
|
||||
android:title="@string/action_edit"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_search"
|
||||
android:icon="@drawable/ic_search"
|
||||
android:title="@string/action_search"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
</menu>
|
Loading…
Reference in a new issue