Added Permission Screen

This commit is contained in:
Hemanth S 2020-09-13 01:09:46 +05:30
parent cc494edbbf
commit 10f56e9e6d
27 changed files with 334 additions and 89 deletions

View file

@ -2,17 +2,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
apply plugin: "ru.cleverpumpkin.proguard-dictionaries-generator"
apply plugin: "androidx.navigation.safeargs.kotlin" apply plugin: "androidx.navigation.safeargs.kotlin"
proguardDictionaries {
dictionaryNames = [
"build/class-dictionary",
"build/package-dictionary",
"build/obfuscation-dictionary"
]
}
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion = '29.0.3' buildToolsVersion = '29.0.3'

View file

@ -41,25 +41,14 @@
public *; public *;
} }
-keep class !android.support.v7.internal.view.menu.**,** {*;}
-dontwarn -dontwarn
-ignorewarnings -ignorewarnings
-keep public class android.support.design.widget.BottomNavigationView { *; }
-keep public class android.support.design.internal.BottomNavigationMenuView { *; }
-keep public class android.support.design.internal.BottomNavigationPresenter { *; }
-keep public class android.support.design.internal.BottomNavigationItemView { *; }
#-dontwarn android.support.v8.renderscript.* #-dontwarn android.support.v8.renderscript.*
#-keepclassmembers class android.support.v8.renderscript.RenderScript { #-keepclassmembers class android.support.v8.renderscript.RenderScript {
# native *** rsn*(...); # native *** rsn*(...);
# native *** n*(...); # native *** n*(...);
#} #}
#-keep class org.jaudiotagger.** { *; } #-keep class org.jaudiotagger.** { *; }
-obfuscationdictionary build/obfuscation-dictionary.txt
-classobfuscationdictionary build/class-dictionary.txt
-packageobfuscationdictionary build/package-dictionary.txt

View file

@ -118,6 +118,7 @@
<activity android:name=".activities.bugreport.BugReportActivity" /> <activity android:name=".activities.bugreport.BugReportActivity" />
<activity android:name=".activities.ShareInstagramStory" /> <activity android:name=".activities.ShareInstagramStory" />
<activity android:name=".activities.DriveModeActivity" /> <activity android:name=".activities.DriveModeActivity" />
<activity android:name=".activities.PermissionActivity" />
<activity <activity
android:name=".activities.LockScreenActivity" android:name=".activities.LockScreenActivity"

View file

@ -16,7 +16,7 @@ import code.name.monkey.retromusic.helper.SearchQueryHelper.getSongs
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.repository.PlaylistSongsLoader import code.name.monkey.retromusic.repository.PlaylistSongsLoader
import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.AppRater.appLaunched import code.name.monkey.retromusic.util.AppRater
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -37,12 +37,15 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar() setDrawUnderStatusBar()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
if (!hasPermissions()) {
findNavController(R.id.fragment_container).navigate(R.id.permissionFragment)
}
setStatusbarColorAuto() setStatusbarColorAuto()
setNavigationbarColorAuto() setNavigationbarColorAuto()
setLightNavigationBar(true) setLightNavigationBar(true)
setTaskDescriptionColorAuto() setTaskDescriptionColorAuto()
hideStatusBar() hideStatusBar()
appLaunched(this) AppRater.appLaunched(this)
updateTabs() updateTabs()
} }
@ -61,21 +64,11 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
} }
} }
override fun onDestroy() {
super.onDestroy()
PreferenceUtil.unregisterOnSharedPreferenceChangedListener(this)
}
override fun requestPermissions() {
if (!blockRequestPermissions) {
super.requestPermissions()
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
if (!hasPermissions()) { if (!hasPermissions()) {
requestPermissions() //requestPermissions()
} }
} }

View file

@ -0,0 +1,63 @@
package code.name.monkey.retromusic.activities
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.provider.Settings
import androidx.core.text.HtmlCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.extensions.accentBackgroundColor
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.util.RingtoneManager
import kotlinx.android.synthetic.main.activity_permission.*
import kotlinx.android.synthetic.main.fragment_library.appNameText
class PermissionActivity : AbsMusicServiceActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView((R.layout.activity_permission))
setStatusbarColorAuto()
setNavigationbarColorAuto()
setLightNavigationBar(true)
setTaskDescriptionColorAuto()
setupTitle()
storagePermission.setButtonClick {
requestPermissions()
}
if (VersionUtils.hasMarshmallow()) audioPermission.show()
audioPermission.setButtonClick {
if (RingtoneManager.requiresDialog(this@PermissionActivity)) {
val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
intent.data = Uri.parse("package:" + applicationContext.packageName)
startActivity(intent)
}
}
finish.accentBackgroundColor()
finish.setOnClickListener {
if (hasPermissions() && !RingtoneManager.requiresDialog(this)) {
startActivity(
Intent(this, MainActivity::class.java).addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TASK
)
)
finish()
}
}
}
private fun setupTitle() {
val color = ThemeStore.accentColor(this)
val hexColor = String.format("#%06X", 0xFFFFFF and color)
val appName = HtmlCompat.fromHtml(
"Hello there! <br>Welcome to <b>Retro <span style='color:$hexColor';>Music</span></b>",
HtmlCompat.FROM_HTML_MODE_COMPACT
)
appNameText.text = appName
}
}

View file

@ -46,7 +46,7 @@ abstract class AbsBaseActivity : AbsThemeActivity() {
override fun onPostCreate(savedInstanceState: Bundle?) { override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState) super.onPostCreate(savedInstanceState)
if (!hasPermissions()) { if (!hasPermissions()) {
requestPermissions() //requestPermissions()
} }
} }

View file

@ -178,6 +178,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
behavior.isHideable = true behavior.isHideable = true
behavior.peekHeight = 0 behavior.peekHeight = 0
collapsePanel() collapsePanel()
ViewCompat.setElevation(slidingPanel, 0f)
ViewCompat.setElevation(bottomNavigationView, 10f) ViewCompat.setElevation(bottomNavigationView, 10f)
} else { } else {
ViewCompat.setElevation(bottomNavigationView, 10f) ViewCompat.setElevation(bottomNavigationView, 10f)

View file

@ -170,6 +170,7 @@ open class AlbumAdapter(
if (isInQuickSelectMode) { if (isInQuickSelectMode) {
toggleChecked(layoutPosition) toggleChecked(layoutPosition)
} else { } else {
println(dataSet[layoutPosition].id)
image?.let { albumClickListener?.onAlbumClick(dataSet[layoutPosition].id, it) } image?.let { albumClickListener?.onAlbumClick(dataSet[layoutPosition].id, it) }
} }
} }

View file

@ -49,6 +49,7 @@ fun Int.ripAlpha(): Int {
} }
fun Dialog.colorControlNormal() = resolveColor(android.R.attr.colorControlNormal) fun Dialog.colorControlNormal() = resolveColor(android.R.attr.colorControlNormal)
fun Toolbar.backgroundTintList() { fun Toolbar.backgroundTintList() {
val surfaceColor = ATHUtil.resolveColor(context, R.attr.colorSurface, Color.BLACK) val surfaceColor = ATHUtil.resolveColor(context, R.attr.colorSurface, Color.BLACK)
val colorStateList = ColorStateList.valueOf(surfaceColor) val colorStateList = ColorStateList.valueOf(surfaceColor)
@ -84,7 +85,6 @@ fun Fragment.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) =
fun Dialog.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) = fun Dialog.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) =
ATHUtil.resolveColor(context, attr, fallBackColor) ATHUtil.resolveColor(context, attr, fallBackColor)
fun CheckBox.addAccentColor() { fun CheckBox.addAccentColor() {
buttonTintList = ColorStateList.valueOf(ThemeStore.accentColor(context)) buttonTintList = ColorStateList.valueOf(ThemeStore.accentColor(context))
} }
@ -103,6 +103,19 @@ fun MaterialButton.accentTextColor() {
setTextColor(ThemeStore.accentColor(App.getContext())) setTextColor(ThemeStore.accentColor(App.getContext()))
} }
fun MaterialButton.accentBackgroundColor() {
backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(App.getContext()))
}
fun MaterialButton.accentOutlineColor() {
val color = ThemeStore.accentColor(context)
val colorStateList = ColorStateList.valueOf(color)
iconTint = colorStateList
strokeColor = colorStateList
setTextColor(colorStateList)
rippleColor = colorStateList
}
fun SeekBar.applyColor(@ColorInt color: Int) { fun SeekBar.applyColor(@ColorInt color: Int) {
thumbTintList = ColorStateList.valueOf(color) thumbTintList = ColorStateList.valueOf(color)
progressTintList = ColorStateList.valueOf(color) progressTintList = ColorStateList.valueOf(color)

View file

@ -74,6 +74,7 @@ class LibraryViewModel(
} }
fun getHome(): LiveData<List<Home>> { fun getHome(): LiveData<List<Home>> {
fetchHomeSections()
return home return home
} }

View file

@ -79,6 +79,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
toolbar.title = " " toolbar.title = " "
postponeEnterTransition() postponeEnterTransition()
detailsViewModel.getAlbum().observe(viewLifecycleOwner, Observer { detailsViewModel.getAlbum().observe(viewLifecycleOwner, Observer {
println(Thread.currentThread().name)
startPostponedEnterTransition() startPostponedEnterTransition()
showAlbum(it) showAlbum(it)
}) })

View file

@ -12,23 +12,23 @@ import code.name.monkey.retromusic.repository.RealRepository
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
class AlbumDetailsViewModel( class AlbumDetailsViewModel(
private val realRepository: RealRepository, private val repository: RealRepository,
private val albumId: Int private val albumId: Int
) : ViewModel(), MusicServiceEventListener { ) : ViewModel(), MusicServiceEventListener {
fun getAlbum(): LiveData<Album> = liveData(IO) { fun getAlbum(): LiveData<Album> = liveData(IO) {
val album = realRepository.albumByIdAsync(albumId) val album = repository.albumByIdAsync(albumId)
emit(album) emit(album)
} }
fun getArtist(artistId: Int): LiveData<Artist> = liveData(IO) { fun getArtist(artistId: Int): LiveData<Artist> = liveData(IO) {
val artist = realRepository.artistById(artistId) val artist = repository.artistById(artistId)
emit(artist) emit(artist)
} }
fun getAlbumInfo(album: Album): LiveData<Result<LastFmAlbum>> = liveData { fun getAlbumInfo(album: Album): LiveData<Result<LastFmAlbum>> = liveData {
emit(Result.Loading) emit(Result.Loading)
emit( realRepository.albumInfo(album.artistName ?: "-", album.title ?: "-")) emit(repository.albumInfo(album.artistName ?: "-", album.title ?: "-"))
} }
fun getMoreAlbums(artist: Artist): LiveData<List<Album>> = liveData(IO) { fun getMoreAlbums(artist: Artist): LiveData<List<Album>> = liveData(IO) {

View file

@ -78,8 +78,7 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
return String(Character.toChars(unicode)) return String(Character.toChars(unicode))
} }
private fun checkIsEmpty() { private fun checkIsEmpty() {
emptyEmoji.text = getEmojiByUnicode(0x1F631)
emptyText.setText(emptyMessage) emptyText.setText(emptyMessage)
empty.visibility = if (adapter!!.itemCount == 0) View.VISIBLE else View.GONE empty.visibility = if (adapter!!.itemCount == 0) View.VISIBLE else View.GONE
} }

View file

@ -114,15 +114,10 @@ class PlaylistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playli
private fun checkIsEmpty() { private fun checkIsEmpty() {
checkForPadding() checkForPadding()
emptyEmoji.text = getEmojiByUnicode(0x1F631)
empty.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE empty.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
emptyText.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE emptyText.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
} }
private fun getEmojiByUnicode(unicode: Int): String {
return String(Character.toChars(unicode))
}
override fun onPause() { override fun onPause() {
if (recyclerViewDragDropManager != null) { if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.cancelDrag() recyclerViewDragDropManager!!.cancelDrag()

View file

@ -60,13 +60,12 @@ class RealAlbumRepository(private val songRepository: RealSongRepository) :
} }
override fun album(albumId: Int): Album { override fun album(albumId: Int): Album {
val songs = songRepository.songs( val cursor = songRepository.makeSongCursor(
songRepository.makeSongCursor( AudioColumns.ALBUM_ID + "=?",
AudioColumns.ALBUM_ID + "=?", arrayOf(albumId.toString()),
arrayOf(albumId.toString()), getSongLoaderSortOrder()
getSongLoaderSortOrder()
)
) )
val songs = songRepository.songs(cursor)
val album = Album(ArrayList(songs)) val album = Album(ArrayList(songs))
sortAlbumSongs(album) sortAlbumSongs(album)
return album return album

View file

@ -18,12 +18,10 @@ import android.content.Context
import android.database.Cursor import android.database.Cursor
import android.provider.MediaStore import android.provider.MediaStore
import android.provider.MediaStore.Audio.AudioColumns import android.provider.MediaStore.Audio.AudioColumns
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.Constants.IS_MUSIC import code.name.monkey.retromusic.Constants.IS_MUSIC
import code.name.monkey.retromusic.Constants.baseProjection import code.name.monkey.retromusic.Constants.baseProjection
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.providers.BlacklistStore import code.name.monkey.retromusic.providers.BlacklistStore
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import java.util.* import java.util.*
@ -124,6 +122,7 @@ class RealSongRepository(private val context: Context) : SongRepository {
@JvmOverloads @JvmOverloads
fun makeSongCursor( fun makeSongCursor(
selection: String?, selection: String?,
selectionValues: Array<String>?, selectionValues: Array<String>?,
sortOrder: String = PreferenceUtil.songSortOrder sortOrder: String = PreferenceUtil.songSortOrder
@ -139,34 +138,22 @@ class RealSongRepository(private val context: Context) : SongRepository {
// Blacklist // Blacklist
val paths = BlacklistStore.getInstance(context).paths val paths = BlacklistStore.getInstance(context).paths
if (paths.isNotEmpty()) { if (paths.isNotEmpty()) {
selectionFinal = selectionFinal = generateBlacklistSelection(selectionFinal, paths.size)
generateBlacklistSelection( selectionValuesFinal = addBlacklistSelectionValues(selectionValuesFinal, paths)
selectionFinal,
paths.size
)
selectionValuesFinal =
addBlacklistSelectionValues(
selectionValuesFinal,
paths
)
} }
selectionFinal = selectionFinal =
selectionFinal + " AND " + MediaStore.Audio.Media.DURATION + ">= " + (PreferenceUtil.filterLength * 1000) selectionFinal + " AND " + MediaStore.Audio.Media.DURATION + ">= " + (PreferenceUtil.filterLength * 1000)
try {
return context.contentResolver.query(
val uri = if (VersionUtils.hasQ()) { MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
MediaStore.Audio.Media.getContentUri(MediaStore.VOLUME_EXTERNAL) baseProjection,
} else { selectionFinal,
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI selectionValuesFinal,
sortOrder
)
} catch (e: SecurityException) {
return null
} }
return context.contentResolver.query(
uri,
baseProjection,
selectionFinal,
selectionValuesFinal,
sortOrder
)
} }
private fun generateBlacklistSelection( private fun generateBlacklistSelection(

View file

@ -74,7 +74,7 @@ class RingtoneManager(val context: Context) {
} }
fun getDialog(context: Context): AlertDialog { fun getDialog(context: Context): AlertDialog {
return MaterialAlertDialogBuilder(context) return MaterialAlertDialogBuilder(context, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.dialog_title_set_ringtone) .setTitle(R.string.dialog_title_set_ringtone)
.setMessage(R.string.dialog_message_set_ringtone) .setMessage(R.string.dialog_message_set_ringtone)
.setPositiveButton(android.R.string.ok) { _, _ -> .setPositiveButton(android.R.string.ok) { _, _ ->

View file

@ -0,0 +1,43 @@
package code.name.monkey.retromusic.views
import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet
import android.widget.FrameLayout
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.accentOutlineColor
import kotlinx.android.synthetic.main.item_permission.view.*
class PermissionItem @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {
init {
val attributes = context.obtainStyledAttributes(attrs, R.styleable.PermissionItem, 0, 0)
inflate(context, R.layout.item_permission, this)
title.text = attributes.getText(R.styleable.PermissionItem_permissionTitle)
summary.text = attributes.getText(R.styleable.PermissionItem_permissionTitleSubTitle)
number.text = attributes.getText(R.styleable.PermissionItem_permissionTitleNumber)
button.text = attributes.getText(R.styleable.PermissionItem_permissionButtonTitle)
button.setIconResource(
attributes.getResourceId(
R.styleable.PermissionItem_permissionIcon,
R.drawable.ic_album
)
)
val color = ThemeStore.accentColor(context)
number.backgroundTintList = ColorStateList.valueOf(ColorUtil.withAlpha(color, 0.22f))
button.accentOutlineColor()
attributes.recycle()
}
fun setButtonClick(callBack: () -> Unit) {
button.setOnClickListener { callBack.invoke() }
}
}

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M14,1L4,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2L16,3c0,-1.1 -0.9,-2 -2,-2zM14,20L4,20L4,4h10v16zM20.63,8.26c-0.26,-0.32 -0.74,-0.36 -1.04,-0.06l-0.03,0.03c-0.25,0.25 -0.26,0.65 -0.05,0.93 1.26,1.64 1.25,3.87 -0.02,5.57 -0.21,0.28 -0.19,0.67 0.05,0.92l0.05,0.05c0.29,0.29 0.76,0.26 1.03,-0.05 1.8,-2.13 1.8,-5.19 0.01,-7.39zM17.42,10.37l-0.06,0.06c-0.2,0.2 -0.26,0.5 -0.15,0.76 0.21,0.49 0.21,1.03 0,1.52 -0.11,0.26 -0.05,0.56 0.15,0.76l0.08,0.08c0.32,0.32 0.87,0.25 1.09,-0.15 0.49,-0.89 0.49,-1.94 -0.01,-2.86 -0.22,-0.42 -0.77,-0.5 -1.1,-0.17z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M18,2h-7.17c-0.53,0 -1.04,0.21 -1.42,0.59L4.6,7.42c-0.37,0.37 -0.6,0.88 -0.6,1.4L4,20c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,4c0,-1.1 -0.9,-2 -2,-2zM11,8c-0.55,0 -1,-0.45 -1,-1L10,5c0,-0.55 0.45,-1 1,-1s1,0.45 1,1v2c0,0.55 -0.45,1 -1,1zM14,8c-0.55,0 -1,-0.45 -1,-1L13,5c0,-0.55 0.45,-1 1,-1s1,0.45 1,1v2c0,0.55 -0.45,1 -1,1zM17,8c-0.55,0 -1,-0.45 -1,-1L16,5c0,-0.55 0.45,-1 1,-1s1,0.45 1,1v2c0,0.55 -0.45,1 -1,1z"/>
</vector>

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/appNameText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="32dp"
android:text="@string/app_name"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:lineHeightHint="32sp" />
<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:background="?attr/dividerHorizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/appNameText" />
<code.name.monkey.retromusic.views.PermissionItem
android:id="@+id/storagePermission"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/divider"
app:permissionButtonTitle="Grant access"
app:permissionIcon="@drawable/ic_sd_storage"
app:permissionTitle="Storage Access"
app:permissionTitleNumber="1"
app:permissionTitleSubTitle="The app needs permission to access your device storage for music files playing music" />
<code.name.monkey.retromusic.views.PermissionItem
android:id="@+id/audioPermission"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/storagePermission"
app:permissionButtonTitle="Grant access"
app:permissionIcon="@drawable/ic_phonelink_ring"
app:permissionTitle="Ringtone"
app:permissionTitleNumber="2"
app:permissionTitleSubTitle="The app needs permission to access your device settings in order to set music as Ringtone"
tools:visibility="visible" />
<com.google.android.material.button.MaterialButton
android:id="@+id/finish"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:paddingVertical="12dp"
android:text="Let's go"
android:textAppearance="@style/TextViewButton"
app:cornerRadius="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/rectSelector"
android:minHeight="?attr/listPreferredItemHeight"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingTop="16dp"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:paddingBottom="16dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/number"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginTop="4dp"
android:layout_marginStart="16dp"
android:background="@drawable/color_circle_gradient"
android:gravity="center"
android:maxLines="3"
tools:text="1"
android:textAppearance="@style/TextViewButton"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/title" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="@style/TextViewSubtitle1"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline_front_margin"
app:layout_constraintTop_toTopOf="parent"
tools:maxLines="@string/grid_size_1"
tools:text="@tools:sample/lorem/random" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/summary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:textAppearance="@style/TextViewNormal"
android:textColor="?android:attr/textColorSecondary"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline_front_margin"
app:layout_constraintTop_toBottomOf="@id/title"
tools:maxLines="2"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp"
app:cornerRadius="8dp"
android:layout_height="wrap_content"
android:paddingVertical="10dp"
android:textAppearance="@style/TextViewButton"
app:icon="@drawable/ic_history"
app:iconGravity="start"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/guideline_front_margin"
app:layout_constraintTop_toBottomOf="@id/summary"
tools:text="@tools:sample/full_names" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_front_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="@dimen/list_pref_guideline_begin" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -71,5 +71,9 @@
android:name="code.name.monkey.retromusic.activities.SettingsActivity" android:name="code.name.monkey.retromusic.activities.SettingsActivity"
android:label="SettingsActivity" /> android:label="SettingsActivity" />
<activity
android:id="@+id/permissionFragment"
android:name="code.name.monkey.retromusic.activities.PermissionActivity"
android:label="PermissionFragment"
tools:layout="@layout/activity_permission" />
</navigation> </navigation>

View file

@ -20,5 +20,5 @@
<string name="app_shortcut_shuffle_all_long" translatable="false">@string/action_shuffle_all</string> <string name="app_shortcut_shuffle_all_long" translatable="false">@string/action_shuffle_all</string>
<string name="app_shortcut_top_tracks_long" translatable="false">@string/my_top_tracks</string> <string name="app_shortcut_top_tracks_long" translatable="false">@string/my_top_tracks</string>
<string name="empty_text_emoji" translatable="false">&#129300;</string> <string name="empty_text_emoji" translatable="false">&#128561;</string>
</resources> </resources>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="PermissionItem">
<attr name="permissionTitle" format="string" />
<attr name="permissionTitleSubTitle" format="string" />
<attr name="permissionTitleNumber" format="string" />
<attr name="permissionIcon" format="integer" />
<attr name="permissionButtonTitle" format="string" />
</declare-styleable>
</resources>

View file

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference <code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false" android:defaultValue="true"
android:key="ignore_media_store_artwork" android:key="ignore_media_store_artwork"
android:layout="@layout/list_item_view_switch" android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_ignore_media_store_artwork" android:summary="@string/pref_summary_ignore_media_store_artwork"
@ -11,7 +11,7 @@
app:icon="@drawable/ic_image" /> app:icon="@drawable/ic_image" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference <code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
android:defaultValue="only_wifi" android:defaultValue="always"
android:entries="@array/pref_auto_download_images_titles" android:entries="@array/pref_auto_download_images_titles"
android:entryValues="@array/pref_auto_download_images_values" android:entryValues="@array/pref_auto_download_images_values"
android:key="auto_download_images_policy" android:key="auto_download_images_policy"

View file

@ -5,15 +5,10 @@ buildscript {
repositories { repositories {
jcenter() jcenter()
google() google()
maven {
url "https://plugins.gradle.org/m2/"
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:bundletool:0.9.0'
classpath "gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.8"
def nav_version = "2.3.0" def nav_version = "2.3.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
} }