Folder color fix

This commit is contained in:
h4h13 2019-12-06 19:55:21 +05:30
parent ac0babeb80
commit ee6af2a6d6
5 changed files with 155 additions and 141 deletions

View file

@ -1,11 +1,15 @@
package code.name.monkey.retromusic.adapter package code.name.monkey.retromusic.adapter
import android.graphics.PorterDuff import android.graphics.PorterDuff
import android.view.* import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.base.* import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.glide.audiocover.AudioFileCover import code.name.monkey.retromusic.glide.audiocover.AudioFileCover
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.CabHolder
import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.RetroUtil
@ -16,7 +20,8 @@ import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
import java.io.File import java.io.File
import java.text.DecimalFormat import java.text.DecimalFormat
import java.util.* import java.util.*
import kotlin.math.* import kotlin.math.log10
import kotlin.math.pow
class SongFileAdapter( class SongFileAdapter(
private val activity: AppCompatActivity, private val activity: AppCompatActivity,
@ -75,17 +80,13 @@ class SongFileAdapter(
} }
private fun loadFileImage(file: File, holder: ViewHolder) { private fun loadFileImage(file: File, holder: ViewHolder) {
val iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor) val iconColor = ATHUtil.resolveColor(activity, R.attr.colorControlNormal)
if (file.isDirectory) { if (file.isDirectory) {
holder.image?.let { holder.image?.let {
it.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN) it.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN)
it.setImageResource(R.drawable.ic_folder_white_24dp) it.setImageResource(R.drawable.ic_folder_white_24dp)
} }
holder.imageTextContainer?.setCardBackgroundColor( holder.imageTextContainer?.setCardBackgroundColor(ATHUtil.resolveColor(activity, R.attr.colorSurface))
ATHUtil.resolveColor(
activity, R.attr.colorPrimary
)
)
} else { } else {
val error = RetroUtil.getTintedVectorDrawable( val error = RetroUtil.getTintedVectorDrawable(
@ -131,7 +132,7 @@ class SongFileAdapter(
init { init {
if (menu != null && callbacks != null) { if (menu != null && callbacks != null) {
menu!!.setOnClickListener { v -> menu?.setOnClickListener { v ->
val position = adapterPosition val position = adapterPosition
if (isPositionInRange(position)) { if (isPositionInRange(position)) {
callbacks.onFileMenuClicked(dataSet!![position], v) callbacks.onFileMenuClicked(dataSet!![position], v)

View file

@ -229,9 +229,8 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
private void setUpAppbarColor() { private void setUpAppbarColor() {
int primaryColor = ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorPrimary); int primaryColor = ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface);
getMainActivity().setSupportActionBar(toolbar); getMainActivity().setSupportActionBar(toolbar);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(RetroColorUtil.toolbarColor(getMainActivity())); toolbar.setBackgroundColor(RetroColorUtil.toolbarColor(getMainActivity()));
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp); toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setNavigationOnClickListener(v -> { toolbar.setNavigationOnClickListener(v -> {

View file

@ -4,7 +4,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?rectSelector" android:background="?attr/colorSurface"
android:foreground="?rectSelector"
android:gravity="center_vertical|start" android:gravity="center_vertical|start"
android:minHeight="@dimen/tab_height" android:minHeight="@dimen/tab_height"
android:orientation="horizontal" android:orientation="horizontal"

View file

@ -31,17 +31,22 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bannerContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer" android:id="@+id/imageContainer"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="228dp" android:layout_height="0dp"
app:cardCornerRadius="24dp" app:cardCornerRadius="24dp"
app:cardUseCompatPadding="true"> app:cardUseCompatPadding="true"
app:layout_constraintDimensionRatio="16:9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -134,7 +139,13 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<include layout="@layout/home_content" /> <include
</LinearLayout> layout="@layout/home_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageContainer" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</LinearLayout> </LinearLayout>

View file

@ -18,6 +18,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinatorLayout" android:id="@+id/coordinatorLayout"
android:background="?attr/colorSurface"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -25,6 +26,7 @@
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:background="@android:color/transparent"
android:elevation="0dp" android:elevation="0dp"
app:elevation="0dp"> app:elevation="0dp">
@ -73,9 +75,9 @@
android:id="@+id/breadCrumbs" android:id="@+id/breadCrumbs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/tab_height" android:layout_height="@dimen/tab_height"
app:cardBackgroundColor="?colorSurface"
android:paddingStart="60dp" android:paddingStart="60dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
app:cardBackgroundColor="?colorSurface"
app:layout_collapseMode="pin" /> app:layout_collapseMode="pin" />
</LinearLayout> </LinearLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>