Fix free label showing when Pro is enable #934

This commit is contained in:
Hemanth S 2020-10-17 18:00:11 +05:30
parent a39a9bd592
commit 2f4632fd67
4 changed files with 11 additions and 45 deletions

View file

@ -33,9 +33,7 @@ import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.colorButtons
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.extensions.materialDialog
import code.name.monkey.retromusic.extensions.*
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
import code.name.monkey.retromusic.fragments.AlbumCoverStyle.*
import code.name.monkey.retromusic.util.NavigationUtil
@ -126,9 +124,10 @@ class AlbumCoverStylePreferenceDialog : DialogFragment(),
Glide.with(context).load(albumCoverStyle.drawableResId).into(image)
title.setText(albumCoverStyle.titleRes)
if (isAlbumCoverStyle(albumCoverStyle)) {
proText.show()
proText.setText(R.string.pro)
} else {
proText.setText(R.string.free)
proText.hide()
}
return layout
}

View file

@ -32,9 +32,7 @@ import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.colorButtons
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.extensions.materialDialog
import code.name.monkey.retromusic.extensions.*
import code.name.monkey.retromusic.fragments.NowPlayingScreen
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
import code.name.monkey.retromusic.util.NavigationUtil
@ -93,7 +91,7 @@ class NowPlayingScreenPreferenceDialog : DialogFragment(), ViewPager.OnPageChang
val nowPlayingScreen = values()[viewPagerPosition]
if (isNowPlayingThemes(nowPlayingScreen)) {
val result =
getString(nowPlayingScreen.titleRes) + " theme is Pro version feature."
"${getString(nowPlayingScreen.titleRes)} theme is Pro version feature."
Toast.makeText(context, result, Toast.LENGTH_SHORT).show()
NavigationUtil.goToProVersion(requireContext())
} else {
@ -131,9 +129,10 @@ private class NowPlayingScreenAdapter(private val context: Context) : PagerAdapt
Glide.with(context).load(nowPlayingScreen.drawableResId).into(image)
title.setText(nowPlayingScreen.titleRes)
if (isNowPlayingThemes(nowPlayingScreen)) {
proText.show()
proText.setText(R.string.pro)
} else {
proText.setText(R.string.free)
}else{
proText.hide()
}
return layout
}
@ -160,14 +159,5 @@ private class NowPlayingScreenAdapter(private val context: Context) : PagerAdapt
}
private fun isNowPlayingThemes(screen: NowPlayingScreen): Boolean {
return (screen == Full ||
screen == Card ||
screen == Plain ||
screen == Blur ||
screen == Color ||
screen == Simple ||
screen == BlurCard ||
screen == Circle ||
screen == Adaptive)
&& !App.isProVersion()
return (screen == Full || screen == Card || screen == Plain || screen == Blur || screen == Color || screen == Simple || screen == BlurCard || screen == Circle || screen == Adaptive) && !App.isProVersion()
}

View file

@ -127,29 +127,6 @@
android:textColor="@color/md_white_1000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_check_circle"
app:tint="@color/md_white_1000" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/window_corner_edges"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="@color/md_white_1000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -37,9 +37,9 @@
android:layout_gravity="center"
android:gravity="center"
android:padding="8dp"
android:text="@string/pro"
android:textAppearance="@style/TextViewHeadline6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:text="@string/pro" />
</androidx.constraintlayout.widget.ConstraintLayout>