mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Fix download errors causing UI blackout
This commit is contained in:
parent
25cbdcb504
commit
ebcb894011
6 changed files with 20 additions and 7 deletions
|
@ -84,8 +84,8 @@ class HomeFragment : MainFragment() {
|
|||
private val _taskGetPager: TaskHandler<Boolean, IPager<IPlatformContent>>;
|
||||
|
||||
constructor(fragment: HomeFragment, inflater: LayoutInflater, cachedRecyclerData: RecyclerData<InsertedViewAdapterWithLoader<ContentPreviewViewHolder>, LinearLayoutManager, IPager<IPlatformContent>, IPlatformContent, IPlatformContent, InsertedViewHolder<ContentPreviewViewHolder>>? = null) : super(fragment, inflater, cachedRecyclerData) {
|
||||
_announcementsView = AnnouncementView(context).apply {
|
||||
headerView.addView(AnnouncementView(context))
|
||||
_announcementsView = AnnouncementView(context, null).apply {
|
||||
headerView.addView(this);
|
||||
};
|
||||
|
||||
_taskGetPager = TaskHandler<Boolean, IPager<IPlatformContent>>({ fragment.lifecycleScope }, {
|
||||
|
|
|
@ -124,8 +124,8 @@ class SubscriptionsFeedFragment : MainFragment() {
|
|||
if (announcementsView == null && !isHomeEnabled) {
|
||||
val c = context;
|
||||
if (c != null) {
|
||||
_announcementsView = AnnouncementView(c).apply {
|
||||
headerView?.addView(AnnouncementView(c))
|
||||
_announcementsView = AnnouncementView(c, null).apply {
|
||||
headerView?.addView(this)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ class OrientationManager : OrientationEventListener {
|
|||
|
||||
constructor(context: Context) : super(context) { }
|
||||
|
||||
//TODO: Something weird is going on here
|
||||
//TODO: Old implementation felt pretty good for me, but now with 0 deadzone still feels bad, even though code should be identical?
|
||||
override fun onOrientationChanged(orientationAnglep: Int) {
|
||||
if (orientationAnglep == -1) return
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import android.util.AttributeSet
|
|||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.findViewTreeLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.futo.platformplayer.R
|
||||
import com.futo.platformplayer.dp
|
||||
import com.futo.platformplayer.logging.Logger
|
||||
|
@ -14,6 +16,9 @@ import com.futo.platformplayer.states.SessionAnnouncement
|
|||
import com.futo.platformplayer.states.StateAnnouncement
|
||||
import com.futo.platformplayer.states.StateApp
|
||||
import com.futo.platformplayer.toHumanNowDiffString
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class AnnouncementView : LinearLayout {
|
||||
private val _root: ConstraintLayout;
|
||||
|
@ -28,9 +33,13 @@ class AnnouncementView : LinearLayout {
|
|||
private val _category: String?;
|
||||
private var _currentAnnouncement: Announcement? = null;
|
||||
|
||||
private val _scope: CoroutineScope?;
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet? = null) : super(context, attrs) {
|
||||
inflate(context, R.layout.view_announcement, this);
|
||||
|
||||
_scope = findViewTreeLifecycleOwner()?.lifecycleScope ?: StateApp.instance.scopeOrNull; //TODO: Fetch correct scope
|
||||
|
||||
val dp10 = 10.dp(resources);
|
||||
setPadding(dp10, dp10, dp10, dp10);
|
||||
|
||||
|
@ -73,7 +82,9 @@ class AnnouncementView : LinearLayout {
|
|||
|
||||
super.onAttachedToWindow()
|
||||
StateAnnouncement.instance.onAnnouncementChanged.subscribe(this) {
|
||||
refresh();
|
||||
_scope?.launch(Dispatchers.Main) {
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
refresh();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 35ac3ba949db354311d8ea6cd3401a92811747ab
|
||||
Subproject commit 123960682a286232963b5ed456598b1922dbe559
|
|
@ -1 +1 @@
|
|||
Subproject commit 35ac3ba949db354311d8ea6cd3401a92811747ab
|
||||
Subproject commit 123960682a286232963b5ed456598b1922dbe559
|
Loading…
Add table
Reference in a new issue