diff --git a/CHANGELOG.md b/CHANGELOG.md index 1278fd5..5bea193 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.6.0 (2021-11-20) + + +### Features + +* Load full description 2f89538 + ## 1.5.2 (2021-10-11) diff --git a/VERSION.txt b/VERSION.txt index 4cda8f1..dc1e644 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -1.5.2 +1.6.0 diff --git a/app/build.gradle b/app/build.gradle index 27aa0f4..65553d9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,8 +46,8 @@ android { applicationId "net.schueller.peertube" minSdkVersion 21 targetSdkVersion 29 - versionCode 1063 - versionName "1.5.2" + versionCode 1064 + versionName "1.6.0" buildConfigField "long", "BUILD_TIME", readPropertyWithDefault('buildTimestamp', System.currentTimeMillis()) + 'L' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.java b/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.java index 7061288..b51e304 100644 --- a/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.java +++ b/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.java @@ -36,6 +36,7 @@ import android.widget.Toast; import com.mikepenz.iconics.Iconics; import com.squareup.picasso.Picasso; +import java.util.Objects; import net.schueller.peertube.R; import net.schueller.peertube.helper.APIUrlHelper; import net.schueller.peertube.helper.ErrorHelper; @@ -43,6 +44,7 @@ import net.schueller.peertube.helper.MetaDataHelper; import net.schueller.peertube.intents.Intents; import net.schueller.peertube.model.Account; import net.schueller.peertube.model.Avatar; +import net.schueller.peertube.model.Description; import net.schueller.peertube.model.Rating; import net.schueller.peertube.model.Video; import net.schueller.peertube.network.GetVideoDataService; @@ -210,7 +212,29 @@ public class VideoMetaDataFragment extends Fragment { // description TextView videoDescription = activity.findViewById(R.id.description); - videoDescription.setText(video.getDescription()); + String shortDescription = video.getDescription(); + if (shortDescription != null && Objects.requireNonNull(shortDescription).length() > 237) { + shortDescription += "\n" + getString(R.string.video_description_read_more); + videoDescription.setOnClickListener(v -> { + Call call = videoDataService.getVideoFullDescription(video.getUuid()); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful() && response.body() != null) { + new Description(); + Description videoFullDescription; + videoFullDescription = response.body(); + videoDescription.setText(videoFullDescription.getDescription()); + } + } + @Override + public void onFailure(Call call, Throwable t) { + Toast.makeText(getContext(), getString(R.string.video_get_full_description_failed), Toast.LENGTH_SHORT).show(); + } + }); + }); + } + videoDescription.setText(shortDescription); // video privacy TextView videoPrivacy = activity.findViewById(R.id.video_privacy); diff --git a/app/src/main/java/net/schueller/peertube/model/Description.java b/app/src/main/java/net/schueller/peertube/model/Description.java new file mode 100644 index 0000000..2070a23 --- /dev/null +++ b/app/src/main/java/net/schueller/peertube/model/Description.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2020 Stefan Schüller + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package net.schueller.peertube.model; + +public class Description { + + private String description; + + public String getDescription() { + return description; + } + + public void setDescription(final String description) { + this.description = description; + } +} 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 d4390cd..e61e168 100644 --- a/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java +++ b/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java @@ -16,6 +16,7 @@ */ package net.schueller.peertube.network; +import net.schueller.peertube.model.Description; import net.schueller.peertube.model.Rating; import net.schueller.peertube.model.Video; import net.schueller.peertube.model.VideoList; @@ -43,9 +44,9 @@ public interface GetVideoDataService { @Query("languageOneOf") Set languages ); - @GET("videos/{id}") + @GET("videos/{uuid}") Call