Merge branch 'load-full-description' into 'master'
Load full description See merge request sschueller/peertube!30
This commit is contained in:
commit
6e4026d426
|
@ -21,7 +21,7 @@ PeerTube is a federated video streaming platform that is community-owned and ad-
|
|||
|
||||
This client comes preconfigured with one PeerTube server managed by the application creator - not the PeerTube project itself, which lists more on http://instances.joinpeertube.org/ - to allow you to have a taste of what the client is capable of. Choose your server to tune your experience!
|
||||
|
||||
Please note this is app is in beta and is still missing a lot of features.
|
||||
Please note this app is in beta and is still missing a lot of features.
|
||||
|
||||
|
||||
## Download
|
||||
|
|
|
@ -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<Description> call = videoDataService.getVideoFullDescription(video.getUuid());
|
||||
call.enqueue(new Callback<Description>() {
|
||||
@Override
|
||||
public void onResponse(Call<Description> call, Response<Description> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
new Description();
|
||||
Description videoFullDescription;
|
||||
videoFullDescription = response.body();
|
||||
videoDescription.setText(videoFullDescription.getDescription());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Call<Description> 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);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Stefan Schüller <sschueller@techdroid.com>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -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<String> languages
|
||||
);
|
||||
|
||||
@GET("videos/{id}")
|
||||
@GET("videos/{uuid}")
|
||||
Call<Video> getVideoData(
|
||||
@Path(value = "id", encoded = true) String id
|
||||
@Path(value = "uuid", encoded = true) String id
|
||||
);
|
||||
|
||||
@GET("search/videos/")
|
||||
|
@ -64,6 +65,11 @@ public interface GetVideoDataService {
|
|||
@Path(value = "id", encoded = true) Integer id
|
||||
);
|
||||
|
||||
@GET("videos/{uuid}/description")
|
||||
Call<Description> getVideoFullDescription(
|
||||
@Path(value = "uuid", encoded = true) String id
|
||||
);
|
||||
|
||||
@PUT("videos/{id}/rate")
|
||||
Call<ResponseBody> rateVideo(
|
||||
@Path(value = "id", encoded = true) Integer id,
|
||||
|
|
|
@ -364,4 +364,6 @@
|
|||
<string name="pref_insecure_confirm_yes">Yes</string>
|
||||
<string name="pref_insecure_confirm_message">You are about the disable all SSL Certification validation in Thorium. Disabling this can be very dangerous if the peertube server is not under your control, because a man-in-the-middle attack could direct traffic to another server without your knowledge. An attacker could record passwords and other personal data.</string>
|
||||
<string name="video_list_live_marker">LIVE</string>
|
||||
<string name="video_get_full_description_failed">Getting full video description failed</string>
|
||||
<string name="video_description_read_more">Read More</string>
|
||||
</resources>
|
Loading…
Reference in New Issue