Fix folder toolbar and folder icon background

main
h4h13 2019-07-30 09:32:56 +05:30
parent 33ed4fe4c3
commit 310cfe8491
3 changed files with 22 additions and 25 deletions

View File

@ -8,13 +8,14 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.appthemehelper.ThemeStore
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.AbsMultiSelectAdapter
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.glide.GlideApp import code.name.monkey.retromusic.glide.GlideApp
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.adapter.base.AbsMultiSelectAdapter
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.RetroUtil
import com.bumptech.glide.GenericTransitionOptions import com.bumptech.glide.GenericTransitionOptions
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
@ -81,8 +82,12 @@ class SongFileAdapter(private val activity: AppCompatActivity, private var dataS
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.iconColor)
if (file.isDirectory) { if (file.isDirectory) {
holder.image!!.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN) holder.image?.let {
holder.image!!.setImageResource(R.drawable.ic_folder_white_24dp) it.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN)
it.setImageResource(R.drawable.ic_folder_white_24dp)
}
holder.imageTextContainer?.setCardBackgroundColor(ThemeStore.primaryColor(activity))
} else { } else {
val error = RetroUtil.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor) val error = RetroUtil.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor)
GlideApp.with(activity) GlideApp.with(activity)

View File

@ -18,7 +18,6 @@ import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.media.MediaScannerConnection; import android.media.MediaScannerConnection;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.widget.Toast; import android.widget.Toast;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -58,17 +57,7 @@ public class UpdateToastMediaScannerCompletionListener implements MediaScannerCo
} }
String text = " " + String.format(scannedFiles, scanned, toBeScanned.length) + (failed > 0 ? " " + String.format(couldNotScanFiles, failed) : ""); String text = " " + String.format(scannedFiles, scanned, toBeScanned.length) + (failed > 0 ? " " + String.format(couldNotScanFiles, failed) : "");
toast.setText(text); toast.setText(text);
try { toast.show();
if (toast.getView().isShown()) {
toast.cancel();
}
if (Build.VERSION.SDK_INT < 28 && toast.getView().isShown()) {
toast.cancel();
}
toast.show();
} catch (Exception e) {
e.printStackTrace();
}
}); });
} }
} }

View File

@ -31,30 +31,33 @@
app:elevation="0dp"> app:elevation="0dp">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/toolbarContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:cardCornerRadius="8dp" app:cardCornerRadius="8dp"
app:cardElevation="6dp" app:cardElevation="0dp"
app:cardUseCompatPadding="true"> app:cardUseCompatPadding="true"
app:layout_scrollFlags="scroll|enterAlways"
app:strokeColor="?dividerColor"
app:strokeWidth="1dp">
<FrameLayout <FrameLayout
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">
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
android:layout_gravity="center_vertical"
app:layout_collapseMode="pin"
app:titleMarginStart="0dp"
app:title="@string/folders" app:title="@string/folders"
app:titleMarginStart="0dp"
tools:ignore="UnusedAttribute" /> tools:ignore="UnusedAttribute" />
<ViewStub <ViewStub
android:id="@+id/cab_stub" android:id="@+id/cab_stub"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="48dp" />
</FrameLayout> </FrameLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>