From 3709b6c043ea2036a61301b77b8b2d7d323a6cba Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Wed, 7 Nov 2018 23:11:19 +0100 Subject: [PATCH 1/4] - gradle update - added nsfw --- app/build.gradle | 4 ++-- .../peertube/activity/VideoListActivity.java | 13 +++++++++---- .../peertube/network/GetVideoDataService.java | 3 ++- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ea8cc53..104ad1f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,12 +24,12 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support.constraint:constraint-layout:1.1.2' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support:recyclerview-v7:27.1.1' - implementation 'com.google.android.gms:play-services-auth:15.0.1' + implementation 'com.google.android.gms:play-services-auth:16.0.1' implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation 'com.squareup.retrofit2:retrofit:2.3.0' 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 b1d3c81..983fa23 100644 --- a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java @@ -61,6 +61,7 @@ public class VideoListActivity extends AppCompatActivity { private int count = 12; private String sort = "-createdAt"; private String filter = ""; + private String nsfw = "false"; private boolean isLoading = false; @@ -107,8 +108,7 @@ public class VideoListActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_list); - //SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); - filter = ""; //"nsfw:" + sharedPref.getBoolean("pref_show_nsfw", true); + filter = ""; // Init icons Iconify.with(new FontAwesomeModule()); @@ -237,11 +237,14 @@ public class VideoListActivity extends AppCompatActivity { isLoading = true; + SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); + nsfw = sharedPref.getBoolean("pref_show_nsfw", true) ? "both" : "false"; + String apiBaseURL = APIUrlHelper.getUrl(this); GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL + "/api/v1/").create(GetVideoDataService.class); - Call call = service.getVideosData(start, count, sort, filter); + Call call = service.getVideosData(start, count, sort, nsfw); /*Log the URL called*/ Log.d("URL Called", call.request().url() + ""); @@ -255,7 +258,9 @@ public class VideoListActivity extends AppCompatActivity { videoAdapter.clearData(); } - videoAdapter.setData(response.body().getVideoArrayList()); + if (response.body() != null) { + videoAdapter.setData(response.body().getVideoArrayList()); + } isLoading = false; swipeRefreshLayout.setRefreshing(false); } diff --git a/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java b/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java index b348688..ce7ad2e 100644 --- a/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java +++ b/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java @@ -14,7 +14,8 @@ public interface GetVideoDataService { @Query("start") int start, @Query("count") int count, @Query("sort") String sort, - @Query("filter") String filter + @Query("nsfw") String nsfw + //@Query("filter") String filter ); @GET("videos/{id}") diff --git a/build.gradle b/build.gradle index 4fa2bd8..a5a2fe0 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.2.1' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c2f5e4d..ff36cf7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Jul 01 13:53:14 CEST 2018 +#Wed Nov 07 22:40:24 CET 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip From 85e08624143b94b032fea23667881243fccf3bdf Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Wed, 7 Nov 2018 23:50:54 +0100 Subject: [PATCH 2/4] - Full screen on landscape --- .../peertube/activity/VideoPlayActivity.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java b/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java index 8881c63..46e58e5 100644 --- a/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java @@ -2,6 +2,7 @@ package net.schueller.peertube.activity; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; @@ -11,7 +12,12 @@ import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Surface; +import android.view.View; +import android.view.ViewGroup; +import android.view.WindowManager; +import android.widget.FrameLayout; import android.widget.ProgressBar; +import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; @@ -216,6 +222,41 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + TextView nameView = findViewById(R.id.name); + TextView videoMetaView = findViewById(R.id.videoMeta); + TextView descriptionView = findViewById(R.id.description); + + // Checking the orientation of the screen + if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams(); + params.width = ViewGroup.LayoutParams.MATCH_PARENT; + params.height = ViewGroup.LayoutParams.MATCH_PARENT; + simpleExoPlayerView.setLayoutParams(params); + + nameView.setVisibility(View.GONE); + videoMetaView.setVisibility(View.GONE); + descriptionView.setVisibility(View.GONE); + + getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + + } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){ + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams(); + params.width = ViewGroup.LayoutParams.MATCH_PARENT; + params.height = ViewGroup.LayoutParams.WRAP_CONTENT; + simpleExoPlayerView.setLayoutParams(params); + + nameView.setVisibility(View.VISIBLE); + videoMetaView.setVisibility(View.VISIBLE); + descriptionView.setVisibility(View.VISIBLE); + + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + } + @Override public void onVideoEnabled(DecoderCounters counters) { From c27ecd713e368544d53c8be3659f79c04674e7bc Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Thu, 8 Nov 2018 00:01:04 +0100 Subject: [PATCH 3/4] - License --- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/pref_general.xml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3ba6624..a442a92 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -51,5 +51,7 @@ UrlVideoPlayActivity Torrent Video Player Videos playback via a torrent stream + License + \nGNU Affero General Public License v3.0\n\nPermissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available. diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index b440307..fae66a8 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -22,5 +22,9 @@ android:summary="@string/pref_description_torrent_player" android:defaultValue="false" /> + + From 2552d13382922a121cf6e6d3f5ead23bfb1a43a6 Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Sat, 10 Nov 2018 17:48:09 +0100 Subject: [PATCH 4/4] - Update to SDK 28 --- app/build.gradle | 22 +++++++++++-------- .../peertube/activity/VideoListActivity.java | 2 +- .../helper/BottomNavigationViewHelper.java | 2 +- .../main/res/layout/activity_video_list.xml | 2 +- app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/pref_general.xml | 4 ++++ 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 104ad1f..dc4d622 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 27 + compileSdkVersion 28 defaultConfig { applicationId "net.schueller.peertube" minSdkVersion 23 - targetSdkVersion 27 - versionCode 100 - versionName "1.0.0" + targetSdkVersion 28 + versionCode 101 + versionName "1.0.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { @@ -20,14 +20,18 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + + applicationVariants.all { variant -> + variant.resValue "string", "versionName", variant.versionName + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support:cardview-v7:27.1.1' - implementation 'com.android.support:recyclerview-v7:27.1.1' + 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.google.android.gms:play-services-auth:16.0.1' @@ -39,7 +43,7 @@ dependencies { implementation 'com.google.code.gson:gson:2.8.2' // implementation 'org.webrtc:google-webrtc:1.0.+' - implementation 'com.android.support:design:27.1.1' + implementation 'com.android.support:design:28.0.0' implementation 'com.blackboardtheory:android-iconify-fontawesome:3.0.1-SNAPSHOT' @@ -50,7 +54,7 @@ dependencies { implementation 'de.hdodenhof:circleimageview:2.2.0' - implementation 'com.android.support:support-v4:27.1.1' + implementation 'com.android.support:support-v4:28.0.0' 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' 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 983fa23..2ac5625 100644 --- a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java @@ -248,7 +248,7 @@ public class VideoListActivity extends AppCompatActivity { /*Log the URL called*/ Log.d("URL Called", call.request().url() + ""); - Toast.makeText(VideoListActivity.this, "URL Called: " + call.request().url(), Toast.LENGTH_SHORT).show(); +// Toast.makeText(VideoListActivity.this, "URL Called: " + call.request().url(), Toast.LENGTH_SHORT).show(); call.enqueue(new Callback() { @Override diff --git a/app/src/main/java/net/schueller/peertube/helper/BottomNavigationViewHelper.java b/app/src/main/java/net/schueller/peertube/helper/BottomNavigationViewHelper.java index 7e012b1..7e9642b 100644 --- a/app/src/main/java/net/schueller/peertube/helper/BottomNavigationViewHelper.java +++ b/app/src/main/java/net/schueller/peertube/helper/BottomNavigationViewHelper.java @@ -20,7 +20,7 @@ public class BottomNavigationViewHelper { for (int i = 0; i < menuView.getChildCount(); i++) { BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i); //noinspection RestrictedApi - item.setShiftingMode(false); + //item.setShiftingMode(false); // set once again checked value, so view will be updated //noinspection RestrictedApi item.setChecked(item.getItemData().isChecked()); diff --git a/app/src/main/res/layout/activity_video_list.xml b/app/src/main/res/layout/activity_video_list.xml index ec9d8ad..1380f10 100644 --- a/app/src/main/res/layout/activity_video_list.xml +++ b/app/src/main/res/layout/activity_video_list.xml @@ -39,7 +39,7 @@ Videos playback via a torrent stream License \nGNU Affero General Public License v3.0\n\nPermissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available. + Version diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index fae66a8..4da93e5 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -22,6 +22,10 @@ android:summary="@string/pref_description_torrent_player" android:defaultValue="false" /> + +