Improve peertube - 1

This commit is contained in:
stom79 2018-10-17 11:32:16 +02:00
parent 365773c13a
commit 90144343bd
15 changed files with 588 additions and 26 deletions

View File

@ -141,7 +141,6 @@
/>
<activity android:name=".activities.PeertubeActivity"
android:label="@string/app_name"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
/>
<activity android:name=".activities.WebviewActivity"

View File

@ -15,6 +15,9 @@
package fr.gouv.etalab.mastodon.activities;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -22,15 +25,27 @@ import android.media.MediaPlayer;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.net.URL;
import java.net.URLConnection;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
@ -39,15 +54,22 @@ import java.util.Objects;
import javax.net.ssl.HttpsURLConnection;
import fr.gouv.etalab.mastodon.R;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrievePeertubeSingleAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrievePeertubeSingleCommentsAsyncTask;
import fr.gouv.etalab.mastodon.client.API;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Peertube;
import fr.gouv.etalab.mastodon.client.Entities.Results;
import fr.gouv.etalab.mastodon.client.Entities.Status;
import fr.gouv.etalab.mastodon.client.TLSSocketFactory;
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
import fr.gouv.etalab.mastodon.helper.FullScreenMediaController;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrievePeertubeInterface;
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
/**
* Created by Thomas on 14/10/20178.
@ -61,6 +83,10 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
private FullScreenMediaController.fullscreen fullscreen;
private VideoView videoView;
private RelativeLayout loader;
private TextView peertube_view_count, peertube_like_count, peertube_dislike_count, peertube_share, peertube_download, peertube_description, peertube_title;
private ScrollView peertube_information_container;
private ProgressDialog pDialog;
public static final int progress_bar_type = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -84,6 +110,15 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
setContentView(R.layout.activity_peertube);
loader = findViewById(R.id.loader);
peertube_view_count = findViewById(R.id.peertube_view_count);
peertube_like_count = findViewById(R.id.peertube_like_count);
peertube_dislike_count = findViewById(R.id.peertube_dislike_count);
peertube_share = findViewById(R.id.peertube_share);
peertube_download = findViewById(R.id.peertube_download);
peertube_description = findViewById(R.id.peertube_description);
peertube_title = findViewById(R.id.peertube_title);
peertube_information_container = findViewById(R.id.peertube_information_container);
loader.setVisibility(View.VISIBLE);
Bundle b = getIntent().getExtras();
if(b != null) {
@ -91,8 +126,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
videoId = b.getString("video_id", null);
peertubeLinkToFetch = b.getString("peertubeLinkToFetch", null);
}
if( peertubeLinkToFetch == null)
finish();
if( getSupportActionBar() != null)
@ -100,6 +133,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
videoView = findViewById(R.id.media_video);
new RetrievePeertubeSingleAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new RetrievePeertubeSingleCommentsAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public void change(){
@ -107,10 +141,12 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Objects.requireNonNull(getSupportActionBar()).hide();
peertube_information_container.setVisibility(View.GONE);
}else{
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
Objects.requireNonNull(getSupportActionBar()).show();
peertube_information_container.setVisibility(View.VISIBLE);
}
}
@ -190,6 +226,15 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
loader.setVisibility(View.GONE);
return;
}
Peertube peertube = apiResponse.getPeertubes().get(0);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
setTitle(peertube.getName());
peertube_description.setText(peertube.getDescription());
peertube_title.setText(peertube.getName());
peertube_dislike_count.setText(String.valueOf(peertube.getDislike()));
peertube_like_count.setText(String.valueOf(peertube.getLike()));
peertube_view_count.setText(String.valueOf(peertube.getView()));
Uri uri = Uri.parse(apiResponse.getPeertubes().get(0).getStreamURL());
try {
@ -208,8 +253,117 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
@Override
public void onPrepared(MediaPlayer mp) {
loader.setVisibility(View.GONE);
mp.start();
//mp.start();
}
});
peertube_download.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new DownloadFileFromURL().execute(peertube.getStreamURL());
}
});
}
@Override
public void onRetrievePeertubeComments(APIResponse apiResponse) {
if( apiResponse == null || (apiResponse.getError() != null && apiResponse.getError().getStatusCode() != 404) ){
if( apiResponse == null)
Toast.makeText(PeertubeActivity.this, R.string.toast_error,Toast.LENGTH_LONG).show();
else
Toast.makeText(PeertubeActivity.this, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
return;
}
List<Status> statuses = apiResponse.getStatuses();
Log.v(Helper.TAG,"statuses " + statuses);
if( statuses != null)
Log.v(Helper.TAG,"size " + statuses.size());
if( statuses == null || statuses.size() == 0){
RelativeLayout no_action = findViewById(R.id.no_action);
no_action.setVisibility(View.VISIBLE);
RecyclerView lv_comments = findViewById(R.id.peertube_comments);
lv_comments.setVisibility(View.GONE);
}else {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean isOnWifi = Helper.isOnWIFI(PeertubeActivity.this);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
StatusListAdapter statusListAdapter = new StatusListAdapter(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, userId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
RecyclerView lv_comments = findViewById(R.id.peertube_comments);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
lv_comments.setLayoutManager(mLayoutManager);
lv_comments.setNestedScrollingEnabled(false);
lv_comments.setAdapter(statusListAdapter);
}
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case progress_bar_type: // we set this to 0
pDialog = new ProgressDialog(PeertubeActivity.this);
pDialog.setMessage(getString(R.string.download_wait));
pDialog.setIndeterminate(false);
pDialog.setMax(100);
pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pDialog.setCancelable(true);
pDialog.show();
return pDialog;
default:
return null;
}
}
/**
* https://stackoverflow.com/a/15758953
*/
@SuppressLint("StaticFieldLeak")
class DownloadFileFromURL extends AsyncTask<String, String, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
showDialog(progress_bar_type);
}
@Override
protected String doInBackground(String... f_url) {
int count;
try {
URL url = new URL(f_url[0]);
URLConnection conection = url.openConnection();
conection.connect();
int lenghtOfFile = conection.getContentLength();
InputStream input = new BufferedInputStream(url.openStream(),
8192);
OutputStream output = new FileOutputStream(Environment
.getExternalStorageDirectory().toString()
+ "/2011.kml");
byte data[] = new byte[1024];
long total = 0;
while ((count = input.read(data)) != -1) {
total += count;
publishProgress("" + (int) ((total * 100) / lenghtOfFile));
output.write(data, 0, count);
}
output.flush();
output.close();
input.close();
} catch (Exception e) {
}
return null;
}
protected void onProgressUpdate(String... progress) {
pDialog.setProgress(Integer.parseInt(progress[0]));
}
@Override
protected void onPostExecute(String file_url) {
dismissDialog(progress_bar_type);
}
}
}

