From 6df4031250f408c5b28db6cb934a8acf9b2676ed Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Sun, 4 Mar 2018 20:24:32 +0100 Subject: [PATCH 01/10] Cleanup old code, expanded video info in list, moved hardcoded stuff. --- .../peertube/activity/VideoListActivity.java | 4 +- .../peertube/adapter/VideoAdapter.java | 25 ++++++++--- .../services/RecentlyAddedVideosService.java | 44 ------------------- app/src/main/res/layout/row_video.xml | 8 ++++ app/src/main/res/values/strings.xml | 4 +- 5 files changed, 32 insertions(+), 53 deletions(-) delete mode 100644 app/src/main/java/net/schueller/peertube/services/RecentlyAddedVideosService.java 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 2a732e0..4ca9634 100644 --- a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java @@ -205,9 +205,9 @@ public class VideoListActivity extends AppCompatActivity { SharedPreferences sharedPref = this.getPreferences(Context.MODE_PRIVATE); String defaultApiURL = getResources().getString(R.string.api_base_url); - String apiURL = sharedPref.getString(getString(R.string.api_url_key_key), defaultApiURL); + String apiBaseURL = sharedPref.getString(getString(R.string.api_url_key_key), defaultApiURL); - GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiURL).create(GetVideoDataService.class); + GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL + "/api/v1/").create(GetVideoDataService.class); Call call = service.getVideoData(start, count, sort); diff --git a/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java b/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java index bb4ff4f..bf7ebb2 100644 --- a/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java +++ b/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java @@ -1,7 +1,9 @@ package net.schueller.peertube.adapter; +import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.util.Log; @@ -26,6 +28,7 @@ public class VideoAdapter extends RecyclerView.Adapter videoList; private Context context; + private String apiBaseURL; public VideoAdapter(ArrayList