Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
subhadipThinkpad 2019-01-03 19:58:03 +05:30
commit 641b515a4c
25 changed files with 1496 additions and 114 deletions

View File

@ -1,3 +1,10 @@
### Version 1.0.20 Tag: v1.0.20 (2019-01-02)
* Added basic login framework
* AR Strings update (@rex07)
### Version 1.0.19 Tag: v1.0.19 (2018-12-31)
* Video Language Filter (@lishoujun)
### Version 1.0.18 Tag: v1.0.18 (2018-12-31) ### Version 1.0.18 Tag: v1.0.18 (2018-12-31)
* Bug Fixes * Bug Fixes
* Arabic translation update * Arabic translation update

View File

@ -6,9 +6,14 @@ android {
applicationId "net.schueller.peertube" applicationId "net.schueller.peertube"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 1018 versionCode 1020
versionName "1.0.18" versionName "1.0.20"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ext {
libVersions = [
exoplayer: '2.9.3'
]
}
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
@ -41,13 +46,13 @@ android {
// implementation "com.github.TorrentStream:TorrentStreamServer-Android:1.0.1" // implementation "com.github.TorrentStream:TorrentStreamServer-Android:1.0.1"
// implementation 'org.webrtc:google-webrtc:1.0.+' // implementation 'org.webrtc:google-webrtc:1.0.+'
// video player // video player repo:jcenter()
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.2' implementation "com.google.android.exoplayer:exoplayer-core:$libVersions.exoplayer"
implementation 'com.google.android.exoplayer:exoplayer-dash:2.9.2' implementation "com.google.android.exoplayer:exoplayer-dash:$libVersions.exoplayer"
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.2' implementation "com.google.android.exoplayer:exoplayer-ui:$libVersions.exoplayer"
implementation 'com.google.android.exoplayer:exoplayer-hls:2.9.2' implementation "com.google.android.exoplayer:exoplayer-hls:$libVersions.exoplayer"
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.9.2' implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:$libVersions.exoplayer"
implementation 'com.google.android.exoplayer:extension-mediasession:2.9.2' implementation "com.google.android.exoplayer:extension-mediasession:$libVersions.exoplayer"
// testing // testing
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
@ -71,3 +76,6 @@ android {
} }
} }
dependencies {
implementation 'com.android.support.constraint:constraint-layout:+'
}

View File

@ -18,7 +18,8 @@
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"> tools:ignore="GoogleAppIndexingWarning"
android:name=".application.AppApplication">
<activity android:name=".activity.VideoListActivity" <activity android:name=".activity.VideoListActivity"
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/AppTheme.NoActionBar"
@ -48,6 +49,14 @@
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/AppTheme.NoActionBar"
android:label="@string/title_activity_settings" /> android:label="@string/title_activity_settings" />
<activity android:name=".activity.SelectServerActivity"
android:theme="@style/AppTheme.NoActionBar"/>
<activity android:name=".activity.AccountActivity"
android:label="@string/title_activity_account"
android:theme="@style/AppTheme.NoActionBar"/>
<!-- Content provider for search suggestions --> <!-- Content provider for search suggestions -->
<provider <provider
android:name=".provider.SearchSuggestionsProvider" android:name=".provider.SearchSuggestionsProvider"
@ -55,7 +64,9 @@
android:enabled="true" android:enabled="true"
android:exported="false" /> android:exported="false" />
<activity android:name=".activity.SelectServerActivity"/>
<service android:name=".service.VideoPlayerService" /> <service android:name=".service.VideoPlayerService" />
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,184 @@
/*
* 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.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TextView;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable;
import net.schueller.peertube.R;
import net.schueller.peertube.helper.APIUrlHelper;
import net.schueller.peertube.model.Me;
import net.schueller.peertube.model.OauthClient;
import net.schueller.peertube.model.Token;
import net.schueller.peertube.network.AuthenticationService;
import net.schueller.peertube.network.GetUserService;
import net.schueller.peertube.network.RetrofitInstance;
import net.schueller.peertube.network.Session;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
public class AccountActivity extends AppCompatActivity {
private static final String TAG = "AccountActivity";
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_top_user, menu);
// Set an icon in the ActionBar
menu.findItem(R.id.action_logout).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_sign_out_alt).actionBar());
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// action with ID action_refresh was selected
case R.id.action_logout:
Session.getInstance().invalidate();
Intent intent = new Intent(this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
this.startActivity(intent);
finish();
return true;
default:
break;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onSupportNavigateUp() {
finish(); // close this activity as oppose to navigating up
return false;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set theme
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
setTheme(getResources().getIdentifier(
sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
"style",
getPackageName())
);
setContentView(R.layout.activity_account);
// Attaching the layout to the toolbar object
Toolbar toolbar = findViewById(R.id.tool_bar_user);
// Setting toolbar as the ActionBar with setSupportActionBar() call
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(
new IconicsDrawable(this, FontAwesome.Icon.faw_chevron_left).actionBar()
);
init();
}
private void init() {
// try to get user data
getUserData();
}
private boolean getUserData() {
// TODO
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
GetUserService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetUserService.class);
Call<Me> call = service.getMe();
call.enqueue(new Callback<Me>() {
@Override
public void onResponse(@NonNull Call<Me> call, @NonNull Response<Me> response) {
if (response.isSuccessful()) {
Me me = response.body();
TextView username = findViewById(R.id.account_username);
TextView email = findViewById(R.id.account_email);
username.setText(me.getUsername());
email.setText(me.getEmail());
Log.v(TAG, me.getEmail());
}
}
@Override
public void onFailure(Call<Me> call, Throwable t) {
}
});
return true;
}
@Override
protected void onResume() {
super.onResume();
init();
}
}

View File

@ -18,16 +18,19 @@
package net.schueller.peertube.activity; package net.schueller.peertube.activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable;
import net.schueller.peertube.R; import net.schueller.peertube.R;
import net.schueller.peertube.helper.APIUrlHelper; import net.schueller.peertube.helper.APIUrlHelper;
@ -36,27 +39,23 @@ import net.schueller.peertube.model.Token;
import net.schueller.peertube.network.AuthenticationService; import net.schueller.peertube.network.AuthenticationService;
import net.schueller.peertube.network.RetrofitInstance; import net.schueller.peertube.network.RetrofitInstance;
import okhttp3.MediaType; import androidx.annotation.NonNull;
import okhttp3.OkHttpClient; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
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 AppCompatActivity {
OkHttpClient client = new OkHttpClient();
public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
private String TAG = "LoginActivity"; private String TAG = "LoginActivity";
// UI references. // UI references.
private AutoCompleteTextView mEmailView; private AutoCompleteTextView mEmailView;
private EditText mPasswordView; private EditText mPasswordView;
private View mProgressView;
private View mLoginFormView;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -79,17 +78,30 @@ public class LoginActivity extends AppCompatActivity {
mEmailView = findViewById(R.id.email); mEmailView = findViewById(R.id.email);
mPasswordView = findViewById(R.id.password); mPasswordView = findViewById(R.id.password);
// if (android.os.Build.VERSION.SDK_INT > 9) {
// StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); // Attaching the layout to the toolbar object
// StrictMode.setThreadPolicy(policy); Toolbar toolbar = findViewById(R.id.tool_bar_login);
// } // Setting toolbar as the ActionBar with setSupportActionBar() call
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(
new IconicsDrawable(this, FontAwesome.Icon.faw_chevron_left).actionBar()
);
} }
@Override
public boolean onSupportNavigateUp() {
finish(); // close this activity as oppose to navigating up
return false;
}
private void attemptLogin() { private void attemptLogin() {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
Context context = this;
// Reset errors. // Reset errors.
mEmailView.setError(null); mEmailView.setError(null);
@ -106,15 +118,18 @@ public class LoginActivity extends AppCompatActivity {
AuthenticationService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(AuthenticationService.class); AuthenticationService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(AuthenticationService.class);
Call<OauthClient> call = service.getOauthClientLocal(); Call<OauthClient> call = service.getOauthClientLocal();
call.enqueue(new Callback<OauthClient>() { call.enqueue(new Callback<OauthClient>() {
@Override @Override
public void onResponse(@NonNull Call<OauthClient> call, @NonNull retrofit2.Response<OauthClient> response) { public void onResponse(@NonNull Call<OauthClient> call, @NonNull Response<OauthClient> response) {
if (response.body() != null) { if (response.isSuccessful()) {
OauthClient oauthClient = response.body();
Call<Token> call2 = service.getAuthenticationToken( Call<Token> call2 = service.getAuthenticationToken(
response.body().getClientId(), oauthClient.getClientId(),
response.body().getClientSecret(), oauthClient.getClientSecret(),
"code", "code",
"password", "password",
"upload", "upload",
@ -125,13 +140,33 @@ public class LoginActivity extends AppCompatActivity {
@Override @Override
public void onResponse(@NonNull Call<Token> call2, @NonNull retrofit2.Response<Token> response2) { public void onResponse(@NonNull Call<Token> call2, @NonNull retrofit2.Response<Token> response2) {
if (response2.body() != null) { if (response2.isSuccessful()) {
Log.wtf(TAG, response2.body().getAccessToken());
Log.wtf(TAG, response2.body().getExpiresIn()); Token token = response2.body();
Log.wtf(TAG, response2.body().getRefreshToken());
Log.wtf(TAG, response2.body().getTokenType()); SharedPreferences.Editor editor = sharedPref.edit();
// TODO: calc expiration
//editor.putInt(getString(R.string.pref_token_expiration), token.getRefreshToken());
editor.putString(getString(R.string.pref_token_access), token.getAccessToken());
editor.putString(getString(R.string.pref_token_refresh), token.getExpiresIn());
editor.putString(getString(R.string.pref_token_type), token.getTokenType());
editor.commit();
Log.wtf(TAG, "Logged in");
Intent intent = new Intent(context, AccountActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(intent);
finish(); // close this activity
} else { } else {
Log.wtf(TAG, response2.toString()); Log.wtf(TAG, response2.toString());
Toast.makeText(LoginActivity.this, "Login Error!", Toast.LENGTH_LONG).show();
} }
} }

View File

@ -53,13 +53,16 @@ import net.schueller.peertube.R;
import net.schueller.peertube.adapter.VideoAdapter; import net.schueller.peertube.adapter.VideoAdapter;
import net.schueller.peertube.helper.APIUrlHelper; import net.schueller.peertube.helper.APIUrlHelper;
import net.schueller.peertube.model.VideoList; import net.schueller.peertube.model.VideoList;
import net.schueller.peertube.network.GetUserService;
import net.schueller.peertube.network.GetVideoDataService; import net.schueller.peertube.network.GetVideoDataService;
import net.schueller.peertube.network.RetrofitInstance; import net.schueller.peertube.network.RetrofitInstance;
import net.schueller.peertube.network.Session;
import net.schueller.peertube.provider.SearchSuggestionsProvider; import net.schueller.peertube.provider.SearchSuggestionsProvider;
import net.schueller.peertube.service.VideoPlayerService; import net.schueller.peertube.service.VideoPlayerService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Set;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
@ -82,6 +85,7 @@ public class VideoListActivity extends AppCompatActivity {
private String sort = "-createdAt"; private String sort = "-createdAt";
private String filter = null; private String filter = null;
private String searchQuery = ""; private String searchQuery = "";
private Boolean subscriptions = false;
private TextView emptyView; private TextView emptyView;
private RecyclerView recyclerView; private RecyclerView recyclerView;
@ -125,7 +129,7 @@ public class VideoListActivity extends AppCompatActivity {
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater(); MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu); inflater.inflate(R.menu.menu_top_videolist, menu);
// Set an icon in the ActionBar // Set an icon in the ActionBar
menu.findItem(R.id.action_settings).setIcon( menu.findItem(R.id.action_settings).setIcon(
@ -253,16 +257,19 @@ public class VideoListActivity extends AppCompatActivity {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String nsfw = sharedPref.getBoolean("pref_show_nsfw", false) ? "both" : "false"; String nsfw = sharedPref.getBoolean("pref_show_nsfw", false) ? "both" : "false";
Set<String> languages = sharedPref.getStringSet("pref_language", null);
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this); String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class); GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
Call<VideoList> call; Call<VideoList> call;
if (!searchQuery.equals("")) { if (!searchQuery.equals("")) {
call = service.searchVideosData(start, count, sort, nsfw, searchQuery, filter); call = service.searchVideosData(start, count, sort, nsfw, searchQuery, filter, languages);
} else if (subscriptions) {
GetUserService userService = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetUserService.class);
call = userService.getVideosSubscripions(start, count, sort);
} else { } else {
call = service.getVideosData(start, count, sort, nsfw, filter); call = service.getVideosData(start, count, sort, nsfw, filter, languages);
} }
/*Log the URL called*/ /*Log the URL called*/
@ -380,6 +387,7 @@ public class VideoListActivity extends AppCompatActivity {
sort = "-createdAt"; sort = "-createdAt";
currentStart = 0; currentStart = 0;
filter = null; filter = null;
subscriptions = false;
loadVideos(currentStart, count, sort, filter); loadVideos(currentStart, count, sort, filter);
} }
@ -391,6 +399,7 @@ public class VideoListActivity extends AppCompatActivity {
sort = "-trending"; sort = "-trending";
currentStart = 0; currentStart = 0;
filter = null; filter = null;
subscriptions = false;
loadVideos(currentStart, count, sort, filter); loadVideos(currentStart, count, sort, filter);
} }
@ -402,22 +411,42 @@ public class VideoListActivity extends AppCompatActivity {
sort = "-publishedAt"; sort = "-publishedAt";
filter = "local"; filter = "local";
currentStart = 0; currentStart = 0;
subscriptions = false;
loadVideos(currentStart, count, sort, filter); loadVideos(currentStart, count, sort, filter);
} }
return true; return true;
case R.id.navigation_subscriptions: case R.id.navigation_subscriptions:
//Log.v(TAG, "navigation_subscriptions"); //Log.v(TAG, "navigation_subscriptions");
Toast.makeText(VideoListActivity.this, "Subscriptions Not Implemented", Toast.LENGTH_SHORT).show();
return false; if (!Session.getInstance().isLoggedIn()) {
Intent intent = new Intent(this, LoginActivity.class);
this.startActivity(intent);
return false;
} else {
if (!isLoading) {
sort = "-publishedAt";
filter = null;
currentStart = 0;
subscriptions = true;
loadVideos(currentStart, count, sort, filter);
}
return true;
}
case R.id.navigation_account: case R.id.navigation_account:
//Log.v(TAG, "navigation_account"); //Log.v(TAG, "navigation_account");
Toast.makeText(VideoListActivity.this, "Account Not Implemented", Toast.LENGTH_SHORT).show(); //Toast.makeText(VideoListActivity.this, "Account Not Implemented", Toast.LENGTH_SHORT).show();
// Intent intent = new Intent(this, LoginActivity.class); if (!Session.getInstance().isLoggedIn()) {
// this.startActivity(intent); Intent intent = new Intent(this, LoginActivity.class);
this.startActivity(intent);
} else {
Intent intent = new Intent(this, AccountActivity.class);
this.startActivity(intent);
}
return false; return false;
} }

View File

@ -66,6 +66,7 @@ import net.schueller.peertube.fragment.VideoOptionsFragment;
import net.schueller.peertube.helper.APIUrlHelper; import net.schueller.peertube.helper.APIUrlHelper;
import net.schueller.peertube.helper.MetaDataHelper; import net.schueller.peertube.helper.MetaDataHelper;
import net.schueller.peertube.intents.Intents; import net.schueller.peertube.intents.Intents;
import net.schueller.peertube.model.Account;
import net.schueller.peertube.model.Avatar; import net.schueller.peertube.model.Avatar;
import net.schueller.peertube.model.Video; import net.schueller.peertube.model.Video;
import net.schueller.peertube.network.GetVideoDataService; import net.schueller.peertube.network.GetVideoDataService;
@ -89,7 +90,7 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
private Context context = this; private Context context = this;
private TextView fullscreenButton; private TextView fullscreenButton;
private Boolean isFullscreen = false; private Boolean isFullscreen = false;
private TorrentStream torrentStream;
boolean mBound = false; boolean mBound = false;
VideoPlayerService mService; VideoPlayerService mService;
@ -296,7 +297,16 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
String baseUrl = APIUrlHelper.getUrl(context); String baseUrl = APIUrlHelper.getUrl(context);
Avatar avatar = video.getAccount().getAvatar(); 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) { if (avatar != null) {
String avatarPath = avatar.getPath(); String avatarPath = avatar.getPath();
Picasso.with(context) Picasso.with(context)
@ -349,6 +359,7 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
videoOptionsFragment.show(getSupportFragmentManager(), videoOptionsFragment.show(getSupportFragmentManager(),
"video_options_fragment"); "video_options_fragment");
}); });
Log.v(TAG, "url : " + video.getFiles().get(0).getFileUrl());
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl()); mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
@ -357,11 +368,13 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
if (sharedPref.getBoolean("pref_torrent_player", false)) { if (sharedPref.getBoolean("pref_torrent_player", false)) {
String stream = video.getFiles().get(0).getTorrentUrl(); String stream = video.getFiles().get(0).getTorrentUrl();
TorrentStream torrentStream = setupTorrentStream(); Log.v(TAG, "getTorrentUrl : " + video.getFiles().get(0).getTorrentUrl());
torrentStream = setupTorrentStream();
torrentStream.startStream(stream); torrentStream.startStream(stream);
} else { } else {
startPlayer(); startPlayer();
} }
Log.v(TAG,"end of load Video");
} }
@ -412,8 +425,12 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy();
simpleExoPlayerView.setPlayer(null); simpleExoPlayerView.setPlayer(null);
if (torrentStream != null){
torrentStream.stopStream();
}
super.onDestroy();
Log.v(TAG, "onDestroy...");
} }
@Override @Override

View File

@ -0,0 +1,18 @@
package net.schueller.peertube.application;
import android.app.Application;
import android.content.Context;
public class AppApplication extends Application {
private static Application instance;
@Override
public void onCreate() {
super.onCreate();
instance = this;
}
public static Context getContext() {
return instance.getApplicationContext();
}
}

View File

