mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2026-05-16 04:52:39 +02:00
Fix empty library clear, comment ui change
This commit is contained in:
+7
@@ -12,6 +12,7 @@ import android.view.ViewGroup
|
|||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.collection.emptyLongSet
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
@@ -273,6 +274,8 @@ class LibraryFragment : MainFragment() {
|
|||||||
"No artists were found on your device",
|
"No artists were found on your device",
|
||||||
-1
|
-1
|
||||||
);
|
);
|
||||||
|
else
|
||||||
|
sectionArtists.clearEmpty();
|
||||||
}
|
}
|
||||||
else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||||
sectionAlbums.isVisible = false;
|
sectionAlbums.isVisible = false;
|
||||||
@@ -290,6 +293,8 @@ class LibraryFragment : MainFragment() {
|
|||||||
adapterAlbums.setData(albums);
|
adapterAlbums.setData(albums);
|
||||||
if (albums.size == 0)
|
if (albums.size == 0)
|
||||||
sectionAlbums.setEmpty("No albums", "No albums were found on your device", -1);
|
sectionAlbums.setEmpty("No albums", "No albums were found on your device", -1);
|
||||||
|
else
|
||||||
|
sectionAlbums.clearEmpty();
|
||||||
}
|
}
|
||||||
else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||||
sectionArtists.isVisible = false;
|
sectionArtists.isVisible = false;
|
||||||
@@ -307,6 +312,8 @@ class LibraryFragment : MainFragment() {
|
|||||||
adapterVideos.setData(videos);
|
adapterVideos.setData(videos);
|
||||||
if (videos.size == 0)
|
if (videos.size == 0)
|
||||||
sectionVideos.setEmpty("No videos", "No videos were found on your device", -1);
|
sectionVideos.setEmpty("No videos", "No videos were found on your device", -1);
|
||||||
|
else
|
||||||
|
sectionVideos.clearEmpty();
|
||||||
}
|
}
|
||||||
else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||||
sectionVideos.isVisible = false;
|
sectionVideos.isVisible = false;
|
||||||
|
|||||||
@@ -53,4 +53,8 @@ class LibrarySection: ConstraintLayout {
|
|||||||
recycler.isVisible = false;
|
recycler.isVisible = false;
|
||||||
noContent.setText(title, txt, iconId);
|
noContent.setText(title, txt, iconId);
|
||||||
}
|
}
|
||||||
|
fun clearEmpty() {
|
||||||
|
noContent.isVisible = false;
|
||||||
|
recycler.isVisible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,7 @@ package com.futo.platformplayer.views.adapters
|
|||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.GestureDetector
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
@@ -46,7 +44,7 @@ class CommentViewHolder : ViewHolder {
|
|||||||
private val _imageLikeIcon: ImageView;
|
private val _imageLikeIcon: ImageView;
|
||||||
private val _textLikes: TextView;
|
private val _textLikes: TextView;
|
||||||
private val _imageDislikeIcon: ImageView;
|
private val _imageDislikeIcon: ImageView;
|
||||||
private val _imageCopy: ImageView;
|
private val _buttonCopy: PillButton;
|
||||||
private val _textDislikes: TextView;
|
private val _textDislikes: TextView;
|
||||||
private val _buttonReplies: PillButton;
|
private val _buttonReplies: PillButton;
|
||||||
private val _layoutRating: LinearLayout;
|
private val _layoutRating: LinearLayout;
|
||||||
@@ -70,7 +68,7 @@ class CommentViewHolder : ViewHolder {
|
|||||||
_textMetadata = itemView.findViewById(R.id.text_metadata);
|
_textMetadata = itemView.findViewById(R.id.text_metadata);
|
||||||
_textBody = itemView.findViewById(R.id.text_body);
|
_textBody = itemView.findViewById(R.id.text_body);
|
||||||
_imageLikeIcon = itemView.findViewById(R.id.image_like_icon);
|
_imageLikeIcon = itemView.findViewById(R.id.image_like_icon);
|
||||||
_imageCopy = itemView.findViewById(R.id.image_copy);
|
_buttonCopy = itemView.findViewById(R.id.image_copy);
|
||||||
_textLikes = itemView.findViewById(R.id.text_likes);
|
_textLikes = itemView.findViewById(R.id.text_likes);
|
||||||
_imageDislikeIcon = itemView.findViewById(R.id.image_dislike_icon);
|
_imageDislikeIcon = itemView.findViewById(R.id.image_dislike_icon);
|
||||||
_textDislikes = itemView.findViewById(R.id.text_dislikes);
|
_textDislikes = itemView.findViewById(R.id.text_dislikes);
|
||||||
@@ -105,7 +103,8 @@ class CommentViewHolder : ViewHolder {
|
|||||||
StatePolycentric.instance.updateLikeMap(c.reference, args.hasLiked, args.hasDisliked)
|
StatePolycentric.instance.updateLikeMap(c.reference, args.hasLiked, args.hasDisliked)
|
||||||
};
|
};
|
||||||
|
|
||||||
_imageCopy.setOnLongClickListener {
|
_buttonCopy.setTransparant()
|
||||||
|
_buttonCopy.onClick.subscribe {
|
||||||
val clipboard = viewGroup.context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboard = viewGroup.context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val text = comment?.message.orEmpty()
|
val text = comment?.message.orEmpty()
|
||||||
val clip = ClipData.newPlainText("Comment", text)
|
val clip = ClipData.newPlainText("Comment", text)
|
||||||
|
|||||||
@@ -7,11 +7,15 @@ import android.view.View
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import com.futo.platformplayer.R
|
import com.futo.platformplayer.R
|
||||||
import com.futo.platformplayer.constructs.Event0
|
import com.futo.platformplayer.constructs.Event0
|
||||||
|
import com.futo.platformplayer.dp
|
||||||
import com.futo.platformplayer.views.LoaderView
|
import com.futo.platformplayer.views.LoaderView
|
||||||
|
|
||||||
class PillButton : LinearLayout {
|
class PillButton : LinearLayout {
|
||||||
|
val root: LinearLayout;
|
||||||
val icon: ImageView;
|
val icon: ImageView;
|
||||||
val text: TextView;
|
val text: TextView;
|
||||||
val loaderView: LoaderView;
|
val loaderView: LoaderView;
|
||||||
@@ -23,6 +27,7 @@ class PillButton : LinearLayout {
|
|||||||
icon = findViewById(R.id.pill_icon);
|
icon = findViewById(R.id.pill_icon);
|
||||||
text = findViewById(R.id.pill_text);
|
text = findViewById(R.id.pill_text);
|
||||||
loaderView = findViewById(R.id.loader)
|
loaderView = findViewById(R.id.loader)
|
||||||
|
root = findViewById<LinearLayout>(R.id.root);
|
||||||
|
|
||||||
val attrArr = context.obtainStyledAttributes(attrs, R.styleable.PillButton, 0, 0);
|
val attrArr = context.obtainStyledAttributes(attrs, R.styleable.PillButton, 0, 0);
|
||||||
val attrIconRef = attrArr.getResourceId(R.styleable.PillButton_pillIcon, -1);
|
val attrIconRef = attrArr.getResourceId(R.styleable.PillButton_pillIcon, -1);
|
||||||
@@ -34,6 +39,13 @@ class PillButton : LinearLayout {
|
|||||||
val attrText = attrArr.getText(R.styleable.PillButton_pillText) ?: "";
|
val attrText = attrArr.getText(R.styleable.PillButton_pillText) ?: "";
|
||||||
text.text = attrText;
|
text.text = attrText;
|
||||||
|
|
||||||
|
if(text.text.isNullOrBlank()) {
|
||||||
|
val dp6 = 6.dp(resources);
|
||||||
|
val dp7 = 7.dp(resources);
|
||||||
|
val dp12 = 12.dp(resources);
|
||||||
|
root.setPadding(dp7, dp6, dp7, dp7)
|
||||||
|
}
|
||||||
|
|
||||||
findViewById<LinearLayout>(R.id.root).setOnClickListener {
|
findViewById<LinearLayout>(R.id.root).setOnClickListener {
|
||||||
if (_isLoading) {
|
if (_isLoading) {
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
@@ -43,6 +55,10 @@ class PillButton : LinearLayout {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setTransparant() {
|
||||||
|
root.setBackgroundColor(0);
|
||||||
|
}
|
||||||
|
|
||||||
fun setLoading(loading: Boolean) {
|
fun setLoading(loading: Boolean) {
|
||||||
if (loading == _isLoading) {
|
if (loading == _isLoading) {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -96,16 +96,6 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/image_copy"
|
|
||||||
android:layout_width="18dp"
|
|
||||||
android:layout_height="18dp"
|
|
||||||
android:contentDescription="@string/copy"
|
|
||||||
app:srcCompat="@drawable/ic_copy"
|
|
||||||
app:tint="@color/white"
|
|
||||||
android:background="@drawable/background_pill"
|
|
||||||
android:layout_marginStart="9dp" />
|
|
||||||
|
|
||||||
<com.futo.platformplayer.views.pills.PillRatingLikesDislikes
|
<com.futo.platformplayer.views.pills.PillRatingLikesDislikes
|
||||||
android:id="@+id/rating"
|
android:id="@+id/rating"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -160,6 +150,15 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="13dp" />
|
android:textSize="13dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.futo.platformplayer.views.pills.PillButton
|
||||||
|
android:id="@+id/image_copy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:pillIcon="@drawable/ic_copy"
|
||||||
|
app:pillText=""
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginEnd="0dp"/>
|
||||||
<com.futo.platformplayer.views.pills.PillButton
|
<com.futo.platformplayer.views.pills.PillButton
|
||||||
android:id="@+id/button_replies"
|
android:id="@+id/button_replies"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -167,7 +166,7 @@
|
|||||||
android:contentDescription="@string/cd_button_replies"
|
android:contentDescription="@string/cd_button_replies"
|
||||||
app:pillIcon="@drawable/ic_forum"
|
app:pillIcon="@drawable/ic_forum"
|
||||||
app:pillText="55 Replies"
|
app:pillText="55 Replies"
|
||||||
android:layout_marginStart="15dp" />
|
android:layout_marginStart="2dp" />
|
||||||
|
|
||||||
<Space android:layout_width="0dp"
|
<Space android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user