mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-05 15:49:22 +00:00
Creator search, toggle to disable bad rep comments fading
This commit is contained in:
parent
7ee4f411cb
commit
55a11d82ac
9 changed files with 86 additions and 23 deletions
|
@ -413,6 +413,9 @@ class Settings : FragmentedStorageFileJson() {
|
||||||
@FormField(R.string.default_comment_section, FieldForm.DROPDOWN, -1, 0)
|
@FormField(R.string.default_comment_section, FieldForm.DROPDOWN, -1, 0)
|
||||||
@DropdownFieldOptionsId(R.array.comment_sections)
|
@DropdownFieldOptionsId(R.array.comment_sections)
|
||||||
var defaultCommentSection: Int = 0;
|
var defaultCommentSection: Int = 0;
|
||||||
|
|
||||||
|
@FormField(R.string.bad_reputation_comments_fading, FieldForm.TOGGLE, R.string.bad_reputation_comments_fading_description, 0)
|
||||||
|
var badReputationCommentsFading: Boolean = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@FormField(R.string.downloads, "group", R.string.configure_downloading_of_videos, 7)
|
@FormField(R.string.downloads, "group", R.string.configure_downloading_of_videos, 7)
|
||||||
|
|
|
@ -190,8 +190,10 @@ class UIDialogs {
|
||||||
view.findViewById<TextView>(R.id.dialog_text_code).apply {
|
view.findViewById<TextView>(R.id.dialog_text_code).apply {
|
||||||
if(code == null)
|
if(code == null)
|
||||||
this.visibility = View.GONE;
|
this.visibility = View.GONE;
|
||||||
else
|
else {
|
||||||
this.text = code;
|
this.text = code;
|
||||||
|
this.visibility = View.VISIBLE;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
view.findViewById<LinearLayout>(R.id.dialog_buttons).apply {
|
view.findViewById<LinearLayout>(R.id.dialog_buttons).apply {
|
||||||
val buttons = actions.map<Action, TextView> { act ->
|
val buttons = actions.map<Action, TextView> { act ->
|
||||||
|
|
|
@ -6,8 +6,10 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.EditText
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.futo.platformplayer.R
|
import com.futo.platformplayer.R
|
||||||
|
@ -21,9 +23,13 @@ class CreatorsFragment : MainFragment() {
|
||||||
|
|
||||||
private var _spinnerSortBy: Spinner? = null;
|
private var _spinnerSortBy: Spinner? = null;
|
||||||
private var _overlayContainer: FrameLayout? = null;
|
private var _overlayContainer: FrameLayout? = null;
|
||||||
|
private var _containerSearch: FrameLayout? = null;
|
||||||
|
private var _editSearch: EditText? = null;
|
||||||
|
|
||||||
override fun onCreateMainView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
override fun onCreateMainView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
val view = inflater.inflate(R.layout.fragment_creators, container, false);
|
val view = inflater.inflate(R.layout.fragment_creators, container, false);
|
||||||
|
_containerSearch = view.findViewById(R.id.container_search);
|
||||||
|
_editSearch = view.findViewById(R.id.edit_search);
|
||||||
|
|
||||||
val adapter = SubscriptionAdapter(inflater, getString(R.string.confirm_delete_subscription));
|
val adapter = SubscriptionAdapter(inflater, getString(R.string.confirm_delete_subscription));
|
||||||
adapter.onClick.subscribe { platformUser -> navigate<ChannelFragment>(platformUser) };
|
adapter.onClick.subscribe { platformUser -> navigate<ChannelFragment>(platformUser) };
|
||||||
|
@ -44,6 +50,10 @@ class CreatorsFragment : MainFragment() {
|
||||||
|
|
||||||
_spinnerSortBy = spinnerSortBy;
|
_spinnerSortBy = spinnerSortBy;
|
||||||
|
|
||||||
|
_editSearch?.addTextChangedListener {
|
||||||
|
adapter.query = it.toString();
|
||||||
|
}
|
||||||
|
|
||||||
val recyclerView = view.findViewById<RecyclerView>(R.id.recycler_subscriptions);
|
val recyclerView = view.findViewById<RecyclerView>(R.id.recycler_subscriptions);
|
||||||
recyclerView.adapter = adapter;
|
recyclerView.adapter = adapter;
|
||||||
recyclerView.layoutManager = LinearLayoutManager(view.context);
|
recyclerView.layoutManager = LinearLayoutManager(view.context);
|
||||||
|
@ -54,6 +64,8 @@ class CreatorsFragment : MainFragment() {
|
||||||
super.onDestroyMainView();
|
super.onDestroyMainView();
|
||||||
_spinnerSortBy = null;
|
_spinnerSortBy = null;
|
||||||
_overlayContainer = null;
|
_overlayContainer = null;
|
||||||
|
_editSearch = null;
|
||||||
|
_containerSearch = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -117,7 +117,8 @@ class CommentViewHolder : ViewHolder {
|
||||||
|
|
||||||
val rating = comment.rating;
|
val rating = comment.rating;
|
||||||
if (rating is RatingLikeDislikes) {
|
if (rating is RatingLikeDislikes) {
|
||||||
_layoutComment.alpha = if (rating.dislikes > 2 && rating.dislikes.toFloat() / (rating.likes + rating.dislikes).toFloat() >= 0.7f) 0.5f else 1.0f;
|
_layoutComment.alpha = if (Settings.instance.comments.badReputationCommentsFading &&
|
||||||
|
rating.dislikes > 2 && rating.dislikes.toFloat() / (rating.likes + rating.dislikes).toFloat() >= 0.7f) 0.5f else 1.0f;
|
||||||
} else {
|
} else {
|
||||||
_layoutComment.alpha = 1.0f;
|
_layoutComment.alpha = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import com.futo.platformplayer.views.pills.PillRatingLikesDislikes
|
||||||
import com.futo.polycentric.core.Opinion
|
import com.futo.polycentric.core.Opinion
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import userpackage.Protocol
|
|
||||||
import java.util.IdentityHashMap
|
import java.util.IdentityHashMap
|
||||||
|
|
||||||
class CommentWithReferenceViewHolder : ViewHolder {
|
class CommentWithReferenceViewHolder : ViewHolder {
|
||||||
|
@ -135,7 +134,8 @@ class CommentWithReferenceViewHolder : ViewHolder {
|
||||||
|
|
||||||
val rating = comment.rating;
|
val rating = comment.rating;
|
||||||
if (rating is RatingLikeDislikes) {
|
if (rating is RatingLikeDislikes) {
|
||||||
_layoutComment.alpha = if (rating.dislikes > 2 && rating.dislikes.toFloat() / (rating.likes + rating.dislikes).toFloat() >= 0.7f) 0.5f else 1.0f;
|
_layoutComment.alpha = if (Settings.instance.comments.badReputationCommentsFading &&
|
||||||
|
rating.dislikes > 2 && rating.dislikes.toFloat() / (rating.likes + rating.dislikes).toFloat() >= 0.7f) 0.5f else 1.0f;
|
||||||
} else {
|
} else {
|
||||||
_layoutComment.alpha = 1.0f;
|
_layoutComment.alpha = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,16 @@ class SubscriptionAdapter : RecyclerView.Adapter<SubscriptionViewHolder> {
|
||||||
|
|
||||||
var onClick = Event1<Subscription>();
|
var onClick = Event1<Subscription>();
|
||||||
var onSettings = Event1<Subscription>();
|
var onSettings = Event1<Subscription>();
|
||||||
var sortBy: Int = 3
|
var sortBy: Int = 5
|
||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
updateDataset()
|
updateDataset()
|
||||||
}
|
}
|
||||||
|
var query: String? = null
|
||||||
|
set(value) {
|
||||||
|
field = value;
|
||||||
|
updateDataset();
|
||||||
|
}
|
||||||
|
|
||||||
constructor(inflater: LayoutInflater, confirmationMessage: String) : super() {
|
constructor(inflater: LayoutInflater, confirmationMessage: String) : super() {
|
||||||
_inflater = inflater;
|
_inflater = inflater;
|
||||||
|
@ -53,6 +58,7 @@ class SubscriptionAdapter : RecyclerView.Adapter<SubscriptionViewHolder> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateDataset() {
|
private fun updateDataset() {
|
||||||
|
val queryLower = query?.lowercase() ?: "";
|
||||||
_sortedDataset = when (sortBy) {
|
_sortedDataset = when (sortBy) {
|
||||||
0 -> StateSubscriptions.instance.getSubscriptions().sortedBy({ u -> u.channel.name.lowercase() })
|
0 -> StateSubscriptions.instance.getSubscriptions().sortedBy({ u -> u.channel.name.lowercase() })
|
||||||
1 -> StateSubscriptions.instance.getSubscriptions().sortedByDescending({ u -> u.channel.name.lowercase() })
|
1 -> StateSubscriptions.instance.getSubscriptions().sortedByDescending({ u -> u.channel.name.lowercase() })
|
||||||
|
@ -61,7 +67,9 @@ class SubscriptionAdapter : RecyclerView.Adapter<SubscriptionViewHolder> {
|
||||||
4 -> StateSubscriptions.instance.getSubscriptions().sortedBy { it.playbackSeconds }
|
4 -> StateSubscriptions.instance.getSubscriptions().sortedBy { it.playbackSeconds }
|
||||||
5 -> StateSubscriptions.instance.getSubscriptions().sortedByDescending { it.playbackSeconds }
|
5 -> StateSubscriptions.instance.getSubscriptions().sortedByDescending { it.playbackSeconds }
|
||||||
else -> throw IllegalStateException("Invalid sorting algorithm selected.");
|
else -> throw IllegalStateException("Invalid sorting algorithm selected.");
|
||||||
}.toList();
|
}
|
||||||
|
.filter { (queryLower.isNullOrBlank() || it.channel.name.lowercase().contains(queryLower)) }
|
||||||
|
.toList();
|
||||||
|
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:textColor="#AAAAAA"
|
android:textColor="#AAAAAA"
|
||||||
android:fontFamily="monospace"
|
android:fontFamily="monospace"
|
||||||
android:text="source.getVideoDetails(...)"
|
android:text=""
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:layout_marginStart="30dp"
|
android:layout_marginStart="30dp"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
|
@ -58,6 +58,7 @@
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:background="#111111"
|
android:background="#111111"
|
||||||
android:textSize="8dp"
|
android:textSize="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
|
|
@ -16,33 +16,67 @@
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp"
|
android:layout_height="100dp"
|
||||||
android:minHeight="0dp"
|
android:minHeight="0dp"
|
||||||
app:layout_scrollFlags="scroll"
|
app:layout_scrollFlags="scroll"
|
||||||
app:contentInsetStart="0dp"
|
app:contentInsetStart="0dp"
|
||||||
app:contentInsetEnd="0dp">
|
app:contentInsetEnd="0dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<!--Search Text-->
|
||||||
android:layout_width="wrap_content"
|
<FrameLayout
|
||||||
|
android:id="@+id/container_search"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="14dp"
|
android:visibility="visible"
|
||||||
android:textColor="@color/gray_ac"
|
android:layout_margin="10dp">
|
||||||
android:fontFamily="@font/inter_light"
|
|
||||||
android:text="@string/sort_by"
|
|
||||||
android:paddingStart="20dp" />
|
|
||||||
|
|
||||||
<Spinner
|
<EditText
|
||||||
android:id="@+id/spinner_sortby"
|
android:id="@+id/edit_search"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="text"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:hint="Search"
|
||||||
|
android:paddingEnd="46dp" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/button_clear_search"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingStart="18dp"
|
||||||
|
android:paddingEnd="18dp"
|
||||||
|
android:layout_gravity="right|center_vertical"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:src="@drawable/ic_clear_16dp" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="20dp"
|
android:gravity="center_vertical">
|
||||||
android:paddingEnd="20dp" />
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14dp"
|
||||||
|
android:textColor="@color/gray_ac"
|
||||||
|
android:fontFamily="@font/inter_light"
|
||||||
|
android:text="@string/sort_by"
|
||||||
|
android:paddingStart="20dp" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/spinner_sortby"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingEnd="20dp" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
|
@ -368,6 +368,8 @@
|
||||||
<string name="preferred_preview_quality_description">Default quality while previewing a video in a feed</string>
|
<string name="preferred_preview_quality_description">Default quality while previewing a video in a feed</string>
|
||||||
<string name="primary_language">Primary Language</string>
|
<string name="primary_language">Primary Language</string>
|
||||||
<string name="default_comment_section">Default Comment Section</string>
|
<string name="default_comment_section">Default Comment Section</string>
|
||||||
|
<string name="bad_reputation_comments_fading">Bad Reputation Comment Fading</string>
|
||||||
|
<string name="bad_reputation_comments_fading_description">If comments with a very bad reputation should be faded. Disabling may worsen experience.</string>
|
||||||
<string name="reinstall_embedded_plugins">Reinstall Embedded Plugins</string>
|
<string name="reinstall_embedded_plugins">Reinstall Embedded Plugins</string>
|
||||||
<string name="remove_cached_version">Remove Cached Version</string>
|
<string name="remove_cached_version">Remove Cached Version</string>
|
||||||
<string name="remove_the_last_downloaded_version">Remove the last downloaded version</string>
|
<string name="remove_the_last_downloaded_version">Remove the last downloaded version</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue