Replace hasPro with purchasedThemes checks

pull/935/head
Alex Baker 5 years ago
parent 210456485b
commit b202a1397a

@ -86,7 +86,7 @@ class ColorPalettePicker : InjectingDialogFragment() {
dialogBuilder dialogBuilder
.newDialog() .newDialog()
.setView(view) .setView(view)
if (inventory.hasPro()) { if (inventory.purchasedThemes()) {
builder.setNegativeButton(android.R.string.cancel, null) builder.setNegativeButton(android.R.string.cancel, null)
} else { } else {
builder.setPositiveButton(R.string.button_subscribe) { _: DialogInterface?, _: Int -> builder.setPositiveButton(R.string.button_subscribe) { _: DialogInterface?, _: Int ->

@ -28,7 +28,7 @@ class ColorPickerAdapter(
override fun onBindViewHolder(holder: IconPickerHolder, position: Int) { override fun onBindViewHolder(holder: IconPickerHolder, position: Int) {
val pickable = getItem(position) val pickable = getItem(position)
val available = inventory.hasPro() || pickable.isFree val available = inventory.purchasedThemes() || pickable.isFree
holder.bind( holder.bind(
pickable.index, pickable.index,
if (available) R.drawable.color_picker else R.drawable.ic_outline_vpn_key_24px, if (available) R.drawable.color_picker else R.drawable.ic_outline_vpn_key_24px,

@ -53,7 +53,7 @@ class ColorWheelPicker : InjectingDialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
selected = savedInstanceState?.getInt(EXTRA_SELECTED) ?: arguments!!.getInt(EXTRA_SELECTED, 0) selected = savedInstanceState?.getInt(EXTRA_SELECTED) ?: arguments!!.getInt(EXTRA_SELECTED, 0)
val button = if (inventory.hasPro()) android.R.string.ok else R.string.button_subscribe val button = if (inventory.purchasedThemes()) android.R.string.ok else R.string.button_subscribe
val builder = ColorPickerDialogBuilder val builder = ColorPickerDialogBuilder
.with(activity) .with(activity)
.wheelType(ColorPickerView.WHEEL_TYPE.CIRCLE) .wheelType(ColorPickerView.WHEEL_TYPE.CIRCLE)
@ -66,7 +66,7 @@ class ColorWheelPicker : InjectingDialogFragment() {
} }
.lightnessSliderOnly() .lightnessSliderOnly()
.setPositiveButton(button) { _, _, _ -> .setPositiveButton(button) { _, _, _ ->
if (inventory.hasPro()) { if (inventory.purchasedThemes()) {
deliverSelection() deliverSelection()
} else { } else {
startActivityForResult(Intent(activity, PurchaseActivity::class.java), REQUEST_PURCHASE) startActivityForResult(Intent(activity, PurchaseActivity::class.java), REQUEST_PURCHASE)
@ -75,7 +75,7 @@ class ColorWheelPicker : InjectingDialogFragment() {
if (selected != 0) { if (selected != 0) {
builder.initialColor(selected) builder.initialColor(selected)
} }
val buttonText = if (inventory.hasPro()) R.string.material_palette else R.string.free_colors val buttonText = if (inventory.purchasedThemes()) R.string.material_palette else R.string.free_colors
builder.setNegativeButton(buttonText) { _, _ -> builder.setNegativeButton(buttonText) { _, _ ->
newColorPalette(targetFragment, targetRequestCode, ColorPickerAdapter.Palette.COLORS) newColorPalette(targetFragment, targetRequestCode, ColorPickerAdapter.Palette.COLORS)
.show(parentFragmentManager, FRAG_TAG_COLOR_PICKER) .show(parentFragmentManager, FRAG_TAG_COLOR_PICKER)

@ -59,7 +59,7 @@ class ThemePickerDialog : InjectingDialogFragment() {
adapter = object : ArrayAdapter<String>(activity!!, R.layout.simple_list_item_single_choice, themes) { adapter = object : ArrayAdapter<String>(activity!!, R.layout.simple_list_item_single_choice, themes) {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val view = super.getView(position, convertView, parent) val view = super.getView(position, convertView, parent)
val textColor = if (inventory.hasPro() || position < 2) { val textColor = if (inventory.purchasedThemes() || position < 2) {
R.color.text_primary R.color.text_primary
} else { } else {
R.color.text_tertiary R.color.text_tertiary
@ -123,5 +123,5 @@ class ThemePickerDialog : InjectingDialogFragment() {
dialog?.getButton(AlertDialog.BUTTON_POSITIVE)?.text = getString(stringRes) dialog?.getButton(AlertDialog.BUTTON_POSITIVE)?.text = getString(stringRes)
} }
private fun available() = inventory.hasPro() || selected < 2 private fun available() = inventory.purchasedThemes() || selected < 2
} }

@ -273,7 +273,7 @@ class LookAndFeel : InjectingPreferenceFragment(), Preference.OnPreferenceChange
val index = data?.getIntExtra(ThemePickerDialog.EXTRA_SELECTED, themeBase.index) val index = data?.getIntExtra(ThemePickerDialog.EXTRA_SELECTED, themeBase.index)
?: preferences.getInt(R.string.p_theme, 0) ?: preferences.getInt(R.string.p_theme, 0)
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
if (inventory.hasPro() || index < 2) { if (inventory.purchasedThemes() || index < 2) {
setBaseTheme(index) setBaseTheme(index)
} else { } else {
startActivityForResult( startActivityForResult(

@ -116,7 +116,7 @@ public class ThemeCache {
int index = preferences.getInt(R.string.p_theme, 0); int index = preferences.getInt(R.string.p_theme, 0);
if (intent != null && intent.hasExtra(EXTRA_THEME_OVERRIDE)) { if (intent != null && intent.hasExtra(EXTRA_THEME_OVERRIDE)) {
index = intent.getIntExtra(EXTRA_THEME_OVERRIDE, 0); index = intent.getIntExtra(EXTRA_THEME_OVERRIDE, 0);
} else if (index > 1 && !inventory.hasPro()) { } else if (index > 1 && !inventory.purchasedThemes()) {
index = 0; index = 0;
} }
return getThemeBase(index); return getThemeBase(index);

Loading…
Cancel
Save