mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-05-01 15:14:29 +02:00
Fix download errors causing UI blackout
This commit is contained in:
parent
25cbdcb504
commit
ebcb894011
@ -84,8 +84,8 @@ class HomeFragment : MainFragment() {
|
|||||||
private val _taskGetPager: TaskHandler<Boolean, IPager<IPlatformContent>>;
|
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) {
|
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 {
|
_announcementsView = AnnouncementView(context, null).apply {
|
||||||
headerView.addView(AnnouncementView(context))
|
headerView.addView(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
_taskGetPager = TaskHandler<Boolean, IPager<IPlatformContent>>({ fragment.lifecycleScope }, {
|
_taskGetPager = TaskHandler<Boolean, IPager<IPlatformContent>>({ fragment.lifecycleScope }, {
|
||||||
|
@ -124,8 +124,8 @@ class SubscriptionsFeedFragment : MainFragment() {
|
|||||||
if (announcementsView == null && !isHomeEnabled) {
|
if (announcementsView == null && !isHomeEnabled) {
|
||||||
val c = context;
|
val c = context;
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
_announcementsView = AnnouncementView(c).apply {
|
_announcementsView = AnnouncementView(c, null).apply {
|
||||||
headerView?.addView(AnnouncementView(c))
|
headerView?.addView(this)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ class OrientationManager : OrientationEventListener {
|
|||||||
|
|
||||||
constructor(context: Context) : super(context) { }
|
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) {
|
override fun onOrientationChanged(orientationAnglep: Int) {
|
||||||
if (orientationAnglep == -1) return
|
if (orientationAnglep == -1) return
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ import android.util.AttributeSet
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.lifecycle.findViewTreeLifecycleOwner
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.futo.platformplayer.R
|
import com.futo.platformplayer.R
|
||||||
import com.futo.platformplayer.dp
|
import com.futo.platformplayer.dp
|
||||||
import com.futo.platformplayer.logging.Logger
|
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.StateAnnouncement
|
||||||
import com.futo.platformplayer.states.StateApp
|
import com.futo.platformplayer.states.StateApp
|
||||||
import com.futo.platformplayer.toHumanNowDiffString
|
import com.futo.platformplayer.toHumanNowDiffString
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class AnnouncementView : LinearLayout {
|
class AnnouncementView : LinearLayout {
|
||||||
private val _root: ConstraintLayout;
|
private val _root: ConstraintLayout;
|
||||||
@ -28,9 +33,13 @@ class AnnouncementView : LinearLayout {
|
|||||||
private val _category: String?;
|
private val _category: String?;
|
||||||
private var _currentAnnouncement: Announcement? = null;
|
private var _currentAnnouncement: Announcement? = null;
|
||||||
|
|
||||||
|
private val _scope: CoroutineScope?;
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet? = null) : super(context, attrs) {
|
constructor(context: Context, attrs: AttributeSet? = null) : super(context, attrs) {
|
||||||
inflate(context, R.layout.view_announcement, this);
|
inflate(context, R.layout.view_announcement, this);
|
||||||
|
|
||||||
|
_scope = findViewTreeLifecycleOwner()?.lifecycleScope ?: StateApp.instance.scopeOrNull; //TODO: Fetch correct scope
|
||||||
|
|
||||||
val dp10 = 10.dp(resources);
|
val dp10 = 10.dp(resources);
|
||||||
setPadding(dp10, dp10, dp10, dp10);
|
setPadding(dp10, dp10, dp10, dp10);
|
||||||
|
|
||||||
@ -73,8 +82,10 @@ class AnnouncementView : LinearLayout {
|
|||||||
|
|
||||||
super.onAttachedToWindow()
|
super.onAttachedToWindow()
|
||||||
StateAnnouncement.instance.onAnnouncementChanged.subscribe(this) {
|
StateAnnouncement.instance.onAnnouncementChanged.subscribe(this) {
|
||||||
|
_scope?.launch(Dispatchers.Main) {
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 35ac3ba949db354311d8ea6cd3401a92811747ab
|
Subproject commit 123960682a286232963b5ed456598b1922dbe559
|
@ -1 +1 @@
|
|||||||
Subproject commit 35ac3ba949db354311d8ea6cd3401a92811747ab
|
Subproject commit 123960682a286232963b5ed456598b1922dbe559
|
Loading…
x
Reference in New Issue
Block a user