Hack around black theme select background color having low contrast (#6352)

This commit is contained in:
ByteHamster 2023-02-25 17:00:49 +01:00 committed by GitHub
parent 9cd59a6720
commit ebcb5e2a7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -1,7 +1,6 @@
package de.danoeh.antennapod.adapter; package de.danoeh.antennapod.adapter;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.os.Build; import android.os.Build;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.InputDevice; import android.view.InputDevice;
@ -15,7 +14,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.elevation.SurfaceColors; import de.danoeh.antennapod.ui.common.ThemeUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -120,9 +119,8 @@ public class EpisodeItemListAdapter extends SelectableAdapter<EpisodeItemViewHol
if (inActionMode()) { if (inActionMode()) {
holder.secondaryActionButton.setOnClickListener(null); holder.secondaryActionButton.setOnClickListener(null);
if (isSelected(pos)) { if (isSelected(pos)) {
Context context = mainActivityRef.get(); holder.itemView.setBackgroundColor(0x88000000
float density = context.getResources().getDisplayMetrics().density; + (0xffffff & ThemeUtils.getColorFromAttr(mainActivityRef.get(), R.attr.colorAccent)));
holder.itemView.setBackgroundColor(SurfaceColors.getColorForElevation(context, 8 * density));
} else { } else {
holder.itemView.setBackgroundResource(android.R.color.transparent); holder.itemView.setBackgroundResource(android.R.color.transparent);
} }