diff --git a/app/build.gradle b/app/build.gradle index a30218b..8a0ce83 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "net.schueller.peertube" minSdkVersion 23 targetSdkVersion 28 - versionCode 103 - versionName "1.0.3" + versionCode 104 + versionName "1.0.4" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) diff --git a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java index 31a09c1..c1c785d 100644 --- a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java @@ -63,44 +63,44 @@ public class VideoListActivity extends AppCompatActivity { private BottomNavigationViewEx.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener = item -> { - switch (item.getItemId()) { - case R.id.navigation_home: - //Log.v(TAG, "navigation_home"); + 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; + 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) { @@ -214,7 +214,7 @@ public class VideoListActivity extends AppCompatActivity { if (dy > 0) { // is at end of list? - if(!recyclerView.canScrollVertically(RecyclerView.FOCUS_DOWN)){ + if (!recyclerView.canScrollVertically(RecyclerView.FOCUS_DOWN)) { if (!isLoading) { currentStart = currentStart + count; loadVideos(currentStart, count, sort, filter); @@ -279,8 +279,8 @@ public class VideoListActivity extends AppCompatActivity { /** * Force android to not use SSLv3 - * -// * @param callingActivity Activity + *
+ * // * @param callingActivity Activity
*/
// private void updateAndroidSecurityProvider(Activity callingActivity) {
// try {
@@ -293,12 +293,13 @@ public class VideoListActivity extends AppCompatActivity {
// Log.e("SecurityException", "Google Play Services not available.");
// }
// }
-
@Override
protected void onResume() {
super.onResume();
-
- if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+ // only check when we actually need the permission
+ SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+ if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED &&
+ sharedPref.getBoolean("pref_torrent_player", false)) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 92814a4..67a3b60 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -49,7 +49,7 @@