From 9ffea41df511b19a5b44e4c45c84d6e9d8bef5a1 Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Sat, 4 Jul 2020 20:46:32 +0200 Subject: [PATCH] Added more fields to server list --- app/build.gradle | 3 + .../peertube/adapter/ChannelAdapter.java | 2 +- .../peertube/adapter/ServerAdapter.java | 58 ++++++++++++------ .../peertube/adapter/VideoAdapter.java | 2 +- .../fragment/VideoMetaDataFragment.java | 2 +- .../net/schueller/peertube/model/Server.java | 59 ++++++++++++++++++- .../ic_baseline_remove_red_eye_24.xml | 10 ++++ .../main/res/layout/fragment_video_meta.xml | 6 +- app/src/main/res/layout/row_account_about.xml | 6 +- .../main/res/layout/row_account_channels.xml | 6 +- app/src/main/res/layout/row_account_video.xml | 6 +- app/src/main/res/layout/row_server.xml | 48 ++++++++++++--- app/src/main/res/layout/row_video.xml | 6 +- app/src/main/res/values/strings.xml | 4 ++ 14 files changed, 172 insertions(+), 46 deletions(-) create mode 100644 app/src/main/res/drawable/ic_baseline_remove_red_eye_24.xml diff --git a/app/build.gradle b/app/build.gradle index 0a32a8e..e4b5736 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,6 +65,9 @@ android { // date formatter implementation 'org.ocpsoft.prettytime:prettytime:4.0.4.Final' + // Version comparison + implementation 'org.apache.maven:maven-artifact:3.0.3' + // testing testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' diff --git a/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java b/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java index ed4f2ea..4fbbe21 100644 --- a/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java +++ b/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java @@ -160,7 +160,7 @@ public class ChannelAdapter extends RecyclerView.Adapter= 0) { + // show NSFW Icon + if (serverList.get(position).getNSFW()) { + holder.isNSFW.setVisibility(View.VISIBLE); + } + } + + + // select server holder.itemView.setOnClickListener(v -> { -// SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(activity); -// SharedPreferences.Editor editor = sharedPref.edit(); - String serverUrl = APIUrlHelper.cleanServerUrl(serverList.get(position).getHost()); -// editor.putString("pref_api_base", serverUrl); -// editor.apply(); -// -// - Toast.makeText(activity, activity.getString(R.string.server_selection_set_server, serverUrl), Toast.LENGTH_LONG).show(); Intent intent = new Intent(); @@ -138,17 +156,19 @@ public class ServerAdapter extends RecyclerView.Adapter languages; + private Boolean autoBlacklistUserVideosEnabled; + private String defaultNSFWPolicy; + private Boolean isNSFW; private Integer totalUsers; private Integer totalVideos; private Integer totalLocalVideos; private Integer totalInstanceFollowers; private Integer totalInstanceFollowing; - private Boolean supportsIPv6; private String country; - private Integer health; + private Date createdAt; public Integer getId() { return id; @@ -93,6 +100,46 @@ public class Server { this.userVideoQuota = userVideoQuota; } + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public ArrayList getLanguages() { + return languages; + } + + public void setLanguages(ArrayList languages) { + this.languages = languages; + } + + public Boolean getAutoBlacklistUserVideosEnabled() { + return autoBlacklistUserVideosEnabled; + } + + public void setAutoBlacklistUserVideosEnabled(Boolean autoBlacklistUserVideosEnabled) { + this.autoBlacklistUserVideosEnabled = autoBlacklistUserVideosEnabled; + } + + public String getDefaultNSFWPolicy() { + return defaultNSFWPolicy; + } + + public void setDefaultNSFWPolicy(String defaultNSFWPolicy) { + this.defaultNSFWPolicy = defaultNSFWPolicy; + } + + public Boolean getNSFW() { + return isNSFW; + } + + public void setNSFW(Boolean NSFW) { + isNSFW = NSFW; + } + public Integer getTotalUsers() { return totalUsers; } @@ -156,4 +203,12 @@ public class Server { public void setHealth(Integer health) { this.health = health; } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } } \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_baseline_remove_red_eye_24.xml b/app/src/main/res/drawable/ic_baseline_remove_red_eye_24.xml new file mode 100644 index 0000000..a3e222a --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_remove_red_eye_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/fragment_video_meta.xml b/app/src/main/res/layout/fragment_video_meta.xml index 1db093d..f734fe4 100644 --- a/app/src/main/res/layout/fragment_video_meta.xml +++ b/app/src/main/res/layout/fragment_video_meta.xml @@ -16,7 +16,7 @@ android:paddingEnd="12dp" /> diff --git a/app/src/main/res/layout/row_account_about.xml b/app/src/main/res/layout/row_account_about.xml index a02de1c..cb86831 100644 --- a/app/src/main/res/layout/row_account_about.xml +++ b/app/src/main/res/layout/row_account_about.xml @@ -50,7 +50,7 @@ android:paddingEnd="12dp" /> + + - + android:orientation="vertical"> + + + + + + + + + + + + diff --git a/app/src/main/res/layout/row_video.xml b/app/src/main/res/layout/row_video.xml index 170c104..398db17 100644 --- a/app/src/main/res/layout/row_video.xml +++ b/app/src/main/res/layout/row_video.xml @@ -58,7 +58,7 @@ android:paddingEnd="12dp" /> About + PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular. + NSFW Instance + Videos: %s, Local Videos: %s + pref_token_access