Fix issue #42 - Allow to display channels from playing video activity

This commit is contained in:
Thomas 2020-11-07 10:24:56 +01:00
parent 24c6f79b51
commit 4c1e466866
2 changed files with 25 additions and 1 deletions

View File

@ -144,6 +144,7 @@ import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPO
import static app.fedilab.fedilabtube.helper.Helper.getAttColor; import static app.fedilab.fedilabtube.helper.Helper.getAttColor;
import static app.fedilab.fedilabtube.helper.Helper.getLiveInstance; import static app.fedilab.fedilabtube.helper.Helper.getLiveInstance;
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn; import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
import static app.fedilab.fedilabtube.helper.Helper.loadGiF;
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO; import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO;
@ -586,7 +587,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
binding.peertubeDescriptionMore.setVisibility(View.GONE); binding.peertubeDescriptionMore.setVisibility(View.GONE);
show_more_content = null; show_more_content = null;
}else{ }else{
if( peertube != null && description.getDescription().compareTo(peertube.getDescription()) > 0) { if( peertube != null && peertube.getDescription() != null && description.getDescription().compareTo(peertube.getDescription()) > 0) {
binding.peertubeDescriptionMore.setVisibility(View.VISIBLE); binding.peertubeDescriptionMore.setVisibility(View.VISIBLE);
show_more_content = description.getDescription(); show_more_content = description.getDescription();
}else{ }else{
@ -796,6 +797,19 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
binding.peertubeDislikeCount.setText(Helper.withSuffix(peertube.getDislikes())); binding.peertubeDislikeCount.setText(Helper.withSuffix(peertube.getDislikes()));
binding.peertubeLikeCount.setText(Helper.withSuffix(peertube.getLikes())); binding.peertubeLikeCount.setText(Helper.withSuffix(peertube.getLikes()));
binding.peertubeViewCount.setText(Helper.withSuffix(peertube.getViews())); binding.peertubeViewCount.setText(Helper.withSuffix(peertube.getViews()));
loadGiF(PeertubeActivity.this,peertube.getChannel().getAvatar()!=null?peertube.getChannel().getAvatar().getPath():null, binding.ppChannel);
binding.ppChannel.setOnClickListener(v->{
Intent intent = new Intent(PeertubeActivity.this, ShowChannelActivity.class);
Bundle b = new Bundle();
b.putParcelable("channel", peertube.getChannel());
b.putBoolean("sepia_search", sepiaSearch);
if (sepiaSearch) {
b.putString("peertube_instance", peertube.getAccount().getHost());
}
intent.putExtras(b);
startActivity(intent);
});
video_id = peertube.getId(); video_id = peertube.getId();
changeColor(); changeColor();

View File

@ -121,6 +121,16 @@
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/pp_channel"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:contentDescription="@string/profile_picture"
/>
<TextView <TextView
android:id="@+id/peertube_view_count" android:id="@+id/peertube_view_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"