View File

@ -0,0 +1,64 @@
/* Copyright 2018 Thomas Schneider
*
* This file is a part of Mastalab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Mastalab 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 General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.asynctasks;
import android.content.Context;
import android.os.AsyncTask;
import java.lang.ref.WeakReference;
import fr.gouv.etalab.mastodon.client.API;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.interfaces.OnRetrievePeertubeInterface;
/**
* Created by Thomas on 16/10/2018.
* Retrieves peertube single
*/
public class RetrievePeertubeSingleCommentsAsyncTask extends AsyncTask<Void, Void, Void> {
private APIResponse apiResponse;
private String videoId;
private OnRetrievePeertubeInterface listener;
private WeakReference<Context> contextReference;
private String instanceName;
public RetrievePeertubeSingleCommentsAsyncTask(Context context, String instanceName, String videoId, OnRetrievePeertubeInterface onRetrievePeertubeInterface){
this.contextReference = new WeakReference<>(context);
this.videoId = videoId;
this.listener = onRetrievePeertubeInterface;
this.instanceName = instanceName;
}
@Override
protected Void doInBackground(Void... params) {
API api = new API(this.contextReference.get());
apiResponse = api.getSinglePeertubeComments(this.instanceName, videoId);
return null;
}
@Override
protected void onPostExecute(Void result) {
listener.onRetrievePeertubeComments(apiResponse);
}
}

View File

