Master codebase marged
This commit is contained in:
parent
a86f9d3913
commit
b4de986ddb
BIN
Screenshot1.png
Normal file
BIN
Screenshot1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 114 KiB |
BIN
Screenshot2.jpg
Normal file
BIN
Screenshot2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 KiB |
@ -6,26 +6,24 @@ android {
|
||||
applicationId "net.schueller.peertube"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 1011
|
||||
versionName "1.0.11"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
versionCode 1012
|
||||
versionName "1.0.12"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
// Layouts and design
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
implementation 'com.android.support:cardview-v7:28.0.0'
|
||||
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||
implementation 'com.android.support:design:28.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'de.hdodenhof:circleimageview:2.2.0'
|
||||
implementation 'com.android.support:support-v13:28.0.0'
|
||||
|
||||
// font awesome
|
||||
implementation 'com.blackboardtheory:android-iconify-fontawesome:3.0.1-SNAPSHOT'
|
||||
|
||||
// BottomNavigationViewEx -> https://github.com/ittianyu/BottomNavigationViewEx
|
||||
implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.2'
|
||||
implementation "com.mikepenz:iconics-core:3.1.0"
|
||||
implementation 'com.mikepenz:fontawesome-typeface:5.3.1.1@aar'
|
||||
|
||||
// http client / REST
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||
@ -49,12 +47,11 @@ android {
|
||||
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.2'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-hls:2.9.2'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.9.2'
|
||||
// implementation 'com.devbrackets.android:exomedia:4.1.0'
|
||||
|
||||
// testing
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.schueller.peertube;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -3,11 +3,10 @@ package net.schueller.peertube.activity;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -1,36 +1,31 @@
|
||||
package net.schueller.peertube.activity;
|
||||
|
||||
import android.os.StrictMode;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.schueller.peertube.R;
|
||||
import net.schueller.peertube.helper.APIUrlHelper;
|
||||
import net.schueller.peertube.model.OauthClient;
|
||||
import net.schueller.peertube.model.Token;
|
||||
import net.schueller.peertube.model.VideoList;
|
||||
import net.schueller.peertube.network.AuthenticationService;
|
||||
import net.schueller.peertube.network.GetVideoDataService;
|
||||
import net.schueller.peertube.network.RetrofitInstance;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
@ -48,6 +43,15 @@ public class LoginActivity extends AppCompatActivity {
|
||||
@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_login);
|
||||
|
||||
// bind button click
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.schueller.peertube.activity;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import net.schueller.peertube.R;
|
||||
|
@ -3,11 +3,12 @@ package net.schueller.peertube.activity;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Patterns;
|
||||
@ -17,6 +18,8 @@ import android.widget.Toast;
|
||||
import net.schueller.peertube.R;
|
||||
import java.util.List;
|
||||
|
||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||
|
||||
public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
|
||||
@ -80,7 +83,17 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
// Set theme
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
setTheme(getResources().getIdentifier(
|
||||
sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
|
||||
"style",
|
||||
getPackageName())
|
||||
);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setupActionBar();
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new GeneralPreferenceFragment()).commit();
|
||||
|
||||
|
@ -8,18 +8,20 @@ import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.SearchRecentSuggestions;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.bottomnavigation.LabelVisibilityMode;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@ -27,17 +29,8 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
//import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
||||
//import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
||||
//import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||
//import com.google.android.gms.security.ProviderInstaller;
|
||||
import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx;
|
||||
import com.joanzapata.iconify.IconDrawable;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
import com.joanzapata.iconify.fonts.FontAwesomeIcons;
|
||||
import com.joanzapata.iconify.fonts.FontAwesomeModule;
|
||||
|
||||
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
|
||||
import com.mikepenz.iconics.IconicsDrawable;
|
||||
import net.schueller.peertube.R;
|
||||
import net.schueller.peertube.adapter.VideoAdapter;
|
||||
import net.schueller.peertube.helper.APIUrlHelper;
|
||||
@ -53,6 +46,9 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||
|
||||
public class VideoListActivity extends AppCompatActivity {
|
||||
|
||||
private String TAG = "VideoListActivity";
|
||||
@ -73,49 +69,10 @@ public class VideoListActivity extends AppCompatActivity {
|
||||
|
||||
private boolean isLoading = false;
|
||||
|
||||
private BottomNavigationViewEx.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||
= item -> {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.navigation_home:
|
||||
//Log.v(TAG, "navigation_home");
|
||||
|
||||
if (!isLoading) {
|
||||
sort = "-createdAt";
|
||||
currentStart = 0;
|
||||
loadVideos(currentStart, count, sort, filter);
|
||||
}
|
||||
|
||||
return true;
|
||||
case R.id.navigation_trending:
|
||||
//Log.v(TAG, "navigation_trending");
|
||||
|
||||
if (!isLoading) {
|
||||
sort = "-trending";
|
||||
currentStart = 0;
|
||||
loadVideos(currentStart, count, sort, filter);
|
||||
}
|
||||
|
||||
return true;
|
||||
case R.id.navigation_subscriptions:
|
||||
//Log.v(TAG, "navigation_subscriptions");
|
||||
Toast.makeText(VideoListActivity.this, "Subscriptions Not Implemented", Toast.LENGTH_SHORT).show();
|
||||
|
||||
return false;
|
||||
|
||||
case R.id.navigation_account:
|
||||
//Log.v(TAG, "navigation_account");
|
||||
Toast.makeText(VideoListActivity.this, "Account Not Implemented", Toast.LENGTH_SHORT).show();
|
||||
|
||||
// Intent intent = new Intent(this, LoginActivity.class);
|
||||
// this.startActivity(intent);
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Set Night Mode
|
||||
@ -125,7 +82,7 @@ public class VideoListActivity extends AppCompatActivity {
|
||||
|
||||
// Set theme
|
||||
setTheme(getResources().getIdentifier(
|
||||
sharedPref.getString("pref_theme", "AppTheme.ORANGE"),
|
||||
sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
|
||||
"style",
|
||||
getPackageName())
|
||||
);
|
||||
@ -134,41 +91,13 @@ public class VideoListActivity extends AppCompatActivity {
|
||||
|
||||
filter = "";
|
||||
|
||||
// Init icons
|
||||
Iconify.with(new FontAwesomeModule());
|
||||
createBottomBarNavigation();
|
||||
|
||||
// Attaching the layout to the toolbar object
|
||||
Toolbar toolbar = findViewById(R.id.tool_bar);
|
||||
// Setting toolbar as the ActionBar with setSupportActionBar() call
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
// fix android trying to use SSLv3 for handshake
|
||||
// updateAndroidSecurityProvider(this);
|
||||
|
||||
// Bottom Navigation
|
||||
BottomNavigationViewEx navigation = findViewById(R.id.navigation);
|
||||
|
||||
navigation.enableAnimation(false);
|
||||
navigation.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED); // enableShiftingMode
|
||||
navigation.setItemHorizontalTranslationEnabled(false); // enableItemShiftingMode
|
||||
|
||||
Menu navMenu = navigation.getMenu();
|
||||
navMenu.findItem(R.id.navigation_home).setIcon(
|
||||
new IconDrawable(this, FontAwesomeIcons.fa_home)
|
||||
.colorRes(R.color.primaryDarkColorDeepOrange));
|
||||
navMenu.findItem(R.id.navigation_trending).setIcon(
|
||||
new IconDrawable(this, FontAwesomeIcons.fa_fire)
|
||||
.colorRes(R.color.primaryDarkColorDeepOrange));
|
||||
navMenu.findItem(R.id.navigation_subscriptions).setIcon(
|
||||
new IconDrawable(this, FontAwesomeIcons.fa_folder)
|
||||
.colorRes(R.color.primaryDarkColorDeepOrange));
|
||||
navMenu.findItem(R.id.navigation_account).setIcon(
|
||||
new IconDrawable(this, FontAwesomeIcons.fa_user_circle)
|
||||
.colorRes(R.color.primaryDarkColorDeepOrange));
|
||||
|
||||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||
|
||||
|
||||
// load Video List
|
||||
createList();
|
||||
|
||||
@ -181,16 +110,12 @@ public class VideoListActivity extends AppCompatActivity {
|
||||
|
||||
// Set an icon in the ActionBar
|
||||
menu.findItem(R.id.action_settings).setIcon(
|
||||
new IconDrawable(this, FontAwesomeIcons.fa_cog)
|
||||
.colorRes(R.color.cardview_light_background)
|
||||
.actionBarSize());
|
||||
|
||||
new IconicsDrawable(this, FontAwesome.Icon.faw_cog).actionBar());
|
||||
|
||||
MenuItem searchMenuItem = menu.findItem(R.id.action_search);
|
||||
|
||||
searchMenuItem.setIcon(
|
||||
new IconDrawable(this, FontAwesomeIcons.fa_search)
|
||||
.colorRes(R.color.cardview_light_background)
|
||||
.actionBarSize());
|
||||
new IconicsDrawable(this, FontAwesome.Icon.faw_search).actionBar());
|
||||
|
||||
// Get the SearchView and set the searchable configuration
|
||||
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
@ -356,22 +281,7 @@ public class VideoListActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Force android to not use SSLv3
|
||||
* <p>
|
||||
* // * @param callingActivity Activity
|
||||
*/
|
||||
// private void updateAndroidSecurityProvider(Activity callingActivity) {
|
||||
// try {
|
||||
// ProviderInstaller.installIfNeeded(this);
|
||||
// } catch (GooglePlayServicesRepairableException e) {
|
||||
// // Thrown when Google Play Services is not installed, up-to-date, or enabled
|
||||
// // Show dialog to allow users to install, update, or otherwise enable Google Play services.
|
||||
// GooglePlayServicesUtil.getErrorDialog(e.getConnectionStatusCode(), callingActivity, 0);
|
||||
// } catch (GooglePlayServicesNotAvailableException e) {
|
||||
// Log.e("SecurityException", "Google Play Services not available.");
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@ -415,4 +325,66 @@ public class VideoListActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
|
||||
private void createBottomBarNavigation() {
|
||||
|
||||
// Get Bottom Navigation
|
||||
BottomNavigationView navigation = findViewById(R.id.navigation);
|
||||
|
||||
// Always show text label
|
||||
navigation.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED);
|
||||
|
||||
// Add Icon font
|
||||
Menu navMenu = navigation.getMenu();
|
||||
navMenu.findItem(R.id.navigation_home).setIcon(
|
||||
new IconicsDrawable(this, FontAwesome.Icon.faw_home));
|
||||
navMenu.findItem(R.id.navigation_trending).setIcon(
|
||||
new IconicsDrawable(this, FontAwesome.Icon.faw_fire));
|
||||
navMenu.findItem(R.id.navigation_subscriptions).setIcon(
|
||||
new IconicsDrawable(this, FontAwesome.Icon.faw_folder));
|
||||
navMenu.findItem(R.id.navigation_account).setIcon(
|
||||
new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle));
|
||||
|
||||
// Click Listener
|
||||
navigation.setOnNavigationItemSelectedListener(menuItem -> {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.navigation_home:
|
||||
//Log.v(TAG, "navigation_home");
|
||||
|
||||
if (!isLoading) {
|
||||
sort = "-createdAt";
|
||||
currentStart = 0;
|
||||
loadVideos(currentStart, count, sort, filter);
|
||||
}
|
||||
|
||||
return true;
|
||||
case R.id.navigation_trending:
|
||||
//Log.v(TAG, "navigation_trending");
|
||||
|
||||
if (!isLoading) {
|
||||
sort = "-trending";
|
||||
currentStart = 0;
|
||||
loadVideos(currentStart, count, sort, filter);
|
||||
}
|
||||
|
||||
return true;
|
||||
case R.id.navigation_subscriptions:
|
||||
//Log.v(TAG, "navigation_subscriptions");
|
||||
Toast.makeText(VideoListActivity.this, "Subscriptions Not Implemented", Toast.LENGTH_SHORT).show();
|
||||
|
||||
return false;
|
||||
|
||||
case R.id.navigation_account:
|
||||
//Log.v(TAG, "navigation_account");
|
||||
Toast.makeText(VideoListActivity.this, "Account Not Implemented", Toast.LENGTH_SHORT).show();
|
||||
|
||||
// Intent intent = new Intent(this, LoginActivity.class);
|
||||
// this.startActivity(intent);
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,13 +8,9 @@ import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.util.Log;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
@ -39,6 +35,7 @@ import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.exoplayer2.video.VideoRendererEventListener;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import net.schueller.peertube.R;
|
||||
import net.schueller.peertube.helper.APIUrlHelper;
|
||||
import net.schueller.peertube.helper.MetaDataHelper;
|
||||
@ -48,22 +45,26 @@ 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 androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
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 VideoPlayActivity extends AppCompatActivity implements VideoRendererEventListener {
|
||||
|
||||
private static final String TAG = "VideoPlayActivity";
|
||||
|
||||
boolean mBound = false;
|
||||
VideoPlayerService mService;
|
||||
private ProgressBar progressBar;
|
||||
private PlayerView simpleExoPlayerView;
|
||||
private Intent videoPlayerIntent;
|
||||
private Context context = this;
|
||||
|
||||
boolean mBound = false;
|
||||
VideoPlayerService mService;
|
||||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
|
||||
@Override
|
||||
@ -90,6 +91,15 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
@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_video_play);
|
||||
|
||||
progressBar = findViewById(R.id.progress);
|
||||
@ -103,8 +113,7 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
|
||||
}
|
||||
|
||||
private void startPlayer()
|
||||
{
|
||||
private void startPlayer() {
|
||||
Util.startForegroundService(context, videoPlayerIntent);
|
||||
}
|
||||
|
||||
@ -132,7 +141,7 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
|
||||
@Override
|
||||
public void onStreamProgress(Torrent torrent, StreamStatus streamStatus) {
|
||||
if(streamStatus.bufferProgress <= 100 && progressBar.getProgress() < 100 && progressBar.getProgress() != streamStatus.bufferProgress) {
|
||||
if (streamStatus.bufferProgress <= 100 && progressBar.getProgress() < 100 && progressBar.getProgress() != streamStatus.bufferProgress) {
|
||||
//Log.d(TAG, "Progress: " + streamStatus.bufferProgress);
|
||||
progressBar.setProgress(streamStatus.bufferProgress);
|
||||
}
|
||||
@ -188,7 +197,7 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams();
|
||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
@ -203,8 +212,7 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
}
|
||||
|
||||
|
||||
private void loadVideo()
|
||||
{
|
||||
private void loadVideo() {
|
||||
// get video ID
|
||||
Intent intent = getIntent();
|
||||
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
|
||||
@ -287,36 +295,36 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
//Playback speed controls
|
||||
speed05.setOnClickListener(view -> {
|
||||
mService.setPlayBackSpeed(0.5f);
|
||||
speed05.setTextColor(getResources().getColor(R.color.colorPrimary));
|
||||
speed05.setTextColor(getResources().getColor(R.color.primaryColorRed));
|
||||
|
||||
speed10.setTextColor(getResources().getColor(R.color.black));
|
||||
speed15.setTextColor(getResources().getColor(R.color.black));
|
||||
speed20.setTextColor(getResources().getColor(R.color.black));
|
||||
speed10.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
speed15.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
speed20.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
|
||||
});
|
||||
speed10.setOnClickListener(view -> {
|
||||
mService.setPlayBackSpeed(1.0f);
|
||||
speed10.setTextColor(getResources().getColor(R.color.colorPrimary));
|
||||
speed10.setTextColor(getResources().getColor(R.color.primaryColorRed));
|
||||
|
||||
speed05.setTextColor(getResources().getColor(R.color.black));
|
||||
speed15.setTextColor(getResources().getColor(R.color.black));
|
||||
speed20.setTextColor(getResources().getColor(R.color.black));
|
||||
speed05.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
speed15.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
speed20.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
});
|
||||
speed15.setOnClickListener(view -> {
|
||||
mService.setPlayBackSpeed(1.5f);
|
||||
speed15.setTextColor(getResources().getColor(R.color.colorPrimary));
|
||||
speed15.setTextColor(getResources().getColor(R.color.primaryColorRed));
|
||||
|
||||
speed05.setTextColor(getResources().getColor(R.color.black));
|
||||
speed10.setTextColor(getResources().getColor(R.color.black));
|
||||
speed20.setTextColor(getResources().getColor(R.color.black));
|
||||
speed05.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
speed10.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
speed20.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
});
|
||||
speed20.setOnClickListener(view -> {
|
||||
mService.setPlayBackSpeed(2.0f);
|
||||
speed20.setTextColor(getResources().getColor(R.color.colorPrimary));
|
||||
speed20.setTextColor(getResources().getColor(R.color.primaryColorRed));
|
||||
|
||||
speed05.setTextColor(getResources().getColor(R.color.black));
|
||||
speed10.setTextColor(getResources().getColor(R.color.black));
|
||||
speed15.setTextColor(getResources().getColor(R.color.black));
|
||||
speed05.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
speed10.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
speed15.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
||||
});
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
|
@ -2,9 +2,9 @@ package net.schueller.peertube.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -0,0 +1,6 @@
|
||||
package net.schueller.peertube.helper;
|
||||
|
||||
public class Constants {
|
||||
public static final String THEME_PREF_KEY = "pref_theme";
|
||||
public static final String DEFAULT_THEME = "AppTheme.ORANGE";
|
||||
}
|
@ -12,7 +12,7 @@ import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlayerFactory;
|
||||
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:color="?colorAccent"
|
||||
android:state_checked="true"
|
||||
android:state_pressed="true"
|
||||
android:state_focused="true"
|
||||
android:state_selected="true"
|
||||
android:state_checkable="true"
|
||||
android:state_enabled="true"
|
||||
/>
|
||||
<item
|
||||
android:color="?colorSecondary"
|
||||
android:state_checked="false"
|
||||
android:state_pressed="false"
|
||||
android:state_focused="false"
|
||||
android:state_selected="false"
|
||||
android:state_checkable="false"
|
||||
android:state_enabled="false"
|
||||
/>
|
||||
</selector>
|
@ -30,7 +30,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
@ -43,9 +43,9 @@
|
||||
android:maxLines="1"
|
||||
android:singleLine="true" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
android:maxLines="1"
|
||||
android:singleLine="true" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/email_sign_in_button"
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.SelectServerActivity">
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,29 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<android.support.design.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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="net.schueller.peertube.activity.VideoListActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tool_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
android:elevation="4dp" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty_view"
|
||||
@ -33,7 +30,7 @@
|
||||
android:visibility="gone"
|
||||
android:text="@string/no_data_available" />
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -42,19 +39,19 @@
|
||||
android:layout_weight="1"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/navigation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -65,8 +62,7 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_gravity="bottom"
|
||||
app:menu="@menu/menu_bottom"
|
||||
app:itemIconTint="@color/bottom_bar"
|
||||
android:background="?android:attr/windowBackground"
|
||||
/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.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"
|
||||
android:layout_width="match_parent"
|
||||
@ -132,7 +132,7 @@
|
||||
android:layout_toRightOf="@id/speed05"
|
||||
android:text="1.0x"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textColor="@color/primaryColorRed"
|
||||
/>
|
||||
|
||||
<Button
|
||||
@ -158,4 +158,4 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- START*** Root Container *** -->
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -89,4 +89,4 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
@ -9,7 +9,7 @@
|
||||
android:orderInCategory="300"
|
||||
android:title="@string/action_bar_title_search"
|
||||
app:showAsAction="always|collapseActionView"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView" />
|
||||
app:actionViewClass="androidx.appcompat.widget.SearchView" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
|
@ -59,5 +59,28 @@
|
||||
<string name="menu_share">Partager</string>
|
||||
<string name="playback_channel_name">PeerTube</string>
|
||||
<string name="invalid_url">URL invalide !</string>
|
||||
<string name="pref_title_dark_mode">Mode Sombre</string>
|
||||
<string name="pref_description_dark_mode">Relancez l\'application pour que le Mode Sombre soit activé</string>
|
||||
<string name="pref_title_app_theme">Thème de l\'Application</string>
|
||||
<string name="pref_description_app_theme">Relancez l\'application pour que le nouveau thème soit activé</string>
|
||||
|
||||
<string name="red">Rouge</string>
|
||||
<string name="pink">Rose</string>
|
||||
<string name="purple">Violet</string>
|
||||
<string name="deeppurple">Violet Foncé</string>
|
||||
<string name="indigo">Indigo</string>
|
||||
<string name="blue">Bleu</string>
|
||||
<string name="lightblue">Bleu Clair</string>
|
||||
<string name="cyan">Cyan</string>
|
||||
<string name="teal">Turquoise</string>
|
||||
<string name="green">Vert</string>
|
||||
<string name="lightgreen">Vert Clair</string>
|
||||
<string name="lime">Citron Vert</string>
|
||||
<string name="yellow">Jaune</string>
|
||||
<string name="amber">Ambre</string>
|
||||
<string name="orange">Orange</string>
|
||||
<string name="deeporange">Orange Foncé</string>
|
||||
<string name="brown">Brun</string>
|
||||
<string name="gray">Gris</string>
|
||||
<string name="bluegray">Bleu-Gris</string>
|
||||
</resources>
|
||||
|
@ -70,7 +70,7 @@
|
||||
<string name="purple">Purple</string>
|
||||
<string name="deeppurple">Deep Purple</string>
|
||||
<string name="indigo">Indigo</string>
|
||||
<string name="blue">Nlue</string>
|
||||
<string name="blue">Blue</string>
|
||||
<string name="lightblue">Light Blue</string>
|
||||
<string name="cyan">Cyan</string>
|
||||
<string name="teal">Teal</string>
|
||||
|
@ -2,13 +2,10 @@
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/primaryColorAmber</item>
|
||||
<item name="colorPrimaryDark">@color/primaryDarkColorAmber</item>
|
||||
<item name="colorAccent">@color/secondaryColorAmber</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<style name="AppTheme.NoActionBar" parent="AppTheme">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
|
Loading…
Reference in New Issue
Block a user