'How to handle exo players in recycler view?
How can we use multiple exo player in a recycler view? I saw many posts and videos like this and this but that all use a custom recycler view class. I could continue with that. But, I wanted to make a complete Insta clone where I can send gif and image and videos. Now, when I use the custom recycler view class, I dont have any idea of how to play the video with the gif and images. This is my recycler view item code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="10dp"
app:cardCornerRadius="6dp"
app:cardElevation="1dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<com.sambhav2358.facebookclone.customviews.RoundedImageView
android:id="@+id/senderImage"
android:layout_width="50dp"
android:layout_height="50dp"
app:cornerRadius="100dp"
android:src="@color/primary"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_marginStart="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/senderName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Sender name"
android:ellipsize="end"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_weight="1"/>
<TextView
android:id="@+id/dateAdded"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date added"
android:ellipsize="end"
android:layout_marginStart="10dp"/>
</LinearLayout>
<TextView
android:id="@+id/senderUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sender user name"
android:ellipsize="end"
android:textColor="@color/black"
android:layout_weight="1"/>
</LinearLayout>
<ImageView
android:id="@+id/more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/more"
android:layout_marginStart="5dp"
android:padding="4dp"
android:background="?selectableItemBackgroundBorderless"/>
</LinearLayout>
<TextView
android:id="@+id/body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Body\nOf\nThe\nPost"
android:layout_margin="10dp"/>
<androidx.cardview.widget.CardView
android:id="@+id/postExtra"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_margin="5dp"
app:cardCornerRadius="6dp"
app:cardElevation="0dp">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="200dp" />
<ImageView
android:id="@+id/imageVIew"
android:layout_width="match_parent"
android:layout_height="200dp" />
<com.giphy.sdk.ui.views.GifView
android:id="@+id/gifView"
android:layout_width="match_parent"
android:layout_height="200dp"/>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
app:cardCornerRadius="50dp"
android:backgroundTint="@color/primary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="10dp"
android:paddingVertical="5dp"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/like"
app:tint="@android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Like"
android:textColor="@color/white"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<View
android:layout_width="10dp"
android:layout_height="0dp"/>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
app:cardCornerRadius="50dp"
android:backgroundTint="@color/primary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="10dp"
android:paddingVertical="5dp"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/share"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Share"
android:textColor="@color/white"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<View
android:layout_width="10dp"
android:layout_height="0dp" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
app:cardCornerRadius="50dp"
android:backgroundTint="@color/primary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="10dp"
android:paddingVertical="5dp"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/comment"
app:tint="@android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Comment"
android:textColor="@color/white"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
Solution 1:[1]
You could try a workaround. You could add an outer query with the max value of the subquery records and compare with that single value.
Note that this solution only include all the student on the outer query that has the greater salary than the max value of the subquery.
Try:
SELECT NAME
FROM STUDENTS AS S
INNER JOIN PACKAGES AS PON S.ID = P.ID
WHERE P.SALARY > (
SELECT MAX(t1.P.SALARY)
FROM (
SELECT P.SALARY
FROM FRIENDS AS F INNER JOIN PACKAGES AS P ON F.FRIEND_ID = P.ID
) as t1
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ergest Basha |
