Local videos

This commit is contained in:
Stefan Schueller 2018-12-29 15:20:06 +01:00
parent d7d597f235
commit 26d951e07d
4 changed files with 29 additions and 8 deletions

View File

@ -80,7 +80,7 @@ public class VideoListActivity extends AppCompatActivity {
private int currentStart = 0; private int currentStart = 0;
private int count = 12; private int count = 12;
private String sort = "-createdAt"; private String sort = "-createdAt";
private String filter = ""; private String filter = null;
private String searchQuery = ""; private String searchQuery = "";
private TextView emptyView; private TextView emptyView;
@ -108,7 +108,7 @@ public class VideoListActivity extends AppCompatActivity {
setContentView(R.layout.activity_video_list); setContentView(R.layout.activity_video_list);
filter = ""; filter = null;
createBottomBarNavigation(); createBottomBarNavigation();
@ -260,9 +260,9 @@ public class VideoListActivity extends AppCompatActivity {
Call<VideoList> call; Call<VideoList> call;
if (!searchQuery.equals("")) { if (!searchQuery.equals("")) {
call = service.searchVideosData(start, count, sort, nsfw, searchQuery); call = service.searchVideosData(start, count, sort, nsfw, searchQuery, filter);
} else { } else {
call = service.getVideosData(start, count, sort, nsfw); call = service.getVideosData(start, count, sort, nsfw, filter);
} }
/*Log the URL called*/ /*Log the URL called*/
@ -363,6 +363,8 @@ public class VideoListActivity extends AppCompatActivity {
new IconicsDrawable(this, FontAwesome.Icon.faw_home)); new IconicsDrawable(this, FontAwesome.Icon.faw_home));
navMenu.findItem(R.id.navigation_trending).setIcon( navMenu.findItem(R.id.navigation_trending).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_fire)); 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( navMenu.findItem(R.id.navigation_subscriptions).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_folder)); new IconicsDrawable(this, FontAwesome.Icon.faw_folder));
navMenu.findItem(R.id.navigation_account).setIcon( navMenu.findItem(R.id.navigation_account).setIcon(
@ -377,6 +379,7 @@ public class VideoListActivity extends AppCompatActivity {
if (!isLoading) { if (!isLoading) {
sort = "-createdAt"; sort = "-createdAt";
currentStart = 0; currentStart = 0;
filter = null;
loadVideos(currentStart, count, sort, filter); loadVideos(currentStart, count, sort, filter);
} }
@ -387,6 +390,18 @@ public class VideoListActivity extends AppCompatActivity {
if (!isLoading) { if (!isLoading) {
sort = "-trending"; sort = "-trending";
currentStart = 0; 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); loadVideos(currentStart, count, sort, filter);
} }

View File

@ -31,8 +31,8 @@ public interface GetVideoDataService {
@Query("start") int start, @Query("start") int start,
@Query("count") int count, @Query("count") int count,
@Query("sort") String sort, @Query("sort") String sort,
@Query("nsfw") String nsfw @Query("nsfw") String nsfw,
//@Query("filter") String filter @Query("filter") String filter
); );
@GET("videos/{id}") @GET("videos/{id}")
@ -46,7 +46,7 @@ public interface GetVideoDataService {
@Query("count") int count, @Query("count") int count,
@Query("sort") String sort, @Query("sort") String sort,
@Query("nsfw") String nsfw, @Query("nsfw") String nsfw,
@Query("search") String search @Query("search") String search,
// @Query("filter") String filter @Query("filter") String filter
); );
} }

View File

@ -12,6 +12,11 @@
android:title="@string/bottom_nav_title_trending" android:title="@string/bottom_nav_title_trending"
app:showAsAction="always|withText"/> app:showAsAction="always|withText"/>
<item
android:id="@+id/navigation_local"
android:title="@string/bottom_nav_title_local"
app:showAsAction="ifRoom|withText"/>
<item <item
android:id="@+id/navigation_subscriptions" android:id="@+id/navigation_subscriptions"
android:title="@string/bottom_nav_title_subscriptions" android:title="@string/bottom_nav_title_subscriptions"

View File

@ -95,5 +95,6 @@
<string name="video_compress_icon">{faw-compress}</string> <string name="video_compress_icon">{faw-compress}</string>
<string name="pref_title_background_play">Background Playback</string> <string name="pref_title_background_play">Background Playback</string>
<string name="pref_description_background_play">If enabled, continues to play video in background.</string> <string name="pref_description_background_play">If enabled, continues to play video in background.</string>
<string name="bottom_nav_title_local">Local</string>
</resources> </resources>