diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62c0dca..e5f034d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+### Version 1.0.23 Tag: v1.0.23 (2019-01-06)
+ * Moved video playback into fragment
+ * Added duration to video list
+ * Cleaned up full screen button and activation
+
### Version 1.0.22 Tag: v1.0.22 (2019-01-05)
* Cleaned up like/dislike
* Added video download
diff --git a/README.md b/README.md
index dd4fc90..43d4b61 100644
--- a/README.md
+++ b/README.md
@@ -6,9 +6,8 @@
-
-
-
+
+
## Download
@@ -27,16 +26,17 @@ Beta Test on Google Play: https://play.google.com/store/apps/details?id=net.schu
- [X] Themes / Dark mode
- [X] Background playback
- [X] NSFW Filter option
-
+- [X] Authentication / Login
+- [X] Like/dislike video
## TODO
- [ ] Video Playback via WebRTC
-- [ ] Authentication / Login
-- [ ] Like/dislike video
-- [ ] Comment video
+- [ ] Video overlay play and draggable video window
+- [ ] Comment videos
+- [ ] Report Videos
+- [ ] User / Channel Overview Page
- [ ] Unit Tests
-
- [ ] Lots more missing at this point...
diff --git a/Screenshot1.png b/Screenshot1.png
deleted file mode 100644
index a962100..0000000
Binary files a/Screenshot1.png and /dev/null differ
diff --git a/Screenshot2.jpg b/Screenshot2.jpg
deleted file mode 100644
index 841a96b..0000000
Binary files a/Screenshot2.jpg and /dev/null differ
diff --git a/Screenshot_1545425431.png b/Screenshot_1545425431.png
deleted file mode 100644
index 2d7c0f9..0000000
Binary files a/Screenshot_1545425431.png and /dev/null differ
diff --git a/Screenshot_1545425504.png b/Screenshot_1545425504.png
deleted file mode 100644
index 586bebc..0000000
Binary files a/Screenshot_1545425504.png and /dev/null differ
diff --git a/Screenshot_1545425516.png b/Screenshot_1545425516.png
deleted file mode 100644
index a1ae020..0000000
Binary files a/Screenshot_1545425516.png and /dev/null differ
diff --git a/Screenshot_1546780555.png b/Screenshot_1546780555.png
new file mode 100644
index 0000000..5ece165
Binary files /dev/null and b/Screenshot_1546780555.png differ
diff --git a/Screenshot_1546780637.png b/Screenshot_1546780637.png
new file mode 100644
index 0000000..2f1ecb8
Binary files /dev/null and b/Screenshot_1546780637.png differ
diff --git a/app/build.gradle b/app/build.gradle
index c00b78b..59a2099 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,8 +6,8 @@ android {
applicationId "net.schueller.peertube"
minSdkVersion 21
targetSdkVersion 28
- versionCode 1022
- versionName "1.0.22"
+ versionCode 1023
+ versionName "1.0.23"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ext {
libVersions = [
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 755c5c3..04a237c 100644
--- a/app/src/main/java/net/schueller/peertube/activity/AccountActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/AccountActivity.java
@@ -55,7 +55,7 @@ import retrofit2.Response;
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
-public class AccountActivity extends AppCompatActivity {
+public class AccountActivity extends CommonActivity {
private static final String TAG = "AccountActivity";
@@ -104,17 +104,8 @@ public class AccountActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // Set theme
- SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
- setTheme(getResources().getIdentifier(
- sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
- "style",
- getPackageName())
- );
-
setContentView(R.layout.activity_account);
-
// Attaching the layout to the toolbar object
Toolbar toolbar = findViewById(R.id.tool_bar_user);
// Setting toolbar as the ActionBar with setSupportActionBar() call
diff --git a/app/src/main/java/net/schueller/peertube/activity/CommonActivity.java b/app/src/main/java/net/schueller/peertube/activity/CommonActivity.java
index 6d01f9b..60c3589 100644
--- a/app/src/main/java/net/schueller/peertube/activity/CommonActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/CommonActivity.java
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2018 Stefan Schüller
+ *
+ * License: GPL-3.0+
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package net.schueller.peertube.activity;
import android.content.SharedPreferences;
diff --git a/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java b/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java
index a1cc45c..56fa0e4 100644
--- a/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java
@@ -49,7 +49,7 @@ import retrofit2.Response;
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
-public class LoginActivity extends AppCompatActivity {
+public class LoginActivity extends CommonActivity {
private String TAG = "LoginActivity";
@@ -61,14 +61,6 @@ public class LoginActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // Set theme
- SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
- setTheme(getResources().getIdentifier(
- sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
- "style",
- getPackageName())
- );
-
setContentView(R.layout.activity_login);
// bind button click
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 641757d..95a0f73 100644
--- a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java
@@ -32,10 +32,8 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import androidx.core.app.ActivityCompat;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
-import androidx.appcompat.app.AppCompatDelegate;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.SearchView;
@@ -68,9 +66,6 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
-import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
-import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
-
public class VideoListActivity extends CommonActivity {
private String TAG = "VideoListActivity";
diff --git a/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java b/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java
index 66b0ed8..2b69783 100644
--- a/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java
@@ -18,105 +18,41 @@
package net.schueller.peertube.activity;
-import android.content.ComponentName;
-import android.content.Context;
+
import android.content.Intent;
-import android.content.ServiceConnection;
import android.content.SharedPreferences;
-import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
-import android.net.Uri;
import android.os.Bundle;
-import android.os.Environment;
-import android.os.IBinder;
import android.preference.PreferenceManager;
-import androidx.annotation.NonNull;
+
import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.widget.PopupMenu;
+
import android.util.Log;
import android.util.TypedValue;
-import android.view.Surface;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.WindowManager;
-import android.widget.Button;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-import com.github.se_bastiaan.torrentstream.StreamStatus;
-import com.github.se_bastiaan.torrentstream.Torrent;
-import com.github.se_bastiaan.torrentstream.TorrentOptions;
-import com.github.se_bastiaan.torrentstream.TorrentStream;
-import com.github.se_bastiaan.torrentstream.listeners.TorrentListener;
-import com.google.android.exoplayer2.Format;
-import com.google.android.exoplayer2.decoder.DecoderCounters;
-import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
-import com.google.android.exoplayer2.ui.PlayerView;
-import com.google.android.exoplayer2.util.Util;
-import com.google.android.exoplayer2.video.VideoRendererEventListener;
-import com.mikepenz.iconics.Iconics;
-import com.squareup.picasso.Picasso;
+import android.view.WindowManager;
+import android.widget.FrameLayout;
+
+import android.widget.RelativeLayout;
+
import net.schueller.peertube.R;
import net.schueller.peertube.fragment.VideoMetaDataFragment;
-import net.schueller.peertube.fragment.VideoOptionsFragment;
-import net.schueller.peertube.helper.APIUrlHelper;
-import net.schueller.peertube.helper.MetaDataHelper;
-import net.schueller.peertube.intents.Intents;
-import net.schueller.peertube.model.Account;
-import net.schueller.peertube.model.Avatar;
-import net.schueller.peertube.model.Video;
-import net.schueller.peertube.network.GetVideoDataService;
-import net.schueller.peertube.network.RetrofitInstance;
-import net.schueller.peertube.service.VideoPlayerService;
-import retrofit2.Call;
-import retrofit2.Callback;
-import retrofit2.Response;
+import net.schueller.peertube.fragment.VideoPlayerFragment;
-import static net.schueller.peertube.helper.Constants.BACKGROUND_PLAY_PREF_KEY;
+import java.util.Objects;
+
+import androidx.fragment.app.FragmentManager;
+
+
+//import static net.schueller.peertube.helper.Constants.BACKGROUND_PLAY_PREF_KEY;
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
-public class VideoPlayActivity extends AppCompatActivity implements VideoRendererEventListener {
+public class VideoPlayActivity extends AppCompatActivity {
private static final String TAG = "VideoPlayActivity";
- private ProgressBar progressBar;
- private PlayerView simpleExoPlayerView;
- private Intent videoPlayerIntent;
- private Context context = this;
- private TextView fullscreenButton;
- private Boolean isFullscreen = false;
- private TorrentStream torrentStream;
- boolean mBound = false;
- VideoPlayerService mService;
-
- private ServiceConnection mConnection = new ServiceConnection() {
-
- @Override
- public void onServiceConnected(ComponentName className, IBinder service) {
- Log.d(TAG, "onServiceConnected");
- VideoPlayerService.LocalBinder binder = (VideoPlayerService.LocalBinder) service;
- mService = binder.getService();
-
- // 2. Create the player
- simpleExoPlayerView.setPlayer(mService.player);
- mBound = true;
-
- loadVideo();
- }
-
- @Override
- public void onServiceDisconnected(ComponentName componentName) {
- Log.d(TAG, "onServiceDisconnected");
- simpleExoPlayerView.setPlayer(null);
- mBound = false;
- }
- };
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -132,95 +68,22 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
setContentView(R.layout.activity_video_play);
- progressBar = findViewById(R.id.progress);
- progressBar.setMax(100);
+ // get video ID
+ Intent intent = getIntent();
+ String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
+ Log.v(TAG, "click: " + videoUuid);
- simpleExoPlayerView = new PlayerView(this);
- simpleExoPlayerView = findViewById(R.id.video_view);
+ VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
+ getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
- simpleExoPlayerView.setControllerShowTimeoutMs(1000);
- simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
+ assert videoPlayerFragment != null;
+ videoPlayerFragment.start(videoUuid);
- // Full screen Icon
- fullscreenButton = findViewById(R.id.exo_fullscreen);
- fullscreenButton.setText(R.string.video_expand_icon);
- new Iconics.IconicsBuilder().ctx(this).on(fullscreenButton).build();
-
- fullscreenButton.setOnClickListener(view -> {
- Log.d(TAG, "Fullscreen");
- if (!isFullscreen) {
- isFullscreen = true;
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
- fullscreenButton.setText(R.string.video_compress_icon);
- } else {
- isFullscreen = false;
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
- fullscreenButton.setText(R.string.video_expand_icon);
- }
- new Iconics.IconicsBuilder().ctx(this).on(fullscreenButton).build();
- });
-
- }
-
- private void startPlayer()
- {
- Util.startForegroundService(context, videoPlayerIntent);
- }
-
- /**
- * Torrent Playback
- *
- * @return torrent stream
- */
- private TorrentStream setupTorrentStream() {
-
- TorrentOptions torrentOptions = new TorrentOptions.Builder()
- .saveLocation(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS))
- .removeFilesAfterStop(true)
- .build();
-
- TorrentStream torrentStream = TorrentStream.init(torrentOptions);
-
- torrentStream.addListener(new TorrentListener() {
- @Override
- public void onStreamReady(Torrent torrent) {
- String videopath = Uri.fromFile(torrent.getVideoFile()).toString();
- Log.d(TAG, "Ready! torrentStream videopath:" + videopath);
- mService.setCurrentStreamUrl(videopath);
- startPlayer();
- }
-
- @Override
- public void onStreamProgress(Torrent torrent, StreamStatus streamStatus) {
- if(streamStatus.bufferProgress <= 100 && progressBar.getProgress() < 100 && progressBar.getProgress() != streamStatus.bufferProgress) {
- //Log.d(TAG, "Progress: " + streamStatus.bufferProgress);
- progressBar.setProgress(streamStatus.bufferProgress);
- }
- }
-
- @Override
- public void onStreamStopped() {
- Log.d(TAG, "Stopped");
- }
-
- @Override
- public void onStreamPrepared(Torrent torrent) {
- Log.d(TAG, "Prepared");
- }
-
- @Override
- public void onStreamStarted(Torrent torrent) {
- Log.d(TAG, "Started");
- }
-
- @Override
- public void onStreamError(Torrent torrent, Exception e) {
- Log.d(TAG, "Error: " + e.getMessage());
- }
-
- });
-
- return torrentStream;
+ // if we are in landscape set the video to fullscreen
+ int orientation = this.getResources().getConfiguration().orientation;
+ if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ setOrientation(true);
+ }
}
@@ -231,145 +94,66 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
super.onConfigurationChanged(newConfig);
- TextView nameView = findViewById(R.id.name);
- TextView videoMetaView = findViewById(R.id.videoMeta);
- TextView descriptionView = findViewById(R.id.description);
-
- // Checking the orientation of the screen
+ // Checking the orientation changes of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams();
- params.width = ViewGroup.LayoutParams.MATCH_PARENT;
- params.height = ViewGroup.LayoutParams.MATCH_PARENT;
- simpleExoPlayerView.setLayoutParams(params);
-
- nameView.setVisibility(View.GONE);
- videoMetaView.setVisibility(View.GONE);
- descriptionView.setVisibility(View.GONE);
-
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
-
- } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams();
- params.width = ViewGroup.LayoutParams.MATCH_PARENT;
- params.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 250, getResources().getDisplayMetrics());
- simpleExoPlayerView.setLayoutParams(params);
-
- nameView.setVisibility(View.VISIBLE);
- videoMetaView.setVisibility(View.VISIBLE);
- descriptionView.setVisibility(View.VISIBLE);
-
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ setOrientation(true);
+ } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
+ setOrientation(false);
}
}
- private void loadVideo()
- {
- // get video ID
- Intent intent = getIntent();
- String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
- Log.v(TAG, "click: " + videoUuid);
- // get video details from api
- String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
- GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
+ private void setOrientation(Boolean isLandscape) {
- Call