Merge remote-tracking branch 'upstream/develop' into develop
19
CHANGELOG.md
@ -1,3 +1,22 @@
|
|||||||
|
### 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
|
||||||
|
|
||||||
|
### Version 1.0.21 Tag: v1.0.21 (2019-01-05)
|
||||||
|
* Added more video meta data
|
||||||
|
* Very basic like and dislike functionality
|
||||||
|
* UI changes to video detail page
|
||||||
|
* Torrent stream fatal fix (@lishoujun)
|
||||||
|
* AR Strings update (@rex07)
|
||||||
|
* ZH Strings update (@lishoujun)
|
||||||
|
* RU Strings update (@ferhadnecef)
|
||||||
|
* Refacturing (@lishoujun)
|
||||||
|
|
||||||
### Version 1.0.20 Tag: v1.0.20 (2019-01-02)
|
### Version 1.0.20 Tag: v1.0.20 (2019-01-02)
|
||||||
* Added basic login framework
|
* Added basic login framework
|
||||||
* AR Strings update (@rex07)
|
* AR Strings update (@rex07)
|
||||||
|
16
README.md
@ -6,9 +6,8 @@
|
|||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1545425516.png" alt="screenshot" />
|
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1546780555.png" alt="screenshot" />
|
||||||
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1545425431.png" alt="screenshot" />
|
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1546780637.png" alt="screenshot" />
|
||||||
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1545425504.png" alt="screenshot" />
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Download
|
## 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] Themes / Dark mode
|
||||||
- [X] Background playback
|
- [X] Background playback
|
||||||
- [X] NSFW Filter option
|
- [X] NSFW Filter option
|
||||||
|
- [X] Authentication / Login
|
||||||
|
- [X] Like/dislike video
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [ ] Video Playback via WebRTC
|
- [ ] Video Playback via WebRTC
|
||||||
- [ ] Authentication / Login
|
- [ ] Video overlay play and draggable video window
|
||||||
- [ ] Like/dislike video
|
- [ ] Comment videos
|
||||||
- [ ] Comment video
|
- [ ] Report Videos
|
||||||
|
- [ ] User / Channel Overview Page
|
||||||
- [ ] Unit Tests
|
- [ ] Unit Tests
|
||||||
|
|
||||||
- [ ] Lots more missing at this point...
|
- [ ] Lots more missing at this point...
|
||||||
|
|
||||||
|
|
||||||
|
BIN
Screenshot1.png
Before Width: | Height: | Size: 114 KiB |
BIN
Screenshot2.jpg
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 843 KiB |
Before Width: | Height: | Size: 725 KiB |
Before Width: | Height: | Size: 585 KiB |
BIN
Screenshot_1546780555.png
Normal file
After Width: | Height: | Size: 614 KiB |
BIN
Screenshot_1546780637.png
Normal file
After Width: | Height: | Size: 440 KiB |
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "net.schueller.peertube"
|
applicationId "net.schueller.peertube"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 1020
|
versionCode 1023
|
||||||
versionName "1.0.20"
|
versionName "1.0.23"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
ext {
|
ext {
|
||||||
libVersions = [
|
libVersions = [
|
||||||
|
@ -55,7 +55,7 @@ import retrofit2.Response;
|
|||||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
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";
|
private static final String TAG = "AccountActivity";
|
||||||
@ -104,17 +104,8 @@ public class AccountActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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);
|
setContentView(R.layout.activity_account);
|
||||||
|
|
||||||
|
|
||||||
// Attaching the layout to the toolbar object
|
// Attaching the layout to the toolbar object
|
||||||
Toolbar toolbar = findViewById(R.id.tool_bar_user);
|
Toolbar toolbar = findViewById(R.id.tool_bar_user);
|
||||||
// Setting toolbar as the ActionBar with setSupportActionBar() call
|
// Setting toolbar as the ActionBar with setSupportActionBar() call
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 Stefan Schüller <sschueller@techdroid.com>
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.schueller.peertube.activity;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
|
||||||
|
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||||
|
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||||
|
|
||||||
|
public class CommonActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// Set Night Mode
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
AppCompatDelegate.setDefaultNightMode(sharedPref.getBoolean("pref_dark_mode", false) ?
|
||||||
|
AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
|
||||||
|
// Set theme
|
||||||
|
setTheme(getResources().getIdentifier(
|
||||||
|
sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
|
||||||
|
"style",
|
||||||
|
getPackageName())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -49,7 +49,7 @@ import retrofit2.Response;
|
|||||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class LoginActivity extends CommonActivity {
|
||||||
|
|
||||||
private String TAG = "LoginActivity";
|
private String TAG = "LoginActivity";
|
||||||
|
|
||||||
@ -61,14 +61,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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);
|
setContentView(R.layout.activity_login);
|
||||||
|
|
||||||
// bind button click
|
// bind button click
|
||||||
|
@ -32,10 +32,8 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
|
|||||||
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
@ -68,10 +66,7 @@ import retrofit2.Call;
|
|||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
public class VideoListActivity extends CommonActivity {
|
||||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
|
||||||
|
|
||||||
public class VideoListActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private String TAG = "VideoListActivity";
|
private String TAG = "VideoListActivity";
|
||||||
|
|
||||||
@ -98,18 +93,6 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// Set Night Mode
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
AppCompatDelegate.setDefaultNightMode(sharedPref.getBoolean("pref_dark_mode", false) ?
|
|
||||||
AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
|
|
||||||
|
|
||||||
// Set theme
|
|
||||||
setTheme(getResources().getIdentifier(
|
|
||||||
sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
|
|
||||||
"style",
|
|
||||||
getPackageName())
|
|
||||||
);
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_video_list);
|
setContentView(R.layout.activity_video_list);
|
||||||
|
|
||||||
filter = null;
|
filter = null;
|
||||||
|
@ -18,104 +18,41 @@
|
|||||||
|
|
||||||
package net.schueller.peertube.activity;
|
package net.schueller.peertube.activity;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Surface;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.RelativeLayout;
|
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 net.schueller.peertube.R;
|
import net.schueller.peertube.R;
|
||||||
import net.schueller.peertube.fragment.VideoOptionsFragment;
|
import net.schueller.peertube.fragment.VideoMetaDataFragment;
|
||||||
import net.schueller.peertube.helper.APIUrlHelper;
|
import net.schueller.peertube.fragment.VideoPlayerFragment;
|
||||||
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 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.DEFAULT_THEME;
|
||||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
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 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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -131,94 +68,22 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
|
|
||||||
setContentView(R.layout.activity_video_play);
|
setContentView(R.layout.activity_video_play);
|
||||||
|
|
||||||
progressBar = findViewById(R.id.progress);
|
// get video ID
|
||||||
progressBar.setMax(100);
|
Intent intent = getIntent();
|
||||||
|
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
|
||||||
|
Log.v(TAG, "click: " + videoUuid);
|
||||||
|
|
||||||
simpleExoPlayerView = new PlayerView(this);
|
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
|
||||||
simpleExoPlayerView = findViewById(R.id.video_view);
|
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
|
||||||
|
|
||||||
simpleExoPlayerView.setControllerShowTimeoutMs(1000);
|
assert videoPlayerFragment != null;
|
||||||
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
|
videoPlayerFragment.start(videoUuid);
|
||||||
|
|
||||||
// Full screen Icon
|
// if we are in landscape set the video to fullscreen
|
||||||
fullscreenButton = findViewById(R.id.exo_fullscreen);
|
int orientation = this.getResources().getConfiguration().orientation;
|
||||||
fullscreenButton.setText(R.string.video_expand_icon);
|
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
new Iconics.IconicsBuilder().ctx(this).on(fullscreenButton).build();
|
setOrientation(true);
|
||||||
|
|
||||||
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) {
|
|
||||||
Log.d(TAG, "Ready");
|
|
||||||
mService.setCurrentStreamUrl(Uri.fromFile(torrent.getVideoFile()).toString());
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -229,206 +94,66 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
|
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
TextView nameView = findViewById(R.id.name);
|
// Checking the orientation changes of the screen
|
||||||
TextView videoMetaView = findViewById(R.id.videoMeta);
|
|
||||||
TextView descriptionView = findViewById(R.id.description);
|
|
||||||
|
|
||||||
// Checking the orientation of the screen
|
|
||||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams();
|
setOrientation(true);
|
||||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
setOrientation(false);
|
||||||
simpleExoPlayerView.setLayoutParams(params);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nameView.setVisibility(View.GONE);
|
|
||||||
videoMetaView.setVisibility(View.GONE);
|
|
||||||
descriptionView.setVisibility(View.GONE);
|
private void setOrientation(Boolean isLandscape) {
|
||||||
|
|
||||||
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
|
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment) fragmentManager.findFragmentById(R.id.video_player_fragment);
|
||||||
|
VideoMetaDataFragment videoMetaFragment = (VideoMetaDataFragment) fragmentManager.findFragmentById(R.id.video_meta_data_fragment);
|
||||||
|
|
||||||
|
if (isLandscape) {
|
||||||
|
assert videoPlayerFragment != null;
|
||||||
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) Objects.requireNonNull(videoPlayerFragment.getView()).getLayoutParams();
|
||||||
|
params.width = FrameLayout.LayoutParams.MATCH_PARENT;
|
||||||
|
params.height = FrameLayout.LayoutParams.MATCH_PARENT;
|
||||||
|
videoPlayerFragment.getView().setLayoutParams(params);
|
||||||
|
|
||||||
|
if (videoMetaFragment != null) {
|
||||||
|
fragmentManager.beginTransaction()
|
||||||
|
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||||
|
.hide(videoMetaFragment)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
videoPlayerFragment.setIsFullscreen(true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
assert videoPlayerFragment != null;
|
||||||
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) Objects.requireNonNull(videoPlayerFragment.getView()).getLayoutParams();
|
||||||
|
params.width = FrameLayout.LayoutParams.MATCH_PARENT;
|
||||||
|
params.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 250, getResources().getDisplayMetrics());
|
||||||
|
videoPlayerFragment.getView().setLayoutParams(params);
|
||||||
|
|
||||||
|
if (videoMetaFragment != null) {
|
||||||
|
fragmentManager.beginTransaction()
|
||||||
|
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||||
|
.show(videoMetaFragment)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
videoPlayerFragment.setIsFullscreen(false);
|
||||||
|
}
|
||||||
|
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
Call<Video> call = service.getVideoData(videoUuid);
|
|
||||||
|
|
||||||
call.enqueue(new Callback<Video>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(@NonNull Call<Video> call, @NonNull Response<Video> response) {
|
|
||||||
|
|
||||||
// Toast.makeText(TorrentVideoPlayActivity.this, response.body().getDescription(), Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
// TODO: remove this code duplication, similar code as in video list rows
|
|
||||||
|
|
||||||
TextView videoName = findViewById(R.id.name);
|
|
||||||
TextView videoDescription = findViewById(R.id.description);
|
|
||||||
TextView videoOwner = findViewById(R.id.videoOwner);
|
|
||||||
TextView videoMeta = findViewById(R.id.videoMeta);
|
|
||||||
ImageView avatarView = findViewById(R.id.avatar);
|
|
||||||
TextView moreButton = findViewById(R.id.moreButton);
|
|
||||||
TextView videoOptions = findViewById(R.id.exo_more);
|
|
||||||
|
|
||||||
|
|
||||||
Video video = response.body();
|
|
||||||
|
|
||||||
mService.setCurrentVideo(video);
|
|
||||||
|
|
||||||
String baseUrl = APIUrlHelper.getUrl(context);
|
|
||||||
|
|
||||||
if(video == null){
|
|
||||||
Toast.makeText(VideoPlayActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Account account = video.getAccount();
|
|
||||||
if(account == null){
|
|
||||||
Toast.makeText(VideoPlayActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Avatar avatar = account.getAvatar();
|
|
||||||
if (avatar != null) {
|
|
||||||
String avatarPath = avatar.getPath();
|
|
||||||
Picasso.with(context)
|
|
||||||
.load(baseUrl + avatarPath)
|
|
||||||
.into(avatarView);
|
|
||||||
}
|
|
||||||
|
|
||||||
videoName.setText(video.getName());
|
|
||||||
videoMeta.setText(
|
|
||||||
MetaDataHelper.getMetaString(
|
|
||||||
video.getCreatedAt(),
|
|
||||||
video.getViews(),
|
|
||||||
getBaseContext()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
videoOwner.setText(
|
|
||||||
MetaDataHelper.getOwnerString(video.getAccount().getName(),
|
|
||||||
video.getAccount().getHost(),
|
|
||||||
context
|
|
||||||
)
|
|
||||||
);
|
|
||||||
videoDescription.setText(video.getDescription());
|
|
||||||
|
|
||||||
moreButton.setText(R.string.video_more_icon);
|
|
||||||
new Iconics.IconicsBuilder().ctx(context).on(moreButton).build();
|
|
||||||
|
|
||||||
moreButton.setOnClickListener(v -> {
|
|
||||||
PopupMenu popup = new PopupMenu(context, v);
|
|
||||||
popup.setOnMenuItemClickListener(menuItem -> {
|
|
||||||
switch (menuItem.getItemId()) {
|
|
||||||
case R.id.menu_share:
|
|
||||||
Intents.Share(context, video);
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
popup.inflate(R.menu.menu_video_row_mode);
|
|
||||||
popup.show();
|
|
||||||
});
|
|
||||||
|
|
||||||
// video player options
|
|
||||||
videoOptions.setText(R.string.video_more_icon);
|
|
||||||
new Iconics.IconicsBuilder().ctx(context).on(videoOptions).build();
|
|
||||||
|
|
||||||
videoOptions.setOnClickListener(v -> {
|
|
||||||
|
|
||||||
VideoOptionsFragment videoOptionsFragment =
|
|
||||||
VideoOptionsFragment.newInstance(mService);
|
|
||||||
videoOptionsFragment.show(getSupportFragmentManager(),
|
|
||||||
"video_options_fragment");
|
|
||||||
});
|
|
||||||
Log.v(TAG, "url : " + video.getFiles().get(0).getFileUrl());
|
|
||||||
|
|
||||||
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
|
||||||
|
|
||||||
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
||||||
if (sharedPref.getBoolean("pref_torrent_player", false)) {
|
|
||||||
|
|
||||||
String stream = video.getFiles().get(0).getTorrentUrl();
|
|
||||||
Log.v(TAG, "getTorrentUrl : " + video.getFiles().get(0).getTorrentUrl());
|
|
||||||
torrentStream = setupTorrentStream();
|
|
||||||
torrentStream.startStream(stream);
|
|
||||||
} else {
|
|
||||||
startPlayer();
|
|
||||||
}
|
|
||||||
Log.v(TAG,"end of load Video");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(@NonNull Call<Video> call, @NonNull Throwable t) {
|
|
||||||
Log.wtf(TAG, t.fillInStackTrace());
|
|
||||||
Toast.makeText(VideoPlayActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onVideoEnabled(DecoderCounters counters) {
|
|
||||||
Log.v(TAG, "onVideoEnabled()...");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onVideoInputFormatChanged(Format format) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDroppedFrames(int count, long elapsedMs) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRenderedFirstFrame(Surface surface) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onVideoDisabled(DecoderCounters counters) {
|
|
||||||
Log.v(TAG, "onVideoDisabled()...");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
simpleExoPlayerView.setPlayer(null);
|
|
||||||
if (torrentStream != null){
|
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
|
||||||
torrentStream.stopStream();
|
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
|
||||||
}
|
|
||||||
|
assert videoPlayerFragment != null;
|
||||||
|
videoPlayerFragment.destroyVideo();
|
||||||
|
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
Log.v(TAG, "onDestroy...");
|
Log.v(TAG, "onDestroy...");
|
||||||
}
|
}
|
||||||
@ -458,10 +183,12 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
// stopService(new Intent(this, VideoPlayerService.class));
|
// stopService(new Intent(this, VideoPlayerService.class));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (mBound) {
|
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
|
||||||
unbindService(mConnection);
|
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
|
||||||
mBound = false;
|
|
||||||
}
|
assert videoPlayerFragment != null;
|
||||||
|
videoPlayerFragment.stopVideo();
|
||||||
|
|
||||||
Log.v(TAG, "onStop()...");
|
Log.v(TAG, "onStop()...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,10 +196,6 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
if (!mBound) {
|
|
||||||
videoPlayerIntent = new Intent(this, VideoPlayerService.class);
|
|
||||||
bindService(videoPlayerIntent, mConnection, Context.BIND_AUTO_CREATE);
|
|
||||||
}
|
|
||||||
Log.v(TAG, "onStart()...");
|
Log.v(TAG, "onStart()...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,9 +85,12 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
|||||||
.into(holder.avatar);
|
.into(holder.avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set Name
|
||||||
holder.name.setText(videoList.get(position).getName());
|
holder.name.setText(videoList.get(position).getName());
|
||||||
|
|
||||||
|
// set duration
|
||||||
|
holder.videoDuration.setText( MetaDataHelper.getDuration(videoList.get(position).getDuration().longValue()));
|
||||||
|
|
||||||
// set age and view count
|
// set age and view count
|
||||||
holder.videoMeta.setText(
|
holder.videoMeta.setText(
|
||||||
MetaDataHelper.getMetaString(videoList.get(position).getCreatedAt(),
|
MetaDataHelper.getMetaString(videoList.get(position).getCreatedAt(),
|
||||||
@ -153,7 +156,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
|||||||
|
|
||||||
class VideoViewHolder extends RecyclerView.ViewHolder {
|
class VideoViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
TextView name, videoMeta, videoOwner, moreButton;
|
TextView name, videoMeta, videoOwner, moreButton, videoDuration;
|
||||||
ImageView thumb, avatar;
|
ImageView thumb, avatar;
|
||||||
View mView;
|
View mView;
|
||||||
|
|
||||||
@ -165,6 +168,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
|||||||
videoMeta = itemView.findViewById(R.id.videoMeta);
|
videoMeta = itemView.findViewById(R.id.videoMeta);
|
||||||
videoOwner = itemView.findViewById(R.id.videoOwner);
|
videoOwner = itemView.findViewById(R.id.videoOwner);
|
||||||
moreButton = itemView.findViewById(R.id.moreButton);
|
moreButton = itemView.findViewById(R.id.moreButton);
|
||||||
|
videoDuration = itemView.findViewById(R.id.video_duration);
|
||||||
mView = itemView;
|
mView = itemView;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,350 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 Stefan Schüller <sschueller@techdroid.com>
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package net.schueller.peertube.fragment;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.mikepenz.iconics.Iconics;
|
||||||
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
import net.schueller.peertube.R;
|
||||||
|
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.Rating;
|
||||||
|
import net.schueller.peertube.model.Video;
|
||||||
|
import net.schueller.peertube.network.GetVideoDataService;
|
||||||
|
import net.schueller.peertube.network.RetrofitInstance;
|
||||||
|
import net.schueller.peertube.network.Session;
|
||||||
|
import net.schueller.peertube.service.VideoPlayerService;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class VideoMetaDataFragment extends Fragment {
|
||||||
|
|
||||||
|
private static final String TAG = "VideoMetaDataFragment";
|
||||||
|
|
||||||
|
private Rating videoRating;
|
||||||
|
private ColorStateList defaultTextColor;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
return inflater.inflate(R.layout.fragment_video_meta, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateVideoMeta(Video video, VideoPlayerService mService) {
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
|
Activity activity = getActivity();
|
||||||
|
|
||||||
|
String apiBaseURL = APIUrlHelper.getUrlWithVersion(context);
|
||||||
|
GetVideoDataService videoDataService = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
||||||
|
|
||||||
|
// Thumbs up
|
||||||
|
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();
|
||||||
|
thumbsUpButton.setOnClickListener(v -> {
|
||||||
|
rateVideo(true, video.getId());
|
||||||
|
});
|
||||||
|
|
||||||
|
TextView thumbsUpButtonTotal = activity.findViewById(R.id.video_thumbs_up_total);
|
||||||
|
thumbsUpButtonTotal.setText(video.getLikes().toString());
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
thumbsDownButton.setOnClickListener(v -> {
|
||||||
|
rateVideo(false, video.getId());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// video rating
|
||||||
|
videoRating = new Rating();
|
||||||
|
videoRating.setRating("none"); // default
|
||||||
|
updateVideoRating();
|
||||||
|
|
||||||
|
if (Session.getInstance().isLoggedIn()) {
|
||||||
|
Call<Rating> call = videoDataService.getVideoRating(video.getId());
|
||||||
|
call.enqueue(new Callback<Rating>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<Rating> call, Response<Rating> response) {
|
||||||
|
videoRating = response.body();
|
||||||
|
updateVideoRating();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<Rating> call, Throwable t) {
|
||||||
|
// Toast.makeText(context, "Rating Failed", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TextView thumbsDownButtonTotal = activity.findViewById(R.id.video_thumbs_down_total);
|
||||||
|
thumbsDownButtonTotal.setText(video.getDislikes().toString());
|
||||||
|
|
||||||
|
// Share
|
||||||
|
Button videoShareButton = activity.findViewById(R.id.video_share);
|
||||||
|
videoShareButton.setText(R.string.video_share_icon);
|
||||||
|
new Iconics.IconicsBuilder().ctx(context).on(videoShareButton).build();
|
||||||
|
videoShareButton.setOnClickListener(v -> Intents.Share(context, video));
|
||||||
|
|
||||||
|
// Download
|
||||||
|
Button videoDownloadButton = activity.findViewById(R.id.video_download);
|
||||||
|
videoDownloadButton.setText(R.string.video_download_icon);
|
||||||
|
new Iconics.IconicsBuilder().ctx(context).on(videoDownloadButton).build();
|
||||||
|
videoDownloadButton.setOnClickListener(v -> {
|
||||||
|
// get permission to store file
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
Intents.Download(context, video);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(context, getString(R.string.video_download_permission_error), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Intents.Download(context, video);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Account account = video.getAccount();
|
||||||
|
|
||||||
|
// owner / creator Avatar
|
||||||
|
Avatar avatar = account.getAvatar();
|
||||||
|
if (avatar != null) {
|
||||||
|
ImageView avatarView = activity.findViewById(R.id.avatar);
|
||||||
|
String baseUrl = APIUrlHelper.getUrl(context);
|
||||||
|
String avatarPath = avatar.getPath();
|
||||||
|
Picasso.with(context)
|
||||||
|
.load(baseUrl + avatarPath)
|
||||||
|
.into(avatarView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// title / name
|
||||||
|
TextView videoName = activity.findViewById(R.id.name);
|
||||||
|
videoName.setText(video.getName());
|
||||||
|
|
||||||
|
// created at / views
|
||||||
|
TextView videoMeta = activity.findViewById(R.id.videoMeta);
|
||||||
|
videoMeta.setText(
|
||||||
|
MetaDataHelper.getMetaString(
|
||||||
|
video.getCreatedAt(),
|
||||||
|
video.getViews(),
|
||||||
|
context
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// owner / creator
|
||||||
|
TextView videoOwner = activity.findViewById(R.id.videoOwner);
|
||||||
|
videoOwner.setText(
|
||||||
|
MetaDataHelper.getOwnerString(video.getAccount().getName(),
|
||||||
|
video.getAccount().getHost(),
|
||||||
|
context
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// description
|
||||||
|
TextView videoDescription = activity.findViewById(R.id.description);
|
||||||
|
videoDescription.setText(video.getDescription());
|
||||||
|
|
||||||
|
|
||||||
|
// video privacy
|
||||||
|
TextView videoPrivacy = activity.findViewById(R.id.video_privacy);
|
||||||
|
videoPrivacy.setText(video.getPrivacy().getLabel());
|
||||||
|
|
||||||
|
// video category
|
||||||
|
TextView videoCategory = activity.findViewById(R.id.video_category);
|
||||||
|
videoCategory.setText(video.getCategory().getLabel());
|
||||||
|
|
||||||
|
// video privacy
|
||||||
|
TextView videoLicense = activity.findViewById(R.id.video_license);
|
||||||
|
videoLicense.setText(video.getLicence().getLabel());
|
||||||
|
|
||||||
|
// video langauge
|
||||||
|
TextView videoLanguage = activity.findViewById(R.id.video_language);
|
||||||
|
videoLanguage.setText(video.getLanguage().getLabel());
|
||||||
|
|
||||||
|
// video privacy
|
||||||
|
TextView videoTags = activity.findViewById(R.id.video_tags);
|
||||||
|
videoTags.setText(android.text.TextUtils.join(", ", video.getTags()));
|
||||||
|
|
||||||
|
|
||||||
|
// more button
|
||||||
|
TextView moreButton = activity.findViewById(R.id.moreButton);
|
||||||
|
moreButton.setText(R.string.video_more_icon);
|
||||||
|
new Iconics.IconicsBuilder().ctx(context).on(moreButton).build();
|
||||||
|
|
||||||
|
moreButton.setOnClickListener(v -> {
|
||||||
|
PopupMenu popup = new PopupMenu(context, v);
|
||||||
|
popup.setOnMenuItemClickListener(menuItem -> {
|
||||||
|
switch (menuItem.getItemId()) {
|
||||||
|
case R.id.video_more_report:
|
||||||
|
Log.v(TAG, "Report");
|
||||||
|
Toast.makeText(context, "Not Implemented", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
case R.id.video_more_blacklist:
|
||||||
|
Log.v(TAG, "Blacklist");
|
||||||
|
Toast.makeText(context, "Not Implemented", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popup.inflate(R.menu.menu_video_more);
|
||||||
|
popup.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
videoOptions.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
VideoOptionsFragment videoOptionsFragment =
|
||||||
|
VideoOptionsFragment.newInstance(mService);
|
||||||
|
videoOptionsFragment.show(getActivity().getSupportFragmentManager(),
|
||||||
|
"video_options_fragment");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void updateVideoRating() {
|
||||||
|
Button thumbsUpButton = getActivity().findViewById(R.id.video_thumbs_up);
|
||||||
|
Button thumbsDownButton = getActivity().findViewById(R.id.video_thumbs_down);
|
||||||
|
|
||||||
|
TypedValue typedValue = new TypedValue();
|
||||||
|
|
||||||
|
TypedArray a = getContext().obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorPrimary});
|
||||||
|
int accentColor = a.getColor(0, 0);
|
||||||
|
|
||||||
|
if (videoRating.getRating().equals(getString(R.string.video_rating_none))) {
|
||||||
|
thumbsUpButton.setTextColor(defaultTextColor);
|
||||||
|
thumbsDownButton.setTextColor(defaultTextColor);
|
||||||
|
//Log.v(TAG, getString(R.string.video_rating_none));
|
||||||
|
|
||||||
|
} else if (videoRating.getRating().equals(getString(R.string.video_rating_like))) {
|
||||||
|
thumbsUpButton.setTextColor(accentColor);
|
||||||
|
thumbsDownButton.setTextColor(defaultTextColor);
|
||||||
|
//Log.v(TAG, getString(R.string.video_rating_like));
|
||||||
|
|
||||||
|
} else if (videoRating.getRating().equals(getString(R.string.video_rating_dislike))) {
|
||||||
|
thumbsUpButton.setTextColor(defaultTextColor);
|
||||||
|
thumbsDownButton.setTextColor(accentColor);
|
||||||
|
//Log.v(TAG, getString(R.string.video_rating_dislike));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rateVideo(Boolean rate, Integer videoId) {
|
||||||
|
|
||||||
|
// TODO cleanup
|
||||||
|
|
||||||
|
if (Session.getInstance().isLoggedIn()) {
|
||||||
|
|
||||||
|
String ratePayload = getString(R.string.video_rating_none);
|
||||||
|
|
||||||
|
if (rate) {
|
||||||
|
// thumbsup
|
||||||
|
if (videoRating.getRating().equals(getString(R.string.video_rating_none))) {
|
||||||
|
ratePayload = getString(R.string.video_rating_like);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// thumbsdown
|
||||||
|
if (videoRating.getRating().equals(getString(R.string.video_rating_none))) {
|
||||||
|
ratePayload = getString(R.string.video_rating_dislike);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json"), "{\"rating\":\"" + ratePayload + "\"}");
|
||||||
|
|
||||||
|
String apiBaseURL = APIUrlHelper.getUrlWithVersion(getContext());
|
||||||
|
GetVideoDataService videoDataService = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
||||||
|
|
||||||
|
Call<ResponseBody> call = videoDataService.rateVideo(videoId, body);
|
||||||
|
|
||||||
|
final String newRating = ratePayload;
|
||||||
|
|
||||||
|
call.enqueue(new Callback<ResponseBody>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
||||||
|
|
||||||
|
//Log.v(TAG, response.toString());
|
||||||
|
|
||||||
|
// if 20x update likes
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
videoRating.setRating(newRating);
|
||||||
|
updateVideoRating();
|
||||||
|
|
||||||
|
// TODO: update count under thumb
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ResponseBody> call, Throwable t) {
|
||||||
|
Toast.makeText(getContext(), getString(R.string.video_rating_failed), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getContext(), getString(R.string.video_login_required_for_service), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -50,7 +50,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
|
|||||||
@Nullable ViewGroup container,
|
@Nullable ViewGroup container,
|
||||||
@Nullable Bundle savedInstanceState) {
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
View view = inflater.inflate(R.layout.bottom_sheet_video_options_fragment, container,
|
View view = inflater.inflate(R.layout.fragment_video_options_popup_menu, container,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
|
@ -0,0 +1,353 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 Stefan Schüller <sschueller@techdroid.com>
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package net.schueller.peertube.fragment;
|
||||||
|
|
||||||
|
import android.app.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.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Surface;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
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 net.schueller.peertube.R;
|
||||||
|
|
||||||
|
import net.schueller.peertube.helper.APIUrlHelper;
|
||||||
|
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 java.util.Objects;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class VideoPlayerFragment extends Fragment implements VideoRendererEventListener {
|
||||||
|
|
||||||
|
private String mVideoUuid;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
private PlayerView simpleExoPlayerView;
|
||||||
|
private Intent videoPlayerIntent;
|
||||||
|
private Boolean mBound = false;
|
||||||
|
private Boolean isFullscreen = false;
|
||||||
|
private VideoPlayerService mService;
|
||||||
|
private TorrentStream torrentStream;
|
||||||
|
|
||||||
|
private static final String TAG = "VideoPlayerFragment";
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
return inflater.inflate(R.layout.fragment_video_player, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void start(String videoUuid) {
|
||||||
|
|
||||||
|
// start service
|
||||||
|
Context context = getContext();
|
||||||
|
Activity activity = getActivity();
|
||||||
|
|
||||||
|
mVideoUuid = videoUuid;
|
||||||
|
|
||||||
|
assert activity != null;
|
||||||
|
progressBar = activity.findViewById(R.id.progress);
|
||||||
|
progressBar.setMax(100);
|
||||||
|
|
||||||
|
simpleExoPlayerView = new PlayerView(context);
|
||||||
|
simpleExoPlayerView = activity.findViewById(R.id.video_view);
|
||||||
|
|
||||||
|
simpleExoPlayerView.setControllerShowTimeoutMs(1000);
|
||||||
|
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
|
||||||
|
|
||||||
|
// Full screen Icon
|
||||||
|
TextView fullscreenButton = activity.findViewById(R.id.exo_fullscreen);
|
||||||
|
fullscreenButton.setText(R.string.video_expand_icon);
|
||||||
|
new Iconics.IconicsBuilder().ctx(context).on(fullscreenButton).build();
|
||||||
|
|
||||||
|
fullscreenButton.setOnClickListener(view -> {
|
||||||
|
Log.d(TAG, "Fullscreen");
|
||||||
|
if (!isFullscreen) {
|
||||||
|
isFullscreen = true;
|
||||||
|
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
} else {
|
||||||
|
isFullscreen = false;
|
||||||
|
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!mBound) {
|
||||||
|
videoPlayerIntent = new Intent(context, VideoPlayerService.class);
|
||||||
|
activity.bindService(videoPlayerIntent, mConnection, Context.BIND_AUTO_CREATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadVideo() {
|
||||||
|
Context context = getContext();
|
||||||
|
|
||||||
|
|
||||||
|
// get video details from api
|
||||||
|
String apiBaseURL = APIUrlHelper.getUrlWithVersion(context);
|
||||||
|
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
||||||
|
|
||||||
|
Call<Video> call = service.getVideoData(mVideoUuid);
|
||||||
|
|
||||||
|
call.enqueue(new Callback<Video>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<Video> call, @NonNull Response<Video> response) {
|
||||||
|
|
||||||
|
Video video = response.body();
|
||||||
|
|
||||||
|
mService.setCurrentVideo(video);
|
||||||
|
|
||||||
|
if (video == null) {
|
||||||
|
Toast.makeText(context, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
playVideo(video);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<Video> call, @NonNull Throwable t) {
|
||||||
|
Log.wtf(TAG, t.fillInStackTrace());
|
||||||
|
Toast.makeText(context, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playVideo(Video video) {
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
|
|
||||||
|
// video Meta fragment
|
||||||
|
assert getFragmentManager() != null;
|
||||||
|
VideoMetaDataFragment videoMetaDataFragment = (VideoMetaDataFragment)
|
||||||
|
getFragmentManager().findFragmentById(R.id.video_meta_data_fragment);
|
||||||
|
|
||||||
|
assert videoMetaDataFragment != null;
|
||||||
|
videoMetaDataFragment.updateVideoMeta(video, mService);
|
||||||
|
|
||||||
|
Log.v(TAG, "url : " + video.getFiles().get(0).getFileUrl());
|
||||||
|
|
||||||
|
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
||||||
|
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
if (sharedPref.getBoolean("pref_torrent_player", false)) {
|
||||||
|
|
||||||
|
String stream = video.getFiles().get(0).getTorrentUrl();
|
||||||
|
Log.v(TAG, "getTorrentUrl : " + video.getFiles().get(0).getTorrentUrl());
|
||||||
|
torrentStream = setupTorrentStream();
|
||||||
|
torrentStream.startStream(stream);
|
||||||
|
} else {
|
||||||
|
startPlayer();
|
||||||
|
}
|
||||||
|
Log.v(TAG, "end of load Video");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startPlayer() {
|
||||||
|
Util.startForegroundService(Objects.requireNonNull(getContext()), videoPlayerIntent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void destroyVideo() {
|
||||||
|
simpleExoPlayerView.setPlayer(null);
|
||||||
|
if (torrentStream != null) {
|
||||||
|
torrentStream.stopStream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopVideo() {
|
||||||
|
|
||||||
|
if (mBound) {
|
||||||
|
Objects.requireNonNull(getContext()).unbindService(mConnection);
|
||||||
|
mBound = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsFullscreen(Boolean fullscreen) {
|
||||||
|
isFullscreen = fullscreen;
|
||||||
|
|
||||||
|
TextView fullscreenButton = getActivity().findViewById(R.id.exo_fullscreen);
|
||||||
|
if (fullscreen) {
|
||||||
|
fullscreenButton.setText(R.string.video_compress_icon);
|
||||||
|
} else {
|
||||||
|
fullscreenButton.setText(R.string.video_expand_icon);
|
||||||
|
}
|
||||||
|
new Iconics.IconicsBuilder().ctx(getContext()).on(fullscreenButton).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIsFullscreen() {
|
||||||
|
return isFullscreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoEnabled(DecoderCounters counters) {
|
||||||
|
Log.v(TAG, "onVideoEnabled()...");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoInputFormatChanged(Format format) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDroppedFrames(int count, long elapsedMs) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRenderedFirstFrame(Surface surface) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoDisabled(DecoderCounters counters) {
|
||||||
|
Log.v(TAG, "onVideoDisabled()...");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -20,6 +20,9 @@ package net.schueller.peertube.helper;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import net.schueller.peertube.R;
|
import net.schueller.peertube.R;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Period;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class MetaDataHelper {
|
public class MetaDataHelper {
|
||||||
@ -37,4 +40,7 @@ public class MetaDataHelper {
|
|||||||
serverHost;
|
serverHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getDuration(Long duration) {
|
||||||
|
return DateUtils.formatElapsedTime(duration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,23 @@
|
|||||||
*/
|
*/
|
||||||
package net.schueller.peertube.intents;
|
package net.schueller.peertube.intents;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.DownloadManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.webkit.URLUtil;
|
||||||
|
|
||||||
|
import com.github.se_bastiaan.torrentstream.TorrentOptions;
|
||||||
|
|
||||||
import net.schueller.peertube.helper.APIUrlHelper;
|
import net.schueller.peertube.helper.APIUrlHelper;
|
||||||
import net.schueller.peertube.model.Video;
|
import net.schueller.peertube.model.Video;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
|
|
||||||
public class Intents {
|
public class Intents {
|
||||||
|
|
||||||
@ -32,6 +44,7 @@ public class Intents {
|
|||||||
* @param context context
|
* @param context context
|
||||||
* @param video video
|
* @param video video
|
||||||
*/
|
*/
|
||||||
|
// TODO, offer which version to download
|
||||||
public static void Share(Context context, Video video) {
|
public static void Share(Context context, Video video) {
|
||||||
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
@ -43,4 +56,25 @@ public class Intents {
|
|||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param context context
|
||||||
|
* @param video video
|
||||||
|
*/
|
||||||
|
// TODO, offer which version to download
|
||||||
|
public static void Download(Context context, Video video) {
|
||||||
|
|
||||||
|
String url = video.getFiles().get(0).getFileDownloadUrl();
|
||||||
|
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||||
|
request.setDescription(video.getDescription());
|
||||||
|
request.setTitle(video.getName());
|
||||||
|
request.allowScanningByMediaScanner();
|
||||||
|
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||||
|
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName(url, null, null));
|
||||||
|
|
||||||
|
// get download service and enqueue file
|
||||||
|
DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||||
|
manager.enqueue(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,50 @@
|
|||||||
package net.schueller.peertube.model;
|
package net.schueller.peertube.model;
|
||||||
|
|
||||||
public class File {
|
public class File {
|
||||||
|
private Integer id;
|
||||||
|
private String fileDownloadUrl;
|
||||||
|
private Integer fps;
|
||||||
|
private String label;
|
||||||
private Resolution resolution;
|
private Resolution resolution;
|
||||||
private String resolutionLabel;
|
private String resolutionLabel;
|
||||||
private String magnetUri;
|
private String magnetUri;
|
||||||
private Integer size;
|
private Integer size;
|
||||||
private String torrentUrl;
|
private String torrentUrl;
|
||||||
|
private String torrentDownloadUrl;
|
||||||
private String fileUrl;
|
private String fileUrl;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileDownloadUrl() {
|
||||||
|
return fileDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileDownloadUrl(String fileDownloadUrl) {
|
||||||
|
this.fileDownloadUrl = fileDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFps() {
|
||||||
|
return fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFps(Integer fps) {
|
||||||
|
this.fps = fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
public Resolution getResolution() {
|
public Resolution getResolution() {
|
||||||
return resolution;
|
return resolution;
|
||||||
}
|
}
|
||||||
@ -65,6 +102,14 @@ public class File {
|
|||||||
this.torrentUrl = torrentUrl;
|
this.torrentUrl = torrentUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTorrentDownloadUrl() {
|
||||||
|
return torrentDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTorrentDownloadUrl(String torrentDownloadUrl) {
|
||||||
|
this.torrentDownloadUrl = torrentDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFileUrl() {
|
public String getFileUrl() {
|
||||||
return fileUrl;
|
return fileUrl;
|
||||||
}
|
}
|
||||||
|
28
app/src/main/java/net/schueller/peertube/model/Rating.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package net.schueller.peertube.model;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class Rating {
|
||||||
|
|
||||||
|
@SerializedName("videoId")
|
||||||
|
private Integer videoId;
|
||||||
|
|
||||||
|
@SerializedName("rating")
|
||||||
|
private String rating;
|
||||||
|
|
||||||
|
public Integer getVideoId() {
|
||||||
|
return videoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoId(Integer videoId) {
|
||||||
|
this.videoId = videoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRating() {
|
||||||
|
return rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRating(String rating) {
|
||||||
|
this.rating = rating;
|
||||||
|
}
|
||||||
|
}
|
@ -17,13 +17,19 @@
|
|||||||
*/
|
*/
|
||||||
package net.schueller.peertube.network;
|
package net.schueller.peertube.network;
|
||||||
|
|
||||||
|
import net.schueller.peertube.model.Rating;
|
||||||
import net.schueller.peertube.model.Video;
|
import net.schueller.peertube.model.Video;
|
||||||
import net.schueller.peertube.model.VideoList;
|
import net.schueller.peertube.model.VideoList;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.Field;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.PUT;
|
||||||
import retrofit2.http.Path;
|
import retrofit2.http.Path;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
@ -53,4 +59,16 @@ public interface GetVideoDataService {
|
|||||||
@Query("filter") String filter,
|
@Query("filter") String filter,
|
||||||
@Query("languageOneOf") Set<String> languages
|
@Query("languageOneOf") Set<String> languages
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@GET("users/me/videos/{id}/rating")
|
||||||
|
Call<Rating> getVideoRating(
|
||||||
|
@Path(value = "id", encoded = true) Integer id
|
||||||
|
);
|
||||||
|
|
||||||
|
@PUT("videos/{id}/rate")
|
||||||
|
Call<ResponseBody> rateVideo(
|
||||||
|
@Path(value = "id", encoded = true) Integer id,
|
||||||
|
@Body RequestBody params
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
@ -35,6 +35,7 @@ import androidx.annotation.Nullable;
|
|||||||
import android.support.v4.media.MediaDescriptionCompat;
|
import android.support.v4.media.MediaDescriptionCompat;
|
||||||
import android.support.v4.media.session.MediaSessionCompat;
|
import android.support.v4.media.session.MediaSessionCompat;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ExoPlayerFactory;
|
import com.google.android.exoplayer2.ExoPlayerFactory;
|
||||||
@ -82,6 +83,8 @@ public class VideoPlayerService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
Log.v(TAG, "onCreate...");
|
||||||
|
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
player = ExoPlayerFactory.newSimpleInstance(getApplicationContext(), new DefaultTrackSelector());
|
player = ExoPlayerFactory.newSimpleInstance(getApplicationContext(), new DefaultTrackSelector());
|
||||||
@ -136,7 +139,11 @@ public class VideoPlayerService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
|
Context context = this;
|
||||||
Log.v(TAG, "onStartCommand...");
|
Log.v(TAG, "onStartCommand...");
|
||||||
|
if(currentStreamUrl == null){
|
||||||
|
Toast.makeText(context, "currentStreamUrl must not null", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
playVideo();
|
playVideo();
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
@ -150,7 +157,7 @@ public class VideoPlayerService extends Service {
|
|||||||
|
|
||||||
public void setCurrentStreamUrl(String streamUrl)
|
public void setCurrentStreamUrl(String streamUrl)
|
||||||
{
|
{
|
||||||
Log.v(TAG, "setCurrentStreamUrl...");
|
Log.v(TAG, "setCurrentStreamUrl..." + streamUrl);
|
||||||
currentStreamUrl = streamUrl;
|
currentStreamUrl = streamUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@
|
|||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Alpha! Login is still in heavy development and may not work correctly!" />
|
android:textSize="16sp"
|
||||||
|
android:text="Alpha! Login is still in heavy development and may not work correctly! You must have an account on the instance you are connecting to. Registration is currently not supported" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@ -12,109 +11,31 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<fragment android:name="net.schueller.peertube.fragment.VideoPlayerFragment"
|
||||||
<com.google.android.exoplayer2.ui.PlayerView
|
android:id="@+id/video_player_fragment"
|
||||||
android:id="@+id/video_view"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="250dp"
|
android:layout_height="250dp" />
|
||||||
android:background="@color/videoBackgroundColor"
|
|
||||||
app:resize_mode="fixed_width"
|
|
||||||
app:controller_layout_id="@layout/video_playback_controls"
|
|
||||||
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/progress"
|
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/video_view"
|
|
||||||
android:indeterminate="false"
|
|
||||||
android:max="100" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@id/progress"
|
android:layout_below="@id/video_player_fragment"
|
||||||
android:padding="6dp"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
<ScrollView
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/login_form"
|
||||||
android:layout_width="72dp"
|
|
||||||
android:layout_height="72dp"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_marginTop="0dp"
|
|
||||||
android:contentDescription="@string/video_row_account_avatar"
|
|
||||||
android:paddingStart="12dp"
|
|
||||||
android:paddingTop="12dp"
|
|
||||||
android:paddingEnd="12dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/name"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginStart="6dp"
|
|
||||||
android:layout_marginTop="0dp"
|
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:layout_toEndOf="@+id/avatar"
|
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title" />
|
|
||||||
|
|
||||||
<TextView
|
<fragment android:name="net.schueller.peertube.fragment.VideoMetaDataFragment"
|
||||||
android:id="@+id/videoMeta"
|
android:id="@+id/video_meta_data_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_below="@+id/name"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginStart="6dp"
|
|
||||||
android:layout_marginTop="0dp"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:layout_toEndOf="@+id/avatar"
|
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/videoOwner"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/videoMeta"
|
|
||||||
android:layout_marginStart="6dp"
|
|
||||||
android:layout_marginTop="0dp"
|
|
||||||
android:layout_marginEnd="0dp"
|
|
||||||
android:layout_toEndOf="@id/avatar"
|
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/moreButton"
|
|
||||||
android:layout_width="45dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_below="@+id/thumb"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginStart="-16dp"
|
|
||||||
android:layout_marginEnd="0dp"
|
|
||||||
android:layout_toEndOf="@+id/name"
|
|
||||||
android:background="@null"
|
|
||||||
android:contentDescription="@string/descr_overflow_button"
|
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/videoMeta"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_marginStart="18dp"
|
|
||||||
android:layout_marginTop="35dp"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" />
|
|
||||||
|
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
353
app/src/main/res/layout/fragment_video_meta.xml
Normal file
@ -0,0 +1,353 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="6dp">
|
||||||
|
|
||||||
|
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="72dp"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:contentDescription="@string/video_row_account_avatar"
|
||||||
|
android:paddingStart="12dp"
|
||||||
|
android:paddingTop="12dp"
|
||||||
|
android:paddingEnd="12dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:layout_toEndOf="@+id/avatar"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/videoMeta"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/name"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_toEndOf="@+id/avatar"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/videoOwner"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/videoMeta"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:layout_toEndOf="@id/avatar"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/moreButton"
|
||||||
|
android:layout_width="45dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginStart="-16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:layout_toEndOf="@+id/name"
|
||||||
|
android:background="@null"
|
||||||
|
android:contentDescription="@string/descr_overflow_button"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/video_actions"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/videoOwner"
|
||||||
|
android:layout_marginStart="18dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="54dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/video_thumbs_up"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_thumbs_up_total"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="54dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/video_thumbs_down"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_thumbs_down_total"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="54dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/video_share"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_share_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/video_meta_button_share"
|
||||||
|
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="54dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/video_download"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_download_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/video_meta_button_download"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/video_actions"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginStart="18dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/description"
|
||||||
|
android:layout_marginStart="18dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/video_meta_button_privacy"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_privacy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:text=""
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/video_meta_button_category"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_category"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:text=""
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/video_meta_button_license"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_license"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:text=""
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/video_meta_button_language"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_language"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:text=""
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/video_meta_button_tags"
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_tags"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:text=""
|
||||||
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
26
app/src/main/res/layout/fragment_video_player.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.exoplayer2.ui.PlayerView
|
||||||
|
android:id="@+id/video_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/videoBackgroundColor"
|
||||||
|
app:controller_layout_id="@layout/video_playback_controls"
|
||||||
|
app:resize_mode="fixed_width"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminate="false"
|
||||||
|
android:max="100" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -24,6 +24,19 @@
|
|||||||
android:maxHeight="300dp"
|
android:maxHeight="300dp"
|
||||||
android:scaleType="fitXY" />
|
android:scaleType="fitXY" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:paddingStart="4dp"
|
||||||
|
android:paddingEnd="4dp"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
android:text=""
|
||||||
|
android:layout_above="@+id/avatar"
|
||||||
|
android:gravity="bottom|end"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:id="@+id/video_duration"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#000000"/>
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
android:layout_width="72dp"
|
android:layout_width="72dp"
|
||||||
|
9
app/src/main/res/menu/menu_video_more.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/video_more_report"
|
||||||
|
android:title="@string/menu_video_more_report" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/video_more_blacklist"
|
||||||
|
android:title="@string/menu_video_more_blacklist" />
|
||||||
|
</menu>
|
268
app/src/main/res/values-ru/strings.xml
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<string name="title_activity_settings">Настройки</string>
|
||||||
|
<string name="title_activity_login">Вход</string>
|
||||||
|
|
||||||
|
<!-- Strings related to login -->
|
||||||
|
<string name="prompt_server">Сервер</string>
|
||||||
|
<string name="prompt_email">Почта</string>
|
||||||
|
<string name="prompt_password">Пароль</string>
|
||||||
|
<string name="action_sign_in">Войти</string>
|
||||||
|
<string name="action_sign_in_short">Войти</string>
|
||||||
|
<string name="error_invalid_email">Этот адрес электронной почты недействителен</string>
|
||||||
|
<string name="error_invalid_password">Этот пароль слишком короткий</string>
|
||||||
|
<string name="error_incorrect_password">Неверный пароль</string>
|
||||||
|
<string name="error_field_required">Это поле обязательно к заполнению</string>
|
||||||
|
<string name="permission_rationale">«Разрешения на контакты необходимы для предоставления электронных писем».</string>
|
||||||
|
|
||||||
|
<!-- Action bar -->
|
||||||
|
<string name="action_bar_title_search">Поиск</string>
|
||||||
|
<string name="action_bar_title_settings">Настройки</string>
|
||||||
|
<string name="action_bar_title_logout">Выйти</string>
|
||||||
|
|
||||||
|
<!-- Bottom navigation bar -->
|
||||||
|
<string name="bottom_nav_title_home">Домашняя</string>
|
||||||
|
<string name="bottom_nav_title_trending">Популярные</string>
|
||||||
|
<string name="bottom_nav_title_subscriptions">Подписки</string>
|
||||||
|
<string name="bottom_nav_title_account">Аккаунт</string>
|
||||||
|
|
||||||
|
<!-- Strings related to Settings -->
|
||||||
|
|
||||||
|
<string name="pref_title_peertube_server">Сервер PeerTube</string>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Strings related to Video meta data -->
|
||||||
|
|
||||||
|
|
||||||
|
<string name="video_row_video_thumbnail">Миниатюра видео</string>
|
||||||
|
<string name="video_row_account_avatar">Аватар</string>
|
||||||
|
|
||||||
|
<string name="pref_title_show_nsfw">Показ NSFW ( контекст сексуального характера)</string>
|
||||||
|
<string name="pref_description_show_nsfw">Содержание NSFW ( контекст сексульного характера) будет показано, если включено.</string>
|
||||||
|
<string name="pref_language">Фильтр языков</string>
|
||||||
|
<string name="pref_description_language">Выберите языки видео, которые вы хотите видеть. Ни один из выбранных покажет все видео на всех языках.</string>
|
||||||
|
<string name="pref_title_torrent_player">Торрент видео плеер</string>
|
||||||
|
<string name="pref_description_torrent_player">Воспроизведение видео через торрент поток. Это требует разрешения на хранение. (Альфа, не стабильный!)</string>
|
||||||
|
<string name="pref_title_license">Лицензия</string>
|
||||||
|
<string name="pref_description_license"><b >Универсальная общественная лицензия GNU Affero v3.0.</b> Разрешения этой самой мощной лицензии с авторским левом обусловлены предоставлением полного исходного кода лицензированных произведений и модификаций, которые включают в себя более крупные произведения с использованием лицензированных произведений, по той же лицензии. Уведомления об авторских правах и лицензии должны быть сохранены. Авторы предоставляют явное предоставление патентных прав. Когда измененная версия используется для предоставления услуги по сети, должен быть доступен полный исходный код модифицированной версии.</string>
|
||||||
|
<string name="pref_title_version">Версия</string>
|
||||||
|
<string name="search_hint">Поиск PeerTube</string>
|
||||||
|
<string name="title_activity_search">Поиск</string>
|
||||||
|
<string name="no_data_available">Нет результатов</string>
|
||||||
|
<string name="descr_overflow_button">Другое</string>
|
||||||
|
<string name="menu_share">Поделиться</string>
|
||||||
|
<string name="invalid_url">Неверная ссылка!</string>
|
||||||
|
<string name="pref_title_dark_mode">Темный режим</string>
|
||||||
|
<string name="pref_description_dark_mode">Перезапустите приложение для того чтобы изменение вступило в силу.</string>
|
||||||
|
<string name="pref_title_app_theme">Тема приложения</string>
|
||||||
|
<string name="pref_description_app_theme">Перезапустите приложение, чтобы тема вступила в силу.</string>
|
||||||
|
|
||||||
|
<string name="ab">Абхазия</string>
|
||||||
|
<string name="aa">Афар</string>
|
||||||
|
<string name="af">Африканский</string>
|
||||||
|
<string name="ak">Акан</string>
|
||||||
|
<string name="sq">Албанский</string>
|
||||||
|
<string name="ase">Английский США</string>
|
||||||
|
<string name="am">Амхарик</string>
|
||||||
|
<string name="ar">Арабский</string>
|
||||||
|
<string name="an">Арагонский</string>
|
||||||
|
<string name="hy">Америкаский</string>
|
||||||
|
<string name="as">Ассамский</string>
|
||||||
|
<string name="av">Аварский</string>
|
||||||
|
<string name="ay">Аймара</string>
|
||||||
|
<string name="az">Азербайджанский</string>
|
||||||
|
<string name="bm">Бамбара</string>
|
||||||
|
<string name="ba">Башкирский</string>
|
||||||
|
<string name="eu">Баскский</string>
|
||||||
|
<string name="be">Беларусский</string>
|
||||||
|
<string name="bn">Бенгальский</string>
|
||||||
|
<string name="bi">Бислама</string>
|
||||||
|
<string name="bs">Боснийский</string>
|
||||||
|
<string name="bzs">Бразильский язык ввода</string>
|
||||||
|
<string name="br">Бретонский</string>
|
||||||
|
<string name="bfi">Английский ВБ</string>
|
||||||
|
<string name="bg">Болгарский</string>
|
||||||
|
<string name="my">Бирманский</string>
|
||||||
|
<string name="ca">Каталонский</string>
|
||||||
|
<string name="ch">Чаморро</string>
|
||||||
|
<string name="ce">Чешский</string>
|
||||||
|
<string name="zh">Китайский</string>
|
||||||
|
<string name="csl">Китайский язык ввода</string>
|
||||||
|
<string name="cv">Чувашский</string>
|
||||||
|
<string name="kw">Корнуоллский</string>
|
||||||
|
<string name="co">Корсиканский</string>
|
||||||
|
<string name="cr">Cree</string>
|
||||||
|
<string name="hr">Хорватский</string>
|
||||||
|
<string name="cs">Чешия</string>
|
||||||
|
<string name="cse">Чешский язык ввода</string>
|
||||||
|
<string name="da">Дания</string>
|
||||||
|
<string name="dsl">Датский язык ввода</string>
|
||||||
|
<string name="dv">Мальдивский</string>
|
||||||
|
<string name="nl">Голландский</string>
|
||||||
|
<string name="dz">Dzongkha</string>
|
||||||
|
<string name="en">Английский</string>
|
||||||
|
<string name="eo">Esperanto</string>
|
||||||
|
<string name="et">Эстонский</string>
|
||||||
|
<string name="ee">Ewe</string>
|
||||||
|
<string name="fo">Фарерская</string>
|
||||||
|
<string name="fj">Fijian</string>
|
||||||
|
<string name="fi">Финский</string>
|
||||||
|
<string name="fr">Французский</string>
|
||||||
|
<string name="fsl">Французский язык ввода</string>
|
||||||
|
<string name="ff">Fulah</string>
|
||||||
|
<string name="gl">Галицкая</string>
|
||||||
|
<string name="lg">Ганда</string>
|
||||||
|
<string name="ka">Грузинский</string>
|
||||||
|
<string name="de">Германия</string>
|
||||||
|
<string name="gsg">Немецкий язык ввода</string>
|
||||||
|
<string name="gn">Гуарани</string>
|
||||||
|
<string name="gu">Гуджарати</string>
|
||||||
|
<string name="ht">Гаитянский</string>
|
||||||
|
<string name="ha">Хауса</string>
|
||||||
|
<string name="he">Иврит</string>
|
||||||
|
<string name="hz">Гереро</string>
|
||||||
|
<string name="hi">Хинди</string>
|
||||||
|
<string name="ho">Хири Моту</string>
|
||||||
|
<string name="hu">Венгерский</string>
|
||||||
|
<string name="is">Исландский</string>
|
||||||
|
<string name="ig">Игбо</string>
|
||||||
|
<string name="id">Индонезийский</string>
|
||||||
|
<string name="iu">Инуктитут</string>
|
||||||
|
<string name="ik">Инупиак</string>
|
||||||
|
<string name="ga">Ирландский</string>
|
||||||
|
<string name="it">Итальянский</string>
|
||||||
|
<string name="ja">Японский</string>
|
||||||
|
<string name="jsl">Японский язык знаков</string>
|
||||||
|
<string name="jv">Яванский</string>
|
||||||
|
<string name="kl">Гренландский</string>
|
||||||
|
<string name="kn">Каннада</string>
|
||||||
|
<string name="kr">Канури</string>
|
||||||
|
<string name="ks">Кашмирский</string>
|
||||||
|
<string name="kk">Казахский</string>
|
||||||
|
<string name="km">Кхмерский</string>
|
||||||
|
<string name="ki">Кикуйю</string>
|
||||||
|
<string name="rw">Киньяруанда</string>
|
||||||
|
<string name="ky">Киргизский</string>
|
||||||
|
<string name="tlh">Клингон</string>
|
||||||
|
<string name="kv">Коми</string>
|
||||||
|
<string name="kg">Конго</string>
|
||||||
|
<string name="ko">Корейский</string>
|
||||||
|
<string name="avk">Котава</string>
|
||||||
|
<string name="kj">Kuanyama</string>
|
||||||
|
<string name="ku">Курдский</string>
|
||||||
|
<string name="lo">Лао</string>
|
||||||
|
<string name="lv">Латышский</string>
|
||||||
|
<string name="li">Лимбурган</string>
|
||||||
|
<string name="ln">Лингала</string>
|
||||||
|
<string name="lt">Литовский</string>
|
||||||
|
<string name="jbo">Ложбан</string>
|
||||||
|
<string name="lu">Луба-Катанга</string>
|
||||||
|
<string name="lb">Люксембургский</string>
|
||||||
|
<string name="mk">Македонский</string>
|
||||||
|
<string name="mg">Малагасийский</string>
|
||||||
|
<string name="ms">Малайский (макроязык)</string>
|
||||||
|
<string name="mt">Мальтийский</string>
|
||||||
|
<string name="gv">Острова Мэн</string>
|
||||||
|
<string name="mi">Маори</string>
|
||||||
|
<string name="mr">Маратхи</string>
|
||||||
|
<string name="el">Грецкий</string>
|
||||||
|
<string name="mn">Монгольский</string>
|
||||||
|
<string name="na">Науру</string>
|
||||||
|
<string name="nv">Навахо</string>
|
||||||
|
<string name="ne">Непальский (макроязык)</string>
|
||||||
|
<string name="nd">Северный ндебеле</string>
|
||||||
|
<string name="se">Северный саам</string>
|
||||||
|
<string name="no">Норвежский</string>
|
||||||
|
<string name="nb">Норвежский букмол</string>
|
||||||
|
<string name="nn">Норвежский Нюнорск</string>
|
||||||
|
<string name="oj">Оджибва</string>
|
||||||
|
<string name="or">Ория (макроязык)</string>
|
||||||
|
<string name="os">Осетинский</string>
|
||||||
|
<string name="pks">Пакистанский язык знаков</string>
|
||||||
|
<string name="fa">Персидский</string>
|
||||||
|
<string name="pl">Польский</string>
|
||||||
|
<string name="pt">Португальский</string>
|
||||||
|
<string name="ps">Нажмите, чтобы</string>
|
||||||
|
<string name="qu">Кечуа</string>
|
||||||
|
<string name="ro">Румынский</string>
|
||||||
|
<string name="rm">Ретороманский диалект</string>
|
||||||
|
<string name="rn">Рунди</string>
|
||||||
|
<string name="ru">Русский</string>
|
||||||
|
<string name="rsl">Русский язык знаков</string>
|
||||||
|
<string name="sg">Санго</string>
|
||||||
|
<string name="sc">Сардинский</string>
|
||||||
|
<string name="sdl">Саудовская Аравия Арабский Язык знаков</string>
|
||||||
|
<string name="gd">Шотландский гэльский</string>
|
||||||
|
<string name="sr">Сербский</string>
|
||||||
|
<string name="sh">Сербско-хорватский</string>
|
||||||
|
<string name="ii">Сычуань Йи</string>
|
||||||
|
<string name="sk">Словацкий</string>
|
||||||
|
<string name="sl">Словенский</string>
|
||||||
|
<string name="so">Сомалийский</string>
|
||||||
|
<string name="sfs">Южноафриканский язык жестов</string>
|
||||||
|
<string name="nr">Южный Ндебеле</string>
|
||||||
|
<string name="st">Южный Сото</string>
|
||||||
|
<string name="es">Испанский</string>
|
||||||
|
<string name="su">Суданский</string>
|
||||||
|
<string name="sw">Суахили (макроязык)</string>
|
||||||
|
<string name="ss">Свати</string>
|
||||||
|
<string name="sv">Шведский</string>
|
||||||
|
<string name="swl">Шведский язык жестов</string>
|
||||||
|
<string name="tl">Тагальский</string>
|
||||||
|
<string name="ty">Таитянский</string>
|
||||||
|
<string name="tg">Таджикский</string>
|
||||||
|
<string name="ta">Тамильский</string>
|
||||||
|
<string name="tt">Татарский</string>
|
||||||
|
<string name="te">Телугу</string>
|
||||||
|
<string name="th">Тайски</string>
|
||||||
|
<string name="bo">Тибетский</string>
|
||||||
|
<string name="ti">Тигринья</string>
|
||||||
|
<string name="to">Тонга (Острова Тонга)</string>
|
||||||
|
<string name="ts">Тсонга</string>
|
||||||
|
<string name="tr">Турецкий</string>
|
||||||
|
<string name="tk">Туркменский</string>
|
||||||
|
<string name="ug">Уйгурский</string>
|
||||||
|
<string name="uk">Украинский</string>
|
||||||
|
<string name="ur">Урду</string>
|
||||||
|
<string name="uz">Узбекский</string>
|
||||||
|
<string name="vi">Вьетнамский</string>
|
||||||
|
<string name="wa">Валлонский</string>
|
||||||
|
<string name="cy">Валлийский</string>
|
||||||
|
<string name="fy">Западно-фризский</string>
|
||||||
|
<string name="yi">Идиш</string>
|
||||||
|
<string name="yo">Йоруба</string>
|
||||||
|
<string name="za">Чжуан</string>
|
||||||
|
|
||||||
|
<string name="red">Красный</string>
|
||||||
|
<string name="pink">Розовый</string>
|
||||||
|
<string name="purple">Пурпурный</string>
|
||||||
|
<string name="deeppurple">Темно-фиолетовый</string>
|
||||||
|
<string name="indigo">Индиго</string>
|
||||||
|
<string name="blue">Синий</string>
|
||||||
|
<string name="lightblue">Светло-синий</string>
|
||||||
|
<string name="cyan">Сиан</string>
|
||||||
|
<string name="green">Зелёный</string>
|
||||||
|
<string name="lightgreen">Светло-зеленый</string>
|
||||||
|
<string name="lime">Лайм</string>
|
||||||
|
<string name="yellow">Желтый</string>
|
||||||
|
<string name="amber">Янтарный</string>
|
||||||
|
<string name="orange">Оранжевый</string>
|
||||||
|
<string name="deeporange">Темно-оранжевый</string>
|
||||||
|
<string name="brown">Коричневый</string>
|
||||||
|
<string name="gray">Серый</string>
|
||||||
|
<string name="bluegray">Серо-голубой</string>
|
||||||
|
<string name="video_speed_05">0.5x</string>
|
||||||
|
<string name="video_speed_10">Нормальная</string>
|
||||||
|
<string name="video_speed_15">1.5x</string>
|
||||||
|
<string name="video_speed_20">2x</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="pref_title_background_play">Фоновое воспроизведение</string>
|
||||||
|
<string name="pref_description_background_play">Если включено, продолжает воспроизводить видео в фоновом режиме.</string>
|
||||||
|
<string name="bottom_nav_title_local">Локаль</string>
|
||||||
|
|
||||||
|
<string name="title_activity_account">Аккаунт</string>
|
||||||
|
|
||||||
|
<!-- Constants, Don't translate -->
|
||||||
|
|
||||||
|
</resources>
|
@ -56,4 +56,12 @@
|
|||||||
<string name="gray">灰色</string>
|
<string name="gray">灰色</string>
|
||||||
<string name="bluegray">蓝灰色</string>
|
<string name="bluegray">蓝灰色</string>
|
||||||
<string name="meta_data_views">次观看</string>
|
<string name="meta_data_views">次观看</string>
|
||||||
|
<string name="bottom_nav_title_local">本地</string>
|
||||||
|
<string name="title_activity_account">帐号</string>
|
||||||
|
<string name="pref_language">按语言过滤</string>
|
||||||
|
<string name="pref_description_language">选择你使用的语言,不勾选时所有语言的视频都会显示</string>
|
||||||
|
<string name="pref_title_torrent_player">使用种子播放</string>
|
||||||
|
<string name="pref_description_torrent_player">视频通过一个种子下载,此选项需要存储权限(实验阶段,不稳定!)</string>
|
||||||
|
<string name="action_bar_title_logout">退出</string>
|
||||||
|
<string name="zh">中文</string>
|
||||||
</resources>
|
</resources>
|
@ -1,5 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">PeerTube</string>
|
<string name="app_name" translatable="false">PeerTube</string>
|
||||||
|
|
||||||
<string name="title_activity_video_play">VideoPlayActivity</string>
|
<string name="title_activity_video_play">VideoPlayActivity</string>
|
||||||
<string name="title_activity_settings">Settings</string>
|
<string name="title_activity_settings">Settings</string>
|
||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<!-- Strings related to login -->
|
<!-- Strings related to login -->
|
||||||
<string name="prompt_server">Server</string>
|
<string name="prompt_server">Server</string>
|
||||||
<string name="prompt_email">Email</string>
|
<string name="prompt_email">Email / Username</string>
|
||||||
<string name="prompt_password">Password</string>
|
<string name="prompt_password">Password</string>
|
||||||
<string name="action_sign_in">Sign in</string>
|
<string name="action_sign_in">Sign in</string>
|
||||||
<string name="action_sign_in_short">Sign in</string>
|
<string name="action_sign_in_short">Sign in</string>
|
||||||
@ -31,16 +31,16 @@
|
|||||||
<string name="bottom_nav_title_account">Account</string>
|
<string name="bottom_nav_title_account">Account</string>
|
||||||
|
|
||||||
<!-- Strings related to Settings -->
|
<!-- Strings related to Settings -->
|
||||||
<string name="peertube_required_server_version">1.0.0-alpha.7</string>
|
<string name="peertube_required_server_version" translatable="false">1.0.0-alpha.7</string>
|
||||||
|
|
||||||
<string name="pref_default_api_base_url" formatted="false">https://troll.tv</string>
|
<string name="pref_default_api_base_url" formatted="false" translatable="false">https://troll.tv</string>
|
||||||
<string name="pref_title_peertube_server">PeerTube Server</string>
|
<string name="pref_title_peertube_server">PeerTube Server</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Strings related to Video meta data -->
|
<!-- Strings related to Video meta data -->
|
||||||
<string name="meta_data_seperator">\u0020-\u0020</string>
|
<string name="meta_data_seperator" translatable="false">\u0020-\u0020</string>
|
||||||
<string name="meta_data_views">\u0020Views</string>
|
<string name="meta_data_views">\u0020Views</string>
|
||||||
<string name="meta_data_owner_seperator">\@</string>
|
<string name="meta_data_owner_seperator" translatable="false">\@</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="video_row_video_thumbnail">Video Thumbnail</string>
|
<string name="video_row_video_thumbnail">Video Thumbnail</string>
|
||||||
@ -61,7 +61,7 @@
|
|||||||
<string name="no_data_available">No Results</string>
|
<string name="no_data_available">No Results</string>
|
||||||
<string name="descr_overflow_button">More</string>
|
<string name="descr_overflow_button">More</string>
|
||||||
<string name="menu_share">Share</string>
|
<string name="menu_share">Share</string>
|
||||||
<string name="playback_channel_name">PeerTube</string>
|
<string name="playback_channel_name" translatable="false">PeerTube</string>
|
||||||
<string name="invalid_url">Invalid Url!</string>
|
<string name="invalid_url">Invalid Url!</string>
|
||||||
<string name="pref_title_dark_mode">Dark Mode</string>
|
<string name="pref_title_dark_mode">Dark Mode</string>
|
||||||
<string name="pref_description_dark_mode">Restart App for Dark Mode to take effect.</string>
|
<string name="pref_description_dark_mode">Restart App for Dark Mode to take effect.</string>
|
||||||
@ -286,22 +286,46 @@
|
|||||||
<string name="video_speed_20">2x</string>
|
<string name="video_speed_20">2x</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="video_speed_active_icon">{faw-check}</string>
|
<string name="video_speed_active_icon" translatable="false">{faw-check}</string>
|
||||||
<string name="video_expand_icon">{faw-expand}</string>
|
<string name="video_expand_icon" translatable="false">{faw-expand}</string>
|
||||||
<string name="video_compress_icon">{faw-compress}</string>
|
<string name="video_compress_icon" translatable="false">{faw-compress}</string>
|
||||||
<string name="video_more_icon">{faw-ellipsis-v}</string>
|
<string name="video_more_icon" translatable="false">{faw-ellipsis-v}</string>
|
||||||
|
<string name="video_thumbs_up_icon" translatable="false">{faw-thumbs-up}</string>
|
||||||
|
<string name="video_thumbs_down_icon" translatable="false">{faw-thumbs-down}</string>
|
||||||
|
<string name="video_share_icon" translatable="false">{faw-share}</string>
|
||||||
|
<string name="video_download_icon" translatable="false">{faw-download}</string>
|
||||||
|
<string name="video_save_icon" translatable="false">{faw-save}</string>
|
||||||
|
|
||||||
<string name="pref_title_background_play">Background Playback</string>
|
<string name="pref_title_background_play">Background Playback</string>
|
||||||
<string name="pref_description_background_play">If enabled, continues to play video in background.</string>
|
<string name="pref_description_background_play">If enabled, continues to play video in background.</string>
|
||||||
<string name="bottom_nav_title_local">Local</string>
|
<string name="bottom_nav_title_local">Local</string>
|
||||||
|
|
||||||
<string name="title_activity_account">Account</string>
|
<string name="title_activity_account">Account</string>
|
||||||
|
<string name="menu_video_more_report">Report</string>
|
||||||
|
<string name="menu_video_more_blacklist">Blacklist</string>
|
||||||
|
<string name="video_download_permission_error">Can not download video without write permission</string>
|
||||||
|
<string name="video_rating_failed">Rating Failed</string>
|
||||||
|
<string name="video_login_required_for_service">You must login to use this service</string>
|
||||||
|
|
||||||
|
<string name="video_meta_button_share">Share</string>
|
||||||
|
<string name="video_meta_button_download">Download</string>
|
||||||
|
<string name="video_meta_button_privacy">Privacy</string>
|
||||||
|
<string name="video_meta_button_category">Category</string>
|
||||||
|
<string name="video_meta_button_license">License</string>
|
||||||
|
<string name="video_meta_button_language">Language</string>
|
||||||
|
<string name="video_meta_button_tags">Tags</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Constants, Don't translate -->
|
<!-- Constants, Don't translate -->
|
||||||
<string name="pref_token_access">pref_token_access</string>
|
<string name="pref_token_access" translatable="false">pref_token_access</string>
|
||||||
<string name="pref_token_refresh">pref_token_refresh</string>
|
<string name="pref_token_refresh" translatable="false">pref_token_refresh</string>
|
||||||
<string name="pref_token_expiration">pref_token_expiration</string>
|
<string name="pref_token_expiration" translatable="false">pref_token_expiration</string>
|
||||||
<string name="pref_token_type">pref_token_type</string>
|
<string name="pref_token_type" translatable="false">pref_token_type</string>
|
||||||
<string name="pref_auth_username">pref_auth_username</string>
|
<string name="pref_auth_username" translatable="false">pref_auth_username</string>
|
||||||
<string name="pref_auth_password">pref_auth_password</string>
|
<string name="pref_auth_password" translatable="false">pref_auth_password</string>
|
||||||
|
<string name="video_rating_none" translatable="false">none</string>
|
||||||
|
<string name="video_rating_like" translatable="false">like</string>
|
||||||
|
<string name="video_rating_dislike" translatable="false">dislike</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|