summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh
diff options
context:
space:
mode:
authorH. Lehmann <ByteHamster@users.noreply.github.com>2020-01-28 18:56:11 +0100
committerGitHub <noreply@github.com>2020-01-28 18:56:11 +0100
commit8fa59a0648d238ea10419dd32852fae87af00e3d (patch)
tree1d16506df18f2e4f15ff6f3cb025716bc62fd54a /app/src/main/java/de/danoeh
parent2a7b5b4311bfe2a10e1100f928025c398e66003f (diff)
parentcb9c999d437cc1d2170e47e891a319ab6f8e4ffd (diff)
downloadAntennaPod-8fa59a0648d238ea10419dd32852fae87af00e3d.zip
Merge pull request #3800 from ByteHamster/fix-multiline-button
Fixed multi-line buttons
Diffstat (limited to 'app/src/main/java/de/danoeh')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java68
1 files changed, 38 insertions, 30 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
index a8a518157..2c0400942 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
@@ -107,8 +107,12 @@ public class ItemFragment extends Fragment {
private ImageView imgvCover;
private ProgressBar progbarDownload;
private ProgressBar progbarLoading;
- private Button butAction1;
- private Button butAction2;
+ private TextView butAction1Text;
+ private TextView butAction2Text;
+ private ImageView butAction1Icon;
+ private ImageView butAction2Icon;
+ private View butAction1;
+ private View butAction2;
private Disposable disposable;
@@ -178,6 +182,10 @@ public class ItemFragment extends Fragment {
progbarLoading = layout.findViewById(R.id.progbarLoading);
butAction1 = layout.findViewById(R.id.butAction1);
butAction2 = layout.findViewById(R.id.butAction2);
+ butAction1Icon = layout.findViewById(R.id.butAction1Icon);
+ butAction2Icon = layout.findViewById(R.id.butAction2Icon);
+ butAction1Text = layout.findViewById(R.id.butAction1Text);
+ butAction2Text = layout.findViewById(R.id.butAction2Text);
butAction1.setOnClickListener(v -> {
if (item == null) {
@@ -301,18 +309,18 @@ public class ItemFragment extends Fragment {
}
FeedMedia media = item.getMedia();
- @AttrRes int butAction1Icon = 0;
- @StringRes int butAction1Text = 0;
- @AttrRes int butAction2Icon = 0;
- @StringRes int butAction2Text = 0;
+ @AttrRes int butAction1IconRes = 0;
+ @StringRes int butAction1TextRes = 0;
+ @AttrRes int butAction2IconRes = 0;
+ @StringRes int butAction2TextRes = 0;
if (media == null) {
if (!item.isPlayed()) {
- butAction1Icon = R.attr.navigation_accept;
- butAction1Text = R.string.mark_read_label;
+ butAction1IconRes = R.attr.navigation_accept;
+ butAction1TextRes = R.string.mark_read_label;
}
if (item.getLink() != null) {
- butAction2Icon = R.attr.location_web_site;
- butAction2Text = R.string.visit_website_label;
+ butAction2IconRes = R.attr.location_web_site;
+ butAction2TextRes = R.string.visit_website_label;
}
} else {
if (media.getDuration() > 0) {
@@ -320,40 +328,40 @@ public class ItemFragment extends Fragment {
}
boolean isDownloading = DownloadRequester.getInstance().isDownloadingFile(media);
if (!media.isDownloaded()) {
- butAction2Icon = R.attr.action_stream;
- butAction2Text = R.string.stream_label;
+ butAction2IconRes = R.attr.action_stream;
+ butAction2TextRes = R.string.stream_label;
} else {
- butAction2Icon = R.attr.content_discard;
- butAction2Text = R.string.delete_label;
+ butAction2IconRes = R.attr.content_discard;
+ butAction2TextRes = R.string.delete_label;
}
if (isDownloading) {
- butAction1Icon = R.attr.navigation_cancel;
- butAction1Text = R.string.cancel_label;
+ butAction1IconRes = R.attr.navigation_cancel;
+ butAction1TextRes = R.string.cancel_label;
} else if (media.isDownloaded()) {
- butAction1Icon = R.attr.av_play;
- butAction1Text = R.string.play_label;
+ butAction1IconRes = R.attr.av_play;
+ butAction1TextRes = R.string.play_label;
} else {
- butAction1Icon = R.attr.av_download;
- butAction1Text = R.string.download_label;
+ butAction1IconRes = R.attr.av_download;
+ butAction1TextRes = R.string.download_label;
}
}
- if (butAction1Icon != 0 && butAction1Text != 0) {
- butAction1.setText(butAction1Text);
- butAction1.setTransformationMethod(null);
+ if (butAction1IconRes != 0 && butAction1TextRes != 0) {
+ butAction1Text.setText(butAction1TextRes);
+ butAction1Text.setTransformationMethod(null);
TypedValue typedValue = new TypedValue();
- getContext().getTheme().resolveAttribute(butAction1Icon, typedValue, true);
- butAction1.setCompoundDrawablesWithIntrinsicBounds(typedValue.resourceId, 0, 0, 0);
+ getContext().getTheme().resolveAttribute(butAction1IconRes, typedValue, true);
+ butAction1Icon.setImageResource(typedValue.resourceId);
butAction1.setVisibility(View.VISIBLE);
} else {
butAction1.setVisibility(View.INVISIBLE);
}
- if (butAction2Icon != 0 && butAction2Text != 0) {
- butAction2.setText(butAction2Text);
- butAction2.setTransformationMethod(null);
+ if (butAction2IconRes != 0 && butAction2TextRes != 0) {
+ butAction2Text.setText(butAction2TextRes);
+ butAction2Text.setTransformationMethod(null);
TypedValue typedValue = new TypedValue();
- getContext().getTheme().resolveAttribute(butAction2Icon, typedValue, true);
- butAction2.setCompoundDrawablesWithIntrinsicBounds(typedValue.resourceId, 0, 0, 0);
+ getContext().getTheme().resolveAttribute(butAction2IconRes, typedValue, true);
+ butAction2Icon.setImageResource(typedValue.resourceId);
butAction2.setVisibility(View.VISIBLE);
} else {
butAction2.setVisibility(View.INVISIBLE);