@ -0,0 +1,144 @@
package net.schueller.peertube.model;
public class Me {
private Integer id;
private Account account;
private Boolean autoPlayVideo;
private Boolean blocked;
private String blockedReason;
private String createdAt;
private String email;
private String emailVerified;
private String nsfwPolicy;
private Integer role;
private String roleLabel;
private String username;
// private VideoChannels videoChannels;
private Integer videoQuota;
private Integer videoQuotaDaily;
private String webTorrentEnabled;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
public Boolean getAutoPlayVideo() {
return autoPlayVideo;
}
public void setAutoPlayVideo(Boolean autoPlayVideo) {
this.autoPlayVideo = autoPlayVideo;
}
public Boolean getBlocked() {
return blocked;
}
public void setBlocked(Boolean blocked) {
this.blocked = blocked;
}
public String getBlockedReason() {
return blockedReason;
}
public void setBlockedReason(String blockedReason) {
this.blockedReason = blockedReason;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmailVerified() {
return emailVerified;
}
public void setEmailVerified(String emailVerified) {
this.emailVerified = emailVerified;
}
public String getNsfwPolicy() {
return nsfwPolicy;
}
public void setNsfwPolicy(String nsfwPolicy) {
this.nsfwPolicy = nsfwPolicy;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public String getRoleLabel() {
return roleLabel;
}
public void setRoleLabel(String roleLabel) {
this.roleLabel = roleLabel;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Integer getVideoQuota() {
return videoQuota;
}
public void setVideoQuota(Integer videoQuota) {
this.videoQuota = videoQuota;
}
public Integer getVideoQuotaDaily() {
return videoQuotaDaily;
}
public void setVideoQuotaDaily(Integer videoQuotaDaily) {
this.videoQuotaDaily = videoQuotaDaily;
}
public String getWebTorrentEnabled() {
return webTorrentEnabled;
}
public void setWebTorrentEnabled(String webTorrentEnabled) {
this.webTorrentEnabled = webTorrentEnabled;
}
}

View File

@ -17,9 +17,14 @@
*/ */
package net.schueller.peertube.model; package net.schueller.peertube.model;
import com.google.gson.annotations.SerializedName;
public class OauthClient { public class OauthClient {
@SerializedName("client_id")
private String clientId; private String clientId;
@SerializedName("client_secret")
private String clientSecret; private String clientSecret;
public String getClientId() { public String getClientId() {

View File

@ -17,11 +17,20 @@
*/ */
package net.schueller.peertube.model; package net.schueller.peertube.model;
import com.google.gson.annotations.SerializedName;
public class Token { public class Token {
@SerializedName("access_token")
private String accessToken; private String accessToken;
@SerializedName("expires_in")
private String expiresIn; private String expiresIn;
@SerializedName("refresh_token")
private String refreshToken; private String refreshToken;
@SerializedName("token_type")
private String tokenType; private String tokenType;
public String getAccessToken() { public String getAccessToken() {

View File

@ -0,0 +1,65 @@
/*
* 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.network;
import android.util.Log;
import java.io.IOException;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
public class AuthorizationInterceptor implements Interceptor {
public AuthorizationInterceptor() {
}
@Override
public Response intercept(Chain chain) throws IOException {
Session session = Session.getInstance();
Response mainResponse = chain.proceed(chain.request());
Request mainRequest = chain.request();
if (session.isLoggedIn()) {
// add authentication header to each request if we are logged in
Request.Builder builder = mainRequest.newBuilder().header("Authorization", session.getToken()).
method(mainRequest.method(), mainRequest.body());
// Log.v("Authorization", "Intercept: " + session.getToken());
// build request
mainResponse = chain.proceed(builder.build());
// logout on auth error
if (mainResponse.code() == 401 || mainResponse.code() == 403) {
session.invalidate();
Log.v("Authorization", "Intercept: Logout forced");
}
}
return mainResponse;
}
}

View File

@ -0,0 +1,23 @@
package net.schueller.peertube.network;
import net.schueller.peertube.model.Me;
import net.schueller.peertube.model.VideoList;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Query;
public interface GetUserService {
@GET("users/me")
Call<Me> getMe();
@GET("users/me/subscriptions/videos")
Call<VideoList> getVideosSubscripions(
@Query("start") int start,
@Query("count") int count,
@Query("sort") String sort
);
}

View File

@ -20,6 +20,8 @@ package net.schueller.peertube.network;
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 retrofit2.Call; import retrofit2.Call;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Path; import retrofit2.http.Path;
@ -32,7 +34,8 @@ public interface GetVideoDataService {
@Query("count") int count, @Query("count") int count,
@Query("sort") String sort, @Query("sort") String sort,
@Query("nsfw") String nsfw, @Query("nsfw") String nsfw,
@Query("filter") String filter @Query("filter") String filter,
@Query("languageOneOf") Set<String> languages
); );
@GET("videos/{id}") @GET("videos/{id}")
@ -47,6 +50,7 @@ public interface GetVideoDataService {
@Query("sort") String sort, @Query("sort") String sort,
@Query("nsfw") String nsfw, @Query("nsfw") String nsfw,
@Query("search") String search, @Query("search") String search,
@Query("filter") String filter @Query("filter") String filter,
@Query("languageOneOf") Set<String> languages
); );
} }

View File

@ -17,6 +17,7 @@
*/ */
package net.schueller.peertube.network; package net.schueller.peertube.network;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.gson.GsonConverterFactory;
@ -28,7 +29,13 @@ public class RetrofitInstance {
public static Retrofit getRetrofitInstance(String newBaseUrl) { public static Retrofit getRetrofitInstance(String newBaseUrl) {
if (retrofit == null || !newBaseUrl.equals(baseUrl)) { if (retrofit == null || !newBaseUrl.equals(baseUrl)) {
baseUrl = newBaseUrl; baseUrl = newBaseUrl;
OkHttpClient.Builder okhttpClientBuilder = new OkHttpClient.Builder();
okhttpClientBuilder.addInterceptor(new AuthorizationInterceptor());
retrofit = new retrofit2.Retrofit.Builder() retrofit = new retrofit2.Retrofit.Builder()
.client(okhttpClientBuilder.build())
.baseUrl(baseUrl) .baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.build(); .build();

View File

@ -0,0 +1,128 @@
/*
* 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.network;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import net.schueller.peertube.R;
import net.schueller.peertube.application.AppApplication;
public class Session {
private static volatile Session sSoleInstance;
private static SharedPreferences sharedPreferences;
//private constructor.
private Session(){
Context context = AppApplication.getContext();
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
//Prevent form the reflection api.
if (sSoleInstance != null){
throw new RuntimeException("Use getInstance() method to get the single instance of this class.");
}
}
public static Session getInstance() {
if (sSoleInstance == null) { //if there is no instance available... create new one
synchronized (Session.class) {
if (sSoleInstance == null) sSoleInstance = new Session();
}
}
return sSoleInstance;
}
//Make singleton from serialize and deserialize operation.
protected Session readResolve() {
return getInstance();
}
public boolean isLoggedIn() {
// check if token exist or not
// return true if exist otherwise false
// assuming that token exists
//Log.v("Session", "isLoggedIn: " + (getToken() != null));
return getToken() != null;
}
public void saveToken(String token) {
// save the token
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(AppApplication.getContext().getString(R.string.pref_token_access), token);
editor.commit();
}
public String getToken() {
// return the token that was saved earlier
String token = sharedPreferences.getString(AppApplication.getContext().getString(R.string.pref_token_access), null);
String type = sharedPreferences.getString(AppApplication.getContext().getString(R.string.pref_token_type), "Bearer");
if (token != null) {
return type + " " + token;
}
return null;
}
public void saveUsername(String username) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(AppApplication.getContext().getString(R.string.pref_auth_username), username);
editor.commit();
}
public String getEmail() {
return sharedPreferences.getString(AppApplication.getContext().getString(R.string.pref_auth_username), null);
}
public void savePassword(String password) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(AppApplication.getContext().getString(R.string.pref_auth_password), password);
editor.commit();
}
public String getPassword() {
return sharedPreferences.getString(AppApplication.getContext().getString(R.string.pref_auth_password), null);
}
public void invalidate() {
// get called when user become logged out
// delete token and other user info
// (i.e: email, password)
// from the storage
Context context = AppApplication.getContext();
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(context.getString(R.string.pref_auth_password), null);
editor.putString(context.getString(R.string.pref_auth_username), null);
editor.putString(context.getString(R.string.pref_token_access), null);
editor.commit();
}
}

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".activity.AccountActivity"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tool_bar_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:elevation="4dp" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_marginBottom="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/account_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/account_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>
</LinearLayout>

View File

@ -3,74 +3,93 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical" android:orientation="vertical">
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="net.schueller.peertube.activity.LoginActivity">
<!-- Login progress --> <com.google.android.material.appbar.AppBarLayout
<ProgressBar android:id="@+id/appbar_login"
android:id="@+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:orientation="vertical">
<LinearLayout <androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/email_login_form" android:id="@+id/tool_bar_login"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:elevation="4dp" />
<com.google.android.material.textfield.TextInputLayout </com.google.android.material.appbar.AppBarLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView <LinearLayout
android:id="@+id/email" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="wrap_content" android:gravity="center_horizontal"
android:hint="@string/prompt_email" android:orientation="vertical"
android:inputType="textEmailAddress" android:paddingLeft="@dimen/activity_horizontal_margin"
android:maxLines="1" android:paddingTop="@dimen/activity_vertical_margin"
android:singleLine="true" /> android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="net.schueller.peertube.activity.LoginActivity">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout <ScrollView
android:layout_width="match_parent" android:id="@+id/login_form"
android:layout_height="wrap_content"> android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:imeActionId="6"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout> <LinearLayout
android:id="@+id/email_login_form"
<Button
android:id="@+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:orientation="vertical">
android:text="@string/action_sign_in"
android:textStyle="bold" /> <androidx.appcompat.widget.AppCompatTextView
</LinearLayout> android:layout_width="match_parent"
</ScrollView> android:layout_height="wrap_content"
</LinearLayout> android:text="Alpha! Login is still in heavy development and may not work correctly!" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:imeActionId="6"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/action_sign_in"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu 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"
tools:context="activity.VideoListActivity">
<item
android:id="@+id/action_logout"
android:orderInCategory="300"
android:title="@string/action_bar_title_logout"
app:showAsAction="ifRoom" />
</menu>

View File

@ -35,8 +35,8 @@
<!-- Strings related to Video meta data --> <!-- Strings related to Video meta data -->
<string name="meta_data_seperator">\0020-\0020</string> <string name="meta_data_seperator">\u0020-\u0020</string>
<string name="meta_data_views">\0020مشاهدات</string> <string name="meta_data_views">\u0020 مشاهدات</string>
<string name="meta_data_owner_seperator">\@</string> <string name="meta_data_owner_seperator">\@</string>
@ -45,11 +45,13 @@
<string name="pref_title_show_nsfw">عرض NSFW</string> <string name="pref_title_show_nsfw">عرض NSFW</string>
<string name="pref_description_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="title_activity_url_video_play">UrlVideoPlayActivity</string> <string name="title_activity_url_video_play">UrlVideoPlayActivity</string>
<string name="pref_title_torrent_player">مشغل فيديو التورنت</string> <string name="pref_title_torrent_player">مشغل فيديو التورنت</string>
<string name="pref_description_torrent_player">تشغيل الفيديو عبر بث التورنت . يتطلب هذا أذونات التخزين. (ألفا ، غير مستقر!)</string> <string name="pref_description_torrent_player">تشغيل الفيديو عبر بث التورنت . يتطلب هذا أذونات التخزين. (ألفا ، غير مستقر!)</string>
<string name="pref_title_license">الرخصة</string> <string name="pref_title_license">الرخصة</string>
<string name="pref_description_license"><b >GNU Affero General Public License v3.0</b>\n <string name="pref_description_license"><b >رخصة جنو العمومية v3.0</b>\n
\n \n
إن أذونات هذا الترخيص الأقوى للحقوق المتروكة مشروطة بإتاحة الشفرة المصدرية الكاملة للأعمال والتعديلات المرخصة ، والتي تشتمل على أعمال أكبر باستخدام عمل مرخص ، تحت نفس الترخيص. يجب الحفاظ على حقوق النشر وإشعارات الترخيص. يقدم المساهمون منحة صريحة لحقوق البراءة. عند استخدام إصدار معدل لتوفير خدمة عبر شبكة ، يجب توفير شفرة المصدر الكاملة للإصدار المعدل.</string> إن أذونات هذا الترخيص الأقوى للحقوق المتروكة مشروطة بإتاحة الشفرة المصدرية الكاملة للأعمال والتعديلات المرخصة ، والتي تشتمل على أعمال أكبر باستخدام عمل مرخص ، تحت نفس الترخيص. يجب الحفاظ على حقوق النشر وإشعارات الترخيص. يقدم المساهمون منحة صريحة لحقوق البراءة. عند استخدام إصدار معدل لتوفير خدمة عبر شبكة ، يجب توفير شفرة المصدر الكاملة للإصدار المعدل.</string>
<string name="pref_title_version">الإصدار</string> <string name="pref_title_version">الإصدار</string>
@ -64,7 +66,10 @@
<string name="pref_description_dark_mode">أعد تشغيل التطبيق لتنشيط الوضع الداكن.</string> <string name="pref_description_dark_mode">أعد تشغيل التطبيق لتنشيط الوضع الداكن.</string>
<string name="pref_title_app_theme">مظهر التطبيق</string> <string name="pref_title_app_theme">مظهر التطبيق</string>
<string name="pref_description_app_theme">أعد تشغيل التطبيق لتفعيل التعديلات التي طرأت على المظهر.</string> <string name="pref_description_app_theme">أعد تشغيل التطبيق لتفعيل التعديلات التي طرأت على المظهر.</string>
<string name="en">الإنجليزية</string>
<string name="fr">الفرنسية</string>
<string name="red">أحمر</string> <string name="red">أحمر</string>
<string name="pink">وردي</string> <string name="pink">وردي</string>
<string name="purple">بنفسجي</string> <string name="purple">بنفسجي</string>
@ -91,7 +96,7 @@
<string name="pref_title_background_play">التشغيل في الخلفية</string> <string name="pref_title_background_play">التشغيل في الخلفية</string>
<string name="pref_description_background_play">إن تم تنشيطه، ستواصل الفيديو في الإشتغال في الخلفية.</string> <string name="pref_description_background_play">إن تم تنشيطه، سيستمر تشغيل الفيديو في الخلفية.</string>
<string name="bottom_nav_title_local">المحلي</string> <string name="bottom_nav_title_local">المحلي</string>
</resources> </resources>

View File

@ -8,7 +8,7 @@
<!-- Strings related to login --> <!-- Strings related to login -->
<string name="prompt_server">Serveur</string> <string name="prompt_server">Serveur</string>
<string name="prompt_email">Email</string> <string name="prompt_email">Email</string>
<string name="prompt_password">Mot de passe (optionnel)</string> <string name="prompt_password">Mot de passe</string>
<string name="action_sign_in">Connexion</string> <string name="action_sign_in">Connexion</string>
<string name="action_sign_in_short">Connexion</string> <string name="action_sign_in_short">Connexion</string>
<string name="error_invalid_email">Cette adresse mail n\'est pas valide</string> <string name="error_invalid_email">Cette adresse mail n\'est pas valide</string>

View File

@ -44,5 +44,395 @@
<item>AppTheme.GRAY</item> <item>AppTheme.GRAY</item>
<item>AppTheme.BLUEGRAY</item> <item>AppTheme.BLUEGRAY</item>
</string-array> </string-array>
<string-array name="languageArray">
<item>@string/ab</item>
<item>@string/aa</item>
<item>@string/af</item>
<item>@string/ak</item>
<item>@string/sq</item>
<item>@string/ase</item>
<item>@string/am</item>
<item>@string/ar</item>
<item>@string/an</item>
<item>@string/hy</item>
<item>@string/as</item>
<item>@string/av</item>
<item>@string/ay</item>
<item>@string/az</item>
<item>@string/bm</item>
<item>@string/ba</item>
<item>@string/eu</item>
<item>@string/be</item>
<item>@string/bn</item>
<item>@string/bi</item>
<item>@string/bs</item>
<item>@string/bzs</item>
<item>@string/br</item>
<item>@string/bfi</item>
<item>@string/bg</item>
<item>@string/my</item>
<item>@string/ca</item>
<item>@string/ch</item>
<item>@string/ce</item>
<item>@string/zh</item>
<item>@string/csl</item>
<item>@string/cv</item>
<item>@string/kw</item>
<item>@string/co</item>
<item>@string/cr</item>
<item>@string/hr</item>
<item>@string/cs</item>
<item>@string/cse</item>
<item>@string/da</item>
<item>@string/dsl</item>
<item>@string/dv</item>
<item>@string/nl</item>
<item>@string/dz</item>
<item>@string/en</item>
<item>@string/eo</item>
<item>@string/et</item>
<item>@string/ee</item>
<item>@string/fo</item>
<item>@string/fj</item>
<item>@string/fi</item>
<item>@string/fr</item>
<item>@string/fsl</item>
<item>@string/ff</item>
<item>@string/gl</item>
<item>@string/lg</item>
<item>@string/ka</item>
<item>@string/de</item>
<item>@string/gsg</item>
<item>@string/gn</item>
<item>@string/gu</item>
<item>@string/ht</item>
<item>@string/ha</item>
<item>@string/he</item>
<item>@string/hz</item>
<item>@string/hi</item>
<item>@string/ho</item>
<item>@string/hu</item>
<item>@string/is</item>
<item>@string/ig</item>
<item>@string/id</item>
<item>@string/iu</item>
<item>@string/ik</item>
<item>@string/ga</item>
<item>@string/it</item>
<item>@string/ja</item>
<item>@string/jsl</item>
<item>@string/jv</item>
<item>@string/kl</item>
<item>@string/kn</item>
<item>@string/kr</item>
<item>@string/ks</item>
<item>@string/kk</item>
<item>@string/km</item>
<item>@string/ki</item>
<item>@string/rw</item>
<item>@string/ky</item>
<item>@string/tlh</item>
<item>@string/kv</item>
<item>@string/kg</item>
<item>@string/ko</item>
<item>@string/avk</item>
<item>@string/kj</item>
<item>@string/ku</item>
<item>@string/lo</item>
<item>@string/lv</item>
<item>@string/li</item>
<item>@string/ln</item>
<item>@string/lt</item>
<item>@string/jbo</item>
<item>@string/lu</item>
<item>@string/lb</item>
<item>@string/mk</item>
<item>@string/mg</item>
<item>@string/ms</item>
<item>@string/ml</item>
<item>@string/mt</item>
<item>@string/gv</item>
<item>@string/mi</item>
<item>@string/mr</item>
<item>@string/mh</item>
<item>@string/el</item>
<item>@string/mn</item>
<item>@string/na</item>
<item>@string/nv</item>
<item>@string/ng</item>
<item>@string/ne</item>
<item>@string/nd</item>
<item>@string/se</item>
<item>@string/no</item>
<item>@string/nb</item>
<item>@string/nn</item>
<item>@string/ny</item>
<item>@string/oc</item>
<item>@string/oj</item>
<item>@string/or</item>
<item>@string/om</item>
<item>@string/os</item>
<item>@string/pks</item>
<item>@string/pa</item>
<item>@string/fa</item>
<item>@string/pl</item>
<item>@string/pt</item>
<item>@string/ps</item>
<item>@string/qu</item>
<item>@string/ro</item>
<item>@string/rm</item>
<item>@string/rn</item>
<item>@string/ru</item>
<item>@string/rsl</item>
<item>@string/sm</item>
<item>@string/sg</item>
<item>@string/sc</item>
<item>@string/sdl</item>
<item>@string/gd</item>
<item>@string/sr</item>
<item>@string/sh</item>
<item>@string/sn</item>
<item>@string/ii</item>
<item>@string/sd</item>
<item>@string/si</item>
<item>@string/sk</item>
<item>@string/sl</item>
<item>@string/so</item>
<item>@string/sfs</item>
<item>@string/nr</item>
<item>@string/st</item>
<item>@string/es</item>
<item>@string/su</item>
<item>@string/sw</item>
<item>@string/ss</item>
<item>@string/sv</item>
<item>@string/swl</item>
<item>@string/tl</item>
<item>@string/ty</item>
<item>@string/tg</item>
<item>@string/ta</item>
<item>@string/tt</item>
<item>@string/te</item>
<item>@string/th</item>
<item>@string/bo</item>
<item>@string/ti</item>
<item>@string/to</item>
<item>@string/ts</item>
<item>@string/tn</item>
<item>@string/tr</item>
<item>@string/tk</item>
<item>@string/tw</item>
<item>@string/ug</item>
<item>@string/uk</item>
<item>@string/ur</item>
<item>@string/uz</item>
<item>@string/ve</item>
<item>@string/vi</item>
<item>@string/wa</item>
<item>@string/cy</item>
<item>@string/fy</item>
<item>@string/wo</item>
<item>@string/xh</item>
<item>@string/yi</item>
<item>@string/yo</item>
<item>@string/za</item>
<item>@string/zu</item>
</string-array>
<string-array name="languageValues">
<item>ab</item>
<item>aa</item>
<item>af</item>
<item>ak</item>
<item>sq</item>
<item>ase</item>
<item>am</item>
<item>ar</item>
<item>an</item>
<item>hy</item>
<item>as</item>
<item>av</item>
<item>ay</item>
<item>az</item>
<item>bm</item>
<item>ba</item>
<item>eu</item>
<item>be</item>
<item>bn</item>
<item>bi</item>
<item>bs</item>
<item>bzs</item>
<item>br</item>
<item>bfi</item>
<item>bg</item>
<item>my</item>
<item>ca</item>
<item>ch</item>
<item>ce</item>
<item>zh</item>
<item>csl</item>
<item>cv</item>
<item>kw</item>
<item>co</item>
<item>cr</item>
<item>hr</item>
<item>cs</item>
<item>cse</item>
<item>da</item>
<item>dsl</item>
<item>dv</item>
<item>nl</item>
<item>dz</item>
<item>en</item>
<item>eo</item>
<item>et</item>
<item>ee</item>
<item>fo</item>
<item>fj</item>
<item>fi</item>
<item>fr</item>
<item>fsl</item>
<item>ff</item>
<item>gl</item>
<item>lg</item>
<item>ka</item>
<item>de</item>
<item>gsg</item>
<item>gn</item>
<item>gu</item>
<item>ht</item>
<item>ha</item>
<item>he</item>
<item>hz</item>
<item>hi</item>
<item>ho</item>
<item>hu</item>
<item>is</item>
<item>ig</item>
<item>id</item>
<item>iu</item>
<item>ik</item>
<item>ga</item>
<item>it</item>
<item>ja</item>
<item>jsl</item>
<item>jv</item>
<item>kl</item>
<item>kn</item>
<item>kr</item>
<item>ks</item>
<item>kk</item>
<item>km</item>
<item>ki</item>
<item>rw</item>
<item>ky</item>
<item>tlh</item>
<item>kv</item>
<item>kg</item>
<item>ko</item>
<item>avk</item>
<item>kj</item>
<item>ku</item>
<item>lo</item>
<item>lv</item>
<item>li</item>
<item>ln</item>
<item>lt</item>
<item>jbo</item>
<item>lu</item>
<item>lb</item>
<item>mk</item>
<item>mg</item>
<item>ms</item>
<item>ml</item>
<item>mt</item>
<item>gv</item>
<item>mi</item>
<item>mr</item>
<item>mh</item>
<item>el</item>
<item>mn</item>
<item>na</item>
<item>nv</item>
<item>ng</item>
<item>ne</item>
<item>nd</item>
<item>se</item>
<item>no</item>
<item>nb</item>
<item>nn</item>
<item>ny</item>
<item>oc</item>
<item>oj</item>
<item>or</item>
<item>om</item>
<item>os</item>
<item>pks</item>
<item>pa</item>
<item>fa</item>
<item>pl</item>
<item>pt</item>
<item>ps</item>
<item>qu</item>
<item>ro</item>
<item>rm</item>
<item>rn</item>
<item>ru</item>
<item>rsl</item>
<item>sm</item>
<item>sg</item>
<item>sc</item>
<item>sdl</item>
<item>gd</item>
<item>sr</item>
<item>sh</item>
<item>sn</item>
<item>ii</item>
<item>sd</item>
<item>si</item>
<item>sk</item>
<item>sl</item>
<item>so</item>
<item>sfs</item>
<item>nr</item>
<item>st</item>
<item>es</item>
<item>su</item>
<item>sw</item>
<item>ss</item>
<item>sv</item>
<item>swl</item>
<item>tl</item>
<item>ty</item>
<item>tg</item>
<item>ta</item>
<item>tt</item>
<item>te</item>
<item>th</item>
<item>bo</item>
<item>ti</item>
<item>to</item>
<item>ts</item>
<item>tn</item>
<item>tr</item>
<item>tk</item>
<item>tw</item>
<item>ug</item>
<item>uk</item>
<item>ur</item>
<item>uz</item>
<item>ve</item>
<item>vi</item>
<item>wa</item>
<item>cy</item>
<item>fy</item>
<item>wo</item>
<item>xh</item>
<item>yi</item>
<item>yo</item>
<item>za</item>
<item>zu</item>
</string-array>
<string-array name="empty_array"/>
</resources> </resources>

View File

@ -8,7 +8,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</string>
<string name="prompt_password">Password (optional)</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>
<string name="error_invalid_email">This email address is invalid</string> <string name="error_invalid_email">This email address is invalid</string>
@ -22,6 +22,7 @@
<!-- Action bar --> <!-- Action bar -->
<string name="action_bar_title_search">Search</string> <string name="action_bar_title_search">Search</string>
<string name="action_bar_title_settings">Settings</string> <string name="action_bar_title_settings">Settings</string>
<string name="action_bar_title_logout">Logout</string>
<!-- Bottom navigation bar --> <!-- Bottom navigation bar -->
<string name="bottom_nav_title_home">Home</string> <string name="bottom_nav_title_home">Home</string>
@ -47,6 +48,8 @@
<string name="pref_title_show_nsfw">Show NSFW</string> <string name="pref_title_show_nsfw">Show NSFW</string>
<string name="pref_description_show_nsfw">NSFW content will be shown if enabled.</string> <string name="pref_description_show_nsfw">NSFW content will be shown if enabled.</string>
<string name="pref_language">Languages filter</string>
<string name="pref_description_language">Select video languages that should be shown. None selected will show all videos in all languages.</string>
<string name="title_activity_url_video_play">UrlVideoPlayActivity</string> <string name="title_activity_url_video_play">UrlVideoPlayActivity</string>
<string name="pref_title_torrent_player">Torrent Video Player</string> <string name="pref_title_torrent_player">Torrent Video Player</string>
<string name="pref_description_torrent_player">Video playback via a torrent stream. This requires Storage Permissions. (Alpha, not stable!)</string> <string name="pref_description_torrent_player">Video playback via a torrent stream. This requires Storage Permissions. (Alpha, not stable!)</string>
@ -65,6 +68,199 @@
<string name="pref_title_app_theme">App Theme</string> <string name="pref_title_app_theme">App Theme</string>
<string name="pref_description_app_theme">Restart App for theme to take effect.</string> <string name="pref_description_app_theme">Restart App for theme to take effect.</string>
<string name="ab">Abkhazian</string>
<string name="aa">Afar</string>
<string name="af">Afrikaans</string>
<string name="ak">Akan</string>
<string name="sq">Albanian</string>
<string name="ase">American Sign Language</string>
<string name="am">Amharic</string>
<string name="ar">Arabic</string>
<string name="an">Aragonese</string>
<string name="hy">Armenian</string>
<string name="as">Assamese</string>
<string name="av">Avaric</string>
<string name="ay">Aymara</string>
<string name="az">Azerbaijani</string>
<string name="bm">Bambara</string>
<string name="ba">Bashkir</string>
<string name="eu">Basque</string>
<string name="be">Belarusian</string>
<string name="bn">Bengali</string>
<string name="bi">Bislama</string>
<string name="bs">Bosnian</string>
<string name="bzs">Brazilian Sign Language</string>
<string name="br">Breton</string>
<string name="bfi">British Sign Language</string>
<string name="bg">Bulgarian</string>
<string name="my">Burmese</string>
<string name="ca">Catalan</string>
<string name="ch">Chamorro</string>
<string name="ce">Chechen</string>
<string name="zh">Chinese</string>
<string name="csl">Chinese Sign Language</string>
<string name="cv">Chuvash</string>
<string name="kw">Cornish</string>
<string name="co">Corsican</string>
<string name="cr">Cree</string>
<string name="hr">Croatian</string>
<string name="cs">Czech</string>
<string name="cse">Czech Sign Language</string>
<string name="da">Danish</string>
<string name="dsl">Danish Sign Language</string>
<string name="dv">Dhivehi</string>
<string name="nl">Dutch</string>
<string name="dz">Dzongkha</string>
<string name="en">English</string>
<string name="eo">Esperanto</string>
<string name="et">Estonian</string>
<string name="ee">Ewe</string>
<string name="fo">Faroese</string>
<string name="fj">Fijian</string>
<string name="fi">Finnish</string>
<string name="fr">French</string>
<string name="fsl">French Sign Language</string>
<string name="ff">Fulah</string>
<string name="gl">Galician</string>
<string name="lg">Ganda</string>
<string name="ka">Georgian</string>
<string name="de">German</string>
<string name="gsg">German Sign Language</string>
<string name="gn">Guarani</string>
<string name="gu">Gujarati</string>
<string name="ht">Haitian</string>
<string name="ha">Hausa</string>
<string name="he">Hebrew</string>
<string name="hz">Herero</string>
<string name="hi">Hindi</string>
<string name="ho">Hiri Motu</string>
<string name="hu">Hungarian</string>
<string name="is">Icelandic</string>
<string name="ig">Igbo</string>
<string name="id">Indonesian</string>
<string name="iu">Inuktitut</string>
<string name="ik">Inupiaq</string>
<string name="ga">Irish</string>
<string name="it">Italian</string>
<string name="ja">Japanese</string>
<string name="jsl">Japanese Sign Language</string>
<string name="jv">Javanese</string>
<string name="kl">Kalaallisut</string>
<string name="kn">Kannada</string>
<string name="kr">Kanuri</string>
<string name="ks">Kashmiri</string>
<string name="kk">Kazakh</string>
<string name="km">Khmer</string>
<string name="ki">Kikuyu</string>
<string name="rw">Kinyarwanda</string>
<string name="ky">Kirghiz</string>
<string name="tlh">Klingon</string>
<string name="kv">Komi</string>
<string name="kg">Kongo</string>
<string name="ko">Korean</string>
<string name="avk">Kotava</string>
<string name="kj">Kuanyama</string>
<string name="ku">Kurdish</string>
<string name="lo">Lao</string>
<string name="lv">Latvian</string>
<string name="li">Limburgan</string>
<string name="ln">Lingala</string>
<string name="lt">Lithuanian</string>
<string name="jbo">Lojban</string>
<string name="lu">Luba-Katanga</string>
<string name="lb">Luxembourgish</string>
<string name="mk">Macedonian</string>
<string name="mg">Malagasy</string>
<string name="ms">Malay (macrolanguage)</string>
<string name="ml">Malayalam</string>
<string name="mt">Maltese</string>
<string name="gv">Manx</string>
<string name="mi">Maori</string>
<string name="mr">Marathi</string>
<string name="mh">Marshallese</string>
<string name="el">Modern Greek (1453-)</string>
<string name="mn">Mongolian</string>
<string name="na">Nauru</string>
<string name="nv">Navajo</string>
<string name="ng">Ndonga</string>
<string name="ne">Nepali (macrolanguage)</string>
<string name="nd">North Ndebele</string>
<string name="se">Northern Sami</string>
<string name="no">Norwegian</string>
<string name="nb">Norwegian Bokmål</string>
<string name="nn">Norwegian Nynorsk</string>
<string name="ny">Nyanja</string>
<string name="oc">Occitan</string>
<string name="oj">Ojibwa</string>
<string name="or">Oriya (macrolanguage)</string>
<string name="om">Oromo</string>
<string name="os">Ossetian</string>
<string name="pks">Pakistan Sign Language</string>
<string name="pa">Panjabi</string>
<string name="fa">Persian</string>
<string name="pl">Polish</string>
<string name="pt">Portuguese</string>
<string name="ps">Pushto</string>
<string name="qu">Quechua</string>
<string name="ro">Romanian</string>
<string name="rm">Romansh</string>
<string name="rn">Rundi</string>
<string name="ru">Russian</string>
<string name="rsl">Russian Sign Language</string>
<string name="sm">Samoan</string>
<string name="sg">Sango</string>
<string name="sc">Sardinian</string>
<string name="sdl">Saudi Arabian Sign Language</string>
<string name="gd">Scottish Gaelic</string>
<string name="sr">Serbian</string>
<string name="sh">Serbo-Croatian</string>
<string name="sn">Shona</string>
<string name="ii">Sichuan Yi</string>
<string name="sd">Sindhi</string>
<string name="si">Sinhala</string>
<string name="sk">Slovak</string>
<string name="sl">Slovenian</string>
<string name="so">Somali</string>
<string name="sfs">South African Sign Language</string>
<string name="nr">South Ndebele</string>
<string name="st">Southern Sotho</string>
<string name="es">Spanish</string>
<string name="su">Sundanese</string>
<string name="sw">Swahili (macrolanguage)</string>
<string name="ss">Swati</string>
<string name="sv">Swedish</string>
<string name="swl">Swedish Sign Language</string>
<string name="tl">Tagalog</string>
<string name="ty">Tahitian</string>
<string name="tg">Tajik</string>
<string name="ta">Tamil</string>
<string name="tt">Tatar</string>
<string name="te">Telugu</string>
<string name="th">Thai</string>
<string name="bo">Tibetan</string>
<string name="ti">Tigrinya</string>
<string name="to">Tonga (Tonga Islands)</string>
<string name="ts">Tsonga</string>
<string name="tn">Tswana</string>
<string name="tr">Turkish</string>
<string name="tk">Turkmen</string>
<string name="tw">Twi</string>
<string name="ug">Uighur</string>
<string name="uk">Ukrainian</string>
<string name="ur">Urdu</string>
<string name="uz">Uzbek</string>
<string name="ve">Venda</string>
<string name="vi">Vietnamese</string>
<string name="wa">Walloon</string>
<string name="cy">Welsh</string>
<string name="fy">Western Frisian</string>
<string name="wo">Wolof</string>
<string name="xh">Xhosa</string>
<string name="yi">Yiddish</string>
<string name="yo">Yoruba</string>
<string name="za">Zhuang</string>
<string name="zu">Zulu</string>
<string name="red">Red</string> <string name="red">Red</string>
<string name="pink">Pink</string> <string name="pink">Pink</string>
<string name="purple">Purple</string> <string name="purple">Purple</string>
@ -98,4 +294,14 @@
<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>
<!-- Constants, Don't translate -->
<string name="pref_token_access">pref_token_access</string>
<string name="pref_token_refresh">pref_token_refresh</string>
<string name="pref_token_expiration">pref_token_expiration</string>
<string name="pref_token_type">pref_token_type</string>
<string name="pref_auth_username">pref_auth_username</string>
<string name="pref_auth_password">pref_auth_password</string>
</resources> </resources>

View File

@ -22,6 +22,14 @@
android:summary="@string/pref_description_show_nsfw" android:summary="@string/pref_description_show_nsfw"
android:defaultValue="false" /> android:defaultValue="false" />
<MultiSelectListPreference
android:defaultValue="@array/empty_array"
android:entries="@array/languageArray"
android:entryValues="@array/languageValues"
android:key="pref_language"
android:summary="@string/pref_description_language"
android:title="@string/pref_language" />
<ListPreference <ListPreference
android:title="@string/pref_title_app_theme" android:title="@string/pref_title_app_theme"
android:summary="@string/pref_description_app_theme" android:summary="@string/pref_description_app_theme"