Adjust padding

main
h4h13 2019-10-11 00:27:44 +05:30
parent 576201bfd5
commit 99787ad5a9
7 changed files with 61 additions and 59 deletions

View File

@ -75,7 +75,7 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
this, this,
MusicPlayerRemote.playingQueue, MusicPlayerRemote.playingQueue,
MusicPlayerRemote.position, MusicPlayerRemote.position,
code.name.monkey.retromusic.R.layout.item_queue) R.layout.item_queue)
wrappedAdapter = recyclerViewDragDropManager!!.createWrappedAdapter(playingQueueAdapter!!) wrappedAdapter = recyclerViewDragDropManager!!.createWrappedAdapter(playingQueueAdapter!!)
linearLayoutManager = LinearLayoutManager(this) linearLayoutManager = LinearLayoutManager(this)

View File

@ -65,7 +65,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
finish() finish()
} }
App.musicComponent?.inject(this) App.musicComponent.inject(this)
playlistSongsPresenter.attachView(this) playlistSongsPresenter.attachView(this)
@ -82,7 +82,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
recyclerView.layoutManager = LinearLayoutManager(this) recyclerView.layoutManager = LinearLayoutManager(this)
if (playlist is AbsCustomPlaylist) { if (playlist is AbsCustomPlaylist) {
adapter = PlaylistSongAdapter(this, ArrayList(), R.layout.item_list, false, this) adapter = PlaylistSongAdapter(this, ArrayList(), R.layout.item_list, false, this)
recyclerView!!.adapter = adapter recyclerView.adapter = adapter
} else { } else {
recyclerViewDragDropManager = RecyclerViewDragDropManager() recyclerViewDragDropManager = RecyclerViewDragDropManager()
val animator = RefactoredDefaultItemAnimator() val animator = RefactoredDefaultItemAnimator()
@ -101,7 +101,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
recyclerView.adapter = wrappedAdapter recyclerView.adapter = wrappedAdapter
recyclerView.itemAnimator = animator recyclerView.itemAnimator = animator
recyclerViewDragDropManager!!.attachRecyclerView(recyclerView!!) recyclerViewDragDropManager?.attachRecyclerView(recyclerView)
} }
adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() { adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onChanged() { override fun onChanged() {
@ -183,6 +183,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
} }
private fun checkIsEmpty() { private fun checkIsEmpty() {
empty.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE empty.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
emptyText.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE emptyText.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
} }

View File

@ -10,7 +10,6 @@ import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.common.ATHToolbarActivity import code.name.monkey.appthemehelper.common.ATHToolbarActivity
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
@ -31,7 +30,10 @@ import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist
import code.name.monkey.retromusic.mvp.presenter.HomePresenter import code.name.monkey.retromusic.mvp.presenter.HomePresenter
import code.name.monkey.retromusic.mvp.presenter.HomeView import code.name.monkey.retromusic.mvp.presenter.HomeView
import code.name.monkey.retromusic.util.* import code.name.monkey.retromusic.util.Compressor
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroColorUtil
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
@ -127,7 +129,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
} }
setupToolbar() setupToolbar()
checkPadding()
userImage.setOnClickListener { userImage.setOnClickListener {
val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image)) val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image))
@ -147,11 +148,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
} }
} }
private fun checkPadding() {
val marginSpan = DensityUtil.dip2px(requireContext(), 52f)
(recyclerView.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin = (marginSpan * 2.3f).toInt()
}
private fun toolbarColor(): Int { private fun toolbarColor(): Int {
return if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) { return if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) {
toolbarContainer.setBackgroundColor(Color.TRANSPARENT) toolbarContainer.setBackgroundColor(Color.TRANSPARENT)
@ -194,17 +190,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
emptyContainer.show() emptyContainer.show()
} }
override fun onServiceConnected() {
super.onServiceConnected()
checkPadding()
}
override fun onQueueChanged() {
super.onQueueChanged()
checkPadding()
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater) super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.menu_search, menu) inflater.inflate(R.menu.menu_search, menu)

View File

@ -62,7 +62,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="16dp" android:padding="@dimen/home_icon_padding"
app:iconBackgroundColor="@color/md_blue_500" app:iconBackgroundColor="@color/md_blue_500"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -98,7 +98,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="16dp" android:padding="@dimen/home_icon_padding"
app:iconBackgroundColor="@color/md_red_500" app:iconBackgroundColor="@color/md_red_500"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -137,7 +137,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="16dp" android:padding="@dimen/home_icon_padding"
app:iconBackgroundColor="@color/md_deep_purple_500" app:iconBackgroundColor="@color/md_deep_purple_500"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -175,7 +175,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="16dp" android:padding="@dimen/home_icon_padding"
app:iconBackgroundColor="@color/md_green_500" app:iconBackgroundColor="@color/md_green_500"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -22,45 +22,50 @@
android:id="@+id/appBarLayout" android:id="@+id/appBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="@dimen/card_elevation" app:liftOnScroll="true">
app:elevation="@dimen/card_elevation">
<com.google.android.material.appbar.CollapsingToolbarLayout <FrameLayout
android:id="@+id/collapsingToolbarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways">
app:titleEnabled="false">
<FrameLayout <ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="48dp" />
<ViewStub <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/cab_stub" android:id="@+id/toolbar"
android:layout_width="match_parent" style="@style/Toolbar"
android:layout_height="48dp" /> app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
<com.google.android.material.appbar.MaterialToolbar </FrameLayout>
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
</FrameLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clipToPadding="false" app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbars="none" />
<Space
android:layout_width="match_parent"
android:layout_height="52dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout <LinearLayout
android:id="@android:id/empty" android:id="@android:id/empty"

View File

@ -18,9 +18,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:background="?colorPrimary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?colorPrimary"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
@ -32,12 +32,22 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <LinearLayout
android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" android:orientation="vertical">
tools:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
tools:visibility="gone" />
<Space
android:layout_width="match_parent"
android:layout_height="112dp" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/emptyContainer" android:id="@+id/emptyContainer"

View File

@ -69,4 +69,5 @@ http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
<dimen name="button_padding_vertical">10dp</dimen> <dimen name="button_padding_vertical">10dp</dimen>
<dimen name="button_margin_horizontal">4dp</dimen> <dimen name="button_margin_horizontal">4dp</dimen>
<dimen name="horizontal_padding_home">8dp</dimen> <dimen name="horizontal_padding_home">8dp</dimen>
<dimen name="home_icon_padding">14dp</dimen>
</resources> </resources>