@ -649,7 +649,7 @@ public class API {
HttpsConnection httpsConnection = new HttpsConnection(context);
String response = httpsConnection.get(String.format("https://"+instance+"/api/v1/videos/%s", videoId), 60, null, null);
JSONObject jsonObject = new JSONObject(response);
peertube = parseSinglePeertube(jsonObject);
peertube = parseSinglePeertube(context, jsonObject);
} catch (HttpsConnection.HttpsConnectionException e) {
setError(e.getStatusCode(), e);
} catch (NoSuchAlgorithmException e) {
@ -667,6 +667,31 @@ public class API {
return apiResponse;
}
/**
* Retrieves Peertube videos from an instance *synchronously*
* @return APIResponse
*/
public APIResponse getSinglePeertubeComments(String instance, String videoId) {
statuses = new ArrayList<>();
try {
HttpsConnection httpsConnection = new HttpsConnection(context);
String response = httpsConnection.get(String.format("https://"+instance+"/api/v1/videos/%s/comment-threads", videoId), 60, null, null);
JSONObject jsonObject = new JSONObject(response);
statuses = parseSinglePeertubeComments(context, instance, jsonObject);
} catch (HttpsConnection.HttpsConnectionException e) {
setError(e.getStatusCode(), e);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
apiResponse.setStatuses(statuses);
return apiResponse;
}
/**
* Retrieves home timeline for the account *synchronously*
@ -2355,9 +2380,10 @@ public class API {
* @param resobj JSONObject
* @return Peertube
*/
private static Peertube parseSinglePeertube(JSONObject resobj){
private static Peertube parseSinglePeertube(Context context, JSONObject resobj){
Peertube peertube = new Peertube();
try {
Log.v(Helper.TAG,"resobj= " + resobj);
peertube.setId(resobj.get("id").toString());
peertube.setUuid(resobj.get("uuid").toString());
peertube.setName(resobj.get("name").toString());
@ -2365,6 +2391,15 @@ public class API {
peertube.setEmbedPath(resobj.get("embedPath").toString());
peertube.setPreviewPath(resobj.get("previewPath").toString());
peertube.setThumbnailPath(resobj.get("thumbnailPath").toString());
peertube.setView(Integer.parseInt(resobj.get("views").toString()));
peertube.setLike(Integer.parseInt(resobj.get("likes").toString()));
peertube.setDislike(Integer.parseInt(resobj.get("dislikes").toString()));
peertube.setDuration(Integer.parseInt(resobj.get("duration").toString()));
try {
peertube.setCreated_at(Helper.mstStringToDate(context, resobj.get("createdAt").toString()));
} catch (ParseException e) {
e.printStackTrace();
}
JSONArray files = resobj.getJSONArray("files");
for(int j = 0 ; j < files.length() ; j++){
@ -2378,6 +2413,44 @@ public class API {
return peertube;
}
/**
* Parse json response for peertube comments
* @param resobj JSONObject
* @return Peertube
*/
private static List<Status> parseSinglePeertubeComments(Context context, String instance, JSONObject resobj){
Peertube peertube = new Peertube();
List<Status> statuses = new ArrayList<>();
try {
JSONArray jsonArray = resobj.getJSONArray("data");
int i = 0;
while (i < jsonArray.length() ){
Status status = new Status();
JSONObject comment = jsonArray.getJSONObject(i);
status.setId(comment.get("id").toString());
status.setUri(comment.get("url").toString());
status.setUrl(comment.get("url").toString());
status.setSensitive(false);
status.setSpoiler_text("");
status.setContent(comment.get("text").toString());
status.setIn_reply_to_id(comment.get("inReplyToCommentId").toString());
status.setAccount(parseAccountResponsePeertube(context, instance, comment.getJSONObject("account")));
status.setCreated_at(Helper.mstStringToDate(context, comment.get("createdAt").toString()));
status.setMentions(new ArrayList<>());
status.setEmojis(new ArrayList<>());
status.setMedia_attachments(new ArrayList<>());
status.setVisibility("public");
i++;
statuses.add(status);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
return statuses;
}
/**
* Parse json response for unique how to
* @param resobj JSONObject
@ -2718,6 +2791,37 @@ public class API {
}
/**
* Parse json response an unique peertube account
* @param resobj JSONObject
* @return Account
*/
@SuppressWarnings("InfiniteRecursion")
private static Account parseAccountResponsePeertube(Context context, String instance, JSONObject resobj){
Account account = new Account();
try {
account.setId(resobj.get("id").toString());
account.setUsername(resobj.get("name").toString());
account.setAcct(resobj.get("name").toString() + "@"+ resobj.get("host").toString());
account.setDisplay_name(resobj.get("displayName").toString());
account.setCreated_at(Helper.mstStringToDate(context, resobj.get("createdAt").toString()));
account.setFollowers_count(Integer.valueOf(resobj.get("followersCount").toString()));
account.setFollowing_count(Integer.valueOf(resobj.get("followingCount").toString()));
account.setStatuses_count(0);
account.setNote(resobj.get("description").toString());
account.setUrl(resobj.get("url").toString());
if( resobj.get("avatar").toString() != null && !resobj.get("avatar").toString().equals("null")){
account.setAvatar("https://" + instance + resobj.getJSONObject("avatar").get("path"));
}else
account.setAvatar(null);
account.setAvatar_static(resobj.get("avatar").toString());
} catch (JSONException ignored) {} catch (ParseException e) {
e.printStackTrace();
}
return account;
}
/**
* Parse json response an unique account
* @param resobj JSONObject

View File

@ -14,6 +14,8 @@
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.client.Entities;
import java.util.Date;
/**
* Created by Thomas on 29/09/2018.
* Manage how to videos
@ -28,6 +30,11 @@ public class Peertube {
private String previewPath;
private String embedPath;
private String streamURL;
private int view;
private int like;
private int dislike;
private Date created_at;
private int duration;
public String getId() {
return id;
@ -92,4 +99,44 @@ public class Peertube {
public void setStreamURL(String streamURL) {
this.streamURL = streamURL;
}
public int getView() {
return view;
}
public void setView(int view) {
this.view = view;
}
public int getLike() {
return like;
}
public void setLike(int like) {
this.like = like;
}
public int getDislike() {
return dislike;
}
public void setDislike(int dislike) {
this.dislike = dislike;
}
public Date getCreated_at() {
return created_at;
}
public void setCreated_at(Date created_at) {
this.created_at = created_at;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
}
}

View File

@ -2066,6 +2066,13 @@ public class Helper {
return;
}
}
if( url == null) {
Glide.with(imageView.getContext())
.load(R.drawable.missing)
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
return;
}
if( !disableGif)
Glide.with(imageView.getContext())
.load(url)

View File

@ -22,4 +22,5 @@ import fr.gouv.etalab.mastodon.client.APIResponse;
*/
public interface OnRetrievePeertubeInterface {
void onRetrievePeertube(APIResponse apiResponse);
void onRetrievePeertubeComments(APIResponse apiResponse);
}

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#606984"
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM17,13l-5,5 -5,-5h3V9h4v4h3z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#606984"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#606984"
android:pathData="M15,3L6,3c-0.83,0 -1.54,0.5 -1.84,1.22l-3.02,7.05c-0.09,0.23 -0.14,0.47 -0.14,0.73v1.91l0.01,0.01L1,14c0,1.1 0.9,2 2,2h6.31l-0.95,4.57 -0.03,0.32c0,0.41 0.17,0.79 0.44,1.06L9.83,23l6.59,-6.59c0.36,-0.36 0.58,-0.86 0.58,-1.41L17,5c0,-1.1 -0.9,-2 -2,-2zM19,3v12h4L23,3h-4z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#606984"
android:pathData="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-1.91l-0.01,-0.01L23,10z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#606984"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -24,26 +24,165 @@
android:layout_height="match_parent"
tools:context=".activities.PeertubeActivity">
<VideoView
android:id="@+id/media_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<!-- Main Loader -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loader"
android:visibility="gone"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<VideoView
android:id="@+id/media_video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<!-- Main Loader -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loader"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
</RelativeLayout>
<ScrollView
android:id="@+id/peertube_information_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginEnd="20dp"
android:orientation="vertical">
<TextView
android:layout_marginTop="5dp"
android:id="@+id/peertube_title"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/peertube_view_count"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_visibility_peertube"
android:drawablePadding="5dp"
android:layout_width="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:text="0"
android:layout_height="wrap_content"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_like_count"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_thumb_up_peertube"
android:drawablePadding="5dp"
android:layout_width="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="20dp"
android:text="0"
android:layout_height="wrap_content"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_dislike_count"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_thumb_down_peertube"
android:drawablePadding="5dp"
android:layout_width="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:text="0"
android:layout_height="wrap_content"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:ignore="UselessLeaf" />
<TextView
android:id="@+id/peertube_share"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_share_peertube"
android:drawablePadding="5dp"
android:layout_width="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:textSize="12sp"
android:text="@string/more_action_6"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/peertube_download"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_cloud_download_peertube"
android:drawablePadding="5dp"
android:layout_width="wrap_content"
android:textSize="12sp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:text="@string/download"
android:layout_height="wrap_content"
/>
</LinearLayout>
<TextView
android:layout_marginTop="10dp"
android:id="@+id/peertube_description"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/peertube_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<RelativeLayout
android:id="@+id/no_action"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:padding="10dp"
android:gravity="center"
android:textSize="25sp"
android:layout_gravity="center"
android:textStyle="italic|bold"
android:typeface="serif"
android:text="@string/no_comments"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -636,6 +636,8 @@
<string name="peertube_instance">Peertube instance</string>
<string name="set_display_direct">Display private messages timeline</string>
<string name="set_keep_background_process">Keep background process when app is closed</string>
<string name="download_wait">Downloading file. Please wait...</string>
<string name="no_comments">Be the first to leave a comment on this video with the top right button!</string>
<string-array name="filter_expire">
<item>Never</item>