commit
4edf67a0f2
@ -1,3 +1,7 @@
|
|||||||
|
### Version 1.0.22 Tag: v1.0.22 (2019-01-05)
|
||||||
|
* Cleaned up like/dislike
|
||||||
|
* Added video download
|
||||||
|
|
||||||
### Version 1.0.21 Tag: v1.0.21 (2019-01-05)
|
### Version 1.0.21 Tag: v1.0.21 (2019-01-05)
|
||||||
* Added more video meta data
|
* Added more video meta data
|
||||||
* Very basic like and dislike functionality
|
* Very basic like and dislike functionality
|
||||||
|
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "net.schueller.peertube"
|
applicationId "net.schueller.peertube"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 1021
|
versionCode 1022
|
||||||
versionName "1.0.21"
|
versionName "1.0.22"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
ext {
|
ext {
|
||||||
libVersions = [
|
libVersions = [
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
package net.schueller.peertube.fragment;
|
package net.schueller.peertube.fragment;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.ArrayMap;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@ -14,30 +17,27 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
|
|
||||||
import com.mikepenz.iconics.Iconics;
|
import com.mikepenz.iconics.Iconics;
|
||||||
import com.mikepenz.iconics.IconicsDrawable;
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import net.schueller.peertube.R;
|
import net.schueller.peertube.R;
|
||||||
import net.schueller.peertube.activity.VideoPlayActivity;
|
|
||||||
import net.schueller.peertube.helper.APIUrlHelper;
|
import net.schueller.peertube.helper.APIUrlHelper;
|
||||||
import net.schueller.peertube.helper.MetaDataHelper;
|
import net.schueller.peertube.helper.MetaDataHelper;
|
||||||
import net.schueller.peertube.intents.Intents;
|
import net.schueller.peertube.intents.Intents;
|
||||||
import net.schueller.peertube.model.Account;
|
import net.schueller.peertube.model.Account;
|
||||||
import net.schueller.peertube.model.Avatar;
|
import net.schueller.peertube.model.Avatar;
|
||||||
|
import net.schueller.peertube.model.Rating;
|
||||||
import net.schueller.peertube.model.Video;
|
import net.schueller.peertube.model.Video;
|
||||||
import net.schueller.peertube.network.GetVideoDataService;
|
import net.schueller.peertube.network.GetVideoDataService;
|
||||||
import net.schueller.peertube.network.RetrofitInstance;
|
import net.schueller.peertube.network.RetrofitInstance;
|
||||||
import net.schueller.peertube.network.Session;
|
import net.schueller.peertube.network.Session;
|
||||||
import net.schueller.peertube.service.VideoPlayerService;
|
import net.schueller.peertube.service.VideoPlayerService;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
@ -48,6 +48,8 @@ public class VideoMetaDataFragment extends Fragment {
|
|||||||
|
|
||||||
private static final String TAG = "VideoMetaDataFragment";
|
private static final String TAG = "VideoMetaDataFragment";
|
||||||
|
|
||||||
|
private Rating videoRating;
|
||||||
|
private ColorStateList defaultTextColor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
@ -63,113 +65,79 @@ public class VideoMetaDataFragment extends Fragment {
|
|||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
|
||||||
|
String apiBaseURL = APIUrlHelper.getUrlWithVersion(context);
|
||||||
|
GetVideoDataService videoDataService = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
||||||
|
|
||||||
// Thumbs up
|
// Thumbs up
|
||||||
Button thumbsUpButton = activity.findViewById(R.id.video_thumbs_up);
|
Button thumbsUpButton = activity.findViewById(R.id.video_thumbs_up);
|
||||||
|
defaultTextColor = thumbsUpButton.getTextColors();
|
||||||
thumbsUpButton.setText(R.string.video_thumbs_up_icon);
|
thumbsUpButton.setText(R.string.video_thumbs_up_icon);
|
||||||
new Iconics.IconicsBuilder().ctx(context).on(thumbsUpButton).build();
|
new Iconics.IconicsBuilder().ctx(context).on(thumbsUpButton).build();
|
||||||
thumbsUpButton.setOnClickListener(v -> {
|
thumbsUpButton.setOnClickListener(v -> {
|
||||||
|
rateVideo(true, video.getId());
|
||||||
if (Session.getInstance().isLoggedIn()) {
|
|
||||||
|
|
||||||
// TODO: move this out helper/service
|
|
||||||
RequestBody body = RequestBody.create(
|
|
||||||
okhttp3.MediaType.parse("application/json"),
|
|
||||||
"{\"rating\":\"like\"}"
|
|
||||||
);
|
|
||||||
|
|
||||||
String apiBaseURL = APIUrlHelper.getUrlWithVersion(context);
|
|
||||||
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
|
||||||
|
|
||||||
Call<ResponseBody> call = service.rateVideo(video.getId(), body);
|
|
||||||
|
|
||||||
call.enqueue(new Callback<ResponseBody>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
|
||||||
|
|
||||||
Log.v(TAG, response.toString() );
|
|
||||||
|
|
||||||
// if 20x update likes
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ResponseBody> call, Throwable t) {
|
|
||||||
Toast.makeText(context, "Rating Failed", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Toast.makeText(context, "You must login to use this service", Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
TextView thumbsUpButtonTotal = activity.findViewById(R.id.video_thumbs_up_total);
|
TextView thumbsUpButtonTotal = activity.findViewById(R.id.video_thumbs_up_total);
|
||||||
thumbsUpButtonTotal.setText(video.getLikes().toString());
|
thumbsUpButtonTotal.setText(video.getLikes().toString());
|
||||||
|
|
||||||
// Thumbs Down
|
// Thumbs Down
|
||||||
TextView thumbsDownButton = activity.findViewById(R.id.video_thumbs_down);
|
Button thumbsDownButton = activity.findViewById(R.id.video_thumbs_down);
|
||||||
thumbsDownButton.setText(R.string.video_thumbs_down_icon);
|
thumbsDownButton.setText(R.string.video_thumbs_down_icon);
|
||||||
new Iconics.IconicsBuilder().ctx(context).on(thumbsDownButton).build();
|
new Iconics.IconicsBuilder().ctx(context).on(thumbsDownButton).build();
|
||||||
thumbsDownButton.setOnClickListener(v -> {
|
thumbsDownButton.setOnClickListener(v -> {
|
||||||
|
rateVideo(false, video.getId());
|
||||||
if (Session.getInstance().isLoggedIn()) {
|
|
||||||
|
|
||||||
// TODO: move this out helper/service
|
|
||||||
RequestBody body = RequestBody.create(
|
|
||||||
okhttp3.MediaType.parse("application/json"),
|
|
||||||
"{\"rating\":\"dislike\"}"
|
|
||||||
);
|
|
||||||
|
|
||||||
String apiBaseURL = APIUrlHelper.getUrlWithVersion(context);
|
|
||||||
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
|
||||||
|
|
||||||
Call<ResponseBody> call = service.rateVideo(video.getId(), body);
|
|
||||||
|
|
||||||
call.enqueue(new Callback<ResponseBody>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
|
||||||
|
|
||||||
// if 20x update likes
|
|
||||||
|
|
||||||
Log.v(TAG, response.toString() );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ResponseBody> call, Throwable t) {
|
|
||||||
Toast.makeText(context, "Rating Failed", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Toast.makeText(context, "You must login to use this service", Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// video rating
|
||||||
|
videoRating = new Rating();
|
||||||
|
videoRating.setRating("none"); // default
|
||||||
|
updateVideoRating();
|
||||||
|
|
||||||
|
if (Session.getInstance().isLoggedIn()) {
|
||||||
|
Call<Rating> call = videoDataService.getVideoRating(video.getId());
|
||||||
|
call.enqueue(new Callback<Rating>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<Rating> call, Response<Rating> response) {
|
||||||
|
videoRating = response.body();
|
||||||
|
updateVideoRating();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<Rating> call, Throwable t) {
|
||||||
|
// Toast.makeText(context, "Rating Failed", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TextView thumbsDownButtonTotal = activity.findViewById(R.id.video_thumbs_down_total);
|
TextView thumbsDownButtonTotal = activity.findViewById(R.id.video_thumbs_down_total);
|
||||||
thumbsDownButtonTotal.setText(video.getDislikes().toString());
|
thumbsDownButtonTotal.setText(video.getDislikes().toString());
|
||||||
|
|
||||||
// Share
|
// Share
|
||||||
TextView videoShareButton = activity.findViewById(R.id.video_share);
|
Button videoShareButton = activity.findViewById(R.id.video_share);
|
||||||
videoShareButton.setText(R.string.video_share_icon);
|
videoShareButton.setText(R.string.video_share_icon);
|
||||||
new Iconics.IconicsBuilder().ctx(context).on(videoShareButton).build();
|
new Iconics.IconicsBuilder().ctx(context).on(videoShareButton).build();
|
||||||
videoShareButton.setOnClickListener(v -> Intents.Share(context, video));
|
videoShareButton.setOnClickListener(v -> Intents.Share(context, video));
|
||||||
|
|
||||||
// Download
|
// Download
|
||||||
TextView videoDownloadButton = activity.findViewById(R.id.video_download);
|
Button videoDownloadButton = activity.findViewById(R.id.video_download);
|
||||||
videoDownloadButton.setText(R.string.video_download_icon);
|
videoDownloadButton.setText(R.string.video_download_icon);
|
||||||
new Iconics.IconicsBuilder().ctx(context).on(videoDownloadButton).build();
|
new Iconics.IconicsBuilder().ctx(context).on(videoDownloadButton).build();
|
||||||
videoDownloadButton.setOnClickListener(v -> Toast.makeText(context, "Not Implemented", Toast.LENGTH_SHORT).show());
|
videoDownloadButton.setOnClickListener(v -> {
|
||||||
|
// get permission to store file
|
||||||
// add to playlist
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
TextView videoSaveButton = activity.findViewById(R.id.video_save);
|
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
|
||||||
videoSaveButton.setText(R.string.video_save_icon);
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
|
||||||
new Iconics.IconicsBuilder().ctx(context).on(videoSaveButton).build();
|
Intents.Download(context, video);
|
||||||
videoSaveButton.setOnClickListener(v -> Toast.makeText(context, "Not Implemented", Toast.LENGTH_SHORT).show());
|
} else {
|
||||||
|
Toast.makeText(context, getString(R.string.video_download_permission_error), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Intents.Download(context, video);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Account account = video.getAccount();
|
Account account = video.getAccount();
|
||||||
@ -245,11 +213,11 @@ public class VideoMetaDataFragment extends Fragment {
|
|||||||
popup.setOnMenuItemClickListener(menuItem -> {
|
popup.setOnMenuItemClickListener(menuItem -> {
|
||||||
switch (menuItem.getItemId()) {
|
switch (menuItem.getItemId()) {
|
||||||
case R.id.video_more_report:
|
case R.id.video_more_report:
|
||||||
Log.v(TAG, "Report" );
|
Log.v(TAG, "Report");
|
||||||
Toast.makeText(context, "Not Implemented", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Not Implemented", Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
case R.id.video_more_blacklist:
|
case R.id.video_more_blacklist:
|
||||||
Log.v(TAG, "Blacklist" );
|
Log.v(TAG, "Blacklist");
|
||||||
Toast.makeText(context, "Not Implemented", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Not Implemented", Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@ -275,4 +243,91 @@ public class VideoMetaDataFragment extends Fragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void updateVideoRating() {
|
||||||
|
Button thumbsUpButton = getActivity().findViewById(R.id.video_thumbs_up);
|
||||||
|
Button thumbsDownButton = getActivity().findViewById(R.id.video_thumbs_down);
|
||||||
|
|
||||||
|
TypedValue typedValue = new TypedValue();
|
||||||
|
|
||||||
|
TypedArray a = getContext().obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorPrimary});
|
||||||
|
int accentColor = a.getColor(0, 0);
|
||||||
|
|
||||||
|
if (videoRating.getRating().equals(getString(R.string.video_rating_none))) {
|
||||||
|
thumbsUpButton.setTextColor(defaultTextColor);
|
||||||
|
thumbsDownButton.setTextColor(defaultTextColor);
|
||||||
|
//Log.v(TAG, getString(R.string.video_rating_none));
|
||||||
|
|
||||||
|
} else if (videoRating.getRating().equals(getString(R.string.video_rating_like))) {
|
||||||
|
thumbsUpButton.setTextColor(accentColor);
|
||||||
|
thumbsDownButton.setTextColor(defaultTextColor);
|
||||||
|
//Log.v(TAG, getString(R.string.video_rating_like));
|
||||||
|
|
||||||
|
} else if (videoRating.getRating().equals(getString(R.string.video_rating_dislike))) {
|
||||||
|
thumbsUpButton.setTextColor(defaultTextColor);
|
||||||
|
thumbsDownButton.setTextColor(accentColor);
|
||||||
|
//Log.v(TAG, getString(R.string.video_rating_dislike));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rateVideo(Boolean rate, Integer videoId) {
|
||||||
|
|
||||||
|
// TODO cleanup
|
||||||
|
|
||||||
|
if (Session.getInstance().isLoggedIn()) {
|
||||||
|
|
||||||
|
String ratePayload = getString(R.string.video_rating_none);
|
||||||
|
|
||||||
|
if (rate) {
|
||||||
|
// thumbsup
|
||||||
|
if (videoRating.getRating().equals(getString(R.string.video_rating_none))) {
|
||||||
|
ratePayload = getString(R.string.video_rating_like);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// thumbsdown
|
||||||
|
if (videoRating.getRating().equals(getString(R.string.video_rating_none))) {
|
||||||
|
ratePayload = getString(R.string.video_rating_dislike);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json"), "{\"rating\":\"" + ratePayload + "\"}");
|
||||||
|
|
||||||
|
String apiBaseURL = APIUrlHelper.getUrlWithVersion(getContext());
|
||||||
|
GetVideoDataService videoDataService = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
||||||
|
|
||||||
|
Call<ResponseBody> call = videoDataService.rateVideo(videoId, body);
|
||||||
|
|
||||||
|
final String newRating = ratePayload;
|
||||||
|
|
||||||
|
call.enqueue(new Callback<ResponseBody>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
||||||
|
|
||||||
|
//Log.v(TAG, response.toString());
|
||||||
|
|
||||||
|
// if 20x update likes
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
videoRating.setRating(newRating);
|
||||||
|
updateVideoRating();
|
||||||
|
|
||||||
|
// TODO: update count under thumb
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ResponseBody> call, Throwable t) {
|
||||||
|
Toast.makeText(getContext(), getString(R.string.video_rating_failed), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getContext(), getString(R.string.video_login_required_for_service), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,23 @@
|
|||||||
*/
|
*/
|
||||||
package net.schueller.peertube.intents;
|
package net.schueller.peertube.intents;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.DownloadManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.webkit.URLUtil;
|
||||||
|
|
||||||
|
import com.github.se_bastiaan.torrentstream.TorrentOptions;
|
||||||
|
|
||||||
import net.schueller.peertube.helper.APIUrlHelper;
|
import net.schueller.peertube.helper.APIUrlHelper;
|
||||||
import net.schueller.peertube.model.Video;
|
import net.schueller.peertube.model.Video;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
|
|
||||||
public class Intents {
|
public class Intents {
|
||||||
|
|
||||||
@ -32,6 +44,7 @@ public class Intents {
|
|||||||
* @param context context
|
* @param context context
|
||||||
* @param video video
|
* @param video video
|
||||||
*/
|
*/
|
||||||
|
// TODO, offer which version to download
|
||||||
public static void Share(Context context, Video video) {
|
public static void Share(Context context, Video video) {
|
||||||
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
@ -43,4 +56,25 @@ public class Intents {
|
|||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param context context
|
||||||
|
* @param video video
|
||||||
|
*/
|
||||||
|
// TODO, offer which version to download
|
||||||
|
public static void Download(Context context, Video video) {
|
||||||
|
|
||||||
|
String url = video.getFiles().get(0).getFileDownloadUrl();
|
||||||
|
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||||
|
request.setDescription(video.getDescription());
|
||||||
|
request.setTitle(video.getName());
|
||||||
|
request.allowScanningByMediaScanner();
|
||||||
|
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||||
|
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName(url, null, null));
|
||||||
|
|
||||||
|
// get download service and enqueue file
|
||||||
|
DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||||
|
manager.enqueue(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,50 @@
|
|||||||
package net.schueller.peertube.model;
|
package net.schueller.peertube.model;
|
||||||
|
|
||||||
public class File {
|
public class File {
|
||||||
|
private Integer id;
|
||||||
|
private String fileDownloadUrl;
|
||||||
|
private Integer fps;
|
||||||
|
private String label;
|
||||||
private Resolution resolution;
|
private Resolution resolution;
|
||||||
private String resolutionLabel;
|
private String resolutionLabel;
|
||||||
private String magnetUri;
|
private String magnetUri;
|
||||||
private Integer size;
|
private Integer size;
|
||||||
private String torrentUrl;
|
private String torrentUrl;
|
||||||
|
private String torrentDownloadUrl;
|
||||||
private String fileUrl;
|
private String fileUrl;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileDownloadUrl() {
|
||||||
|
return fileDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileDownloadUrl(String fileDownloadUrl) {
|
||||||
|
this.fileDownloadUrl = fileDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFps() {
|
||||||
|
return fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFps(Integer fps) {
|
||||||
|
this.fps = fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
public Resolution getResolution() {
|
public Resolution getResolution() {
|
||||||
return resolution;
|
return resolution;
|
||||||
}
|
}
|
||||||
@ -65,6 +102,14 @@ public class File {
|
|||||||
this.torrentUrl = torrentUrl;
|
this.torrentUrl = torrentUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTorrentDownloadUrl() {
|
||||||
|
return torrentDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTorrentDownloadUrl(String torrentDownloadUrl) {
|
||||||
|
this.torrentDownloadUrl = torrentDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFileUrl() {
|
public String getFileUrl() {
|
||||||
return fileUrl;
|
return fileUrl;
|
||||||
}
|
}
|
||||||
|
28
app/src/main/java/net/schueller/peertube/model/Rating.java
Normal file
28
app/src/main/java/net/schueller/peertube/model/Rating.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package net.schueller.peertube.model;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class Rating {
|
||||||
|
|
||||||
|
@SerializedName("videoId")
|
||||||
|
private Integer videoId;
|
||||||
|
|
||||||
|
@SerializedName("rating")
|
||||||
|
private String rating;
|
||||||
|
|
||||||
|
public Integer getVideoId() {
|
||||||
|
return videoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoId(Integer videoId) {
|
||||||
|
this.videoId = videoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRating() {
|
||||||
|
return rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRating(String rating) {
|
||||||
|
this.rating = rating;
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.schueller.peertube.network;
|
package net.schueller.peertube.network;
|
||||||
|
|
||||||
|
import net.schueller.peertube.model.Rating;
|
||||||
import net.schueller.peertube.model.Video;
|
import net.schueller.peertube.model.Video;
|
||||||
import net.schueller.peertube.model.VideoList;
|
import net.schueller.peertube.model.VideoList;
|
||||||
|
|
||||||
@ -59,6 +60,11 @@ public interface GetVideoDataService {
|
|||||||
@Query("languageOneOf") Set<String> languages
|
@Query("languageOneOf") Set<String> languages
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@GET("users/me/videos/{id}/rating")
|
||||||
|
Call<Rating> getVideoRating(
|
||||||
|
@Path(value = "id", encoded = true) Integer id
|
||||||
|
);
|
||||||
|
|
||||||
@PUT("videos/{id}/rate")
|
@PUT("videos/{id}/rate")
|
||||||
Call<ResponseBody> rateVideo(
|
Call<ResponseBody> rateVideo(
|
||||||
@Path(value = "id", encoded = true) Integer id,
|
@Path(value = "id", encoded = true) Integer id,
|
||||||
|
@ -46,7 +46,8 @@
|
|||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Alpha! Login is still in heavy development and may not work correctly!" />
|
android:textSize="16sp"
|
||||||
|
android:text="Alpha! Login is still in heavy development and may not work correctly! You must have an account on the instance you are connecting to. Registration is currently not supported" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Share"
|
android:text="@string/video_meta_button_share"
|
||||||
|
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
@ -173,7 +173,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Download"
|
android:text="@string/video_meta_button_download"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -183,28 +183,6 @@
|
|||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="54dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/video_save"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:background="?android:selectableItemBackground"
|
|
||||||
android:gravity="center" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/video_save_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="Save"
|
|
||||||
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -238,7 +216,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Privacy"
|
android:text="@string/video_meta_button_privacy"
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
@ -249,7 +227,7 @@
|
|||||||
android:id="@+id/video_privacy"
|
android:id="@+id/video_privacy"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center|start"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
@ -267,7 +245,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Category"
|
android:text="@string/video_meta_button_category"
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
@ -278,7 +256,7 @@
|
|||||||
android:id="@+id/video_category"
|
android:id="@+id/video_category"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center|start"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
@ -295,7 +273,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="License"
|
android:text="@string/video_meta_button_license"
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
@ -306,7 +284,7 @@
|
|||||||
android:id="@+id/video_license"
|
android:id="@+id/video_license"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center|start"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
@ -324,7 +302,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Language"
|
android:text="@string/video_meta_button_language"
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
@ -335,7 +313,7 @@
|
|||||||
android:id="@+id/video_language"
|
android:id="@+id/video_language"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center|start"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
@ -352,7 +330,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Tags"
|
android:text="@string/video_meta_button_tags"
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
@ -363,7 +341,7 @@
|
|||||||
android:id="@+id/video_tags"
|
android:id="@+id/video_tags"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center|start"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<!-- Strings related to login -->
|
<!-- Strings related to login -->
|
||||||
<string name="prompt_server">Server</string>
|
<string name="prompt_server">Server</string>
|
||||||
<string name="prompt_email">Email</string>
|
<string name="prompt_email">Email / Username</string>
|
||||||
<string name="prompt_password">Password</string>
|
<string name="prompt_password">Password</string>
|
||||||
<string name="action_sign_in">Sign in</string>
|
<string name="action_sign_in">Sign in</string>
|
||||||
<string name="action_sign_in_short">Sign in</string>
|
<string name="action_sign_in_short">Sign in</string>
|
||||||
@ -301,6 +301,20 @@
|
|||||||
<string name="bottom_nav_title_local">Local</string>
|
<string name="bottom_nav_title_local">Local</string>
|
||||||
|
|
||||||
<string name="title_activity_account">Account</string>
|
<string name="title_activity_account">Account</string>
|
||||||
|
<string name="menu_video_more_report">Report</string>
|
||||||
|
<string name="menu_video_more_blacklist">Blacklist</string>
|
||||||
|
<string name="video_download_permission_error">Can not download video without write permission</string>
|
||||||
|
<string name="video_rating_failed">Rating Failed</string>
|
||||||
|
<string name="video_login_required_for_service">You must login to use this service</string>
|
||||||
|
|
||||||
|
<string name="video_meta_button_share">Share</string>
|
||||||
|
<string name="video_meta_button_download">Download</string>
|
||||||
|
<string name="video_meta_button_privacy">Privacy</string>
|
||||||
|
<string name="video_meta_button_category">Category</string>
|
||||||
|
<string name="video_meta_button_license">License</string>
|
||||||
|
<string name="video_meta_button_language">Language</string>
|
||||||
|
<string name="video_meta_button_tags">Tags</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Constants, Don't translate -->
|
<!-- Constants, Don't translate -->
|
||||||
<string name="pref_token_access" translatable="false">pref_token_access</string>
|
<string name="pref_token_access" translatable="false">pref_token_access</string>
|
||||||
@ -309,7 +323,9 @@
|
|||||||
<string name="pref_token_type" translatable="false">pref_token_type</string>
|
<string name="pref_token_type" translatable="false">pref_token_type</string>
|
||||||
<string name="pref_auth_username" translatable="false">pref_auth_username</string>
|
<string name="pref_auth_username" translatable="false">pref_auth_username</string>
|
||||||
<string name="pref_auth_password" translatable="false">pref_auth_password</string>
|
<string name="pref_auth_password" translatable="false">pref_auth_password</string>
|
||||||
<string name="menu_video_more_report">Report</string>
|
<string name="video_rating_none" translatable="false">none</string>
|
||||||
<string name="menu_video_more_blacklist">Blacklist</string>
|
<string name="video_rating_like" translatable="false">like</string>
|
||||||
|
<string name="video_rating_dislike" translatable="false">dislike</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user