fix animations

This commit is contained in:
Bnyro 2022-07-21 18:06:09 +02:00
parent 276d611a9f
commit f15a98175c
3 changed files with 17 additions and 22 deletions

View File

@ -21,7 +21,6 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
val TAG = "SubChannelAdapter"
private var subscribed = true
private var isLoading = false
override fun getItemCount(): Int {
return subscriptions.size
@ -43,17 +42,16 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
NavigationHelper.navigateChannel(root.context, subscription.url)
}
subscriptionSubscribe.setOnClickListener {
if (!isLoading) {
isLoading = true
val channelId = subscription.url?.replace("/channel/", "")!!
if (subscribed) {
unsubscribe(channelId)
subscriptionSubscribe.text = root.context.getString(R.string.unsubscribe)
} else {
subscribe(channelId)
subscriptionSubscribe.text =
root.context.getString(R.string.subscribe)
}
val channelId = subscription.url?.replace("/channel/", "")!!
if (subscribed) {
subscriptionSubscribe.text = root.context.getString(R.string.subscribe)
unsubscribe(channelId)
subscribed = false
} else {
subscriptionSubscribe.text =
root.context.getString(R.string.unsubscribe)
subscribe(channelId)
subscribed = true
}
}
}
@ -71,8 +69,6 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
} catch (e: Exception) {
Log.e(TAG, e.toString())
}
subscribed = true
isLoading = false
}
}
run()
@ -90,8 +86,6 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
} catch (e: Exception) {
Log.e(TAG, e.toString())
}
subscribed = false
isLoading = false
}
}
run()

View File

@ -78,11 +78,11 @@ class SubscriptionsFragment : Fragment() {
fetchChannels(binding.subChannels)
loadedSubbedChannels = true
}
binding.subChannels.visibility = View.VISIBLE
binding.subFeed.visibility = View.GONE
binding.subChannelsContainer.visibility = View.VISIBLE
binding.subFeedContainer.visibility = View.GONE
} else {
binding.subChannels.visibility = View.GONE
binding.subFeed.visibility = View.VISIBLE
binding.subChannelsContainer.visibility = View.GONE
binding.subFeedContainer.visibility = View.VISIBLE
}
}

View File

@ -95,13 +95,13 @@
</com.google.android.material.card.MaterialCardView>
<RelativeLayout
android:id="@+id/sub_channels_container"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<androidx.recyclerview.widget.RecyclerView
android:visibility="gone"
android:id="@+id/sub_channels"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -110,6 +110,7 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/sub_feed_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">