mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay
This commit is contained in:
commit
e88c649578
12 changed files with 162 additions and 8 deletions
|
@ -739,7 +739,7 @@ class UISlideOverlays {
|
|||
}
|
||||
|
||||
|
||||
fun showMoreButtonOverlay(container: ViewGroup, buttonGroup: RoundButtonGroup, ignoreTags: List<Any> = listOf(), onPinnedbuttons: ((List<RoundButton>)->Unit)? = null): SlideUpMenuOverlay {
|
||||
fun showMoreButtonOverlay(container: ViewGroup, buttonGroup: RoundButtonGroup, ignoreTags: List<Any> = listOf(), invokeParents: Boolean = true, onPinnedbuttons: ((List<RoundButton>)->Unit)? = null): SlideUpMenuOverlay {
|
||||
val visible = buttonGroup.getVisibleButtons().filter { !ignoreTags.contains(it.tagRef) };
|
||||
val hidden = buttonGroup.getInvisibleButtons().filter { !ignoreTags.contains(it.tagRef) };
|
||||
|
||||
|
@ -747,7 +747,7 @@ class UISlideOverlays {
|
|||
hidden
|
||||
.map { btn -> SlideUpMenuItem(container.context, btn.iconResource, btn.text.text.toString(), "", "", {
|
||||
btn.handler?.invoke(btn);
|
||||
}, true) as View }.toTypedArray(),
|
||||
}, invokeParents) as View }.toTypedArray(),
|
||||
arrayOf(SlideUpMenuItem(container.context, R.drawable.ic_pin, container.context.getString(R.string.change_pins), container.context.getString(R.string.decide_which_buttons_should_be_pinned), "", {
|
||||
showOrderOverlay(container, container.context.getString(R.string.select_your_pins_in_order), (visible + hidden).map { Pair(it.text.text.toString(), it.tagRef!!) }) {
|
||||
val selected = it
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.futo.platformplayer.api.media.platforms.js.JSClient
|
|||
import com.futo.platformplayer.api.media.structures.IPager
|
||||
import com.futo.platformplayer.constructs.TaskHandler
|
||||
import com.futo.platformplayer.engine.exceptions.PluginException
|
||||
import com.futo.platformplayer.engine.exceptions.ScriptCaptchaRequiredException
|
||||
import com.futo.platformplayer.exceptions.ChannelException
|
||||
import com.futo.platformplayer.exceptions.RateLimitException
|
||||
import com.futo.platformplayer.logging.Logger
|
||||
|
|
|
@ -437,11 +437,11 @@ class VideoDetailView : ConstraintLayout {
|
|||
|
||||
var buttonMore: RoundButton? = null;
|
||||
buttonMore = RoundButton(context, R.drawable.ic_menu, context.getString(R.string.more), TAG_MORE) {
|
||||
_slideUpOverlay = UISlideOverlays.showMoreButtonOverlay(_overlayContainer, _buttonPins, listOf(TAG_MORE)) {selected ->
|
||||
_slideUpOverlay = UISlideOverlays.showMoreButtonOverlay(_overlayContainer, _buttonPins, listOf(TAG_MORE), false) {selected ->
|
||||
_buttonPins.setButtons(*(selected + listOf(buttonMore!!)).toTypedArray());
|
||||
_buttonPinStore.set(*selected.filter { it.tagRef is String }.map{ it.tagRef as String }.toTypedArray())
|
||||
_buttonPinStore.save();
|
||||
}
|
||||
};
|
||||
};
|
||||
_buttonMore = buttonMore;
|
||||
updateMoreButtons();
|
||||
|
@ -769,6 +769,7 @@ class VideoDetailView : ConstraintLayout {
|
|||
Logger.e(TAG, "Failed to reopen live chat", ex);
|
||||
}
|
||||
}
|
||||
_slideUpOverlay?.hide();
|
||||
} else null,
|
||||
RoundButton(context, R.drawable.ic_screen_share, context.getString(R.string.background), TAG_BACKGROUND) {
|
||||
if(!allowBackground) {
|
||||
|
@ -781,6 +782,7 @@ class VideoDetailView : ConstraintLayout {
|
|||
allowBackground = false;
|
||||
it.text.text = resources.getString(R.string.background);
|
||||
}
|
||||
_slideUpOverlay?.hide();
|
||||
},
|
||||
RoundButton(context, R.drawable.ic_download, context.getString(R.string.download), TAG_DOWNLOAD) {
|
||||
video?.let {
|
||||
|
@ -793,11 +795,13 @@ class VideoDetailView : ConstraintLayout {
|
|||
preventPictureInPicture = true;
|
||||
shareVideo();
|
||||
};
|
||||
_slideUpOverlay?.hide();
|
||||
},
|
||||
RoundButton(context, R.drawable.ic_screen_share, context.getString(R.string.overlay), TAG_OVERLAY) {
|
||||
this.startPictureInPicture();
|
||||
fragment.forcePictureInPicture();
|
||||
//PiPActivity.startPiP(context);
|
||||
_slideUpOverlay?.hide();
|
||||
},
|
||||
RoundButton(context, R.drawable.ic_export, context.getString(R.string.page), TAG_OPEN) {
|
||||
video?.let {
|
||||
|
@ -805,9 +809,11 @@ class VideoDetailView : ConstraintLayout {
|
|||
fragment.navigate<BrowserFragment>(url);
|
||||
fragment.minimizeVideoDetail();
|
||||
};
|
||||
_slideUpOverlay?.hide();
|
||||
},
|
||||
RoundButton(context, R.drawable.ic_refresh, context.getString(R.string.reload), "Reload") {
|
||||
reloadVideo();
|
||||
_slideUpOverlay?.hide();
|
||||
}).filterNotNull();
|
||||
if(!_buttonPinStore.getAllValues().any())
|
||||
_buttonPins.setButtons(*(buttons + listOf(_buttonMore)).toTypedArray());
|
||||
|
|
|
@ -2,12 +2,14 @@ package com.futo.platformplayer.views.subscriptions
|
|||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import androidx.lifecycle.findViewTreeLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.futo.platformplayer.R
|
||||
import com.futo.platformplayer.Settings
|
||||
import com.futo.platformplayer.UIDialogs
|
||||
import com.futo.platformplayer.api.media.models.channels.SerializedChannel
|
||||
import com.futo.platformplayer.constructs.Event1
|
||||
import com.futo.platformplayer.models.Subscription
|
||||
|
@ -24,7 +26,8 @@ import kotlinx.coroutines.launch
|
|||
|
||||
class SubscriptionBar : LinearLayout {
|
||||
private var _adapterView: AnyAdapterView<Subscription, SubscriptionBarViewHolder>? = null;
|
||||
private var _subGroups: AnyAdapterView<SubscriptionGroup, SubscriptionGroupBarViewHolder>
|
||||
private var _subGroups: AnyAdapterView<SubscriptionGroup, SubscriptionGroupBarViewHolder>;
|
||||
private var _subGroupsExplore: SubscriptionExploreButton;
|
||||
private val _tagsContainer: LinearLayout;
|
||||
|
||||
private val _groups: ArrayList<SubscriptionGroup>;
|
||||
|
@ -64,7 +67,25 @@ class SubscriptionBar : LinearLayout {
|
|||
onHoldGroup.emit(g);
|
||||
}
|
||||
}
|
||||
_subGroupsExplore = findViewById(R.id.subgroup_explore);
|
||||
_tagsContainer = findViewById(R.id.container_tags);
|
||||
|
||||
_subGroupsExplore.onClick.subscribe {
|
||||
UIDialogs.showDialog(context, R.drawable.ic_subscriptions, "Subscription Groups",
|
||||
"Subscription groups are an easy way to navigate your subscriptions.\n\nDefine your own subsets, and in the near future share them with others.", null, 0,
|
||||
UIDialogs.Action("Hide Bar", {
|
||||
Settings.instance.subscriptions.showSubscriptionGroups = false;
|
||||
Settings.instance.save();
|
||||
reloadGroups();
|
||||
|
||||
UIDialogs.showDialogOk(context, R.drawable.ic_quiz, "Subscription groups can be re-enabled in settings")
|
||||
}),
|
||||
UIDialogs.Action("Create", {
|
||||
onToggleGroup.emit(SubscriptionGroup.Add()); //Shortcut..
|
||||
}, UIDialogs.ActionStyle.PRIMARY))
|
||||
};
|
||||
|
||||
updateExplore();
|
||||
}
|
||||
|
||||
private fun groupClicked(g: SubscriptionGroup) {
|
||||
|
@ -100,6 +121,8 @@ class SubscriptionBar : LinearLayout {
|
|||
_groups.clear();
|
||||
_groups.addAll(results);
|
||||
_subGroups.notifyContentChanged();
|
||||
|
||||
updateExplore();
|
||||
}
|
||||
private fun getGroups(): List<SubscriptionGroup> {
|
||||
return if(Settings.instance.subscriptions.showSubscriptionGroups)
|
||||
|
@ -110,6 +133,18 @@ class SubscriptionBar : LinearLayout {
|
|||
else listOf();
|
||||
}
|
||||
|
||||
fun updateExplore() {
|
||||
val show = Settings.instance.subscriptions.showSubscriptionGroups &&
|
||||
_groups.all { it is SubscriptionGroup.Add };
|
||||
if(show) {
|
||||
_subGroupsExplore.visibility = View.VISIBLE;
|
||||
_subGroups.view.visibility = View.GONE;
|
||||
}
|
||||
else {
|
||||
_subGroupsExplore.visibility = View.GONE;
|
||||
_subGroups.view.visibility = View.VISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
fun setToggles(vararg buttons: Toggle) {
|
||||
_tagsContainer.removeAllViews();
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.futo.platformplayer.views.subscriptions
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Animatable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.futo.platformplayer.*
|
||||
import com.futo.platformplayer.api.media.models.channels.IPlatformChannel
|
||||
import com.futo.platformplayer.constructs.Event0
|
||||
import com.futo.platformplayer.constructs.Event1
|
||||
import com.futo.platformplayer.constructs.TaskHandler
|
||||
import com.futo.platformplayer.models.Subscription
|
||||
import com.futo.platformplayer.states.StateApp
|
||||
import com.futo.platformplayer.states.StatePlatform
|
||||
import com.futo.platformplayer.states.StateSubscriptions
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.android.material.shape.CornerFamily
|
||||
import com.google.android.material.shape.ShapeAppearanceModel
|
||||
|
||||
class SubscriptionExploreButton : ConstraintLayout {
|
||||
val onClick = Event0();
|
||||
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
inflate(context, R.layout.view_subscription_group_bar_explore, this);
|
||||
|
||||
val dp10 = 10.dp(resources);
|
||||
findViewById<ShapeableImageView>(R.id.image)
|
||||
.apply {
|
||||
adjustViewBounds = true
|
||||
scaleType = ImageView.ScaleType.CENTER_CROP;
|
||||
shapeAppearanceModel = ShapeAppearanceModel.builder().setAllCorners(CornerFamily.ROUNDED, dp10.toFloat()).build()
|
||||
}
|
||||
|
||||
findViewById<ConstraintLayout>(R.id.root).setOnClickListener {
|
||||
onClick.emit();
|
||||
}
|
||||
}
|
||||
}
|
12
app/src/main/res/drawable/background_button_explore.xml
Normal file
12
app/src/main/res/drawable/background_button_explore.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:radius="10dp"
|
||||
android:topRightRadius="10dp"
|
||||
android:bottomRightRadius="10dp"
|
||||
android:bottomLeftRadius="10dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#6F6F6F" />
|
||||
</shape>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:radius="10dp"
|
||||
android:topRightRadius="10dp"
|
||||
android:bottomRightRadius="10dp"
|
||||
android:bottomLeftRadius="10dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#6F6F6F" />
|
||||
<solid android:color="#99000000" />
|
||||
</shape>
|
BIN
app/src/main/res/drawable/sub_group_demo.png
Normal file
BIN
app/src/main/res/drawable/sub_group_demo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
|
@ -27,7 +27,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/failed_to_retrieve_data_are_you_connected"
|
||||
android:textSize="14dp"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/white"
|
||||
android:fontFamily="@font/inter_regular"
|
||||
android:textAlignment="center"
|
||||
|
@ -43,7 +43,7 @@
|
|||
android:textAlignment="center"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:textSize="9dp"
|
||||
android:textSize="11dp"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/dialog_text_code"
|
||||
|
|
|
@ -28,4 +28,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" />
|
||||
<com.futo.platformplayer.views.subscriptions.SubscriptionExploreButton
|
||||
android:id="@+id/subgroup_explore"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="1dp"
|
||||
android:clickable="true"
|
||||
android:id="@+id/root">
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/sub_group_demo" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background_button_explore_inner"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:id="@+id/text_sub_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/inter_medium"
|
||||
android:textSize="13dp"
|
||||
android:textAlignment="center"
|
||||
android:text="Explore Subscription Groups" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -569,7 +569,7 @@
|
|||
<string name="playlist_copied_as_local_playlist">Playlist copied as local playlist</string>
|
||||
<string name="are_you_sure_you_want_to_delete_the_downloaded_videos">Are you sure you want to delete the downloaded videos?</string>
|
||||
<string name="create_new_playlist">Create new playlist</string>
|
||||
<string name="create_new_subgroup">Create new subscription group</string>
|
||||
<string name="create_new_subgroup">Create new group</string>
|
||||
<string name="expected_media_content_found">Expected media content, found</string>
|
||||
<string name="failed_to_load_post">Failed to load post.</string>
|
||||
<string name="replies">replies</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue