From 3709b6c043ea2036a61301b77b8b2d7d323a6cba Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Wed, 7 Nov 2018 23:11:19 +0100 Subject: [PATCH] - 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