parent
e64692d0d3
commit
bdd12de34d
|
@ -96,6 +96,7 @@ import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
||||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||||
|
import com.google.android.exoplayer2.ui.DefaultTimeBar;
|
||||||
import com.google.android.exoplayer2.ui.PlayerControlView;
|
import com.google.android.exoplayer2.ui.PlayerControlView;
|
||||||
import com.google.android.exoplayer2.upstream.DataSource;
|
import com.google.android.exoplayer2.upstream.DataSource;
|
||||||
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
||||||
|
@ -103,6 +104,7 @@ import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import com.google.android.exoplayer2.video.VideoListener;
|
import com.google.android.exoplayer2.video.VideoListener;
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -975,6 +977,19 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
userHistory.setCurrentTime(previousPositionHistory);
|
userHistory.setCurrentTime(previousPositionHistory);
|
||||||
peertube.setUserHistory(userHistory);
|
peertube.setUserHistory(userHistory);
|
||||||
|
|
||||||
|
|
||||||
|
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
|
||||||
|
DefaultTimeBar exo_progress = controlView.findViewById(R.id.exo_progress);
|
||||||
|
TextView exo_duration = controlView.findViewById(R.id.exo_duration);
|
||||||
|
if (peertube.isLive()) {
|
||||||
|
exo_progress.setVisibility(View.GONE);
|
||||||
|
exo_duration.setText(R.string.live);
|
||||||
|
exo_duration.setBackgroundResource(R.drawable.rounded_live);
|
||||||
|
} else {
|
||||||
|
exo_progress.setVisibility(View.VISIBLE);
|
||||||
|
exo_duration.setBackground(null);
|
||||||
|
}
|
||||||
|
|
||||||
if (peertube.getUserHistory() != null) {
|
if (peertube.getUserHistory() != null) {
|
||||||
position = peertube.getUserHistory().getCurrentTime() * 1000;
|
position = peertube.getUserHistory().getCurrentTime() * 1000;
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1041,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
LinkedHashMap<Integer, String> categoryInit = new LinkedHashMap<>(peertubeInformation.getCategories());
|
LinkedHashMap<Integer, String> categoryInit = new LinkedHashMap<>(peertubeInformation.getCategories());
|
||||||
info_category.setText(categoryInit.get(peertube.getCategory().getId()));
|
info_category.setText(categoryInit.get(peertube.getCategory().getId()));
|
||||||
|
|
||||||
info_duration.setText(Helper.secondsToString(peertube.getDuration()));
|
if (peertube.isLive()) {
|
||||||
|
info_duration.setText(R.string.live);
|
||||||
|
info_duration.setBackgroundResource(R.drawable.rounded_live);
|
||||||
|
} else {
|
||||||
|
info_duration.setText(Helper.secondsToString(peertube.getDuration()));
|
||||||
|
}
|
||||||
|
|
||||||
String format = DateFormat.getDateInstance(DateFormat.LONG).format(peertube.getPublishedAt());
|
String format = DateFormat.getDateInstance(DateFormat.LONG).format(peertube.getPublishedAt());
|
||||||
info_published_at.setText(format);
|
info_published_at.setText(format);
|
||||||
List<String> tags = peertube.getTags();
|
List<String> tags = peertube.getTags();
|
||||||
|
@ -1343,6 +1364,14 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
|
|
||||||
private void startStream(String videoURL, String streamingPlaylistsURLS, boolean autoPlay, long position, Uri subtitles, String lang, boolean promptNSFW) {
|
private void startStream(String videoURL, String streamingPlaylistsURLS, boolean autoPlay, long position, Uri subtitles, String lang, boolean promptNSFW) {
|
||||||
|
|
||||||
|
|
||||||
|
if (peertube != null && peertube.isWaitTranscoding()) {
|
||||||
|
View parentLayout = findViewById(android.R.id.content);
|
||||||
|
Snackbar snackbar = Snackbar.make(parentLayout, R.string.live_not_started, Snackbar.LENGTH_INDEFINITE);
|
||||||
|
snackbar.setAction(R.string.close, view -> finish());
|
||||||
|
snackbar.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
chromeCastVideoURL = videoURL;
|
chromeCastVideoURL = videoURL;
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
String nsfwAction = sharedpreferences.getString(getString(R.string.set_video_sensitive_choice), Helper.BLUR);
|
String nsfwAction = sharedpreferences.getString(getString(R.string.set_video_sensitive_choice), Helper.BLUR);
|
||||||
|
@ -2064,6 +2093,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
openMainMenuOptions();
|
openMainMenuOptions();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRequestedOrientationCustom(int orientationCustom) {
|
private void setRequestedOrientationCustom(int orientationCustom) {
|
||||||
|
|
|
@ -88,6 +88,8 @@ public class VideoData {
|
||||||
private List<File> files;
|
private List<File> files;
|
||||||
@SerializedName("id")
|
@SerializedName("id")
|
||||||
private String id;
|
private String id;
|
||||||
|
@SerializedName("isLive")
|
||||||
|
private boolean isLive = false;
|
||||||
@SerializedName("isLocal")
|
@SerializedName("isLocal")
|
||||||
private boolean isLocal;
|
private boolean isLocal;
|
||||||
@SerializedName("language")
|
@SerializedName("language")
|
||||||
|
@ -163,6 +165,7 @@ public class VideoData {
|
||||||
this.files = new ArrayList<>();
|
this.files = new ArrayList<>();
|
||||||
in.readList(this.files, File.class.getClassLoader());
|
in.readList(this.files, File.class.getClassLoader());
|
||||||
this.id = in.readString();
|
this.id = in.readString();
|
||||||
|
this.isLive = in.readByte() != 0;
|
||||||
this.isLocal = in.readByte() != 0;
|
this.isLocal = in.readByte() != 0;
|
||||||
this.language = in.readParcelable(ItemStr.class.getClassLoader());
|
this.language = in.readParcelable(ItemStr.class.getClassLoader());
|
||||||
this.licence = in.readParcelable(Item.class.getClassLoader());
|
this.licence = in.readParcelable(Item.class.getClassLoader());
|
||||||
|
@ -413,6 +416,14 @@ public class VideoData {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLive() {
|
||||||
|
return isLive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLive(boolean live) {
|
||||||
|
isLive = live;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLocal() {
|
public boolean isLocal() {
|
||||||
return isLocal;
|
return isLocal;
|
||||||
}
|
}
|
||||||
|
@ -668,6 +679,7 @@ public class VideoData {
|
||||||
dest.writeString(this.embedUrl);
|
dest.writeString(this.embedUrl);
|
||||||
dest.writeList(this.files);
|
dest.writeList(this.files);
|
||||||
dest.writeString(this.id);
|
dest.writeString(this.id);
|
||||||
|
dest.writeByte(this.isLive ? (byte) 1 : (byte) 0);
|
||||||
dest.writeByte(this.isLocal ? (byte) 1 : (byte) 0);
|
dest.writeByte(this.isLocal ? (byte) 1 : (byte) 0);
|
||||||
dest.writeParcelable(this.language, flags);
|
dest.writeParcelable(this.language, flags);
|
||||||
dest.writeParcelable(this.licence, flags);
|
dest.writeParcelable(this.licence, flags);
|
||||||
|
|
|
@ -147,7 +147,15 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||||
Helper.loadGiF(context, instance, video.getChannel().getAvatar() != null ? video.getChannel().getAvatar().getPath() : null, holder.binding.peertubeProfile);
|
Helper.loadGiF(context, instance, video.getChannel().getAvatar() != null ? video.getChannel().getAvatar().getPath() : null, holder.binding.peertubeProfile);
|
||||||
|
|
||||||
holder.binding.peertubeTitle.setText(video.getName());
|
holder.binding.peertubeTitle.setText(video.getName());
|
||||||
holder.binding.peertubeDuration.setText(Helper.secondsToString(video.getDuration()));
|
if (video.isLive()) {
|
||||||
|
holder.binding.peertubeDuration.setText(R.string.live);
|
||||||
|
holder.binding.peertubeDuration.setBackgroundResource(R.drawable.rounded_live);
|
||||||
|
} else {
|
||||||
|
holder.binding.peertubeDuration.setText(Helper.secondsToString(video.getDuration()));
|
||||||
|
holder.binding.peertubeDuration.setBackgroundResource(R.drawable.rounded_corner);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
holder.binding.peertubeDate.setText(String.format(" - %s", Helper.dateDiff(context, video.getCreatedAt())));
|
holder.binding.peertubeDate.setText(String.format(" - %s", Helper.dateDiff(context, video.getCreatedAt())));
|
||||||
holder.binding.peertubeViews.setText(context.getString(R.string.number_view_video, Helper.withSuffix(video.getViews())));
|
holder.binding.peertubeViews.setText(context.getString(R.string.number_view_video, Helper.withSuffix(video.getViews())));
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="@color/red_1" />
|
||||||
|
|
||||||
|
<solid android:color="@color/red_1" />
|
||||||
|
|
||||||
|
<padding
|
||||||
|
android:bottom="1dp"
|
||||||
|
android:left="1dp"
|
||||||
|
android:right="1dp"
|
||||||
|
android:top="1dp" />
|
||||||
|
<corners android:radius="5dp" />
|
||||||
|
</shape>
|
|
@ -443,4 +443,6 @@
|
||||||
|
|
||||||
<string name="set_video_language">Language filter</string>
|
<string name="set_video_language">Language filter</string>
|
||||||
<string name="set_video_language_description">Filter videos with different languages</string>
|
<string name="set_video_language_description">Filter videos with different languages</string>
|
||||||
|
<string name="live">Live</string>
|
||||||
|
<string name="live_not_started">This live has not started!</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue