Code refactor 🧑💻
This commit is contained in:
parent
2817dc1db5
commit
543893adba
26 changed files with 77 additions and 111 deletions
|
@ -34,7 +34,7 @@ android {
|
|||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
Properties properties = getProperties('/Users/h4h13/Documents/Github/retro.properties')
|
||||
Properties properties = getProperties('/Users/apple/Documents/Github/retro.properties ')
|
||||
storeFile file(getProperty(properties, 'storeFile'))
|
||||
keyAlias getProperty(properties, 'keyAlias')
|
||||
storePassword getProperty(properties, 'storePassword')
|
||||
|
@ -130,7 +130,7 @@ dependencies {
|
|||
implementation "com.afollestad.material-dialogs:commons:$material_dialog_version"
|
||||
implementation 'com.afollestad:material-cab:0.1.12'
|
||||
implementation 'com.afollestad:recyclical:1.1.1'
|
||||
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:3.8.0'
|
||||
implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
|
||||
|
|
|
@ -218,7 +218,7 @@ class DriveModeActivity : AbsMusicServiceActivity(), Callback {
|
|||
.build()
|
||||
.transform(BlurTransformation.Builder(this).build())
|
||||
.into(object : RetroMusicColoredTarget(image) {
|
||||
override fun onColorReady(color: MediaNotificationProcessor) {
|
||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.SharedPreferences
|
|||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import code.name.monkey.retromusic.*
|
||||
|
@ -112,7 +111,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
|
|||
if (intent.action != null && (intent.action == MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH)
|
||||
) {
|
||||
val songs: List<Song> =
|
||||
getSongs(this, intent.extras!!)
|
||||
getSongs(intent.extras!!)
|
||||
if (shuffleMode == MusicService.SHUFFLE_MODE_SHUFFLE) {
|
||||
openAndShuffleQueue(songs, true)
|
||||
} else {
|
||||
|
@ -167,7 +166,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
|
|||
try {
|
||||
id = idString.toLong()
|
||||
} catch (e: NumberFormatException) {
|
||||
Log.e(TAG, e.message)
|
||||
//Log.e(TAG, e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
}
|
||||
}
|
||||
})
|
||||
val fastScroller = ThemedFastScroller.create(recyclerView)
|
||||
ThemedFastScroller.create(recyclerView)
|
||||
}
|
||||
|
||||
private fun checkForPadding() {
|
||||
|
|
|
@ -110,7 +110,7 @@ class SupportDevelopmentActivity : AbsBaseActivity(), BillingProcessor.IBillingH
|
|||
}
|
||||
if (requestCode == TEZ_REQUEST_CODE) {
|
||||
// Process based on the data in response.
|
||||
Log.d("result", data!!.getStringExtra("Status"))
|
||||
//Log.d("result", data!!.getStringExtra("Status"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -280,22 +280,22 @@ open class BugReportActivity : AbsThemeActivity() {
|
|||
RESULT_BAD_CREDENTIALS -> MaterialAlertDialogBuilder(context)
|
||||
.setTitle(R.string.bug_report_failed)
|
||||
.setMessage(R.string.bug_report_failed_wrong_credentials)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
RESULT_INVALID_TOKEN -> MaterialAlertDialogBuilder(context)
|
||||
.setTitle(R.string.bug_report_failed)
|
||||
.setMessage(R.string.bug_report_failed_invalid_token)
|
||||
.setPositiveButton(android.R.string.ok, null).show()
|
||||
.setPositiveButton(R.string.ok, null).show()
|
||||
RESULT_ISSUES_NOT_ENABLED -> MaterialAlertDialogBuilder(context)
|
||||
.setTitle(R.string.bug_report_failed)
|
||||
.setMessage(R.string.bug_report_failed_issues_not_available)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
|
||||
else -> MaterialAlertDialogBuilder(context)
|
||||
.setTitle(R.string.bug_report_failed)
|
||||
.setMessage(R.string.bug_report_failed_unknown)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ -> tryToFinishActivity() }
|
||||
.setNegativeButton(android.R.string.cancel) { _, _ -> { tryToFinishActivity() } }
|
||||
.setPositiveButton(R.string.ok) { _, _ -> tryToFinishActivity() }
|
||||
.setNegativeButton(android.R.string.cancel) { _, _ -> tryToFinishActivity() }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
|||
window.enterTransition = slide
|
||||
}
|
||||
|
||||
override fun loadImageFromFile(selectedFileUri: Uri?) {
|
||||
override fun loadImageFromFile(selectedFile: Uri?) {
|
||||
|
||||
Glide.with(this@AlbumTagEditorActivity).load(selectedFileUri).asBitmap()
|
||||
Glide.with(this@AlbumTagEditorActivity).load(selectedFile).asBitmap()
|
||||
.transcode(BitmapPaletteTranscoder(this), BitmapPaletteWrapper::class.java)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true)
|
||||
.into(object : SimpleTarget<BitmapPaletteWrapper>() {
|
||||
|
|
|
@ -169,7 +169,7 @@ class PlayingQueueAdapter(
|
|||
holder: ViewHolder?,
|
||||
position: Int, @SwipeableItemResults result: Int
|
||||
): SwipeResultAction {
|
||||
return if (result === SwipeableItemConstants.RESULT_CANCELED) {
|
||||
return if (result == SwipeableItemConstants.RESULT_CANCELED) {
|
||||
SwipeResultActionDefault()
|
||||
} else {
|
||||
SwipedResultActionRemoveItem(this, position, activity)
|
||||
|
|
|
@ -76,7 +76,7 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate
|
|||
return new MaterialDialog.Builder(requireActivity())
|
||||
.title(R.string.md_error_label)
|
||||
.content(R.string.md_storage_perm_error)
|
||||
.positiveText(android.R.string.ok)
|
||||
.positiveText(R.string.ok)
|
||||
.build();
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
|
|
|
@ -42,24 +42,25 @@ class DeleteSongsDialog : DialogFragment() {
|
|||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val songs = extraNotNull<List<Song>>(EXTRA_SONG).value
|
||||
var title = 0
|
||||
var message: CharSequence = ""
|
||||
if (songs.size > 1) {
|
||||
title = R.string.delete_songs_title
|
||||
message = HtmlCompat.fromHtml(
|
||||
String.format(getString(R.string.delete_x_songs), songs.size),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
val pair = if (songs.size > 1) {
|
||||
Pair(
|
||||
R.string.delete_songs_title, HtmlCompat.fromHtml(
|
||||
String.format(getString(R.string.delete_x_songs), songs.size),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
)
|
||||
} else {
|
||||
title = R.string.delete_song_title
|
||||
message = HtmlCompat.fromHtml(
|
||||
String.format(getString(R.string.delete_song_x), songs[0].title),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
Pair(
|
||||
R.string.delete_song_title,
|
||||
HtmlCompat.fromHtml(
|
||||
String.format(getString(R.string.delete_song_x), songs[0].title),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return materialDialog(title)
|
||||
.setMessage(message)
|
||||
return materialDialog(pair.first)
|
||||
.setMessage(pair.second)
|
||||
.setCancelable(false)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.action_delete) { _, _ ->
|
||||
|
|
|
@ -21,8 +21,6 @@ import android.os.Bundle
|
|||
import android.text.Spanned
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.core.text.HtmlCompat
|
||||
|
@ -41,12 +39,6 @@ import org.jaudiotagger.tag.TagException
|
|||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
||||
inline fun ViewGroup.forEach(action: (View) -> Unit) {
|
||||
for (i in 0 until childCount) {
|
||||
action(getChildAt(i))
|
||||
}
|
||||
}
|
||||
|
||||
class SongDetailDialog : DialogFragment() {
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
|
@ -152,7 +144,7 @@ class SongDetailDialog : DialogFragment() {
|
|||
}
|
||||
}
|
||||
return materialDialog(R.string.action_details)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setView(dialogView)
|
||||
.create()
|
||||
.colorButtons()
|
||||
|
|
|
@ -15,13 +15,8 @@
|
|||
package code.name.monkey.retromusic.extensions
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import com.google.android.material.appbar.MaterialToolbar
|
||||
|
||||
fun AppCompatActivity.applyToolbar(toolbar: MaterialToolbar) {
|
||||
|
@ -30,41 +25,6 @@ fun AppCompatActivity.applyToolbar(toolbar: MaterialToolbar) {
|
|||
setSupportActionBar(toolbar)
|
||||
}
|
||||
|
||||
fun FragmentActivity?.addFragment(
|
||||
@IdRes idRes: Int = R.id.container,
|
||||
fragment: Fragment,
|
||||
tag: String? = null,
|
||||
addToBackStack: Boolean = false
|
||||
) {
|
||||
val compatActivity = this as? AppCompatActivity ?: return
|
||||
compatActivity.supportFragmentManager.beginTransaction()
|
||||
.apply {
|
||||
add(fragment, tag)
|
||||
setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
||||
if (addToBackStack) {
|
||||
addToBackStack(null)
|
||||
}
|
||||
commitNow()
|
||||
}
|
||||
}
|
||||
|
||||
fun AppCompatActivity.replaceFragment(
|
||||
@IdRes id: Int = R.id.container,
|
||||
fragment: Fragment,
|
||||
tag: String? = null,
|
||||
addToBackStack: Boolean = false
|
||||
) {
|
||||
val compatActivity = this
|
||||
compatActivity.supportFragmentManager.beginTransaction()
|
||||
.apply {
|
||||
replace(id, fragment, tag)
|
||||
if (addToBackStack) {
|
||||
addToBackStack(null)
|
||||
}
|
||||
commit()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : Any> Activity.extra(key: String, default: T? = null) = lazy {
|
||||
val value = intent?.extras?.get(key)
|
||||
if (value is T) value else default
|
||||
|
|
|
@ -51,7 +51,7 @@ class LibraryViewModel(
|
|||
artists.value = loadArtists.await()
|
||||
playlists.value = loadPlaylists.await()
|
||||
roomPlaylists.value = loadPlaylistsWithSongs.await()
|
||||
//genres.value = loadGenres.await()
|
||||
genres.value = loadGenres.await()
|
||||
}
|
||||
|
||||
private val loadHome: Deferred<List<Home>>
|
||||
|
|
|
@ -36,7 +36,7 @@ class GenreDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playlist_
|
|||
mainActivity.addMusicServiceEventListener(detailsViewModel)
|
||||
mainActivity.setSupportActionBar(toolbar)
|
||||
mainActivity.hideBottomBarVisibility(false)
|
||||
|
||||
progressIndicator.hide()
|
||||
setupRecyclerView()
|
||||
detailsViewModel.getSongs().observe(viewLifecycleOwner, androidx.lifecycle.Observer {
|
||||
songs(it)
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
*/
|
||||
package code.name.monkey.retromusic.helper
|
||||
|
||||
import android.content.Context
|
||||
import code.name.monkey.retromusic.model.Playlist
|
||||
import java.io.BufferedWriter
|
||||
import java.io.File
|
||||
|
@ -24,14 +23,13 @@ object M3UWriter : M3UConstants {
|
|||
@JvmStatic
|
||||
@Throws(IOException::class)
|
||||
fun write(
|
||||
context: Context,
|
||||
dir: File,
|
||||
playlist: Playlist
|
||||
): File? {
|
||||
if (!dir.exists()) dir.mkdirs()
|
||||
val file = File(dir, playlist.name + "." + M3UConstants.EXTENSION)
|
||||
val songs = playlist.getSongs()
|
||||
if (songs.size > 0) {
|
||||
if (songs.isNotEmpty()) {
|
||||
val bw = BufferedWriter(FileWriter(file))
|
||||
bw.write(M3UConstants.HEADER)
|
||||
for (song in songs) {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
package code.name.monkey.retromusic.helper
|
||||
|
||||
import android.app.SearchManager
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
|
@ -33,7 +32,7 @@ object SearchQueryHelper : KoinComponent {
|
|||
var songs = ArrayList<Song>()
|
||||
|
||||
@JvmStatic
|
||||
fun getSongs(context: Context, extras: Bundle): List<Song> {
|
||||
fun getSongs(extras: Bundle): List<Song> {
|
||||
val query = extras.getString(SearchManager.QUERY, null)
|
||||
val artistName = extras.getString(MediaStore.EXTRA_MEDIA_ARTIST, null)
|
||||
val albumName = extras.getString(MediaStore.EXTRA_MEDIA_ALBUM, null)
|
||||
|
@ -45,9 +44,9 @@ object SearchQueryHelper : KoinComponent {
|
|||
songRepository.makeSongCursor(
|
||||
ARTIST_SELECTION + AND + ALBUM_SELECTION + AND + TITLE_SELECTION,
|
||||
arrayOf(
|
||||
artistName.toLowerCase(),
|
||||
albumName.toLowerCase(),
|
||||
titleName.toLowerCase()
|
||||
artistName.toLowerCase(Locale.getDefault()),
|
||||
albumName.toLowerCase(Locale.getDefault()),
|
||||
titleName.toLowerCase(Locale.getDefault())
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -59,7 +58,10 @@ object SearchQueryHelper : KoinComponent {
|
|||
songs = songRepository.songs(
|
||||
songRepository.makeSongCursor(
|
||||
ARTIST_SELECTION + AND + TITLE_SELECTION,
|
||||
arrayOf(artistName.toLowerCase(), titleName.toLowerCase())
|
||||
arrayOf(
|
||||
artistName.toLowerCase(Locale.getDefault()),
|
||||
titleName.toLowerCase(Locale.getDefault())
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -70,7 +72,10 @@ object SearchQueryHelper : KoinComponent {
|
|||
songs = songRepository.songs(
|
||||
songRepository.makeSongCursor(
|
||||
ALBUM_SELECTION + AND + TITLE_SELECTION,
|
||||
arrayOf(albumName.toLowerCase(), titleName.toLowerCase())
|
||||
arrayOf(
|
||||
albumName.toLowerCase(Locale.getDefault()),
|
||||
titleName.toLowerCase(Locale.getDefault())
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -81,7 +86,7 @@ object SearchQueryHelper : KoinComponent {
|
|||
songs = songRepository.songs(
|
||||
songRepository.makeSongCursor(
|
||||
ARTIST_SELECTION,
|
||||
arrayOf(artistName.toLowerCase())
|
||||
arrayOf(artistName.toLowerCase(Locale.getDefault()))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -92,7 +97,7 @@ object SearchQueryHelper : KoinComponent {
|
|||
songs = songRepository.songs(
|
||||
songRepository.makeSongCursor(
|
||||
ALBUM_SELECTION,
|
||||
arrayOf(albumName.toLowerCase())
|
||||
arrayOf(albumName.toLowerCase(Locale.getDefault()))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -103,7 +108,7 @@ object SearchQueryHelper : KoinComponent {
|
|||
songs = songRepository.songs(
|
||||
songRepository.makeSongCursor(
|
||||
TITLE_SELECTION,
|
||||
arrayOf(titleName.toLowerCase())
|
||||
arrayOf(titleName.toLowerCase(Locale.getDefault()))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -113,7 +118,7 @@ object SearchQueryHelper : KoinComponent {
|
|||
songs = songRepository.songs(
|
||||
songRepository.makeSongCursor(
|
||||
ARTIST_SELECTION,
|
||||
arrayOf(query.toLowerCase())
|
||||
arrayOf(query.toLowerCase(Locale.getDefault()))
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -123,7 +128,7 @@ object SearchQueryHelper : KoinComponent {
|
|||
songs = songRepository.songs(
|
||||
songRepository.makeSongCursor(
|
||||
ALBUM_SELECTION,
|
||||
arrayOf(query.toLowerCase())
|
||||
arrayOf(query.toLowerCase(Locale.getDefault()))
|
||||
)
|
||||
)
|
||||
if (songs.isNotEmpty()) {
|
||||
|
@ -132,7 +137,7 @@ object SearchQueryHelper : KoinComponent {
|
|||
songs = songRepository.songs(
|
||||
songRepository.makeSongCursor(
|
||||
TITLE_SELECTION,
|
||||
arrayOf(query.toLowerCase())
|
||||
arrayOf(query.toLowerCase(Locale.getDefault()))
|
||||
)
|
||||
)
|
||||
return if (songs.isNotEmpty()) {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
package code.name.monkey.retromusic.helper.menu
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
|
@ -90,7 +89,6 @@ object PlaylistMenuHelper : KoinComponent {
|
|||
}
|
||||
|
||||
private fun getPlaylistSongs(
|
||||
activity: Activity,
|
||||
playlist: Playlist
|
||||
): List<Song> {
|
||||
return if (playlist is AbsCustomPlaylist) {
|
||||
|
|
|
@ -72,9 +72,7 @@ class LibraryPreferenceDialog : DialogFragment() {
|
|||
categoryAdapter.categoryInfos = PreferenceUtil.defaultCategories
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(
|
||||
android.R.string.ok
|
||||
) { _, _ -> updateCategories(categoryAdapter.categoryInfos) }
|
||||
.setPositiveButton(R.string.ok) { _, _ -> updateCategories(categoryAdapter.categoryInfos) }
|
||||
.setView(view)
|
||||
.create()
|
||||
.colorButtons()
|
||||
|
|
|
@ -22,8 +22,8 @@ import android.graphics.BitmapFactory
|
|||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.media.app.NotificationCompat.MediaStyle
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.MainActivity
|
||||
|
@ -132,9 +132,19 @@ class PlayingNotificationImpl : PlayingNotification() {
|
|||
.setLargeIcon(bitmapFinal)
|
||||
.setContentIntent(clickIntent)
|
||||
.setDeleteIntent(deleteIntent)
|
||||
.setContentTitle(Html.fromHtml("<b>" + song.title + "</b>"))
|
||||
.setContentTitle(
|
||||
HtmlCompat.fromHtml(
|
||||
"<b>" + song.title + "</b>",
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
)
|
||||
.setContentText(song.artistName)
|
||||
.setSubText(Html.fromHtml("<b>" + song.albumName + "</b>"))
|
||||
.setSubText(
|
||||
HtmlCompat.fromHtml(
|
||||
"<b>" + song.albumName + "</b>",
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
)
|
||||
.setOngoing(isPlaying)
|
||||
.setShowWhen(false)
|
||||
.addAction(toggleFavorite)
|
||||
|
|
|
@ -310,7 +310,7 @@ object MusicUtil : KoinComponent {
|
|||
context: Context,
|
||||
playlist: Playlist
|
||||
): Boolean {
|
||||
return playlist.name != null && playlist.name == context.getString(R.string.favorites)
|
||||
return playlist.name == context.getString(R.string.favorites)
|
||||
}
|
||||
|
||||
fun toggleFavorite(context: Context, song: Song) {
|
||||
|
@ -349,7 +349,7 @@ object MusicUtil : KoinComponent {
|
|||
BaseColumns._ID, MediaStore.MediaColumns.DATA
|
||||
)
|
||||
// Split the query into multiple batches, and merge the resulting cursors
|
||||
var batchStart = 0
|
||||
var batchStart: Int
|
||||
var batchEnd = 0
|
||||
val batchSize =
|
||||
1000000 / 10 // 10^6 being the SQLite limite on the query lenth in bytes, 10 being the max number of digits in an int, used to store the track ID
|
||||
|
|
|
@ -247,7 +247,7 @@ public class PlaylistsUtil {
|
|||
}
|
||||
|
||||
public static File savePlaylist(Context context, Playlist playlist) throws IOException {
|
||||
return M3UWriter.write(context, new File(Environment.getExternalStorageDirectory(), "Playlists"), playlist);
|
||||
return M3UWriter.write(new File(Environment.getExternalStorageDirectory(), "Playlists"), playlist);
|
||||
}
|
||||
|
||||
public static boolean doesPlaylistExist(@NonNull final Context context, final int playlistId) {
|
||||
|
|
|
@ -93,7 +93,7 @@ object PreferenceUtil {
|
|||
}
|
||||
}
|
||||
|
||||
val languageCode get() = sharedPreferences.getString(LANGUAGE_NAME, "auto")
|
||||
val languageCode: String get() = sharedPreferences.getString(LANGUAGE_NAME, "auto") ?: "auto"
|
||||
|
||||
var userName
|
||||
get() = sharedPreferences.getString(
|
||||
|
|
|
@ -77,7 +77,7 @@ class RingtoneManager(val context: Context) {
|
|||
return MaterialAlertDialogBuilder(context)
|
||||
.setTitle(R.string.dialog_title_set_ringtone)
|
||||
.setMessage(R.string.dialog_message_set_ringtone)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
.setPositiveButton(R.string.ok) { _, _ ->
|
||||
val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
|
||||
intent.data = Uri.parse("package:" + context.applicationContext.packageName)
|
||||
context.startActivity(intent)
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:maxLines="3"
|
||||
android:textAppearance="@style/TextViewHeadline4.Compress"
|
||||
android:textAppearance="@style/TextViewHeadline4"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constrainedWidth="true"
|
||||
|
|
|
@ -883,4 +883,5 @@
|
|||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="done">Done</string>
|
||||
<string name="ok">Ok</string>
|
||||
</resources>
|
||||
|
|
|
@ -109,6 +109,10 @@
|
|||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextViewHeadline4.Compress" parent="TextAppearance.MaterialComponents.Headline4">
|
||||
<item name="android:textSize">32sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextViewHeadline4" parent="TextAppearance.MaterialComponents.Headline4" />
|
||||
|
||||
<style name="TextViewHeadline5" parent="TextAppearance.MaterialComponents.Headline5" />
|
||||
|
|
Loading…
Reference in a new issue