Fix layout issues for tablet

This commit is contained in:
h4h13 2019-06-24 01:44:27 +05:30
parent 2f6ca4b124
commit d132dafef5
17 changed files with 412 additions and 350 deletions

View file

@ -1,6 +1,7 @@
package code.name.monkey.retromusic.activities
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.transition.Slide
@ -70,7 +71,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsContrac
setupWindowTransition()
super.onCreate(savedInstanceState)
toggleBottomNavigationView(true)
collapsingToolbarLayout?.setBackgroundColor(ThemeStore.primaryColor(this))
contentContainer?.setCardBackgroundColor( ColorStateList.valueOf(ThemeStore.primaryColor(this)))
setLightNavigationBar(true)
setNavigationbarColorAuto()
@ -111,7 +112,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsContrac
supportActionBar!!.title = null
val primaryColor = ThemeStore.primaryColor(this)
TintHelper.setTintAuto(contentContainer!!, primaryColor, true)
//TintHelper.setTintAuto(contentContainer!!, primaryColor, true)
if (collapsingToolbarLayout != null) {
collapsingToolbarLayout!!.apply {

View file

@ -2,6 +2,7 @@ package code.name.monkey.retromusic.activities
import android.app.Activity
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.os.Build
@ -17,7 +18,10 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
@ -68,7 +72,8 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailContrac
setDrawUnderStatusBar()
setupWindowTransitions()
super.onCreate(savedInstanceState)
collapsingToolbarLayout?.setBackgroundColor(ThemeStore.primaryColor(this))
//collapsingToolbarLayout?.setBackgroundColor(ThemeStore.primaryColor(this))
contentContainer?.setCardBackgroundColor(ColorStateList.valueOf(ThemeStore.primaryColor(this)))
toggleBottomNavigationView(true)
setNavigationbarColorAuto()
setLightNavigationBar(true)
@ -114,7 +119,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailContrac
private fun setupToolbarMarginHeight() {
val primaryColor = ThemeStore.primaryColor(this)
TintHelper.setTintAuto(contentContainer!!, primaryColor, true)
collapsingToolbarLayout?.let {
it.setContentScrimColor(primaryColor)
it.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor))

View file

@ -17,6 +17,7 @@ import code.name.monkey.retromusic.Constants
import code.name.monkey.retromusic.Constants.USER_BANNER
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.HomeAdapter
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.glide.GlideApp
@ -201,16 +202,17 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
private lateinit var homeAdapter: HomeAdapter
override fun showData(list: ArrayList<Home>) {
if (list.isEmpty()){
showEmptyView()
return
}
val finalList = list.sortedWith(compareBy { it.priority })
homeAdapter.swapData(finalList)
recyclerView.apply {
layoutManager = LinearLayoutManager(mainActivity)
adapter = homeAdapter
}
if (list.isEmpty()) {
showEmptyView()
} else {
emptyContainer.hide()
}
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {

View file

@ -101,7 +101,6 @@ class PlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
super.onViewCreated(view, savedInstanceState)
setUpSubFragments()
setUpPlayerToolbar()
snowfall.visibility = if (PreferenceUtil.getInstance().isSnowFall) View.VISIBLE else View.GONE
//val display = activity?.windowManager?.defaultDisplay

View file

@ -30,13 +30,19 @@
</FrameLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:fillViewport="true"
android:overScrollMode="never">
<com.google.android.material.card.MaterialCardView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -94,6 +100,7 @@
<include layout="@layout/activity_album_content" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:id="@+id/root"
android:layout_width="match_parent"
@ -30,12 +31,18 @@
</FrameLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:overScrollMode="never">
<com.google.android.material.card.MaterialCardView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -88,6 +95,7 @@
android:layout_height="@dimen/status_bar_padding" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View file

@ -41,7 +41,6 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
@ -52,6 +51,13 @@
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.google.android.material.card.MaterialCardView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -119,7 +125,7 @@
<include layout="@layout/activity_album_content" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>
<View

View file

@ -39,18 +39,23 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:layout_marginStart="128dp"
android:layout_marginEnd="128dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:background="@color/md_red_500">
<com.google.android.material.card.MaterialCardView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -93,5 +98,6 @@
<include layout="@layout/activity_artist_content" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -30,7 +30,7 @@
<FrameLayout
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="228dp"
android:layout_height="258dp"
app:layout_collapseMode="parallax">
<ImageView
@ -63,6 +63,8 @@
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardElevation="6dp"
android:layout_marginStart="128dp"
android:layout_marginEnd="128dp"
app:cardUseCompatPadding="true"
app:layout_scrollFlags="scroll|enterAlways">

View file

@ -13,10 +13,7 @@
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="24dp"
android:paddingTop="10dp"
android:paddingEnd="24dp"
android:paddingBottom="10dp">
android:padding="24dp">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage"

View file

@ -42,17 +42,22 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:layout_marginStart="96dp"
android:layout_marginEnd="96dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.google.android.material.card.MaterialCardView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -61,6 +66,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
@ -119,9 +125,9 @@
</LinearLayout>
</LinearLayout>
<include layout="@layout/activity_album_content" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>
<View

View file

@ -40,17 +40,22 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:layout_marginStart="96dp"
android:layout_marginEnd="96dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.google.android.material.card.MaterialCardView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -96,5 +101,6 @@
<include layout="@layout/activity_artist_content" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -30,7 +30,7 @@
<FrameLayout
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="196dp"
android:layout_height="228dp"
app:layout_collapseMode="parallax">
<ImageView
@ -61,6 +61,8 @@
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginEnd="64dp"
app:cardCornerRadius="8dp"
app:cardElevation="6dp"
app:cardUseCompatPadding="true"
@ -70,8 +72,8 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:title="@string/search_hint"
app:titleTextAppearance="@style/TextAppearance.MaterialComponents.Body1"
app:titleMarginStart="0dp"
app:titleTextAppearance="@style/TextAppearance.MaterialComponents.Body1"
tools:ignore="UnusedAttribute" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout>

View file

@ -32,10 +32,10 @@
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginEnd="64dp"
app:cardCornerRadius="8dp"
app:cardElevation="0dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:cardUseCompatPadding="true"
app:layout_scrollFlags="scroll|enterAlways"
app:strokeColor="?dividerColor"

View file

@ -11,10 +11,7 @@
android:id="@+id/colorGradientBackground"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.jetradarmobile.snowfall.SnowfallView
android:id="@+id/snowfall"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="@layout/shadow_statusbar_toolbar" />
<code.name.monkey.retromusic.views.FitSystemWindowsLayout
@ -29,6 +26,12 @@
android:gravity="center_horizontal"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/status_bar" />
</FrameLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:id="@+id/album_cover_container"

View file

@ -46,12 +46,17 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.google.android.material.card.MaterialCardView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_circular_top_corners"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
@ -110,5 +115,6 @@
<include layout="@layout/activity_album_content" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -47,14 +47,19 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_circular_top_corners"
android:overScrollMode="never"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.google.android.material.card.MaterialCardView
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -96,5 +101,6 @@
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>