Improve when no comments
This commit is contained in:
parent
029d84b209
commit
745d727173
|
@ -83,6 +83,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
private MediaPlayer mediaPlayer;
|
private MediaPlayer mediaPlayer;
|
||||||
private FullScreenMediaController fullScreenMediaController;
|
private FullScreenMediaController fullScreenMediaController;
|
||||||
private int stopPosition;
|
private int stopPosition;
|
||||||
|
private Peertube peertube;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -224,7 +225,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
loader.setVisibility(View.GONE);
|
loader.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Peertube peertube = apiResponse.getPeertubes().get(0);
|
peertube = apiResponse.getPeertubes().get(0);
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
|
||||||
setTitle(peertube.getName());
|
setTitle(peertube.getName());
|
||||||
|
@ -316,6 +317,10 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
List<Status> statuses = apiResponse.getStatuses();
|
List<Status> statuses = apiResponse.getStatuses();
|
||||||
if( statuses == null || statuses.size() == 0){
|
if( statuses == null || statuses.size() == 0){
|
||||||
RelativeLayout no_action = findViewById(R.id.no_action);
|
RelativeLayout no_action = findViewById(R.id.no_action);
|
||||||
|
if( peertube != null && !peertube.isCommentsEnabled()) {
|
||||||
|
TextView no_action_text = findViewById(R.id.no_action_text);
|
||||||
|
no_action_text.setText(getString(R.string.comment_no_allowed_peertube));
|
||||||
|
}
|
||||||
no_action.setVisibility(View.VISIBLE);
|
no_action.setVisibility(View.VISIBLE);
|
||||||
RecyclerView lv_comments = findViewById(R.id.peertube_comments);
|
RecyclerView lv_comments = findViewById(R.id.peertube_comments);
|
||||||
lv_comments.setVisibility(View.GONE);
|
lv_comments.setVisibility(View.GONE);
|
||||||
|
|
|
@ -2442,6 +2442,7 @@ public class API {
|
||||||
peertube.setThumbnailPath(resobj.get("thumbnailPath").toString());
|
peertube.setThumbnailPath(resobj.get("thumbnailPath").toString());
|
||||||
peertube.setView(Integer.parseInt(resobj.get("views").toString()));
|
peertube.setView(Integer.parseInt(resobj.get("views").toString()));
|
||||||
peertube.setLike(Integer.parseInt(resobj.get("likes").toString()));
|
peertube.setLike(Integer.parseInt(resobj.get("likes").toString()));
|
||||||
|
peertube.setCommentsEnabled(Boolean.parseBoolean(resobj.get("commentsEnabled").toString()));
|
||||||
peertube.setDislike(Integer.parseInt(resobj.get("dislikes").toString()));
|
peertube.setDislike(Integer.parseInt(resobj.get("dislikes").toString()));
|
||||||
peertube.setDuration(Integer.parseInt(resobj.get("duration").toString()));
|
peertube.setDuration(Integer.parseInt(resobj.get("duration").toString()));
|
||||||
peertube.setAccount(parseAccountResponsePeertube(context, instance, resobj.getJSONObject("account")));
|
peertube.setAccount(parseAccountResponsePeertube(context, instance, resobj.getJSONObject("account")));
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class Peertube {
|
||||||
private String instance;
|
private String instance;
|
||||||
private Account account;
|
private Account account;
|
||||||
private List<String> resolution;
|
private List<String> resolution;
|
||||||
|
private boolean commentsEnabled;
|
||||||
|
|
||||||
|
|
||||||
public Peertube() {
|
public Peertube() {
|
||||||
|
@ -198,4 +199,12 @@ public class Peertube {
|
||||||
public void setHost(String host) {
|
public void setHost(String host) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCommentsEnabled() {
|
||||||
|
return commentsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommentsEnabled(boolean commentsEnabled) {
|
||||||
|
this.commentsEnabled = commentsEnabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,7 @@
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<TextView
|
<TextView
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
|
android:id="@+id/no_action_text"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="25sp"
|
android:textSize="25sp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
|
|
@ -640,6 +640,7 @@
|
||||||
<string name="number_view_video">%s views</string>
|
<string name="number_view_video">%s views</string>
|
||||||
<string name="duration_video">Duration: %s</string>
|
<string name="duration_video">Duration: %s</string>
|
||||||
<string name="add_remote_instance">Add an instance</string>
|
<string name="add_remote_instance">Add an instance</string>
|
||||||
|
<string name="comment_no_allowed_peertube">Comments are not enabled on this video!</string>
|
||||||
|
|
||||||
<string-array name="filter_expire">
|
<string-array name="filter_expire">
|
||||||
<item>Never</item>
|
<item>Never</item>
|
||||||
|
|
Loading…
Reference in New Issue