diff --git a/CHANGELOG.md b/CHANGELOG.md
index 278d0ce..52bc736 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+### Version 1.0.53 Tag: v1.0.53 (2021-01-24)
+ - Making X in pip mode stop background audio properly (@dhk2)
+ - Adding clear search history option to settings menu (@dhk2)
+ - Fix no language selected defaults to all video languages
+ - Updated icon library
+ - Added buffering indicator to video playback
+ - Fixed blank video issues on servers offering 0p video.
+ - Updated translations
+
### Version 1.0.52 Tag: v1.0.52 (2021-01-17)
- Implemented edit server in server book (@kosharskiy)
- Updated translations
diff --git a/app/build.gradle b/app/build.gradle
index ef4901c..0f94fb4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -109,11 +109,11 @@ dependencies {
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.fragment:fragment-ktx:$fragment_version"
- implementation 'de.hdodenhof:circleimageview:3.0.0'
+ implementation 'de.hdodenhof:circleimageview:3.1.0'
// font awesome
- implementation "com.mikepenz:iconics-core:3.1.0"
- implementation 'com.mikepenz:fontawesome-typeface:5.3.1.1@aar'
+ implementation 'com.mikepenz:iconics-core:5.2.4'
+ implementation 'com.mikepenz:fontawesome-typeface:5.9.0.2-kotlin@aar'
// http client / REST
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
@@ -141,10 +141,10 @@ dependencies {
implementation "com.google.android.exoplayer:extension-okhttp:$exoplayer"
// date formatter
- implementation 'org.ocpsoft.prettytime:prettytime:4.0.4.Final'
+ implementation 'org.ocpsoft.prettytime:prettytime:5.0.0.Final'
// Version comparison
- implementation 'org.apache.maven:maven-artifact:3.5.0'
+ implementation 'org.apache.maven:maven-artifact:3.6.3'
// database lib
implementation "androidx.room:room-runtime:$room_version"
@@ -162,7 +162,7 @@ dependencies {
implementation 'androidx.preference:preference-ktx:1.1.1'
// testing
- testImplementation 'junit:junit:4.13'
+ testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation "androidx.room:room-testing:$room_version"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3091705..a872992 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -67,6 +67,13 @@
android:exported="false" />
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/net/schueller/peertube/activity/AccountActivity.java b/app/src/main/java/net/schueller/peertube/activity/AccountActivity.java
index f9006d3..6f933cd 100644
--- a/app/src/main/java/net/schueller/peertube/activity/AccountActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/AccountActivity.java
@@ -24,12 +24,11 @@ import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
-import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
-import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable;
+import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome;
import com.squareup.picasso.Picasso;
import net.schueller.peertube.R;
diff --git a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java
index a760c4a..8ee78a6 100644
--- a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java
@@ -50,11 +50,10 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
-import android.widget.Toast;
-import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable;
+import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome;
import net.schueller.peertube.R;
import net.schueller.peertube.adapter.VideoAdapter;
import net.schueller.peertube.helper.APIUrlHelper;
@@ -130,15 +129,15 @@ public class VideoListActivity extends CommonActivity {
// Set an icon in the ActionBar
menu.findItem(R.id.action_account).setIcon(
- new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle).actionBar());
+ new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle));
menu.findItem(R.id.action_server_address_book).setIcon(
- new IconicsDrawable(this, FontAwesome.Icon.faw_server).actionBar());
+ new IconicsDrawable(this, FontAwesome.Icon.faw_server));
MenuItem searchMenuItem = menu.findItem(R.id.action_search);
searchMenuItem.setIcon(
- new IconicsDrawable(this, FontAwesome.Icon.faw_search).actionBar());
+ new IconicsDrawable(this, FontAwesome.Icon.faw_search));
// Get the SearchView and set the searchable configuration
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
@@ -324,13 +323,16 @@ public class VideoListActivity extends CommonActivity {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String nsfw = sharedPref.getBoolean(getString(R.string.pref_show_nsfw_key), false) ? "both" : "false";
- Locale locale = getResources().getConfiguration().locale;
- String country = locale.getLanguage();
+//
+// Locale locale = getResources().getConfiguration().locale;
+// String country = locale.getLanguage();
+//
+// HashSet countries = new HashSet<>(1);
+// countries.add(country);
- HashSet countries = new HashSet<>(1);
- countries.add(country);
+ // We set this to default to null so that on initial start there are videos listed.
+ Set languages = sharedPref.getStringSet(getString(R.string.pref_video_language_key), null);
- Set languages = sharedPref.getStringSet(getString(R.string.pref_video_language_key), countries);
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL, APIUrlHelper.useInsecureConnection(this)).create(GetVideoDataService.class);
diff --git a/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java b/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java
index 3e92433..55fbb02 100644
--- a/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java
+++ b/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java
@@ -115,7 +115,7 @@ public class ChannelAdapter extends RecyclerView.Adapter {
diff --git a/app/src/main/java/net/schueller/peertube/adapter/ServerSearchAdapter.java b/app/src/main/java/net/schueller/peertube/adapter/ServerSearchAdapter.java
index 6a2c74f..ab9dac9 100644
--- a/app/src/main/java/net/schueller/peertube/adapter/ServerSearchAdapter.java
+++ b/app/src/main/java/net/schueller/peertube/adapter/ServerSearchAdapter.java
@@ -119,7 +119,7 @@ public class ServerSearchAdapter extends RecyclerView.Adapter {
//
diff --git a/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java b/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java
index 5c720d3..36b5c81 100644
--- a/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java
+++ b/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java
@@ -131,7 +131,7 @@ public class VideoAdapter extends RecyclerView.Adapter {
diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoMenuQualityFragment.java b/app/src/main/java/net/schueller/peertube/fragment/VideoMenuQualityFragment.java
index d1de80f..04c5485 100644
--- a/app/src/main/java/net/schueller/peertube/fragment/VideoMenuQualityFragment.java
+++ b/app/src/main/java/net/schueller/peertube/fragment/VideoMenuQualityFragment.java
@@ -52,9 +52,9 @@ public class VideoMenuQualityFragment extends BottomSheetDialogFragment {
if (autoQualityFile == null) {
autoQualityFile = new File();
Resolution autoQualityResolution = new Resolution();
- autoQualityResolution.setId(0);
+ autoQualityResolution.setId(999999);
autoQualityResolution.setLabel(context.getString(R.string.menu_video_options_quality_automated));
- autoQualityFile.setId(0);
+ autoQualityFile.setId(999999);
autoQualityFile.setResolution(autoQualityResolution);
}
if (!mFiles.contains(autoQualityFile)) {
@@ -74,7 +74,7 @@ public class VideoMenuQualityFragment extends BottomSheetDialogFragment {
false);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
- Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 0);
+ Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 999999);
for (File file : mFiles) {
@@ -95,11 +95,13 @@ public class VideoMenuQualityFragment extends BottomSheetDialogFragment {
for (File fileV : mFiles) {
TextView iconViewV = view.findViewById(fileV.getResolution().getId());
- iconViewV.setText("");
+ if (iconViewV != null) {
+ iconViewV.setText("");
+ }
}
iconView.setText(R.string.video_quality_active_icon);
- new Iconics.IconicsBuilder().ctx(getContext()).on(iconView).build();
+ new Iconics.Builder().on(iconView).build();
//TODO: set new video quality on running video
@@ -112,7 +114,7 @@ public class VideoMenuQualityFragment extends BottomSheetDialogFragment {
// Set current
if (videoQuality.equals(file.getResolution().getId())) {
iconView.setText(R.string.video_quality_active_icon);
- new Iconics.IconicsBuilder().ctx(getContext()).on(iconView).build();
+ new Iconics.Builder().on(iconView).build();
}
}
diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoMenuSpeedFragment.java b/app/src/main/java/net/schueller/peertube/fragment/VideoMenuSpeedFragment.java
index da7a2fa..c43f084 100644
--- a/app/src/main/java/net/schueller/peertube/fragment/VideoMenuSpeedFragment.java
+++ b/app/src/main/java/net/schueller/peertube/fragment/VideoMenuSpeedFragment.java
@@ -100,7 +100,7 @@ public class VideoMenuSpeedFragment extends BottomSheetDialogFragment {
videoPlayerService.setPlayBackSpeed(speed);
icon.setText(R.string.video_speed_active_icon);
- new Iconics.IconicsBuilder().ctx(getContext()).on(icon).build();
+ new Iconics.Builder().on(icon).build();
}
}
\ No newline at end of file
diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.java b/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.java
index d7f30f7..7061288 100644
--- a/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.java
+++ b/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.java
@@ -105,7 +105,7 @@ public class VideoMetaDataFragment extends Fragment {
Button thumbsUpButton = activity.findViewById(R.id.video_thumbs_up);
defaultTextColor = thumbsUpButton.getTextColors();
thumbsUpButton.setText(R.string.video_thumbs_up_icon);
- new Iconics.IconicsBuilder().ctx(context).on(thumbsUpButton).build();
+ new Iconics.Builder().on(thumbsUpButton).build();
thumbsUpButton.setOnClickListener(v -> {
rateVideo(true, video);
});
@@ -113,7 +113,7 @@ public class VideoMetaDataFragment extends Fragment {
// Thumbs Down
Button thumbsDownButton = activity.findViewById(R.id.video_thumbs_down);
thumbsDownButton.setText(R.string.video_thumbs_down_icon);
- new Iconics.IconicsBuilder().ctx(context).on(thumbsDownButton).build();
+ new Iconics.Builder().on(thumbsDownButton).build();
thumbsDownButton.setOnClickListener(v -> {
rateVideo(false, video);
});
@@ -145,7 +145,7 @@ public class VideoMetaDataFragment extends Fragment {
// Share
Button videoShareButton = activity.findViewById(R.id.video_share);
videoShareButton.setText(R.string.video_share_icon);
- new Iconics.IconicsBuilder().ctx(context).on(videoShareButton).build();
+ new Iconics.Builder().on(videoShareButton).build();
videoShareButton.setOnClickListener(v ->
{
leaveAppExpected = true;
@@ -155,7 +155,7 @@ public class VideoMetaDataFragment extends Fragment {
// Download
Button videoDownloadButton = activity.findViewById(R.id.video_download);
videoDownloadButton.setText(R.string.video_download_icon);
- new Iconics.IconicsBuilder().ctx(context).on(videoDownloadButton).build();
+ new Iconics.Builder().on(videoDownloadButton).build();
videoDownloadButton.setOnClickListener(v -> {
// get permission to store file
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
@@ -235,7 +235,7 @@ public class VideoMetaDataFragment extends Fragment {
// more button
TextView moreButton = activity.findViewById(R.id.moreButton);
moreButton.setText(R.string.video_more_icon);
- new Iconics.IconicsBuilder().ctx(context).on(moreButton).build();
+ new Iconics.Builder().on(moreButton).build();
moreButton.setOnClickListener(v -> {
PopupMenu popup = new PopupMenu(context, v);
@@ -260,7 +260,7 @@ public class VideoMetaDataFragment extends Fragment {
// video player options
TextView videoOptions = activity.findViewById(R.id.exo_more);
videoOptions.setText(R.string.video_more_icon);
- new Iconics.IconicsBuilder().ctx(context).on(videoOptions).build();
+ new Iconics.Builder().on(videoOptions).build();
videoOptions.setOnClickListener(v -> {
VideoOptionsFragment videoOptionsFragment =
diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoOptionsFragment.java b/app/src/main/java/net/schueller/peertube/fragment/VideoOptionsFragment.java
index 6f66fe9..3914d34 100644
--- a/app/src/main/java/net/schueller/peertube/fragment/VideoOptionsFragment.java
+++ b/app/src/main/java/net/schueller/peertube/fragment/VideoOptionsFragment.java
@@ -77,7 +77,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
iconView.setText(R.string.video_option_speed_icon);
- new Iconics.IconicsBuilder().ctx(getContext()).on(iconView).build();
+ new Iconics.Builder().on(iconView).build();
textView.setOnClickListener(view1 -> {
VideoMenuSpeedFragment videoMenuSpeedFragment =
VideoMenuSpeedFragment.newInstance(videoPlayerService);
@@ -92,7 +92,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
TextView textView2 = menuRow2.findViewById(R.id.video_quality_text);
textView2.setText(String.format(getString(R.string.menu_video_options_quality), getCurrentVideoQuality(files)));
iconView2.setText(R.string.video_option_quality_icon);
- new Iconics.IconicsBuilder().ctx(getContext()).on(iconView2).build();
+ new Iconics.Builder().on(iconView2).build();
textView2.setOnClickListener(view1 -> {
VideoMenuQualityFragment videoMenuQualityFragment =
VideoMenuQualityFragment.newInstance(getContext(), files);
@@ -107,7 +107,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
private String getCurrentVideoQuality(ArrayList files) {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
- Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 0);
+ Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 999999);
for (File file : files) {
if (videoQuality.equals(file.getResolution().getId())) {
diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoPlayerFragment.java b/app/src/main/java/net/schueller/peertube/fragment/VideoPlayerFragment.java
index f63f3de..b51a988 100644
--- a/app/src/main/java/net/schueller/peertube/fragment/VideoPlayerFragment.java
+++ b/app/src/main/java/net/schueller/peertube/fragment/VideoPlayerFragment.java
@@ -162,7 +162,7 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
FrameLayout fullscreenButton = activity.findViewById(R.id.exo_fullscreen_button);
fullscreenText.setText(R.string.video_expand_icon);
- new Iconics.IconicsBuilder().ctx(context).on(fullscreenText).build();
+ new Iconics.Builder().on(fullscreenText).build();
fullscreenButton.setOnClickListener(view -> {
Log.d(TAG, "Fullscreen");
@@ -239,12 +239,12 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
torrentStream.startStream(stream);
} else {
- Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 0);
+ Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 999999);
- //get video qualities
- /// #
+ // get video qualities
+ // TODO: if auto is set all versions except 0p should be added to a track and have exoplayer auto select optimal bitrate
if (video.getFiles().size() > 0) {
- String urlToPlay = video.getFiles().get( 0 ).getFileUrl();
+ String urlToPlay = video.getFiles().get( 0 ).getFileUrl(); // default, take first found, usually highest res
for ( File file : video.getFiles() ) {
// Set quality if it matches
if ( file.getResolution().getId().equals( videoQuality ) ) {
@@ -321,7 +321,7 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
} else {
fullscreenButton.setText(R.string.video_expand_icon);
}
- new Iconics.IconicsBuilder().ctx(getContext()).on(fullscreenButton).build();
+ new Iconics.Builder().on(fullscreenButton).build();
}
public Boolean getIsFullscreen() {
diff --git a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java
index 905aa98..0e73eca 100644
--- a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java
+++ b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java
@@ -44,6 +44,7 @@ import android.widget.Toast;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
+import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@@ -53,6 +54,8 @@ import com.google.android.exoplayer2.ext.mediasession.TimelineQueueNavigator;
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource;
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
+import com.google.android.exoplayer2.source.MediaSource;
+import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.ui.PlayerNotificationManager;
import com.google.android.exoplayer2.upstream.DataSource;
@@ -102,7 +105,9 @@ public class VideoPlayerService extends Service {
super.onCreate();
- player = ExoPlayerFactory.newSimpleInstance(getApplicationContext(), new DefaultTrackSelector());
+ player = new SimpleExoPlayer.Builder(getApplicationContext())
+ .setTrackSelector(new DefaultTrackSelector(getApplicationContext()))
+ .build();
// Stop player if audio device changes, e.g. headphones unplugged
player.addListener(new Player.EventListener() {
@@ -224,14 +229,18 @@ public class VideoPlayerService extends Service {
okhttpClientBuilder = getUnsafeOkHttpClientBuilder();
}
+ // Create a data source factory.
DataSource.Factory dataSourceFactory = new OkHttpDataSourceFactory(okhttpClientBuilder.build(), Util.getUserAgent(getApplicationContext(), "PeerTube"));
- // This is the MediaSource representing the media to be played.
- ExtractorMediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory)
- .createMediaSource(Uri.parse(currentStreamUrl));
+ // Create a progressive media source pointing to a stream uri.
+ MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
+ .createMediaSource(MediaItem.fromUri(Uri.parse(currentStreamUrl)));
- // Prepare the player with the source.
- player.prepare(videoSource);
+ // Set the media source to be played.
+ player.setMediaSource(mediaSource);
+
+ // Prepare the player.
+ player.prepare();
// Auto play
player.setPlayWhenReady(true);
diff --git a/app/src/main/res/layout/fragment_video_player.xml b/app/src/main/res/layout/fragment_video_player.xml
index 5f9591c..cf0bd2a 100644
--- a/app/src/main/res/layout/fragment_video_player.xml
+++ b/app/src/main/res/layout/fragment_video_player.xml
@@ -13,7 +13,7 @@
android:background="@color/videoBackgroundColor"
app:controller_layout_id="@layout/video_playback_controls"
app:resize_mode="fixed_width"
-
+ app:show_buffering="always"
/>
diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml
index 949d57f..2c76891 100644
--- a/app/src/main/res/xml/root_preferences.xml
+++ b/app/src/main/res/xml/root_preferences.xml
@@ -39,6 +39,7 @@
app:iconSpaceReserved="false"/>