From 26d951e07d1757e90f9e47313c9a5b7a20682057 Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Sat, 29 Dec 2018 15:20:06 +0100 Subject: [PATCH] Local videos --- .../peertube/activity/VideoListActivity.java | 23 +++++++++++++++---- .../peertube/network/GetVideoDataService.java | 8 +++---- app/src/main/res/menu/menu_bottom.xml | 5 ++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 29 insertions(+), 8 deletions(-) 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 1abce71..bef23d9 100644 --- a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java @@ -80,7 +80,7 @@ public class VideoListActivity extends AppCompatActivity { private int currentStart = 0; private int count = 12; private String sort = "-createdAt"; - private String filter = ""; + private String filter = null; private String searchQuery = ""; private TextView emptyView; @@ -108,7 +108,7 @@ public class VideoListActivity extends AppCompatActivity { setContentView(R.layout.activity_video_list); - filter = ""; + filter = null; createBottomBarNavigation(); @@ -260,9 +260,9 @@ public class VideoListActivity extends AppCompatActivity { Call call; if (!searchQuery.equals("")) { - call = service.searchVideosData(start, count, sort, nsfw, searchQuery); + call = service.searchVideosData(start, count, sort, nsfw, searchQuery, filter); } else { - call = service.getVideosData(start, count, sort, nsfw); + call = service.getVideosData(start, count, sort, nsfw, filter); } /*Log the URL called*/ @@ -363,6 +363,8 @@ public class VideoListActivity extends AppCompatActivity { 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_local).setIcon( + new IconicsDrawable(this, FontAwesome.Icon.faw_home)); navMenu.findItem(R.id.navigation_subscriptions).setIcon( new IconicsDrawable(this, FontAwesome.Icon.faw_folder)); navMenu.findItem(R.id.navigation_account).setIcon( @@ -377,6 +379,7 @@ public class VideoListActivity extends AppCompatActivity { if (!isLoading) { sort = "-createdAt"; currentStart = 0; + filter = null; loadVideos(currentStart, count, sort, filter); } @@ -387,6 +390,18 @@ public class VideoListActivity extends AppCompatActivity { if (!isLoading) { sort = "-trending"; currentStart = 0; + filter = null; + loadVideos(currentStart, count, sort, filter); + } + + return true; + case R.id.navigation_local: + //Log.v(TAG, "navigation_trending"); + + if (!isLoading) { + sort = "-publishedAt"; + filter = "local"; + currentStart = 0; loadVideos(currentStart, count, sort, filter); } 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 cd9f2e8..b66b727 100644 --- a/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java +++ b/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java @@ -31,8 +31,8 @@ public interface GetVideoDataService { @Query("start") int start, @Query("count") int count, @Query("sort") String sort, - @Query("nsfw") String nsfw - //@Query("filter") String filter + @Query("nsfw") String nsfw, + @Query("filter") String filter ); @GET("videos/{id}") @@ -46,7 +46,7 @@ public interface GetVideoDataService { @Query("count") int count, @Query("sort") String sort, @Query("nsfw") String nsfw, - @Query("search") String search -// @Query("filter") String filter + @Query("search") String search, + @Query("filter") String filter ); } \ No newline at end of file diff --git a/app/src/main/res/menu/menu_bottom.xml b/app/src/main/res/menu/menu_bottom.xml index 6070ab8..2d4e290 100644 --- a/app/src/main/res/menu/menu_bottom.xml +++ b/app/src/main/res/menu/menu_bottom.xml @@ -12,6 +12,11 @@ android:title="@string/bottom_nav_title_trending" app:showAsAction="always|withText"/> + + {faw-compress} Background Playback If enabled, continues to play video in background. + Local