Fixed folder fragment AppBarLayout
This commit is contained in:
parent
92635af1e0
commit
8422e5abbd
2 changed files with 49 additions and 69 deletions
|
@ -70,8 +70,8 @@ import com.afollestad.materialcab.attached.destroy
|
|||
import com.afollestad.materialcab.attached.isActive
|
||||
import com.afollestad.materialcab.createCab
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.transition.MaterialFadeThrough
|
||||
import com.google.android.material.transition.MaterialSharedAxis
|
||||
import java.io.*
|
||||
import java.lang.ref.WeakReference
|
||||
|
@ -103,13 +103,9 @@ class FoldersFragment : AbsMainActivityFragment(R.layout.fragment_folder),
|
|||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
enterTransition = MaterialFadeThrough()
|
||||
exitTransition = MaterialFadeThrough()
|
||||
mainActivity.addMusicServiceEventListener(libraryViewModel)
|
||||
mainActivity.setSupportActionBar(binding.toolbar)
|
||||
mainActivity.supportActionBar?.title = null
|
||||
setStatusBarColorAuto(view)
|
||||
setUpAppbarColor()
|
||||
setUpBreadCrumbs()
|
||||
setUpRecyclerView()
|
||||
setUpAdapter()
|
||||
|
@ -125,6 +121,8 @@ class FoldersFragment : AbsMainActivityFragment(R.layout.fragment_folder),
|
|||
}
|
||||
})
|
||||
binding.toolbarContainer.drawNextToNavbar()
|
||||
binding.appBarLayout.statusBarForeground =
|
||||
MaterialShapeDrawable.createWithElevationOverlay(requireContext())
|
||||
}
|
||||
|
||||
private fun setUpTitle() {
|
||||
|
@ -308,7 +306,7 @@ class FoldersFragment : AbsMainActivityFragment(R.layout.fragment_folder),
|
|||
openQueue(songs, startIndex, true)
|
||||
} else {
|
||||
Snackbar.make(
|
||||
binding.coordinatorLayout,
|
||||
binding.root,
|
||||
Html.fromHtml(
|
||||
String.format(
|
||||
getString(R.string.not_listed_in_media_store), file1.name
|
||||
|
@ -451,12 +449,12 @@ class FoldersFragment : AbsMainActivityFragment(R.layout.fragment_folder),
|
|||
private fun checkForPadding() {
|
||||
val count = adapter?.itemCount ?: 0
|
||||
if (_binding != null) {
|
||||
val params = binding.coordinatorLayout.layoutParams as ViewGroup.MarginLayoutParams
|
||||
val params = binding.root.layoutParams as ViewGroup.MarginLayoutParams
|
||||
params.bottomMargin = if (count > 0 && playingQueue.isNotEmpty()) dip2px(
|
||||
requireContext(),
|
||||
104f
|
||||
) else dip2px(requireContext(), 54f)
|
||||
binding.coordinatorLayout.layoutParams = params
|
||||
binding.root.layoutParams = params
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -522,16 +520,13 @@ class FoldersFragment : AbsMainActivityFragment(R.layout.fragment_folder),
|
|||
switchToFileAdapter()
|
||||
}
|
||||
|
||||
private fun setUpAppbarColor() {
|
||||
private fun setUpBreadCrumbs() {
|
||||
binding.breadCrumbs.setActivatedContentColor(
|
||||
resolveColor(requireContext(), android.R.attr.textColorPrimary)
|
||||
)
|
||||
binding.breadCrumbs.setDeactivatedContentColor(
|
||||
resolveColor(requireContext(), android.R.attr.textColorSecondary)
|
||||
)
|
||||
}
|
||||
|
||||
private fun setUpBreadCrumbs() {
|
||||
binding.breadCrumbs.setCallback(this)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:liftOnScroll="true">
|
||||
app:liftOnScroll="true"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/toolbar_container"
|
||||
|
@ -23,7 +24,6 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSurface"
|
||||
app:navigationIcon="@drawable/ic_search"
|
||||
app:popupTheme="?attr/toolbarPopupTheme"
|
||||
app:title="@null"
|
||||
|
@ -38,14 +38,15 @@
|
|||
android:textStyle="bold" />
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
</FrameLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/coordinatorLayout"
|
||||
<code.name.monkey.retromusic.views.BreadCrumbLayout
|
||||
android:id="@+id/breadCrumbs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
android:layout_height="@dimen/tab_height"
|
||||
android:paddingStart="60dp"
|
||||
android:paddingEnd="8dp"
|
||||
app:layout_collapseMode="pin" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@android:id/empty"
|
||||
|
@ -76,19 +77,6 @@
|
|||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<code.name.monkey.retromusic.views.BreadCrumbLayout
|
||||
android:id="@+id/breadCrumbs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/tab_height"
|
||||
android:paddingStart="60dp"
|
||||
android:paddingEnd="8dp"
|
||||
app:layout_collapseMode="pin" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -97,7 +85,4 @@
|
|||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
Loading…
Reference in a new issue