added readonly message for feed items w/o media (#4711)

This commit is contained in:
markamaze 2020-12-03 13:57:58 -08:00 committed by GitHub
parent 5645407620
commit e4eacefeb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -17,7 +17,6 @@ import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.text.TextUtilsCompat; import androidx.core.text.TextUtilsCompat;
import androidx.core.util.ObjectsCompat; import androidx.core.util.ObjectsCompat;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
@ -71,7 +70,6 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -120,6 +118,7 @@ public class ItemFragment extends Fragment {
private View butAction2; private View butAction2;
private ItemActionButton actionButton1; private ItemActionButton actionButton1;
private ItemActionButton actionButton2; private ItemActionButton actionButton2;
private View noMediaLabel;
private Disposable disposable; private Disposable disposable;
private PlaybackController controller; private PlaybackController controller;
@ -169,6 +168,7 @@ public class ItemFragment extends Fragment {
butAction2Icon = layout.findViewById(R.id.butAction2Icon); butAction2Icon = layout.findViewById(R.id.butAction2Icon);
butAction1Text = layout.findViewById(R.id.butAction1Text); butAction1Text = layout.findViewById(R.id.butAction1Text);
butAction2Text = layout.findViewById(R.id.butAction2Text); butAction2Text = layout.findViewById(R.id.butAction2Text);
noMediaLabel = layout.findViewById(R.id.noMediaLabel);
butAction1.setOnClickListener(v -> { butAction1.setOnClickListener(v -> {
if (actionButton1 instanceof StreamActionButton && !UserPreferences.isStreamOverDownload() if (actionButton1 instanceof StreamActionButton && !UserPreferences.isStreamOverDownload()
@ -319,7 +319,9 @@ public class ItemFragment extends Fragment {
if (media == null) { if (media == null) {
actionButton1 = new MarkAsPlayedActionButton(item); actionButton1 = new MarkAsPlayedActionButton(item);
actionButton2 = new VisitWebsiteActionButton(item); actionButton2 = new VisitWebsiteActionButton(item);
noMediaLabel.setVisibility(View.VISIBLE);
} else { } else {
noMediaLabel.setVisibility(View.GONE);
if (media.getDuration() > 0) { if (media.getDuration() > 0) {
txtvDuration.setText(Converter.getDurationStringLong(media.getDuration())); txtvDuration.setText(Converter.getDurationStringLong(media.getDuration()));
txtvDuration.setContentDescription( txtvDuration.setContentDescription(

View File

@ -166,6 +166,15 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/noMediaLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:textAlignment="center"
android:background="?android:attr/dividerVertical"
android:text="@string/no_media_label"/>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"

View File

@ -295,6 +295,7 @@
<string name="player_go_to_picture_in_picture">Picture-in-picture mode</string> <string name="player_go_to_picture_in_picture">Picture-in-picture mode</string>
<string name="unknown_media_key">AntennaPod - Unknown media key: %1$d</string> <string name="unknown_media_key">AntennaPod - Unknown media key: %1$d</string>
<string name="error_file_not_found">File not found</string> <string name="error_file_not_found">File not found</string>
<string name="no_media_label">Item does not contain a media file</string>
<!-- Queue operations --> <!-- Queue operations -->
<string name="lock_queue">Lock Queue</string> <string name="lock_queue">Lock Queue</string>