Skip to content
Snippets Groups Projects
Commit b822078d authored by Koen's avatar Koen
Browse files

Fixed support tab falsely showing when a creator does not have a polycentric profile.

parent 290d2ceb
No related branches found
No related tags found
No related merge requests found
package com.futo.platformplayer.fragment.channel.tab package com.futo.platformplayer.fragment.channel.tab
import android.content.Intent
import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.futo.platformplayer.R import com.futo.platformplayer.R
import com.futo.platformplayer.api.media.models.channels.IPlatformChannel import com.futo.platformplayer.api.media.models.channels.IPlatformChannel
import com.futo.platformplayer.fragment.mainactivity.main.PolycentricProfile import com.futo.platformplayer.fragment.mainactivity.main.PolycentricProfile
import com.futo.platformplayer.logging.Logger
import com.futo.platformplayer.views.SupportView import com.futo.platformplayer.views.SupportView
import com.futo.platformplayer.views.buttons.BigButton
class ChannelMonetizationFragment : Fragment, IChannelTabFragment { class ChannelMonetizationFragment : Fragment, IChannelTabFragment {
private var _supportView: SupportView? = null private var _supportView: SupportView? = null
private var _textMonetization: TextView? = null
private var _lastChannel: IPlatformChannel? = null; private var _lastChannel: IPlatformChannel? = null;
private var _lastPolycentricProfile: PolycentricProfile? = null; private var _lastPolycentricProfile: PolycentricProfile? = null;
...@@ -26,21 +24,22 @@ class ChannelMonetizationFragment : Fragment, IChannelTabFragment { ...@@ -26,21 +24,22 @@ class ChannelMonetizationFragment : Fragment, IChannelTabFragment {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_channel_monetization, container, false); val view = inflater.inflate(R.layout.fragment_channel_monetization, container, false);
_supportView = view.findViewById(R.id.support); _supportView = view.findViewById(R.id.support);
_textMonetization = view.findViewById(R.id.text_monetization);
_lastChannel?.also { _lastChannel?.also {
setChannel(it); setChannel(it);
}; };
_lastPolycentricProfile?.also { _supportView?.visibility = View.GONE;
setPolycentricProfile(it, animate = false); _textMonetization?.visibility = View.GONE;
} setPolycentricProfile(_lastPolycentricProfile, animate = false);
return view; return view;
} }
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView(); super.onDestroyView();
_supportView = null; _supportView = null;
_textMonetization = null;
} }
override fun setChannel(channel: IPlatformChannel) { override fun setChannel(channel: IPlatformChannel) {
...@@ -49,7 +48,15 @@ class ChannelMonetizationFragment : Fragment, IChannelTabFragment { ...@@ -49,7 +48,15 @@ class ChannelMonetizationFragment : Fragment, IChannelTabFragment {
fun setPolycentricProfile(polycentricProfile: PolycentricProfile?, animate: Boolean) { fun setPolycentricProfile(polycentricProfile: PolycentricProfile?, animate: Boolean) {
_lastPolycentricProfile = polycentricProfile _lastPolycentricProfile = polycentricProfile
_supportView?.setPolycentricProfile(polycentricProfile, animate) if (polycentricProfile != null) {
_supportView?.setPolycentricProfile(polycentricProfile, animate)
_supportView?.visibility = View.VISIBLE
_textMonetization?.visibility = View.GONE
} else {
_supportView?.setPolycentricProfile(null, animate)
_supportView?.visibility = View.GONE
_textMonetization?.visibility = View.VISIBLE
}
} }
companion object { companion object {
......
...@@ -6,5 +6,18 @@ ...@@ -6,5 +6,18 @@
<com.futo.platformplayer.views.SupportView <com.futo.platformplayer.views.SupportView
android:id="@+id/support" android:id="@+id/support"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
android:visibility="gone"/>
<TextView
android:id="@+id/text_monetization"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_gravity="center"
android:text="@string/this_creator_has_not_setup_any_monetization_features"
android:fontFamily="@font/inter_light"
android:textColor="#ACACAC"
android:textSize="12dp"
android:visibility="gone" />
</FrameLayout> </FrameLayout>
\ No newline at end of file
...@@ -639,6 +639,7 @@ ...@@ -639,6 +639,7 @@
<string name="this_creator_has_not_set_any_support_options_on_harbor_polycentric">This creator has not set any support options on Harbor (Polycentric)</string> <string name="this_creator_has_not_set_any_support_options_on_harbor_polycentric">This creator has not set any support options on Harbor (Polycentric)</string>
<string name="load_more">Load More</string> <string name="load_more">Load More</string>
<string name="stopped_after_requestcount_to_avoid_rate_limit_click_load_more_to_load_more">Stopped after {requestCount} to avoid rate limit, click load more to load more.</string> <string name="stopped_after_requestcount_to_avoid_rate_limit_click_load_more_to_load_more">Stopped after {requestCount} to avoid rate limit, click load more to load more.</string>
<string name="this_creator_has_not_setup_any_monetization_features">This creator has not setup any monetization features</string>
<string-array name="home_screen_array"> <string-array name="home_screen_array">
<item>Recommendations</item> <item>Recommendations</item>
<item>Subscriptions</item> <item>Subscriptions</item>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment