Converted WhatsNewActivity to BottomSheetDialogFragment

This commit is contained in:
Prathamesh More 2022-04-21 17:07:57 +05:30
parent dabdcc1d31
commit c5a25c200c
9 changed files with 73 additions and 63 deletions

View file

@ -19,6 +19,7 @@ import android.content.Context
import android.content.Intent
import android.media.audiofx.AudioEffect
import android.widget.Toast
import androidx.fragment.app.FragmentActivity
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.*
import code.name.monkey.retromusic.activities.bugreport.BugReportActivity
@ -56,10 +57,9 @@ object NavigationUtil {
)
}
fun gotoWhatNews(activity: Activity) {
activity.startActivity(
Intent(activity, WhatsNewActivity::class.java), null
)
fun gotoWhatNews(activity: FragmentActivity) {
val changelogBottomSheet = WhatsNewFragment()
changelogBottomSheet.show(activity.supportFragmentManager, WhatsNewFragment.TAG)
}
fun openEqualizer(activity: Activity) {

View file

@ -389,9 +389,15 @@ object PreferenceUtil {
val filterLength get() = sharedPreferences.getInt(FILTER_SONG, 20)
var lastVersion
get() = sharedPreferences.getInt(LAST_CHANGELOG_VERSION, 0)
// This was stored as an integer before now it's a long, so avoid a ClassCastException
get() = try {
sharedPreferences.getLong(LAST_CHANGELOG_VERSION, 0)
} catch (e: ClassCastException) {
sharedPreferences.edit { remove(LAST_CHANGELOG_VERSION) }
0
}
set(value) = sharedPreferences.edit {
putInt(LAST_CHANGELOG_VERSION, value)
putLong(LAST_CHANGELOG_VERSION, value)
}
var lastSleepTimerValue