Fix navigation bar color on dialog
This commit is contained in:
parent
183c6810fe
commit
ce918acb45
23 changed files with 411 additions and 387 deletions
|
@ -4,16 +4,16 @@ apply plugin: 'kotlin-android-extensions'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 29
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 29
|
||||||
|
|
||||||
renderscriptTargetApi 28 //must match target sdk and build tools
|
renderscriptTargetApi 28 //must match target sdk and build tools
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
applicationId "code.name.monkey.retromusic"
|
applicationId "code.name.monkey.retromusic"
|
||||||
versionCode 392
|
versionCode 393
|
||||||
versionName '3.4.800'
|
versionName '3.4.800'
|
||||||
|
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,6 @@
|
||||||
package code.name.monkey.retromusic.activities
|
package code.name.monkey.retromusic.activities
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.ContentUris
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.ContextWrapper
|
import android.content.ContextWrapper
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
@ -9,7 +8,6 @@ import android.content.res.ColorStateList
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.provider.DocumentsContract
|
|
||||||
import android.provider.MediaStore.Images.Media
|
import android.provider.MediaStore.Images.Media
|
||||||
import android.provider.MediaStore.Images.Media.getBitmap
|
import android.provider.MediaStore.Images.Media.getBitmap
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
|
@ -123,10 +121,7 @@ class UserInfoActivity : AbsBaseActivity() {
|
||||||
pickImageIntent.putExtra("aspectY", 9)
|
pickImageIntent.putExtra("aspectY", 9)
|
||||||
pickImageIntent.putExtra("scale", true)
|
pickImageIntent.putExtra("scale", true)
|
||||||
//intent.setAction(Intent.ACTION_GET_CONTENT);
|
//intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||||
startActivityForResult(
|
startActivityForResult(Intent.createChooser(pickImageIntent, "Select Picture"), PICK_BANNER_REQUEST)
|
||||||
Intent.createChooser(pickImageIntent, "Select Picture"),
|
|
||||||
PICK_BANNER_REQUEST
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun pickNewPhoto() {
|
private fun pickNewPhoto() {
|
||||||
|
@ -138,10 +133,7 @@ class UserInfoActivity : AbsBaseActivity() {
|
||||||
pickImageIntent.putExtra("aspectX", 1)
|
pickImageIntent.putExtra("aspectX", 1)
|
||||||
pickImageIntent.putExtra("aspectY", 1)
|
pickImageIntent.putExtra("aspectY", 1)
|
||||||
pickImageIntent.putExtra("scale", true)
|
pickImageIntent.putExtra("scale", true)
|
||||||
startActivityForResult(
|
startActivityForResult(Intent.createChooser(pickImageIntent, "Select Picture"), PICK_IMAGE_REQUEST)
|
||||||
Intent.createChooser(pickImageIntent, "Select Picture"),
|
|
||||||
PICK_IMAGE_REQUEST
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
@ -180,32 +172,6 @@ class UserInfoActivity : AbsBaseActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getImagePathFromUri(aUri: Uri?): String? {
|
|
||||||
var imagePath: String? = null
|
|
||||||
if (aUri == null) {
|
|
||||||
return imagePath
|
|
||||||
}
|
|
||||||
if (DocumentsContract.isDocumentUri(App.getContext(), aUri)) {
|
|
||||||
val documentId = DocumentsContract.getDocumentId(aUri)
|
|
||||||
if ("com.android.providers.media.documents" == aUri.authority) {
|
|
||||||
val id = documentId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
|
|
||||||
val selection = Media._ID + "=" + id
|
|
||||||
imagePath = getImagePath(Media.EXTERNAL_CONTENT_URI, selection)
|
|
||||||
} else if ("com.android.providers.downloads.documents" == aUri.authority) {
|
|
||||||
val contentUri = ContentUris.withAppendedId(
|
|
||||||
Uri.parse("content://downloads/public_downloads"),
|
|
||||||
java.lang.Long.valueOf(documentId)
|
|
||||||
)
|
|
||||||
imagePath = getImagePath(contentUri, null)
|
|
||||||
}
|
|
||||||
} else if ("content".equals(aUri.scheme!!, ignoreCase = true)) {
|
|
||||||
imagePath = getImagePath(aUri, null)
|
|
||||||
} else if ("file".equals(aUri.scheme!!, ignoreCase = true)) {
|
|
||||||
imagePath = aUri.path
|
|
||||||
}
|
|
||||||
return imagePath
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getImagePath(aUri: Uri, aSelection: String?): String? {
|
private fun getImagePath(aUri: Uri, aSelection: String?): String? {
|
||||||
var path: String? = null
|
var path: String? = null
|
||||||
val cursor = App.getContext().contentResolver.query(aUri, null, aSelection, null, null)
|
val cursor = App.getContext().contentResolver.query(aUri, null, aSelection, null, null)
|
||||||
|
@ -219,27 +185,25 @@ class UserInfoActivity : AbsBaseActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadBannerFromStorage(profileImagePath: String) {
|
private fun loadBannerFromStorage(profileImagePath: String) {
|
||||||
disposable.add(
|
disposable.add(Compressor(this).setQuality(100)
|
||||||
Compressor(this).setQuality(100).setCompressFormat(Bitmap.CompressFormat.WEBP).compressToBitmapAsFlowable(
|
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
||||||
File(profileImagePath, USER_BANNER)
|
.compressToBitmapAsFlowable(File(profileImagePath, USER_BANNER))
|
||||||
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
|
.subscribeOn(Schedulers.io())
|
||||||
{ bitmap -> bannerImage.setImageBitmap(bitmap) },
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
{ t -> println() })
|
.subscribe({ bitmap -> bannerImage.setImageBitmap(bitmap) }, { t -> println(t) })
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadImageFromStorage(path: String) {
|
private fun loadImageFromStorage(path: String) {
|
||||||
disposable.add(
|
disposable.add(Compressor(this)
|
||||||
Compressor(this).setMaxHeight(300).setMaxWidth(300).setQuality(75).setCompressFormat(
|
.setMaxHeight(300)
|
||||||
Bitmap.CompressFormat.WEBP
|
.setMaxWidth(300)
|
||||||
).compressToBitmapAsFlowable(
|
.setQuality(75)
|
||||||
File(
|
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
||||||
path,
|
.compressToBitmapAsFlowable(File(path, USER_PROFILE))
|
||||||
USER_PROFILE
|
.subscribeOn(Schedulers.io())
|
||||||
)
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
|
.subscribe({ bitmap -> userImage.setImageBitmap(bitmap) }, { t -> println(t) })
|
||||||
{ bitmap -> userImage!!.setImageBitmap(bitmap) },
|
|
||||||
{ t -> println() })
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,284 +48,284 @@ private const val RESULT_ISSUES_NOT_ENABLED = "RESULT_ISSUES_NOT_ENABLED"
|
||||||
private const val RESULT_UNKNOWN = "RESULT_UNKNOWN"
|
private const val RESULT_UNKNOWN = "RESULT_UNKNOWN"
|
||||||
|
|
||||||
@StringDef(
|
@StringDef(
|
||||||
RESULT_SUCCESS,
|
RESULT_SUCCESS,
|
||||||
RESULT_BAD_CREDENTIALS,
|
RESULT_BAD_CREDENTIALS,
|
||||||
RESULT_INVALID_TOKEN,
|
RESULT_INVALID_TOKEN,
|
||||||
RESULT_ISSUES_NOT_ENABLED,
|
RESULT_ISSUES_NOT_ENABLED,
|
||||||
RESULT_UNKNOWN
|
RESULT_UNKNOWN
|
||||||
)
|
)
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
@Retention(AnnotationRetention.SOURCE)
|
||||||
private annotation class Result
|
private annotation class Result
|
||||||
|
|
||||||
open class BugReportActivity : AbsThemeActivity() {
|
open class BugReportActivity : AbsThemeActivity() {
|
||||||
|
|
||||||
private var deviceInfo: DeviceInfo? = null
|
private var deviceInfo: DeviceInfo? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
setDrawUnderStatusBar()
|
setDrawUnderStatusBar()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_bug_report)
|
setContentView(R.layout.activity_bug_report)
|
||||||
setStatusbarColorAuto()
|
setStatusbarColorAuto()
|
||||||
setNavigationbarColorAuto()
|
setNavigationbarColorAuto()
|
||||||
setTaskDescriptionColorAuto()
|
setTaskDescriptionColorAuto()
|
||||||
|
|
||||||
initViews()
|
initViews()
|
||||||
|
|
||||||
if (TextUtils.isEmpty(title)) setTitle(R.string.report_an_issue)
|
if (TextUtils.isEmpty(title)) setTitle(R.string.report_an_issue)
|
||||||
|
|
||||||
deviceInfo = DeviceInfo(this)
|
deviceInfo = DeviceInfo(this)
|
||||||
airTextDeviceInfo.text = deviceInfo.toString()
|
airTextDeviceInfo.text = deviceInfo.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initViews() {
|
private fun initViews() {
|
||||||
val accentColor = ThemeStore.accentColor(this)
|
val accentColor = ThemeStore.accentColor(this)
|
||||||
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||||
toolbar.setBackgroundColor(primaryColor)
|
toolbar.setBackgroundColor(primaryColor)
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
TintHelper.setTintAuto(optionUseAccount, accentColor, false)
|
TintHelper.setTintAuto(optionUseAccount, accentColor, false)
|
||||||
optionUseAccount?.setOnClickListener {
|
optionUseAccount?.setOnClickListener {
|
||||||
inputTitle.isEnabled = true
|
inputTitle.isEnabled = true
|
||||||
inputDescription.isEnabled = true
|
inputDescription.isEnabled = true
|
||||||
inputUsername.isEnabled = true
|
inputUsername.isEnabled = true
|
||||||
inputPassword.isEnabled = true
|
inputPassword.isEnabled = true
|
||||||
|
|
||||||
optionAnonymous.isChecked = false
|
optionAnonymous.isChecked = false
|
||||||
sendFab.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
sendFab.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
||||||
override fun onHidden(fab: FloatingActionButton?) {
|
override fun onHidden(fab: FloatingActionButton?) {
|
||||||
super.onHidden(fab)
|
super.onHidden(fab)
|
||||||
sendFab.setImageResource(R.drawable.ic_send_white_24dp)
|
sendFab.setImageResource(R.drawable.ic_send_white_24dp)
|
||||||
sendFab.show()
|
sendFab.show()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
TintHelper.setTintAuto(optionAnonymous, accentColor, false)
|
TintHelper.setTintAuto(optionAnonymous, accentColor, false)
|
||||||
optionAnonymous.setOnClickListener {
|
optionAnonymous.setOnClickListener {
|
||||||
inputTitle.isEnabled = false
|
inputTitle.isEnabled = false
|
||||||
inputDescription.isEnabled = false
|
inputDescription.isEnabled = false
|
||||||
inputUsername.isEnabled = false
|
inputUsername.isEnabled = false
|
||||||
inputPassword.isEnabled = false
|
inputPassword.isEnabled = false
|
||||||
|
|
||||||
optionUseAccount.isChecked = false
|
optionUseAccount.isChecked = false
|
||||||
sendFab.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
sendFab.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
||||||
override fun onHidden(fab: FloatingActionButton?) {
|
override fun onHidden(fab: FloatingActionButton?) {
|
||||||
super.onHidden(fab)
|
super.onHidden(fab)
|
||||||
sendFab.setImageResource(R.drawable.ic_open_in_browser_white_24dp)
|
sendFab.setImageResource(R.drawable.ic_open_in_browser_white_24dp)
|
||||||
sendFab.show()
|
sendFab.show()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
inputPassword.setOnEditorActionListener { _, actionId, _ ->
|
inputPassword.setOnEditorActionListener { _, actionId, _ ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
||||||
reportIssue()
|
reportIssue()
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
airTextDeviceInfo.setOnClickListener { copyDeviceInfoToClipBoard() }
|
airTextDeviceInfo.setOnClickListener { copyDeviceInfoToClipBoard() }
|
||||||
|
|
||||||
TintHelper.setTintAuto(sendFab, accentColor, true)
|
TintHelper.setTintAuto(sendFab, accentColor, true)
|
||||||
sendFab.setOnClickListener { reportIssue() }
|
sendFab.setOnClickListener { reportIssue() }
|
||||||
|
|
||||||
MaterialUtil.setTint(inputLayoutTitle, false)
|
MaterialUtil.setTint(inputLayoutTitle, false)
|
||||||
MaterialUtil.setTint(inputLayoutDescription, false)
|
MaterialUtil.setTint(inputLayoutDescription, false)
|
||||||
MaterialUtil.setTint(inputLayoutUsername, false)
|
MaterialUtil.setTint(inputLayoutUsername, false)
|
||||||
MaterialUtil.setTint(inputLayoutPassword, false)
|
MaterialUtil.setTint(inputLayoutPassword, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun reportIssue() {
|
private fun reportIssue() {
|
||||||
if (optionUseAccount.isChecked) {
|
if (optionUseAccount.isChecked) {
|
||||||
if (!validateInput()) return
|
if (!validateInput()) return
|
||||||
val username = inputUsername.text.toString()
|
val username = inputUsername.text.toString()
|
||||||
val password = inputPassword.text.toString()
|
val password = inputPassword.text.toString()
|
||||||
sendBugReport(GithubLogin(username, password))
|
sendBugReport(GithubLogin(username, password))
|
||||||
} else {
|
} else {
|
||||||
copyDeviceInfoToClipBoard()
|
copyDeviceInfoToClipBoard()
|
||||||
|
|
||||||
val i = Intent(Intent.ACTION_VIEW)
|
val i = Intent(Intent.ACTION_VIEW)
|
||||||
i.data = Uri.parse(ISSUE_TRACKER_LINK)
|
i.data = Uri.parse(ISSUE_TRACKER_LINK)
|
||||||
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun copyDeviceInfoToClipBoard() {
|
private fun copyDeviceInfoToClipBoard() {
|
||||||
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clip = ClipData.newPlainText(getString(R.string.device_info), deviceInfo?.toMarkdown())
|
val clip = ClipData.newPlainText(getString(R.string.device_info), deviceInfo?.toMarkdown())
|
||||||
clipboard.primaryClip = clip
|
clipboard.setPrimaryClip(clip)
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
this@BugReportActivity,
|
this@BugReportActivity,
|
||||||
R.string.copied_device_info_to_clipboard,
|
R.string.copied_device_info_to_clipboard,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun validateInput(): Boolean {
|
private fun validateInput(): Boolean {
|
||||||
var hasErrors = false
|
var hasErrors = false
|
||||||
|
|
||||||
if (optionUseAccount.isChecked) {
|
if (optionUseAccount.isChecked) {
|
||||||
if (TextUtils.isEmpty(inputUsername.text)) {
|
if (TextUtils.isEmpty(inputUsername.text)) {
|
||||||
setError(inputLayoutUsername, R.string.bug_report_no_username)
|
setError(inputLayoutUsername, R.string.bug_report_no_username)
|
||||||
hasErrors = true
|
hasErrors = true
|
||||||
} else {
|
} else {
|
||||||
removeError(inputLayoutUsername)
|
removeError(inputLayoutUsername)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(inputPassword.text)) {
|
if (TextUtils.isEmpty(inputPassword.text)) {
|
||||||
setError(inputLayoutPassword, R.string.bug_report_no_password)
|
setError(inputLayoutPassword, R.string.bug_report_no_password)
|
||||||
hasErrors = true
|
hasErrors = true
|
||||||
} else {
|
} else {
|
||||||
removeError(inputLayoutPassword)
|
removeError(inputLayoutPassword)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(inputTitle.text)) {
|
if (TextUtils.isEmpty(inputTitle.text)) {
|
||||||
setError(inputLayoutTitle, R.string.bug_report_no_title)
|
setError(inputLayoutTitle, R.string.bug_report_no_title)
|
||||||
hasErrors = true
|
hasErrors = true
|
||||||
} else {
|
} else {
|
||||||
removeError(inputLayoutTitle)
|
removeError(inputLayoutTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(inputDescription.text)) {
|
if (TextUtils.isEmpty(inputDescription.text)) {
|
||||||
setError(inputLayoutDescription, R.string.bug_report_no_description)
|
setError(inputLayoutDescription, R.string.bug_report_no_description)
|
||||||
hasErrors = true
|
hasErrors = true
|
||||||
} else {
|
} else {
|
||||||
removeError(inputLayoutDescription)
|
removeError(inputLayoutDescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
return !hasErrors
|
return !hasErrors
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setError(editTextLayout: TextInputLayout, @StringRes errorRes: Int) {
|
private fun setError(editTextLayout: TextInputLayout, @StringRes errorRes: Int) {
|
||||||
editTextLayout.error = getString(errorRes)
|
editTextLayout.error = getString(errorRes)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeError(editTextLayout: TextInputLayout) {
|
private fun removeError(editTextLayout: TextInputLayout) {
|
||||||
editTextLayout.error = null
|
editTextLayout.error = null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sendBugReport(login: GithubLogin) {
|
private fun sendBugReport(login: GithubLogin) {
|
||||||
if (!validateInput()) return
|
if (!validateInput()) return
|
||||||
|
|
||||||
val bugTitle = inputTitle.text.toString()
|
val bugTitle = inputTitle.text.toString()
|
||||||
val bugDescription = inputDescription.text.toString()
|
val bugDescription = inputDescription.text.toString()
|
||||||
|
|
||||||
val extraInfo = ExtraInfo()
|
val extraInfo = ExtraInfo()
|
||||||
onSaveExtraInfo()
|
onSaveExtraInfo()
|
||||||
|
|
||||||
val report = Report(bugTitle, bugDescription, deviceInfo, extraInfo)
|
val report = Report(bugTitle, bugDescription, deviceInfo, extraInfo)
|
||||||
val target = GithubTarget("h4h13", "RetroMusicPlayer")
|
val target = GithubTarget("h4h13", "RetroMusicPlayer")
|
||||||
|
|
||||||
ReportIssueAsyncTask.report(this, report, target, login)
|
ReportIssueAsyncTask.report(this, report, target, login)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSaveExtraInfo() {}
|
private fun onSaveExtraInfo() {}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
if (item.itemId == android.R.id.home) {
|
if (item.itemId == android.R.id.home) {
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ReportIssueAsyncTask private constructor(
|
private class ReportIssueAsyncTask private constructor(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
private val report: Report,
|
private val report: Report,
|
||||||
private val target: GithubTarget,
|
private val target: GithubTarget,
|
||||||
private val login: GithubLogin
|
private val login: GithubLogin
|
||||||
) : DialogAsyncTask<Void, Void, String>(activity) {
|
) : DialogAsyncTask<Void, Void, String>(activity) {
|
||||||
override fun createDialog(context: Context): Dialog {
|
override fun createDialog(context: Context): Dialog {
|
||||||
return AlertDialog.Builder(context).show()
|
return AlertDialog.Builder(context).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Result
|
@Result
|
||||||
override fun doInBackground(vararg params: Void): String {
|
override fun doInBackground(vararg params: Void): String {
|
||||||
val client: GitHubClient = if (login.shouldUseApiToken()) {
|
val client: GitHubClient = if (login.shouldUseApiToken()) {
|
||||||
GitHubClient().setOAuth2Token(login.apiToken)
|
GitHubClient().setOAuth2Token(login.apiToken)
|
||||||
} else {
|
} else {
|
||||||
GitHubClient().setCredentials(login.username, login.password)
|
GitHubClient().setCredentials(login.username, login.password)
|
||||||
}
|
}
|
||||||
|
|
||||||
val issue = Issue().setTitle(report.title).setBody(report.description)
|
val issue = Issue().setTitle(report.title).setBody(report.description)
|
||||||
try {
|
try {
|
||||||
IssueService(client).createIssue(target.username, target.repository, issue)
|
IssueService(client).createIssue(target.username, target.repository, issue)
|
||||||
return RESULT_SUCCESS
|
return RESULT_SUCCESS
|
||||||
} catch (e: RequestException) {
|
} catch (e: RequestException) {
|
||||||
return when (e.status) {
|
return when (e.status) {
|
||||||
STATUS_BAD_CREDENTIALS -> {
|
STATUS_BAD_CREDENTIALS -> {
|
||||||
if (login.shouldUseApiToken()) RESULT_INVALID_TOKEN else RESULT_BAD_CREDENTIALS
|
if (login.shouldUseApiToken()) RESULT_INVALID_TOKEN else RESULT_BAD_CREDENTIALS
|
||||||
}
|
}
|
||||||
STATUS_ISSUES_NOT_ENABLED -> RESULT_ISSUES_NOT_ENABLED
|
STATUS_ISSUES_NOT_ENABLED -> RESULT_ISSUES_NOT_ENABLED
|
||||||
else -> {
|
else -> {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
RESULT_UNKNOWN
|
RESULT_UNKNOWN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
return RESULT_UNKNOWN
|
return RESULT_UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPostExecute(@Result result: String) {
|
override fun onPostExecute(@Result result: String) {
|
||||||
super.onPostExecute(result)
|
super.onPostExecute(result)
|
||||||
|
|
||||||
val context = context ?: return
|
val context = context ?: return
|
||||||
|
|
||||||
when (result) {
|
when (result) {
|
||||||
RESULT_SUCCESS -> tryToFinishActivity()
|
RESULT_SUCCESS -> tryToFinishActivity()
|
||||||
RESULT_BAD_CREDENTIALS -> MaterialDialog(context).show {
|
RESULT_BAD_CREDENTIALS -> MaterialDialog(context).show {
|
||||||
title(R.string.bug_report_failed)
|
title(R.string.bug_report_failed)
|
||||||
message(R.string.bug_report_failed_wrong_credentials)
|
message(R.string.bug_report_failed_wrong_credentials)
|
||||||
positiveButton(android.R.string.ok)
|
positiveButton(android.R.string.ok)
|
||||||
}
|
}
|
||||||
RESULT_INVALID_TOKEN -> MaterialDialog(context).show {
|
RESULT_INVALID_TOKEN -> MaterialDialog(context).show {
|
||||||
title(R.string.bug_report_failed)
|
title(R.string.bug_report_failed)
|
||||||
message(R.string.bug_report_failed_invalid_token)
|
message(R.string.bug_report_failed_invalid_token)
|
||||||
positiveButton(android.R.string.ok)
|
positiveButton(android.R.string.ok)
|
||||||
}
|
}
|
||||||
RESULT_ISSUES_NOT_ENABLED -> MaterialDialog(context).show {
|
RESULT_ISSUES_NOT_ENABLED -> MaterialDialog(context).show {
|
||||||
title(R.string.bug_report_failed)
|
title(R.string.bug_report_failed)
|
||||||
message(R.string.bug_report_failed_issues_not_available)
|
message(R.string.bug_report_failed_issues_not_available)
|
||||||
positiveButton(android.R.string.ok)
|
positiveButton(android.R.string.ok)
|
||||||
}
|
}
|
||||||
else -> MaterialDialog(context).show {
|
else -> MaterialDialog(context).show {
|
||||||
title(R.string.bug_report_failed)
|
title(R.string.bug_report_failed)
|
||||||
message(R.string.bug_report_failed_unknown)
|
message(R.string.bug_report_failed_unknown)
|
||||||
positiveButton(android.R.string.ok) { tryToFinishActivity() }
|
positiveButton(android.R.string.ok) { tryToFinishActivity() }
|
||||||
onCancel { tryToFinishActivity() }
|
onCancel { tryToFinishActivity() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun tryToFinishActivity() {
|
private fun tryToFinishActivity() {
|
||||||
val context = context
|
val context = context
|
||||||
if (context is Activity && !context.isFinishing) {
|
if (context is Activity && !context.isFinishing) {
|
||||||
context.finish()
|
context.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
fun report(
|
fun report(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
report: Report,
|
report: Report,
|
||||||
target: GithubTarget,
|
target: GithubTarget,
|
||||||
login: GithubLogin
|
login: GithubLogin
|
||||||
) {
|
) {
|
||||||
ReportIssueAsyncTask(activity, report, target, login).execute()
|
ReportIssueAsyncTask(activity, report, target, login).execute()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private const val STATUS_BAD_CREDENTIALS = 401
|
private const val STATUS_BAD_CREDENTIALS = 401
|
||||||
private const val STATUS_ISSUES_NOT_ENABLED = 410
|
private const val STATUS_ISSUES_NOT_ENABLED = 410
|
||||||
private const val ISSUE_TRACKER_LINK = "https://github.com/h4h13/RetroMusicPlayer"
|
private const val ISSUE_TRACKER_LINK = "https://github.com/h4h13/RetroMusicPlayer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,6 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onCreateView(inflater, container, savedInstanceState)
|
return super.onCreateView(inflater, container, savedInstanceState)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package code.name.monkey.retromusic.fragments.mainactivity.folders;
|
||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
import android.media.MediaScannerConnection;
|
import android.media.MediaScannerConnection;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
@ -231,15 +232,14 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
private void setUpAppbarColor() {
|
private void setUpAppbarColor() {
|
||||||
int primaryColor = ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface);
|
int primaryColor = ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface);
|
||||||
getMainActivity().setSupportActionBar(toolbar);
|
getMainActivity().setSupportActionBar(toolbar);
|
||||||
toolbar.setBackgroundColor(RetroColorUtil.toolbarColor(getMainActivity()));
|
toolbar.setBackgroundTintList(ColorStateList.valueOf(ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface)));
|
||||||
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
|
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
|
||||||
toolbar.setNavigationOnClickListener(v -> {
|
toolbar.setNavigationOnClickListener(v -> {
|
||||||
showMainMenu(OptionsSheetDialogFragment.FOLDER);
|
showMainMenu(OptionsSheetDialogFragment.FOLDER);
|
||||||
});
|
});
|
||||||
breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(requireActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor)));
|
breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(requireActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor)));
|
||||||
breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(requireActivity(),
|
breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(requireActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor)));
|
||||||
ColorUtil.INSTANCE.darkenColor(primaryColor)));
|
appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(requireContext())));
|
||||||
appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(getContext())));
|
|
||||||
toolbar.setOnClickListener(v -> {
|
toolbar.setOnClickListener(v -> {
|
||||||
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getMainActivity(), toolbarContainer, getString(R.string.transition_toolbar));
|
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getMainActivity(), toolbarContainer, getString(R.string.transition_toolbar));
|
||||||
NavigationUtil.goToSearch(getMainActivity(), options);
|
NavigationUtil.goToSearch(getMainActivity(), options);
|
||||||
|
|
|
@ -48,16 +48,8 @@ class PlayingNotificationImpl24 : PlayingNotification() {
|
||||||
val song = service.currentSong
|
val song = service.currentSong
|
||||||
val isPlaying = service.isPlaying
|
val isPlaying = service.isPlaying
|
||||||
val isFavorite = MusicUtil.isFavorite(service, song)
|
val isFavorite = MusicUtil.isFavorite(service, song)
|
||||||
val playButtonResId = if (isPlaying)
|
val playButtonResId = if (isPlaying) R.drawable.ic_pause_white_48dp else R.drawable.ic_play_arrow_white_48dp
|
||||||
R.drawable.ic_pause_white_48dp
|
val favoriteResId = if (isFavorite) R.drawable.ic_favorite_white_24dp else R.drawable.ic_favorite_border_white_24dp
|
||||||
else
|
|
||||||
R.drawable.ic_play_arrow_white_48dp
|
|
||||||
|
|
||||||
val favoriteResId = if (isFavorite)
|
|
||||||
R.drawable.ic_favorite_white_24dp
|
|
||||||
else
|
|
||||||
R.drawable.ic_favorite_border_white_24dp
|
|
||||||
|
|
||||||
|
|
||||||
val action = Intent(service, MainActivity::class.java)
|
val action = Intent(service, MainActivity::class.java)
|
||||||
action.putExtra("expand", true)
|
action.putExtra("expand", true)
|
||||||
|
@ -99,30 +91,10 @@ class PlayingNotificationImpl24 : PlayingNotification() {
|
||||||
bitmapFinal = BitmapFactory.decodeResource(service.resources, R.drawable.default_album_art)
|
bitmapFinal = BitmapFactory.decodeResource(service.resources, R.drawable.default_album_art)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val toggleFavorite = NotificationCompat.Action(favoriteResId, service.getString(R.string.action_toggle_favorite), retrievePlaybackAction(TOGGLE_FAVORITE))
|
||||||
val toggleFavorite = NotificationCompat.Action(favoriteResId,
|
val playPauseAction = NotificationCompat.Action(playButtonResId, service.getString(R.string.action_play_pause), retrievePlaybackAction(ACTION_TOGGLE_PAUSE))
|
||||||
service.getString(R.string.action_toggle_favorite),
|
val previousAction = NotificationCompat.Action(R.drawable.ic_skip_previous_round_white_32dp, service.getString(R.string.action_previous), retrievePlaybackAction(ACTION_REWIND))
|
||||||
retrievePlaybackAction(TOGGLE_FAVORITE))
|
val nextAction = NotificationCompat.Action(R.drawable.ic_skip_next_round_white_32dp, service.getString(R.string.action_next), retrievePlaybackAction(ACTION_SKIP))
|
||||||
|
|
||||||
val playPauseAction = NotificationCompat.Action(
|
|
||||||
playButtonResId,
|
|
||||||
service.getString(R.string.action_play_pause),
|
|
||||||
retrievePlaybackAction(ACTION_TOGGLE_PAUSE))
|
|
||||||
|
|
||||||
val closeAction = NotificationCompat.Action(
|
|
||||||
R.drawable.ic_close_white_24dp,
|
|
||||||
service.getString(R.string.close_notification),
|
|
||||||
retrievePlaybackAction(ACTION_QUIT))
|
|
||||||
|
|
||||||
val previousAction = NotificationCompat.Action(
|
|
||||||
R.drawable.ic_skip_previous_round_white_32dp,
|
|
||||||
service.getString(R.string.action_previous),
|
|
||||||
retrievePlaybackAction(ACTION_REWIND))
|
|
||||||
|
|
||||||
val nextAction = NotificationCompat.Action(
|
|
||||||
R.drawable.ic_skip_next_round_white_32dp,
|
|
||||||
service.getString(R.string.action_next),
|
|
||||||
retrievePlaybackAction(ACTION_SKIP))
|
|
||||||
|
|
||||||
val builder = NotificationCompat.Builder(service,
|
val builder = NotificationCompat.Builder(service,
|
||||||
NOTIFICATION_CHANNEL_ID)
|
NOTIFICATION_CHANNEL_ID)
|
||||||
|
@ -139,7 +111,6 @@ class PlayingNotificationImpl24 : PlayingNotification() {
|
||||||
.addAction(previousAction)
|
.addAction(previousAction)
|
||||||
.addAction(playPauseAction)
|
.addAction(playPauseAction)
|
||||||
.addAction(nextAction)
|
.addAction(nextAction)
|
||||||
.addAction(closeAction)
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
builder.setStyle(MediaStyle()
|
builder.setStyle(MediaStyle()
|
||||||
|
|
|
@ -114,7 +114,7 @@ class PlayingNotificationOreo : PlayingNotification() {
|
||||||
|
|
||||||
override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) {
|
override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) {
|
||||||
super.onLoadFailed(e, errorDrawable)
|
super.onLoadFailed(e, errorDrawable)
|
||||||
update(null, ATHUtil.resolveColor(service, R.attr.colorPrimary, Color.WHITE))
|
update(null, ATHUtil.resolveColor(service, R.attr.colorSurface, Color.WHITE))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun update(bitmap: Bitmap?, bgColor: Int) {
|
private fun update(bitmap: Bitmap?, bgColor: Int) {
|
||||||
|
|
|
@ -657,9 +657,7 @@ public final class PreferenceUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveProfileImage(String profileImagePath) {
|
public void saveProfileImage(String profileImagePath) {
|
||||||
mPreferences.edit().putString(PROFILE_IMAGE_PATH, profileImagePath)
|
mPreferences.edit().putString(PROFILE_IMAGE_PATH, profileImagePath).apply();
|
||||||
.apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProfileImage() {
|
public String getProfileImage() {
|
||||||
|
|
|
@ -54,9 +54,6 @@ public class OptionMenuItemView extends FrameLayout {
|
||||||
public OptionMenuItemView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
public OptionMenuItemView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
|
||||||
int accentColor = ThemeStore.Companion.accentColor(context);
|
|
||||||
int colorWithAlpha = ColorUtil.INSTANCE.adjustAlpha(accentColor, 0.22f);
|
|
||||||
|
|
||||||
setBackground(ContextCompat.getDrawable(context, R.drawable.option_menu_background));
|
setBackground(ContextCompat.getDrawable(context, R.drawable.option_menu_background));
|
||||||
|
|
||||||
setClickable(true);
|
setClickable(true);
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingStart="12dp"
|
android:paddingStart="12dp"
|
||||||
android:paddingTop="6dp"
|
|
||||||
android:paddingEnd="8dp"
|
android:paddingEnd="8dp"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
android:textAppearance="@style/TextViewNormal"
|
android:textAppearance="@style/TextViewNormal"
|
||||||
|
|
|
@ -17,11 +17,12 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/rectSelector"
|
android:background="?selectableItemBackground"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:minHeight="72dp"
|
android:minHeight="64dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="12dp"
|
android:paddingStart="12dp"
|
||||||
|
android:paddingEnd="12dp"
|
||||||
tools:ignore="PrivateResource">
|
tools:ignore="PrivateResource">
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.CircularImageView
|
<code.name.monkey.retromusic.views.CircularImageView
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/rectSelector"
|
android:background="?selectableItemBackground"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:minHeight="@dimen/md_listitem_height"
|
android:minHeight="@dimen/md_listitem_height"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
|
|
@ -48,16 +48,18 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextViewSubtitle1"
|
android:textAppearance="@style/TextViewSubtitle1"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="@string/bug_report_summary" />
|
tools:text="@tools:sample/lorem" />
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/text"
|
android:id="@+id/text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="2dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
tools:text="@string/bug_report_summary" />
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
tools:text="@tools:sample/lorem" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="4dp"
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:foreground="?rectSelector"
|
android:foreground="?rectSelector"
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:padding="14dp"
|
android:padding="12dp"
|
||||||
app:tint="?attr/colorControlNormal"
|
app:tint="?attr/colorControlNormal"
|
||||||
tools:srcCompat="@drawable/ic_folder_white_24dp" />
|
tools:srcCompat="@drawable/ic_folder_white_24dp" />
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
android:id="@+id/largeIcon"
|
android:id="@+id/largeIcon"
|
||||||
android:layout_width="@dimen/notification_big_image_size"
|
android:layout_width="@dimen/notification_big_image_size"
|
||||||
android:layout_height="@dimen/notification_big_image_size"
|
android:layout_height="@dimen/notification_big_image_size"
|
||||||
|
android:forceDarkAllowed="false"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
tools:src="@tools:sample/avatars" />
|
tools:src="@tools:sample/avatars" />
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/rectSelector"
|
android:background="?selectableItemBackground"
|
||||||
android:minHeight="72dp"
|
android:minHeight="72dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
|
|
37
app/src/main/res/values-night-v27/styles.xml
Normal file
37
app/src/main/res/values-night-v27/styles.xml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
|
<item name="md_font_title">@font/circular</item>
|
||||||
|
<item name="md_font_body">@font/circular</item>
|
||||||
|
<item name="md_font_button">@font/circular</item>
|
||||||
|
<item name="md_background_color">?attr/colorSurface</item>
|
||||||
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
|
<item name="android:windowActivityTransitions">true</item>
|
||||||
|
<item name="android:fontFamily">@font/circular</item>
|
||||||
|
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||||
|
<item name="mcab_popup_theme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||||
|
<item name="windowActionBarOverlay">true</item>
|
||||||
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||||
|
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
|
||||||
|
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
|
||||||
|
<item name="roundSelector">@drawable/round_selector</item>
|
||||||
|
<item name="rectSelector">@drawable/rect_selector</item>
|
||||||
|
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
||||||
|
<item name="android:windowLightNavigationBar">false</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
|
@ -31,5 +31,6 @@
|
||||||
<item name="roundSelector">@drawable/round_selector</item>
|
<item name="roundSelector">@drawable/round_selector</item>
|
||||||
<item name="rectSelector">@drawable/rect_selector</item>
|
<item name="rectSelector">@drawable/rect_selector</item>
|
||||||
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
||||||
|
<item name="android:windowLightNavigationBar">false</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
79
app/src/main/res/values-v27/styles_parents.xml
Normal file
79
app/src/main/res/values-v27/styles_parents.xml
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
|
<item name="md_font_title">@font/circular</item>
|
||||||
|
<item name="md_font_body">@font/circular</item>
|
||||||
|
<item name="md_font_button">@font/circular</item>
|
||||||
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
|
<item name="android:windowActivityTransitions">true</item>
|
||||||
|
<item name="windowActionBarOverlay">true</item>
|
||||||
|
<item name="android:fontFamily">@font/circular</item>
|
||||||
|
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
|
||||||
|
<item name="mcab_popup_theme">@style/ThemeOverlay.AppCompat.Light</item>
|
||||||
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||||
|
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
|
||||||
|
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
|
||||||
|
<item name="roundSelector">@drawable/round_selector</item>
|
||||||
|
<item name="rectSelector">@drawable/rect_selector</item>
|
||||||
|
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
||||||
|
<item name="android:windowLightNavigationBar">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.RetroMusic.Base" parent="Theme.MaterialComponents.NoActionBar">
|
||||||
|
<item name="md_font_title">@font/circular</item>
|
||||||
|
<item name="md_font_body">@font/circular</item>
|
||||||
|
<item name="md_font_button">@font/circular</item>
|
||||||
|
<item name="md_color_button_text">@color/md_white_1000</item>
|
||||||
|
<item name="md_background_color">@color/darkColorPrimary</item>
|
||||||
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
|
<item name="android:windowActivityTransitions">true</item>
|
||||||
|
<item name="android:fontFamily">@font/circular</item>
|
||||||
|
<item name="windowActionBarOverlay">true</item>
|
||||||
|
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||||
|
<item name="mcab_popup_theme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||||
|
<item name="roundSelector">@drawable/round_selector_dark</item>
|
||||||
|
<item name="rectSelector">@drawable/rect_selector_dark</item>
|
||||||
|
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
||||||
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
|
||||||
|
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
|
||||||
|
<item name="android:windowLightNavigationBar">false</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.RetroMusic.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||||
|
<item name="md_font_title">@font/circular</item>
|
||||||
|
<item name="md_font_body">@font/circular</item>
|
||||||
|
<item name="md_font_button">@font/circular</item>
|
||||||
|
<item name="md_color_button_text">@color/md_black_1000</item>
|
||||||
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
|
<item name="windowActionBarOverlay">true</item>
|
||||||
|
<item name="roundSelector">@drawable/round_selector</item>
|
||||||
|
<item name="rectSelector">@drawable/rect_selector</item>
|
||||||
|
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
|
||||||
|
<item name="android:windowBackground">@color/md_white_1000</item>
|
||||||
|
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
||||||
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||||
|
<item name="android:windowActivityTransitions">true</item>
|
||||||
|
<item name="android:fontFamily">@font/circular</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
|
||||||
|
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
|
||||||
|
<item name="android:windowLightNavigationBar">false</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
|
@ -29,15 +29,16 @@
|
||||||
<item name="android:windowActivityTransitions">true</item>
|
<item name="android:windowActivityTransitions">true</item>
|
||||||
<item name="android:fontFamily">@font/circular</item>
|
<item name="android:fontFamily">@font/circular</item>
|
||||||
<item name="windowActionBarOverlay">true</item>
|
<item name="windowActionBarOverlay">true</item>
|
||||||
|
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||||
<item name="mcab_popup_theme">@style/ThemeOverlay.AppCompat.Dark</item>
|
<item name="mcab_popup_theme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||||
<item name="roundSelector">@drawable/round_selector_dark</item>
|
<item name="roundSelector">@drawable/round_selector_dark</item>
|
||||||
<item name="rectSelector">@drawable/rect_selector_dark</item>
|
<item name="rectSelector">@drawable/rect_selector_dark</item>
|
||||||
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat</item>
|
|
||||||
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
||||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
|
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
|
||||||
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
|
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.RetroMusic.Base.Black" parent="Theme.MaterialComponents.NoActionBar">
|
<style name="Theme.RetroMusic.Base.Black" parent="Theme.MaterialComponents.NoActionBar">
|
||||||
|
@ -59,58 +60,23 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.RetroMusic.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
|
<style name="Theme.RetroMusic.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||||
|
|
||||||
<item name="md_font_title">@font/circular</item>
|
<item name="md_font_title">@font/circular</item>
|
||||||
<item name="md_font_body">@font/circular</item>
|
<item name="md_font_body">@font/circular</item>
|
||||||
<item name="md_font_button">@font/circular</item>
|
<item name="md_font_button">@font/circular</item>
|
||||||
<item name="md_color_button_text">@color/md_black_1000</item>
|
<item name="md_color_button_text">@color/md_black_1000</item>
|
||||||
|
|
||||||
<item name="android:windowActionBarOverlay">true</item>
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
<item name="windowActionBarOverlay">true</item>
|
<item name="windowActionBarOverlay">true</item>
|
||||||
|
|
||||||
<item name="roundSelector">@drawable/round_selector</item>
|
<item name="roundSelector">@drawable/round_selector</item>
|
||||||
<item name="rectSelector">@drawable/rect_selector</item>
|
<item name="rectSelector">@drawable/rect_selector</item>
|
||||||
|
|
||||||
<item name="cardBackgroundColor">@color/md_white_1000</item>
|
|
||||||
|
|
||||||
<item name="defaultFooterColor">@color/md_grey_500</item>
|
|
||||||
|
|
||||||
<item name="dividerColor">@color/md_grey_200</item>
|
|
||||||
<item name="iconColor">@color/ate_secondary_text_light</item>
|
|
||||||
|
|
||||||
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
|
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
|
||||||
|
|
||||||
<!-- just in case-->
|
|
||||||
<item name="android:windowBackground">@color/md_white_1000</item>
|
<item name="android:windowBackground">@color/md_white_1000</item>
|
||||||
|
|
||||||
<!-- necessary to find the overflow button later in the layout-->
|
|
||||||
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
|
||||||
|
|
||||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||||
|
|
||||||
<item name="android:windowActivityTransitions">true</item>
|
<item name="android:windowActivityTransitions">true</item>
|
||||||
<item name="android:fontFamily">@font/circular</item>
|
<item name="android:fontFamily">@font/circular</item>
|
||||||
|
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
|
|
||||||
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
|
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
|
||||||
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
|
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
|
||||||
|
|
||||||
<item name="colorPrimary">@color/lightColorPrimary</item>
|
|
||||||
<item name="colorSecondary">@color/lightColorSecondary</item>
|
|
||||||
<item name="colorPrimaryVariant">@color/md_red_400</item>
|
|
||||||
|
|
||||||
<item name="colorOnPrimary">@color/lightColorOnPrimary</item>
|
|
||||||
<item name="colorAccent">@color/md_deep_purple_A200</item>
|
|
||||||
<item name="colorOnSecondary">@color/mi_text_color_secondary_light</item>
|
|
||||||
<item name="colorSecondaryVariant">@color/md_green_A700</item>
|
|
||||||
|
|
||||||
|
|
||||||
<item name="android:colorBackground">@color/lightColorBackground</item>
|
|
||||||
<item name="colorSurface">@color/lightColorSurface</item>
|
|
||||||
<item name="colorOnSurface">@color/mi_text_color_secondary_light</item>
|
|
||||||
<item name="colorOnBackground">@color/mi_text_color_secondary_light</item>
|
|
||||||
<item name="colorControlNormal">@color/mi_text_color_secondary_light</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -199,18 +199,24 @@ public final class ToolbarContentTintHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setToolbarContentColorBasedOnToolbarColor(@NonNull Context context,
|
public static void setToolbarContentColorBasedOnToolbarColor(@NonNull Context context,
|
||||||
Toolbar toolbar, int toolbarColor) {
|
Toolbar toolbar,
|
||||||
|
int toolbarColor) {
|
||||||
setToolbarContentColorBasedOnToolbarColor(context, toolbar, null, toolbarColor);
|
setToolbarContentColorBasedOnToolbarColor(context, toolbar, null, toolbarColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setToolbarContentColorBasedOnToolbarColor(@NonNull Context context,
|
public static void setToolbarContentColorBasedOnToolbarColor(@NonNull Context context,
|
||||||
Toolbar toolbar, @Nullable Menu menu, int toolbarColor) {
|
Toolbar toolbar,
|
||||||
|
@Nullable Menu menu,
|
||||||
|
int toolbarColor) {
|
||||||
setToolbarContentColorBasedOnToolbarColor(context, toolbar, menu, toolbarColor,
|
setToolbarContentColorBasedOnToolbarColor(context, toolbar, menu, toolbarColor,
|
||||||
ThemeStore.Companion.accentColor(context));
|
ThemeStore.Companion.accentColor(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setToolbarContentColorBasedOnToolbarColor(@NonNull Context context,
|
public static void setToolbarContentColorBasedOnToolbarColor(@NonNull Context context,
|
||||||
Toolbar toolbar, @Nullable Menu menu, int toolbarColor, final @ColorInt int menuWidgetColor) {
|
Toolbar toolbar,
|
||||||
|
@Nullable Menu menu,
|
||||||
|
int toolbarColor,
|
||||||
|
final @ColorInt int menuWidgetColor) {
|
||||||
setToolbarContentColor(context, toolbar, menu, toolbarContentColor(context, toolbarColor),
|
setToolbarContentColor(context, toolbar, menu, toolbarContentColor(context, toolbarColor),
|
||||||
toolbarTitleColor(context, toolbarColor), toolbarSubtitleColor(context, toolbarColor),
|
toolbarTitleColor(context, toolbarColor), toolbarSubtitleColor(context, toolbarColor),
|
||||||
menuWidgetColor);
|
menuWidgetColor);
|
||||||
|
|
Loading…
Reference in a new issue