animate some views at visibility change

This commit is contained in:
tibbi 2021-02-28 09:43:56 +01:00
parent c3ff917e68
commit f69618166f
5 changed files with 9 additions and 12 deletions

View file

@ -58,7 +58,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.33.41'
implementation 'com.simplemobiletools:commons:5.33.44'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'androidx.media:media:1.2.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View file

@ -319,13 +319,13 @@ class MainActivity : SimpleActivity() {
private fun startSleepTimer() {
checkSleepTimerPosition()
sleep_timer_holder.beVisible()
sleep_timer_holder.fadeIn()
sendIntent(START_SLEEP_TIMER)
}
private fun stopSleepTimer() {
sendIntent(STOP_SLEEP_TIMER)
sleep_timer_holder.beGone()
sleep_timer_holder.fadeOut()
}
private fun checkSleepTimerPosition() {

View file

@ -25,6 +25,7 @@ import com.bumptech.glide.request.target.Target
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.extensions.config
@ -262,7 +263,7 @@ class TrackActivity : SimpleActivity() {
val isShuffleEnabled = config.isShuffleEnabled
activity_track_toggle_shuffle.apply {
applyColorFilter(if (isShuffleEnabled) getAdjustedPrimaryColor() else config.textColor)
alpha = if (isShuffleEnabled) 1f else LOWER_ALPHA
alpha = if (isShuffleEnabled) 1f else MEDIUM_ALPHA
contentDescription = getString(if (isShuffleEnabled) R.string.disable_shuffle else R.string.enable_shuffle)
}
}
@ -278,7 +279,7 @@ class TrackActivity : SimpleActivity() {
val repeatTrack = config.repeatTrack
activity_track_repeat.apply {
applyColorFilter(if (repeatTrack) getAdjustedPrimaryColor() else config.textColor)
alpha = if (repeatTrack) 1f else LOWER_ALPHA
alpha = if (repeatTrack) 1f else MEDIUM_ALPHA
contentDescription = getString(if (repeatTrack) R.string.disable_song_repetition else R.string.enable_song_repetition)
}
}

View file

@ -59,8 +59,6 @@ const val SLEEP_IN_TS = "sleep_in_ts"
const val EQUALIZER_PRESET = "EQUALIZER_PRESET"
const val EQUALIZER_BANDS = "EQUALIZER_BANDS"
const val LOWER_ALPHA = 0.5f
const val SHOW_FILENAME_NEVER = 1
const val SHOW_FILENAME_IF_UNAVAILABLE = 2
const val SHOW_FILENAME_ALWAYS = 3

View file

@ -9,9 +9,7 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.simplemobiletools.commons.extensions.beGone
import com.simplemobiletools.commons.extensions.beVisible
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.extensions.config
import com.simplemobiletools.musicplayer.extensions.sendIntent
@ -30,10 +28,10 @@ class CurrentTrackBar(context: Context, attributeSet: AttributeSet) : RelativeLa
fun updateCurrentTrack(track: Track?) {
if (track == null) {
beGone()
fadeOut()
return
} else {
beVisible()
fadeIn()
}
val artist = if (track.artist.trim().isNotEmpty() && track.artist != MediaStore.UNKNOWN_STRING) {