Fix Buy pro CardView

This commit is contained in:
h4h13 2019-06-05 13:47:45 +05:30
parent d4147923d9
commit 8f1672b38e
56 changed files with 280 additions and 132 deletions

View file

@ -57,7 +57,7 @@ class AppWidgetBig : BaseAppWidget() {
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp,
MaterialValueHelper.getPrimaryTextColor(context, false))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.Companion.createBitmap(
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp,
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp,
MaterialValueHelper.getPrimaryTextColor(context, false))!!, 1f))
linkButtons(context, appWidgetView)
@ -84,7 +84,7 @@ class AppWidgetBig : BaseAppWidget() {
}
// Set correct drawable for pause state
val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_24dp
val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_32dp
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(
RetroUtil.getTintedVectorDrawable(service, playPauseRes,
MaterialValueHelper.getPrimaryTextColor(service, false))!!, 1f))

View file

@ -52,7 +52,7 @@ class AppWidgetCard : BaseAppWidget() {
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art)
appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.Companion.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_prev, BaseAppWidget.Companion.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.Companion.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.Companion.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
linkButtons(context, appWidgetView)
pushUpdate(context, appWidgetIds, appWidgetView)
@ -78,7 +78,7 @@ class AppWidgetCard : BaseAppWidget() {
}
// Set correct drawable for pause state
val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_24dp
val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_32dp
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.Companion.createBitmap(
RetroUtil.getTintedVectorDrawable(service, playPauseRes,
MaterialValueHelper.getSecondaryTextColor(service, true))!!, 1f))
@ -127,7 +127,7 @@ class AppWidgetCard : BaseAppWidget() {
// Set correct drawable for pause state
val playPauseRest = if (isPlaying) R.drawable.ic_pause_white_24dp
else
R.drawable.ic_play_arrow_white_24dp
R.drawable.ic_play_arrow_white_32dp
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(service, playPauseRest, color)!!, 1f))
// Set prev/next button drawables
appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, color)!!, 1f))

View file

@ -51,7 +51,7 @@ class AppWidgetClassic : BaseAppWidget() {
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art)
appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_prev, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
linkButtons(context, appWidgetView)
pushUpdate(context, appWidgetIds, appWidgetView)
@ -114,7 +114,7 @@ class AppWidgetClassic : BaseAppWidget() {
val playPauseRes = if (isPlaying)
R.drawable.ic_pause_white_24dp
else
R.drawable.ic_play_arrow_white_24dp
R.drawable.ic_play_arrow_white_32dp
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause,
BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(service, playPauseRes, color)!!, 1f))

View file

@ -51,7 +51,7 @@ class AppWidgetSmall : BaseAppWidget() {
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art)
appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_prev, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
linkButtons(context, appWidgetView)
pushUpdate(context, appWidgetIds, appWidgetView)
@ -120,7 +120,7 @@ class AppWidgetSmall : BaseAppWidget() {
val playPauseRes = if (isPlaying)
R.drawable.ic_pause_white_24dp
else
R.drawable.ic_play_arrow_white_24dp
R.drawable.ic_play_arrow_white_32dp
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.Companion.createBitmap(RetroUtil.getTintedVectorDrawable(service, playPauseRes, color)!!, 1f))
// Set prev/next button drawables

View file

