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 PeertubeAdapter.ViewHolder holder = (PeertubeAdapter.ViewHolder) viewHolder;
final VideoData.Video video = videos.get(position); final VideoData.Video video = videos.get(position);
if( video == null) {
return;
}
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, ""); 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)) { if (Helper.isLoggedIn(context)) {
List<String> uids = new ArrayList<>(); List<String> uids = new ArrayList<>();
for (VideoData.Video video : apiResponse.getPeertubes()) { 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()) { if (uids.size() > 0 && !DisplayVideosFragment.this.isDetached()) {
try { try {
@ -365,7 +367,9 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
List<String> videoIds = new ArrayList<>(); List<String> videoIds = new ArrayList<>();
for (VideoData.Video video : apiResponse.getPeertubes()) { for (VideoData.Video video : apiResponse.getPeertubes()) {
videoIds.add(video.getId()); if( video != null) {
videoIds.add(video.getId());
}
} }
if (videoIds.size() > 0 && !DisplayVideosFragment.this.isDetached()) { if (videoIds.size() > 0 && !DisplayVideosFragment.this.isDetached()) {
try { try {
@ -387,7 +391,9 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
} }
playlists.putAll(apiResponse.getVideoExistPlaylist()); playlists.putAll(apiResponse.getVideoExistPlaylist());
for (VideoData.Video video : peertubes) { 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"> android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:paddingTop="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:orientation="horizontal">
android:layout_marginLeft="5dp"
android:layout_marginEnd="5dp" <ImageView
android:layout_marginRight="5dp" android:id="@+id/peertube_notif_pp"
android:divider="?android:dividerHorizontal" android:layout_width="50dp"
android:gravity="center_vertical" android:layout_height="50dp"
android:orientation="vertical" android:layout_gravity="top"
android:paddingTop="10dp" android:contentDescription="@string/profile_picture" />
android:showDividers="end">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
<ImageView <TextView
android:id="@+id/peertube_notif_pp" android:id="@+id/peertube_notif_date"
android:layout_width="50dp" android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="top" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="10dp" android:layout_gravity="center_vertical"
android:layout_weight="1" android:gravity="end"
android:orientation="vertical"> android:textAlignment="viewEnd" />
<TextView <TextView
android:id="@+id/peertube_notif_date" android:id="@+id/peertube_notif_message"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:gravity="end" android:layout_marginStart="10dp"
android:textAlignment="viewEnd" /> android:autoLink="web" />
<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> </LinearLayout>
</LinearLayout> </LinearLayout>
<RelativeLayout <RelativeLayout