Adjust padding

This commit is contained in:
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,
MusicPlayerRemote.playingQueue,
MusicPlayerRemote.position,
code.name.monkey.retromusic.R.layout.item_queue)
R.layout.item_queue)
wrappedAdapter = recyclerViewDragDropManager!!.createWrappedAdapter(playingQueueAdapter!!)
linearLayoutManager = LinearLayoutManager(this)

View file

@ -65,7 +65,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
finish()
}
App.musicComponent?.inject(this)
App.musicComponent.inject(this)
playlistSongsPresenter.attachView(this)
@ -82,7 +82,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
recyclerView.layoutManager = LinearLayoutManager(this)
if (playlist is AbsCustomPlaylist) {
adapter = PlaylistSongAdapter(this, ArrayList(), R.layout.item_list, false, this)
recyclerView!!.adapter = adapter
recyclerView.adapter = adapter
} else {
recyclerViewDragDropManager = RecyclerViewDragDropManager()
val animator = RefactoredDefaultItemAnimator()
@ -101,7 +101,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
recyclerView.adapter = wrappedAdapter
recyclerView.itemAnimator = animator
recyclerViewDragDropManager!!.attachRecyclerView(recyclerView!!)
recyclerViewDragDropManager?.attachRecyclerView(recyclerView)
}
adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onChanged() {
@ -183,6 +183,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
}
private fun checkIsEmpty() {
empty.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.recyclerview.widget.LinearLayoutManager
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.ToolbarContentTintHelper
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.mvp.presenter.HomePresenter
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.load.engine.DiskCacheStrategy
import io.reactivex.android.schedulers.AndroidSchedulers
@ -127,7 +129,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
}
setupToolbar()
checkPadding()
userImage.setOnClickListener {
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 {
return if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) {
toolbarContainer.setBackgroundColor(Color.TRANSPARENT)
@ -194,17 +190,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
emptyContainer.show()
}
override fun onServiceConnected() {
super.onServiceConnected()
checkPadding()
}
override fun onQueueChanged() {
super.onQueueChanged()
checkPadding()
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.menu_search, menu)

View file

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

View file

@ -22,19 +22,12 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="@dimen/card_elevation"
app:elevation="@dimen/card_elevation">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false">
app:liftOnScroll="true">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
<ViewStub
android:id="@+id/cab_stub"
@ -44,23 +37,35 @@
<com.google.android.material.appbar.MaterialToolbar
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>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
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"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
android:scrollbars="none" />
<Space
android:layout_width="match_parent"
android:layout_height="52dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:id="@android:id/empty"

View file

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

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_margin_horizontal">4dp</dimen>
<dimen name="horizontal_padding_home">8dp</dimen>
<dimen name="home_icon_padding">14dp</dimen>
</resources>