@ -36,7 +36,7 @@ class AppWidgetText : BaseAppWidget() {
appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
appWidgetView.setImageViewBitmap(R.id.button_prev, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
appWidgetView.setTextColor(R.id.title, ContextCompat.getColor(context, R.color.md_white_1000))
appWidgetView.setTextColor(R.id.text, ContextCompat.getColor(context, R.color.md_white_1000))
@ -94,7 +94,7 @@ class AppWidgetText : BaseAppWidget() {
val playPauseRes = if (isPlaying)
R.drawable.ic_pause_white_24dp
else
R.drawable.ic_play_arrow_white_24dp
R.drawable.ic_play_arrow_white_32dp
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, playPauseRes, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
appWidgetView.setImageViewBitmap(R.id.button_prev, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))

View file

@ -124,7 +124,7 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
if (MusicPlayerRemote.isPlaying) {
miniPlayerPlayPauseButton!!.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
miniPlayerPlayPauseButton!!.setImageResource(R.drawable.ic_play_arrow_white_24dp)
miniPlayerPlayPauseButton!!.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -152,10 +152,18 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
(recyclerView.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin = (marginSpan * 2.3f).toInt()
}
private fun toolbarColor(): Int {
return if (PreferenceUtil.getInstance().isHomeBanner) {
toolbarContainer.setBackgroundColor(Color.TRANSPARENT)
ColorUtil.withAlpha(RetroUtil.toolbarColor(mainActivity), 0.85f)
} else {
RetroUtil.toolbarColor(mainActivity)
}
}
private fun setupToolbar() {
toolbarContainer.setBackgroundColor(Color.TRANSPARENT)
toolbar.apply {
setBackgroundColor(ColorUtil.withAlpha(RetroUtil.toolbarColor(mainActivity), 0.85f))
setBackgroundColor(toolbarColor())
setNavigationIcon(R.drawable.ic_menu_white_24dp)
setOnClickListener {
val pairImageView = Pair.create<View, String>(toolbarContainer, resources.getString(R.string.transition_toolbar))

View file

@ -120,7 +120,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -135,7 +135,7 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -149,7 +149,7 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -75,7 +75,7 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
private fun updatePlayPauseDrawableState() {
when {
MusicPlayerRemote.isPlaying -> playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
else -> playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
else -> playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -97,7 +97,7 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playerPlayPauseFab.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playerPlayPauseFab.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playerPlayPauseFab.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -132,7 +132,7 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
private fun updatePlayPauseDrawableState() {
when {
MusicPlayerRemote.isPlaying -> playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
else -> playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
else -> playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -137,7 +137,7 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -153,7 +153,7 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -154,7 +154,7 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(), PopupMenu.OnMe
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -144,7 +144,7 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -129,7 +129,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_big);
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_big);
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_64dp);
}
}

View file

@ -134,7 +134,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -238,7 +238,7 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}

View file

@ -213,7 +213,7 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}
}

View file

@ -14,6 +14,7 @@
package code.name.monkey.retromusic.fragments.settings
import android.content.res.ColorStateList
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -22,10 +23,13 @@ import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.SettingsActivity
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.util.NavigationUtil
import kotlinx.android.synthetic.main.fragment_main_settings.*
@ -64,8 +68,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
aboutSettings.setOnClickListener(this)
buyProContainer.apply {
setCardBackgroundColor(ThemeStore.accentColor(context!!))
visibility = if (!App.isProVersion) View.VISIBLE else View.GONE
if (!App.isProVersion) show() else hide()
setOnClickListener {
NavigationUtil.goToProVersion(context)
}
@ -73,11 +76,12 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
buyPremium.setOnClickListener {
NavigationUtil.goToProVersion(context!!)
}
val primaryColor = MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(ThemeStore.accentColor(context!!)))
MaterialUtil.setTint(buyPremium)
val primaryColor = MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(ThemeStore.primaryColor(context!!)))
text.setTextColor(ColorUtil.withAlpha(primaryColor, 0.75f))
title.setTextColor(primaryColor)
//title.setTextColor(primaryColor)
text2.setTextColor(primaryColor)
text3.setTextColor(primaryColor)
text3.imageTintList = ColorStateList.valueOf(primaryColor)
}

View file

@ -36,6 +36,11 @@ class PersonaizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
activity!!.recreate()
return@setOnPreferenceChangeListener true
}
val toggleFullScreen: TwoStatePreference = findPreference("toggle_full_screen")!!
toggleFullScreen.setOnPreferenceChangeListener { _, _ ->
activity!!.recreate()
true
}
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {

View file

@ -96,8 +96,7 @@ object MusicPlayerRemote {
val isServiceConnected: Boolean
get() = musicService != null
fun bindToService(context: Context,
callback: ServiceConnection): ServiceToken? {
fun bindToService(context: Context, callback: ServiceConnection): ServiceToken? {
var realActivity: Activity? = (context as Activity).parent
if (realActivity == null) {
@ -105,6 +104,7 @@ object MusicPlayerRemote {
}
val contextWrapper = ContextWrapper(realActivity)
contextWrapper.startService(Intent(contextWrapper, MusicService::class.java))
val binder = ServiceBinder(callback)
@ -129,24 +129,21 @@ object MusicPlayerRemote {
}
private fun getFilePathFromUri(context: Context, uri: Uri): String? {
var cursor: Cursor? = null
val column = "_data"
val projection = arrayOf(column)
var cursor: Cursor? = null
try {
cursor = context.contentResolver.query(uri, projection, null, null, null)
cursor.use {
if (it.moveToFirst()) {
val columnIndex = it.getColumnIndexOrThrow(column)
return it.getString(columnIndex)
}
if (cursor != null && cursor.moveToFirst()) {
val column_index = cursor.getColumnIndexOrThrow(column)
return cursor.getString(column_index)
}
} catch (e: Exception) {
Log.e(TAG, e.message)
} finally {
cursor!!.close()
cursor?.close()
}
return null
}

View file

@ -173,7 +173,7 @@ class PlayingNotificationImpl : PlayingNotification() {
if (isPlaying)
R.drawable.ic_pause_white_24dp
else
R.drawable.ic_play_arrow_white_24dp, primary)!!, 1.5f)
R.drawable.ic_play_arrow_white_32dp, primary)!!, 1.5f)
notificationLayout.setTextColor(R.id.title, primary)
notificationLayout.setTextColor(R.id.text, secondary)

View file

@ -52,7 +52,7 @@ class PlayingNotificationImpl24 : PlayingNotification() {
val playButtonResId = if (isPlaying)
R.drawable.ic_pause_white_24dp
else
R.drawable.ic_play_arrow_white_24dp
R.drawable.ic_play_arrow_white_32dp
val action = Intent(service, MainActivity::class.java)
action.putExtra("expand", true)

View file

@ -163,7 +163,7 @@ class PlayingNotificationOreo : PlayingNotification() {
if (isPlaying)
R.drawable.ic_pause_white_24dp
else
R.drawable.ic_play_arrow_white_24dp, primary)!!, PlayingNotification.NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
R.drawable.ic_play_arrow_white_32dp, primary)!!, PlayingNotification.NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
notificationLayout.setTextColor(R.id.title, primary)
notificationLayout.setTextColor(R.id.subtitle, secondary)