From c35d86bfd65bb488b30435e086cd71361cfa95fb Mon Sep 17 00:00:00 2001 From: h4h13 Date: Sat, 1 Feb 2020 23:23:26 +0530 Subject: [PATCH] Text corrections --- app/build.gradle | 6 +- .../activities/AlbumDetailsActivity.kt | 28 +++--- .../dialogs/DeletePlaylistDialog.kt | 26 +++-- .../dialogs/RemoveFromPlaylistDialog.kt | 32 +++--- .../dialogs/RenamePlaylistDialog.kt | 24 ++--- .../retromusic/dialogs/SleepTimerDialog.kt | 99 +++++++++++-------- .../retromusic/dialogs/SongDetailDialog.kt | 67 +++++++++---- .../retromusic/dialogs/SongShareDialog.kt | 50 ++++++---- .../monkey/retromusic/util/PlaylistsUtil.java | 8 +- .../views/WidthFitSquareCardView.kt | 28 +++--- .../views/WidthFitSquareLayout.java | 48 --------- .../retromusic/views/WidthFitSquareLayout.kt | 37 +++++++ app/src/main/res/values-ar/strings.xml | 8 +- app/src/main/res/values-bg/strings.xml | 7 +- app/src/main/res/values-cs/strings.xml | 4 +- app/src/main/res/values-es-rES/strings.xml | 5 +- app/src/main/res/values-hu/strings.xml | 2 +- app/src/main/res/values-id/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 4 +- app/src/main/res/values-ja/strings.xml | 1 - app/src/main/res/values-ko/strings.xml | 1 - app/src/main/res/values-pl/strings.xml | 1 - app/src/main/res/values-tr/strings.xml | 1 - app/src/main/res/values-vi/strings.xml | 1 - app/src/main/res/values-zh-rCN/strings.xml | 7 +- app/src/main/res/values-zh-rHK/strings.xml | 3 - app/src/main/res/values-zh-rTW/strings.xml | 5 +- appthemehelper/build.gradle | 4 +- 28 files changed, 260 insertions(+), 248 deletions(-) delete mode 100755 app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareLayout.java create mode 100755 app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareLayout.kt diff --git a/app/build.gradle b/app/build.gradle index 2aed7142..4df1753a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -129,10 +129,10 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.core:core-ktx:1.1.0' - implementation 'androidx.fragment:fragment:1.2.0-rc04' - implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01' + implementation 'androidx.fragment:fragment:1.2.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' - implementation 'com.google.android.material:material:1.2.0-alpha03' + implementation 'com.google.android.material:material:1.2.0-alpha04' implementation 'com.google.android.play:core:1.6.4' def retrofit_version = "2.6.2" diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt index 83204b6c..a1318a86 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt @@ -230,20 +230,22 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C } override fun aboutAlbum(lastFmAlbum: LastFmAlbum) { - if (lastFmAlbum.album.wiki != null) { - aboutAlbumText.show() - aboutAlbumTitle.show() - aboutAlbumTitle.text = String.format("About %s", lastFmAlbum.album.name) - aboutAlbumText.text = lastFmAlbum.album.wiki.content - } - if (lastFmAlbum.album.listeners.isNotEmpty()) { - listeners.show() - listenersLabel.show() - scrobbles.show() - scrobblesLabel.show() + if (lastFmAlbum.album != null) { + if (lastFmAlbum.album.wiki != null) { + aboutAlbumText.show() + aboutAlbumTitle.show() + aboutAlbumTitle.text = String.format("About %s", lastFmAlbum.album.name) + aboutAlbumText.text = lastFmAlbum.album.wiki.content + } + if (lastFmAlbum.album.listeners.isNotEmpty()) { + listeners.show() + listenersLabel.show() + scrobbles.show() + scrobblesLabel.show() - listeners.text = RetroUtil.formatValue(lastFmAlbum.album.listeners.toFloat()) - scrobbles.text = RetroUtil.formatValue(lastFmAlbum.album.playcount.toFloat()) + listeners.text = RetroUtil.formatValue(lastFmAlbum.album.listeners.toFloat()) + scrobbles.text = RetroUtil.formatValue(lastFmAlbum.album.playcount.toFloat()) + } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/DeletePlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/DeletePlaylistDialog.kt index 312b2781..6e022020 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/DeletePlaylistDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/DeletePlaylistDialog.kt @@ -26,8 +26,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil import com.afollestad.materialdialogs.LayoutMode import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.bottomsheets.BottomSheet -import java.util.* - +import java.util.ArrayList class DeletePlaylistDialog : DialogFragment() { @@ -45,18 +44,18 @@ class DeletePlaylistDialog : DialogFragment() { } return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)) - .show { - cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) - title(title) - message(text = content) - negativeButton(android.R.string.cancel) - positiveButton(R.string.action_delete) { - if (activity == null) - return@positiveButton - PlaylistsUtil.deletePlaylists(activity!!, playlists) - } - negativeButton(android.R.string.cancel) + .show { + cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) + title(title) + message(text = content) + negativeButton(android.R.string.cancel) + positiveButton(R.string.action_delete) { + if (activity == null) + return@positiveButton + PlaylistsUtil.deletePlaylists(activity!!, playlists) } + negativeButton(android.R.string.cancel) + } } companion object { @@ -75,5 +74,4 @@ class DeletePlaylistDialog : DialogFragment() { return dialog } } - } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/RemoveFromPlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/RemoveFromPlaylistDialog.kt index e2eaf495..37491ec6 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/RemoveFromPlaylistDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/RemoveFromPlaylistDialog.kt @@ -19,6 +19,7 @@ import android.os.Bundle import android.text.Html import androidx.fragment.app.DialogFragment import code.name.monkey.retromusic.R +import code.name.monkey.retromusic.R.string import code.name.monkey.retromusic.model.PlaylistSong import code.name.monkey.retromusic.util.PlaylistsUtil import code.name.monkey.retromusic.util.PreferenceUtil @@ -26,7 +27,6 @@ import com.afollestad.materialdialogs.LayoutMode import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.bottomsheets.BottomSheet - class RemoveFromPlaylistDialog : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { @@ -37,27 +37,31 @@ class RemoveFromPlaylistDialog : DialogFragment() { if (songs != null) { if (songs.size > 1) { title = R.string.remove_songs_from_playlist_title - content = Html.fromHtml(getString(code.name.monkey.retromusic.R.string.remove_x_songs_from_playlist, songs.size)) + content = Html.fromHtml(getString(string.remove_x_songs_from_playlist, songs.size)) } else { title = R.string.remove_song_from_playlist_title - content = Html.fromHtml(getString(code.name.monkey.retromusic.R.string.remove_song_x_from_playlist, songs[0].title)) + content = Html.fromHtml( + getString( + code.name.monkey.retromusic.R.string.remove_song_x_from_playlist, + songs[0].title + ) + ) } } return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)) - .show { - title(title) - message(text = content) - negativeButton(android.R.string.cancel) - positiveButton(R.string.remove_action) { - if (activity == null) - return@positiveButton - PlaylistsUtil.removeFromPlaylist(activity!!, songs as MutableList) - } - cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) + .show { + title(title) + message(text = content) + negativeButton(android.R.string.cancel) + positiveButton(R.string.remove_action) { + if (activity == null) + return@positiveButton + PlaylistsUtil.removeFromPlaylist(activity!!, songs as MutableList) } - + cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) + } } companion object { diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt index cd39a301..c0df8987 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt @@ -34,25 +34,24 @@ import com.afollestad.materialdialogs.customview.getCustomView import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textfield.TextInputLayout - class RenamePlaylistDialog : DialogFragment() { private lateinit var playlistView: TextInputEditText private lateinit var actionNewPlaylistContainer: TextInputLayout override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)) - .show { - cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) - title(string.rename_playlist_title) - customView(layout.dialog_playlist) - negativeButton(android.R.string.cancel) - positiveButton(string.action_rename) { - if (playlistView.toString().trim { it <= ' ' } != "") { - val playlistId = arguments!!.getLong(PLAYLIST_ID) - PlaylistsUtil.renamePlaylist(context, playlistId, playlistView.text!!.toString()) - } + .show { + cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) + title(string.rename_playlist_title) + customView(layout.dialog_playlist) + negativeButton(android.R.string.cancel) + positiveButton(string.action_rename) { + if (playlistView.toString().trim { it <= ' ' } != "") { + val playlistId = arguments!!.getLong(PLAYLIST_ID) + PlaylistsUtil.renamePlaylist(context, playlistId, playlistView.text!!.toString()) } } + } val dialogView = materialDialog.getCustomView() playlistView = dialogView.findViewById(R.id.actionNewPlaylist) @@ -61,7 +60,8 @@ class RenamePlaylistDialog : DialogFragment() { MaterialUtil.setTint(actionNewPlaylistContainer, false) val playlistId = arguments!!.getLong(PLAYLIST_ID) - playlistView.appHandleColor().setText(PlaylistsUtil.getNameForPlaylist(context!!, playlistId), TextView.BufferType.EDITABLE) + playlistView.appHandleColor() + .setText(PlaylistsUtil.getNameForPlaylist(context!!, playlistId), TextView.BufferType.EDITABLE) return materialDialog } diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt index 34781f5c..11ff4a36 100755 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt @@ -46,7 +46,6 @@ import com.afollestad.materialdialogs.callbacks.onShow import com.afollestad.materialdialogs.customview.customView import com.afollestad.materialdialogs.customview.getCustomView - class SleepTimerDialog : DialogFragment() { private var seekArcProgress: Int = 0 @@ -60,48 +59,61 @@ class SleepTimerDialog : DialogFragment() { timerUpdater = TimerUpdater() materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)) - .title(R.string.action_sleep_timer) - .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) - .positiveButton(R.string.action_set) { - PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic = shouldFinishLastSong.isChecked + .title(R.string.action_sleep_timer) + .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) + .positiveButton(R.string.action_set) { + PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic = shouldFinishLastSong.isChecked - val minutes = seekArcProgress + val minutes = seekArcProgress - val pi = makeTimerPendingIntent(PendingIntent.FLAG_CANCEL_CURRENT) + val pi = makeTimerPendingIntent(PendingIntent.FLAG_CANCEL_CURRENT) - val nextSleepTimerElapsedTime = SystemClock.elapsedRealtime() + minutes * 60 * 1000 - PreferenceUtil.getInstance(requireContext()).setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime) + val nextSleepTimerElapsedTime = SystemClock.elapsedRealtime() + minutes * 60 * 1000 + PreferenceUtil.getInstance(requireContext()) + .setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime) + val am = activity!!.getSystemService(Context.ALARM_SERVICE) as AlarmManager + am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextSleepTimerElapsedTime, pi) + + Toast.makeText( + activity, + activity!!.resources.getString(R.string.sleep_timer_set, minutes), + Toast.LENGTH_SHORT + ).show() + } + .negativeButton(android.R.string.cancel) { + if (activity == null) { + return@negativeButton + } + val previous = makeTimerPendingIntent(PendingIntent.FLAG_NO_CREATE) + if (previous != null) { val am = activity!!.getSystemService(Context.ALARM_SERVICE) as AlarmManager - am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextSleepTimerElapsedTime, pi) + am.cancel(previous) + previous.cancel() + Toast.makeText( + activity, + activity!!.resources.getString(R.string.sleep_timer_canceled), + Toast.LENGTH_SHORT + ).show() + } - Toast.makeText(activity, activity!!.resources.getString(R.string.sleep_timer_set, minutes), Toast.LENGTH_SHORT).show() + val musicService = MusicPlayerRemote.musicService + if (musicService != null && musicService.pendingQuit) { + musicService.pendingQuit = false + Toast.makeText( + activity, + activity!!.resources.getString(R.string.sleep_timer_canceled), + Toast.LENGTH_SHORT + ).show() } - .negativeButton(android.R.string.cancel) { - if (activity == null) { - return@negativeButton - } - val previous = makeTimerPendingIntent(PendingIntent.FLAG_NO_CREATE) - if (previous != null) { - val am = activity!!.getSystemService(Context.ALARM_SERVICE) as AlarmManager - am.cancel(previous) - previous.cancel() - Toast.makeText(activity, activity!!.resources.getString(R.string.sleep_timer_canceled), Toast.LENGTH_SHORT).show() - } - - val musicService = MusicPlayerRemote.musicService - if (musicService != null && musicService.pendingQuit) { - musicService.pendingQuit = false - Toast.makeText(activity, activity!!.resources.getString(R.string.sleep_timer_canceled), Toast.LENGTH_SHORT).show() - } - } - .customView(R.layout.dialog_sleep_timer, scrollable = false) - .show { - onShow { - if (makeTimerPendingIntent(PendingIntent.FLAG_NO_CREATE) != null) { - timerUpdater.start() - } + } + .customView(R.layout.dialog_sleep_timer, scrollable = false) + .show { + onShow { + if (makeTimerPendingIntent(PendingIntent.FLAG_NO_CREATE) != null) { + timerUpdater.start() } } + } if (activity == null || materialDialog.getCustomView() == null) { return materialDialog @@ -133,7 +145,6 @@ class SleepTimerDialog : DialogFragment() { } override fun onStartTrackingTouch(seekBar: SeekBar) { - } override fun onStopTrackingTouch(seekBar: SeekBar) { @@ -148,7 +159,6 @@ class SleepTimerDialog : DialogFragment() { timerDisplay.text = "$seekArcProgress min" } - private fun makeTimerPendingIntent(flag: Int): PendingIntent? { return PendingIntent.getService(activity, 0, makeTimerIntent(), flag) } @@ -160,22 +170,27 @@ class SleepTimerDialog : DialogFragment() { } else intent.setAction(ACTION_QUIT) } - private fun updateCancelButton() { val musicService = MusicPlayerRemote.musicService if (musicService != null && musicService.pendingQuit) { - materialDialog.getActionButton(WhichButton.NEGATIVE).text = materialDialog.context.getString(R.string.cancel_current_timer) + materialDialog.getActionButton(WhichButton.NEGATIVE).text = + materialDialog.context.getString(R.string.cancel_current_timer) } else { materialDialog.getActionButton(WhichButton.NEGATIVE).text = null } } - private inner class TimerUpdater internal constructor() : CountDownTimer(PreferenceUtil.getInstance(requireContext()).nextSleepTimerElapsedRealTime - SystemClock.elapsedRealtime(), 1000) { + private inner class TimerUpdater internal constructor() : CountDownTimer( + PreferenceUtil.getInstance(requireContext()).nextSleepTimerElapsedRealTime - SystemClock.elapsedRealtime(), + 1000 + ) { override fun onTick(millisUntilFinished: Long) { materialDialog.getActionButton(WhichButton.NEGATIVE).text = - String.format("%s %s", materialDialog.context.getString(R.string.cancel_current_timer), - " (" + MusicUtil.getReadableDurationString(millisUntilFinished) + ")") + String.format( + "%s %s", materialDialog.context.getString(R.string.cancel_current_timer), + " (" + MusicUtil.getReadableDurationString(millisUntilFinished) + ")" + ) } override fun onFinish() { diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongDetailDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongDetailDialog.kt index 975a0104..d8620ada 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongDetailDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongDetailDialog.kt @@ -43,7 +43,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)) @@ -57,13 +56,15 @@ class SongDetailDialog : DialogFragment() { val song = arguments!!.getParcelable("song") val materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)) - .show { - customView(R.layout.dialog_file_details, - scrollable = true) - positiveButton(android.R.string.ok) - title(string.action_details) - cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) - } + .show { + customView( + R.layout.dialog_file_details, + scrollable = true + ) + positiveButton(android.R.string.ok) + title(string.action_details) + cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) + } val dialogView = materialDialog.getCustomView() val fileName: TextView = dialogView.findViewById(R.id.fileName) @@ -86,37 +87,66 @@ class SongDetailDialog : DialogFragment() { if (songFile.exists()) { fileName.text = makeTextWithTitle(context, string.label_file_name, songFile.name) filePath.text = makeTextWithTitle(context, string.label_file_path, songFile.absolutePath) - fileSize.text = makeTextWithTitle(context, string.label_file_size, getFileSizeString(songFile.length())) + fileSize.text = + makeTextWithTitle(context, string.label_file_size, getFileSizeString(songFile.length())) try { val audioFile = AudioFileIO.read(songFile) val audioHeader = audioFile.audioHeader fileFormat.text = makeTextWithTitle(context, string.label_file_format, audioHeader.format) - trackLength.text = makeTextWithTitle(context, string.label_track_length, MusicUtil.getReadableDurationString((audioHeader.trackLength * 1000).toLong())) + trackLength.text = makeTextWithTitle( + context, + string.label_track_length, + MusicUtil.getReadableDurationString((audioHeader.trackLength * 1000).toLong()) + ) bitRate.text = makeTextWithTitle(context, string.label_bit_rate, audioHeader.bitRate + " kb/s") - samplingRate.text = makeTextWithTitle(context, string.label_sampling_rate, audioHeader.sampleRate + " Hz") + samplingRate.text = + makeTextWithTitle(context, string.label_sampling_rate, audioHeader.sampleRate + " Hz") } catch (@NonNull e: CannotReadException) { Log.e(TAG, "error while reading the song file", e) // fallback - trackLength.text = makeTextWithTitle(context, string.label_track_length, MusicUtil.getReadableDurationString(song.duration)) + trackLength.text = makeTextWithTitle( + context, + string.label_track_length, + MusicUtil.getReadableDurationString(song.duration) + ) } catch (@NonNull e: IOException) { Log.e(TAG, "error while reading the song file", e) - trackLength.text = makeTextWithTitle(context, string.label_track_length, MusicUtil.getReadableDurationString(song.duration)) + trackLength.text = makeTextWithTitle( + context, + string.label_track_length, + MusicUtil.getReadableDurationString(song.duration) + ) } catch (@NonNull e: TagException) { Log.e(TAG, "error while reading the song file", e) - trackLength.text = makeTextWithTitle(context, string.label_track_length, MusicUtil.getReadableDurationString(song.duration)) + trackLength.text = makeTextWithTitle( + context, + string.label_track_length, + MusicUtil.getReadableDurationString(song.duration) + ) } catch (@NonNull e: ReadOnlyFileException) { Log.e(TAG, "error while reading the song file", e) - trackLength.text = makeTextWithTitle(context, string.label_track_length, MusicUtil.getReadableDurationString(song.duration)) + trackLength.text = makeTextWithTitle( + context, + string.label_track_length, + MusicUtil.getReadableDurationString(song.duration) + ) } catch (@NonNull e: InvalidAudioFrameException) { Log.e(TAG, "error while reading the song file", e) - trackLength.text = makeTextWithTitle(context, string.label_track_length, MusicUtil.getReadableDurationString(song.duration)) + trackLength.text = makeTextWithTitle( + context, + string.label_track_length, + MusicUtil.getReadableDurationString(song.duration) + ) } - } else { // fallback fileName.text = makeTextWithTitle(context, string.label_file_name, song.title) - trackLength.text = makeTextWithTitle(context, string.label_track_length, MusicUtil.getReadableDurationString(song.duration)) + trackLength.text = makeTextWithTitle( + context, + string.label_track_length, + MusicUtil.getReadableDurationString(song.duration) + ) } } @@ -127,7 +157,6 @@ class SongDetailDialog : DialogFragment() { val TAG: String = SongDetailDialog::class.java.simpleName - fun create(song: Song): SongDetailDialog { val dialog = SongDetailDialog() val args = Bundle() diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt index b7ab8555..85a7fbff 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt @@ -27,35 +27,45 @@ import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.bottomsheets.BottomSheet import com.afollestad.materialdialogs.list.listItems - class SongShareDialog : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val song: Song? = arguments!!.getParcelable("song") - val currentlyListening: String = getString(R.string.currently_listening_to_x_by_x, song?.title, song?.artistName) + val currentlyListening: String = + getString(R.string.currently_listening_to_x_by_x, song?.title, song?.artistName) return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)) - .title(R.string.what_do_you_want_to_share) - .show { - cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) - listItems(items = listOf(getString(code.name.monkey.retromusic.R.string.the_audio_file), "\u201C" + currentlyListening + "\u201D")) { dialog, index, text -> - when (index) { - 0 -> { - startActivity(Intent.createChooser(song?.let { MusicUtil.createShareSongFileIntent(it, context) }, null)) - } - 1 -> { - activity!!.startActivity( - Intent.createChooser( - Intent() - .setAction(Intent.ACTION_SEND) - .putExtra(Intent.EXTRA_TEXT, currentlyListening) - .setType("text/plain"), - null - ) + .title(R.string.what_do_you_want_to_share) + .show { + cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) + listItems( + items = listOf( + getString(code.name.monkey.retromusic.R.string.the_audio_file), + "\u201C" + currentlyListening + "\u201D" + ) + ) { _, index, _ -> + when (index) { + 0 -> { + startActivity(Intent.createChooser(song?.let { + MusicUtil.createShareSongFileIntent( + it, + context ) - } + }, null)) + } + 1 -> { + activity!!.startActivity( + Intent.createChooser( + Intent() + .setAction(Intent.ACTION_SEND) + .putExtra(Intent.EXTRA_TEXT, currentlyListening) + .setType("text/plain"), + null + ) + ) } } } + } } companion object { diff --git a/app/src/main/java/code/name/monkey/retromusic/util/PlaylistsUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/PlaylistsUtil.java index 07c5dce6..422f9a21 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/PlaylistsUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/PlaylistsUtil.java @@ -129,7 +129,7 @@ public class PlaylistsUtil { } } - public static boolean doPlaylistContains(@NonNull final Context context, final long playlistId, + static boolean doPlaylistContains(@NonNull final Context context, final long playlistId, final int songId) { if (playlistId != -1) { try { @@ -156,12 +156,6 @@ public class PlaylistsUtil { new String[]{String.valueOf(playlistId)}); } - public static boolean doesPlaylistExist(@NonNull final Context context, final String name) { - return doesPlaylistExist(context, - MediaStore.Audio.PlaylistsColumns.NAME + "=?", - new String[]{name}); - } - public static String getNameForPlaylist(@NonNull final Context context, final long id) { try { Cursor cursor = context.getContentResolver().query(EXTERNAL_CONTENT_URI, diff --git a/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareCardView.kt b/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareCardView.kt index ba87f865..ea42d7ad 100644 --- a/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareCardView.kt +++ b/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareCardView.kt @@ -23,24 +23,20 @@ import com.google.android.material.card.MaterialCardView * Created by hemanths on 3/18/19 */ class WidthFitSquareCardView : MaterialCardView { - constructor(context: Context) : super(context) {} - constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {} + constructor(context: Context) : super(context) - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {} + constructor( + context: Context, + attrs: AttributeSet + ) : super(context, attrs) - fun forceSquare(z: Boolean) { - this.forceSquare = z - requestLayout() + constructor( + context: Context, attrs: + AttributeSet, defStyleAttr: Int + ) : super(context, attrs, defStyleAttr) + + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + super.onMeasure(widthMeasureSpec, widthMeasureSpec) } - - override fun onMeasure(i: Int, i2: Int) { - var width = i2 - if (this.forceSquare) { - width = i - } - super.onMeasure(i, width) - } - - private var forceSquare = true } diff --git a/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareLayout.java b/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareLayout.java deleted file mode 100755 index ef9aeaba..00000000 --- a/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareLayout.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2019 Hemanth Savarala. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by - * the Free Software Foundation either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - */ - -package code.name.monkey.retromusic.views; - -import android.content.Context; -import android.util.AttributeSet; -import android.widget.FrameLayout; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -public class WidthFitSquareLayout extends FrameLayout { - - public WidthFitSquareLayout(@NonNull final Context context) { - super(context); - } - - public WidthFitSquareLayout(@NonNull final Context context, @Nullable final AttributeSet attrs) { - super(context, attrs); - } - - public WidthFitSquareLayout(@NonNull final Context context, @Nullable final AttributeSet attrs, - final int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public WidthFitSquareLayout(@NonNull final Context context, @Nullable final AttributeSet attrs, - final int defStyleAttr, - final int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override - protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, widthMeasureSpec); - } -} diff --git a/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareLayout.kt b/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareLayout.kt new file mode 100755 index 00000000..b6bd9f70 --- /dev/null +++ b/app/src/main/java/code/name/monkey/retromusic/views/WidthFitSquareLayout.kt @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ +package code.name.monkey.retromusic.views + +import android.content.Context +import android.util.AttributeSet +import android.widget.FrameLayout + +class WidthFitSquareLayout : FrameLayout { + constructor(context: Context) : super(context) + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + constructor( + context: Context, attrs: AttributeSet?, + defStyleAttr: Int + ) : super(context, attrs, defStyleAttr) + + constructor( + context: Context, attrs: AttributeSet?, + defStyleAttr: Int, + defStyleRes: Int + ) : super(context, attrs, defStyleAttr, defStyleRes) + + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + super.onMeasure(widthMeasureSpec, widthMeasureSpec) + } +} \ No newline at end of file diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index ef0ec195..12e81cc1 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -55,8 +55,7 @@ الألبومات دائما - مرحبا القي نظرة على مشغل الموسيقى الرائع هذا في: -https://play.google.com/store/apps/details?id=%s + مرحبا القي نظرة على مشغل الموسيقى الرائع هذا في: https://play.google.com/store/apps/details?id=%s عشوائي المسارات الاكثر شعبية @@ -92,13 +91,10 @@ https://play.google.com/store/apps/details?id=%s إزالة إزالة القائمة السوداء إزالة قائمة التشغيل - %1$s\u061f \u0644\u0627 \u064a\u0645\u0643\u0646 \u0627\u0644\u0642\u064a\u0627\u0645 \u0628\u0630\u0644\u0643!]]> اغلاق لون لون الوان - \u0644\u0627\u064a\u0645\u0643\u0646 \u0625\u0646\u0634\u0627\u0621 \u0642\u0627\u0626\u0645\u0629 \u062a\u0634\u063a\u064a\u0644 - "\u0644\u0627\u064a\u0645\u0643\u0646 \u062a\u0646\u0632\u064a\u0644 \u063a\u0644\u0627\u0641 \u0627\u0644\u0628\u0648\u0645 \u0645\u062a\u0637\u0627\u0628\u0642." لايمكن إسترجاع المشتريات لايمكن فحص الملفات %d إنشاء @@ -222,7 +218,6 @@ https://play.google.com/store/apps/details?id=%s تتغير ألوان أزرار الخلفية والتحكم وفقًا لصورة الألبوم من شاشة التشغيل الآن تلوين اختصارات التطبيق باللون الثانوي . في كل مرة تقوم فيها بتغيير اللون ، يرجى تفعيل هذا الخيار ليتم تطبيق التغييرات تلوين شريط التنقل باللون الاساسي - "\u062a\u0644\u0648\u064a\u0646 \u0627\u0644\u0625\u0634\u0639\u0627\u0631\u0627\u062a \u0628\u0644\u0648\u0646 \u063a\u0644\u0627\u0641 \u0627\u0644\u0623\u0644\u0628\u0648\u0645 \u0627\u0644\u0648\u0627\u0646 \u0646\u0627\u0628\u0636\u0629" سيتم اختيار اللون الأكثر انتشارًا من الألبوم أو غلاف الفنان "يمكن أن يسبب مشاكل في التشغيل على بعض الأجهزة." يمكنك أن تزيد من جودة غلاف الألبوم ، لكنه يسبب بطئ في التحميل للصور. قم بتمكين هذا فقط إذا كنت تواجه مشاكل مع صور ألبومات منخفضة الدقة @@ -355,7 +350,6 @@ https://play.google.com/store/apps/details?id=%s ساعدها لترجمة التطبيق الى لغتك تويتر شارك تصميمك مع ريترو ميوزك - \u0644\u0627\u064a\u0645\u0643\u0646 \u062a\u0634\u063a\u064a\u0644 \u0647\u0630\u0627 \u0627\u0644\u0645\u0644\u0641. التالي تحديث الصورة تحديث... diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 568b6f5b..376b8f62 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -174,7 +174,6 @@ Изчисти опашката Изчисти плейлист - %1$s? \u0422\u043e\u0432\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435 \u0434\u0430 \u0431\u044a\u0434\u0435 \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u043e!]]> Затвори @@ -186,8 +185,6 @@ Копирана информация за устройството в клипборда. - \u041d\u0435\u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u044a\u0437\u0434\u0430\u0432\u0430\u043d\u0435 \u043d\u0430 \u043f\u043b\u0435\u0439\u043b\u0438\u0441\u0442. - "\u041d\u0435\u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u0437\u0442\u0435\u0433\u043b\u044f\u043d\u0435 \u043d\u0430 \u043a\u043e\u0440\u0438\u0446\u0430 \u043d\u0430 \u0430\u043b\u0431\u0443\u043c\u0430." Неуспешно възстановяване на покупката. Неуспешно сканиране на %d файлове. @@ -300,6 +297,8 @@ Местонахождение на файла Размер + More from %s + Размер на използване Дължина @@ -431,7 +430,6 @@ Натисни за или плъзни за без прозрачна навигация на екрана с песен Натисни или плъзни - Ефект на валящ сняг Използвай корицата на настоящата песен като фон на заключен екран @@ -698,5 +696,4 @@ Ще бъдете препратени към сайта на тракера. Данните на акаунта Ви се използват единствено за автентификация. - More from %s diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 764de320..c439cf14 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -85,7 +85,7 @@ Vytvořit - "Vytvořený seznam skladeb " + Vytvořený seznam skladeb %1$s. Aktuálně posloucháš %1$s od %2$s. @@ -221,7 +221,7 @@ Smazat skladbu ze seznamu skladeb %1$s ze seznamu skladeb?]]> Smazat skladby ze seznamu skladeb - %1$s skladby ze seznamu skladeb?]]> + %1$d skladby ze seznamu skladeb?]]> Přejmenovat seznam skladeb diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 19f56145..20cdf27d 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -205,11 +205,10 @@ Crear - Lista de reproducción creada. + Lista de reproducción creada %1$s. Miembros y colaboradores - Estás escuchando a Algo oscuro @@ -221,11 +220,9 @@ Eliminar listas de reproducción Eliminar canción - Eliminar canciones - %1$d canciones?]]> Se han eliminado %1$d canciones. diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 9c7aea11..16ef3463 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -125,7 +125,7 @@ A vásárlást nem sikerült visszaállítani. Nem sikerült beolvasni %d fájlt. Létrehozás - Létrehozott lejátszási lista %1$s + Létrehozott lejátszási lista %1$s. Tagok és támogatók Jelenleg hallgat %1$s által %2$s Kissé sötét diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index c4994251..626043b3 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -210,7 +210,6 @@ tetap bermasalah, \"Hapus data Aplikasi\" Member dan kontribusi - Sedang mendengarkan Agak gelap diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 047024fa..a58b1ee5 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -190,7 +190,7 @@ https://play.google.com/store/apps/details?id=%s Cancella coda Cancella playlist - % 1 $ s ? Questo non pu\u00f2 essere annullato!]]> + %1$s ? Questo non pu\u00f2 essere annullato!]]> Chiudi @@ -211,7 +211,7 @@ https://play.google.com/store/apps/details?id=%s Crea - Playlist creata + Playlist creata %1$s. Membri e contributori diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 71226c04..f1911b43 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -182,7 +182,6 @@ キューを削除 プレイリストを削除 - %1$s \u3092\u524a\u9664\u3057\u307e\u3059\u304b? \u3053\u306e\u64cd\u4f5c\u306f\u5fa9\u5143\u3067\u304d\u307e\u305b\u3093!]]> 閉じる diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index d5af999e..a4a2068c 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -124,7 +124,6 @@ 블랙리스트 비우기 재생목록 비우기 - %1$s \uc7ac\uc0dd\ubaa9\ub85d\uc744 \ube44\uc6b0\uc2dc\uaca0\uc2b5\ub2c8\uae4c? \uc774 \uc791\uc5c5\uc740 \ucde8\uc18c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4!]]> 색상 diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index aa51c8c1..3e8fabc0 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -184,7 +184,6 @@ Wyczyść kolejkę Wyczyść playlistę - %1$s? Ta czynno\u015b\u0107 nie mo\u017ce zosta\u0107 cofni\u0119ta!]]> Zamknij diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 7234fa74..84c0bfed 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -113,7 +113,6 @@ Kara listeyi temizle Kuyruğu temizle Oynatma listesini temizle - % 1 $ s oynatma listesini temizlemek istedi\u011finizden emin misiniz? Bu i\u015flem kal\u0131c\u0131d\u0131r ve geri al\u0131namaz!]]> Kapat Renk Renk diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 8938f22f..31328155 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -184,7 +184,6 @@ tiếp tục xảy ra hãy \"Xóa dữ liệu ứng dụng\" Xóa hàng đợi Xoá danh sách phát - %1$s? Thao t\u00e1c kh\u00f4ng th\u1ec3 ho\u00e0n t\u00e1c!]]> Đóng diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 857efd33..0ebc3b42 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -181,7 +181,6 @@ 清空队列 清除播放列表 - %1$s \u5417\uff1f\u8bf7\u6ce8\u610f\uff0c\u6b64\u64cd\u4f5c\u4e0d\u53ef\u6062\u590d\uff01]]> 关闭 @@ -217,10 +216,10 @@ 删除播放列表 - %1 $ s 吗?]]> + %1$s吗?]]> - %1$s 吗?]]> - %1$s 吗?]]> + %1$d 吗?]]> + %1$d 吗?]]> 已删除 %1$d 首歌曲 深度 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 99b2b0c9..dfb79886 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -113,15 +113,12 @@ 清除黑名單 清除列表 清除播放清單 - %1$s\u64ad\u653e\u6e05\u55ae\u55ce?\u8acb\u6ce8\u610f\u9019\u4e0d\u80fd\u5fa9\u539f!]]> 關閉 彩色 彩色 色彩 作曲者 已複製裝置內容到剪貼簿 - \u7121\u6cd5\u5efa\u7acb\u64ad\u653e\u6e05\u55ae\u3002 - "\u7121\u6cd5\u4e0b\u8f09\u5408\u9069\u7684\u5c08\u8f2f\u5716\u7247\u3002" 無法恢復購買狀態。 無法掃描 %d 個檔案。 新增 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 7a441777..6a31a558 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -100,19 +100,16 @@ 清空 清空播放清單 - %1$s \u55ce\uff1f\u6b64\u64cd\u4f5c\u662f\u7121\u6cd5\u5fa9\u539f\u7684\uff01]]> 主題顏色 - \u7121\u6cd5\u65b0\u589e\u64ad\u653e\u6e05\u55ae\u3002 - "\u7121\u6cd5\u4e0b\u8f09\u5408\u9069\u7684\u5c08\u8f2f\u5c01\u9762\u3002" 不能掃描 %d。 建立 已新增播放清單 %1$s。 - 我正在聽 %2$s 的 %1$s ! + 我正在聽 %2$s 的 %1$s 暗沉 diff --git a/appthemehelper/build.gradle b/appthemehelper/build.gradle index 0b5cf00b..c6f418d4 100644 --- a/appthemehelper/build.gradle +++ b/appthemehelper/build.gradle @@ -5,7 +5,7 @@ android { compileSdkVersion 29 defaultConfig { minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 1 versionName "1.0" @@ -27,7 +27,7 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'com.google.android.material:material:1.2.0-alpha01' + implementation 'com.google.android.material:material:1.2.0-alpha04' implementation 'androidx.preference:preference:1.1.0' implementation 'androidx.cardview:cardview:1.0.0' // Used for the list preference classes