mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-02-03 12:07:39 +01:00
Increase touchable area
This commit is contained in:
parent
29010b857e
commit
3ca6be8b04
@ -49,11 +49,8 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter {
|
|||||||
final FeedItem item = getItem(position);
|
final FeedItem item = getItem(position);
|
||||||
holder.bind(item);
|
holder.bind(item);
|
||||||
holder.dragHandle.setVisibility(View.GONE);
|
holder.dragHandle.setVisibility(View.GONE);
|
||||||
holder.butSecondary.setImageResource(R.drawable.ic_delete_grey600_24dp);
|
holder.secondaryActionIcon.setImageResource(R.drawable.ic_delete_grey600_24dp);
|
||||||
holder.butSecondary.setOnClickListener(v -> {
|
holder.secondaryActionButton.setOnClickListener(v -> itemAccess.onFeedItemSecondaryAction(item));
|
||||||
FeedItem item1 = (FeedItem) v.getTag();
|
|
||||||
itemAccess.onFeedItemSecondaryAction(item1);
|
|
||||||
});
|
|
||||||
holder.hideSeparatorIfNecessary();
|
holder.hideSeparatorIfNecessary();
|
||||||
|
|
||||||
return holder.itemView;
|
return holder.itemView;
|
||||||
|
@ -2,6 +2,7 @@ package de.danoeh.antennapod.adapter.actionbutton;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
import android.widget.ImageView;
|
||||||
import androidx.annotation.AttrRes;
|
import androidx.annotation.AttrRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
@ -53,14 +54,13 @@ public abstract class ItemActionButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void configure(@NonNull ImageButton button, Context context) {
|
public void configure(@NonNull View button, @NonNull ImageView icon, Context context) {
|
||||||
TypedArray drawables = context.obtainStyledAttributes(new int[]{getDrawable()});
|
|
||||||
|
|
||||||
button.setVisibility(getVisibility());
|
button.setVisibility(getVisibility());
|
||||||
button.setContentDescription(context.getString(getLabel()));
|
button.setContentDescription(context.getString(getLabel()));
|
||||||
button.setImageDrawable(drawables.getDrawable(0));
|
|
||||||
button.setOnClickListener((view) -> onClick(context));
|
button.setOnClickListener((view) -> onClick(context));
|
||||||
|
|
||||||
|
TypedArray drawables = context.obtainStyledAttributes(new int[]{getDrawable()});
|
||||||
|
icon.setImageDrawable(drawables.getDrawable(0));
|
||||||
drawables.recycle();
|
drawables.recycle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,8 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
|||||||
private final ImageView isVideo;
|
private final ImageView isVideo;
|
||||||
public final ImageView isFavorite;
|
public final ImageView isFavorite;
|
||||||
private final ProgressBar progressBar;
|
private final ProgressBar progressBar;
|
||||||
public final ImageButton butSecondary;
|
public final View secondaryActionButton;
|
||||||
|
public final ImageView secondaryActionIcon;
|
||||||
private final CircularProgressBar secondaryActionProgress;
|
private final CircularProgressBar secondaryActionProgress;
|
||||||
private final MainActivity activity;
|
private final MainActivity activity;
|
||||||
private final TextView separatorIcons;
|
private final TextView separatorIcons;
|
||||||
@ -72,7 +73,6 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
|||||||
pubDate = itemView.findViewById(R.id.txtvPubDate);
|
pubDate = itemView.findViewById(R.id.txtvPubDate);
|
||||||
position = itemView.findViewById(R.id.txtvPosition);
|
position = itemView.findViewById(R.id.txtvPosition);
|
||||||
duration = itemView.findViewById(R.id.txtvDuration);
|
duration = itemView.findViewById(R.id.txtvDuration);
|
||||||
butSecondary = itemView.findViewById(R.id.butSecondaryAction);
|
|
||||||
progressBar = itemView.findViewById(R.id.progressBar);
|
progressBar = itemView.findViewById(R.id.progressBar);
|
||||||
isInQueue = itemView.findViewById(R.id.ivInPlaylist);
|
isInQueue = itemView.findViewById(R.id.ivInPlaylist);
|
||||||
isVideo = itemView.findViewById(R.id.ivIsVideo);
|
isVideo = itemView.findViewById(R.id.ivIsVideo);
|
||||||
@ -81,6 +81,8 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
|||||||
size = itemView.findViewById(R.id.size);
|
size = itemView.findViewById(R.id.size);
|
||||||
separatorIcons = itemView.findViewById(R.id.separatorIcons);
|
separatorIcons = itemView.findViewById(R.id.separatorIcons);
|
||||||
secondaryActionProgress = itemView.findViewById(R.id.secondaryActionProgress);
|
secondaryActionProgress = itemView.findViewById(R.id.secondaryActionProgress);
|
||||||
|
secondaryActionButton = itemView.findViewById(R.id.secondaryActionButton);
|
||||||
|
secondaryActionIcon = itemView.findViewById(R.id.secondaryActionIcon);
|
||||||
itemView.setTag(this);
|
itemView.setTag(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,9 +108,8 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
|||||||
itemView.setAlpha(item.isPlayed() /*&& makePlayedItemsTransparent*/ ? 0.5f : 1.0f);
|
itemView.setAlpha(item.isPlayed() /*&& makePlayedItemsTransparent*/ ? 0.5f : 1.0f);
|
||||||
|
|
||||||
ItemActionButton actionButton = ItemActionButton.forItem(item, true);
|
ItemActionButton actionButton = ItemActionButton.forItem(item, true);
|
||||||
actionButton.configure(butSecondary, activity);
|
actionButton.configure(secondaryActionButton, secondaryActionIcon, activity);
|
||||||
butSecondary.setFocusable(false);
|
secondaryActionButton.setFocusable(false);
|
||||||
butSecondary.setTag(item);
|
|
||||||
|
|
||||||
if (item.getMedia() != null) {
|
if (item.getMedia() != null) {
|
||||||
bind(item.getMedia());
|
bind(item.getMedia());
|
||||||
@ -131,7 +132,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
|||||||
if (media.isCurrentlyPlaying()) {
|
if (media.isCurrentlyPlaying()) {
|
||||||
container.setBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.currently_playing_background));
|
container.setBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.currently_playing_background));
|
||||||
} else {
|
} else {
|
||||||
container.setBackgroundColor(Color.TRANSPARENT);
|
container.setBackgroundResource(ThemeUtils.getDrawableFromAttr(activity, R.attr.selectableItemBackground));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DownloadRequester.getInstance().isDownloadingFile(media)) {
|
if (DownloadRequester.getInstance().isDownloadingFile(media)) {
|
||||||
|
@ -2,20 +2,21 @@
|
|||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="48dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
android:layout_marginEnd="16dp">
|
android:layout_marginEnd="16dp"
|
||||||
|
android:id="@+id/secondaryActionButton"
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/butSecondaryAction"
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="32dp"
|
|
||||||
android:clickable="false"
|
|
||||||
android:focusable="false"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:focusableInTouchMode="false"
|
|
||||||
tools:ignore="ContentDescription"
|
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/secondaryActionIcon"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
tools:ignore="ContentDescription"
|
||||||
tools:src="@sample/secondaryaction"/>
|
tools:src="@sample/secondaryaction"/>
|
||||||
|
|
||||||
<de.danoeh.antennapod.view.CircularProgressBar
|
<de.danoeh.antennapod.view.CircularProgressBar
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import androidx.annotation.AttrRes;
|
import androidx.annotation.AttrRes;
|
||||||
import androidx.annotation.ColorInt;
|
import androidx.annotation.ColorInt;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
import androidx.annotation.DrawableRes;
|
||||||
|
|
||||||
public class ThemeUtils {
|
public class ThemeUtils {
|
||||||
private ThemeUtils() {
|
private ThemeUtils() {
|
||||||
@ -15,4 +16,10 @@ public class ThemeUtils {
|
|||||||
context.getTheme().resolveAttribute(attr, typedValue, true);
|
context.getTheme().resolveAttribute(attr, typedValue, true);
|
||||||
return typedValue.data;
|
return typedValue.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static @DrawableRes int getDrawableFromAttr(Context context, @AttrRes int attr) {
|
||||||
|
TypedValue typedValue = new TypedValue();
|
||||||
|
context.getTheme().resolveAttribute(attr, typedValue, true);
|
||||||
|
return typedValue.resourceId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user