Fix some elements

This commit is contained in:
Thomas 2020-10-10 11:49:18 +02:00
parent b089ae93e1
commit 93eaec8544
3 changed files with 38 additions and 44 deletions

View File

@ -94,7 +94,9 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
final PeertubeAdapter.ViewHolder holder = (PeertubeAdapter.ViewHolder) viewHolder;
final VideoData.Video video = videos.get(position);
if( video == null) {
return;
}
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, "");

View File

@ -353,7 +353,9 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
if (Helper.isLoggedIn(context)) {
List<String> uids = new ArrayList<>();
for (VideoData.Video video : apiResponse.getPeertubes()) {
uids.add(video.getChannel().getName() + "@" + video.getChannel().getHost());
if( video != null) {
uids.add(video.getChannel().getName() + "@" + video.getChannel().getHost());
}
}
if (uids.size() > 0 && !DisplayVideosFragment.this.isDetached()) {
try {
@ -365,7 +367,9 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
List<String> videoIds = new ArrayList<>();
for (VideoData.Video video : apiResponse.getPeertubes()) {
videoIds.add(video.getId());
if( video != null) {
videoIds.add(video.getId());
}
}
if (videoIds.size() > 0 && !DisplayVideosFragment.this.isDetached()) {
try {
@ -387,7 +391,9 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
}
playlists.putAll(apiResponse.getVideoExistPlaylist());
for (VideoData.Video video : peertubes) {
video.setPlaylistExists(playlists.get(video.getId()));
if( video != null) {
video.setPlaylistExists(playlists.get(video.getId()));
}
}
}

View File

@ -19,55 +19,41 @@
android:layout_height="wrap_content">
<LinearLayout
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:divider="?android:dividerHorizontal"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingTop="10dp"
android:showDividers="end">
android:orientation="horizontal">
<ImageView
android:id="@+id/peertube_notif_pp"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="top"
android:contentDescription="@string/profile_picture" />
<LinearLayout
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/peertube_notif_pp"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="top" />
<LinearLayout
android:layout_width="0dp"
<TextView
android:id="@+id/peertube_notif_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
android:layout_gravity="center_vertical"
android:gravity="end"
android:textAlignment="viewEnd" />
<TextView
android:id="@+id/peertube_notif_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="end"
android:textAlignment="viewEnd" />
<TextView
android:id="@+id/peertube_notif_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:autoLink="web" />
</LinearLayout>
<TextView
android:id="@+id/peertube_notif_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:autoLink="web" />
</LinearLayout>
</LinearLayout>
<RelativeLayout