Back button will be dark

This commit is contained in:
h4h13 2019-10-12 14:59:52 +05:30
parent 5ff9d5bcd8
commit 54c50b1a98
15 changed files with 68 additions and 71 deletions

View file

@ -13,8 +13,8 @@ android {
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic" applicationId "code.name.monkey.retromusic"
versionCode 380 versionCode 381
versionName '3.4.400-beta06' versionName '3.4.400-beta07'
multiDexEnabled true multiDexEnabled true

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,6 @@ import android.view.View
import androidx.core.app.ShareCompat import androidx.core.app.ShareCompat
import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK import code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK
import code.name.monkey.retromusic.Constants.APP_TELEGRAM_LINK import code.name.monkey.retromusic.Constants.APP_TELEGRAM_LINK
@ -69,7 +68,7 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
loadContributors() loadContributors()
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.resolveColor(this, R.attr.colorOnSurface)) ToolbarContentTintHelper.colorBackButton(toolbar )
appVersion.text = getAppVersion() appVersion.text = getAppVersion()
setUpView() setUpView()
} }

View file

@ -30,7 +30,6 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
@ -66,7 +65,7 @@ public class LicenseActivity extends AbsBaseActivity {
setLightNavigationBar(true); setLightNavigationBar(true);
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.INSTANCE.resolveColor(this, R.attr.colorOnSurface)); ToolbarContentTintHelper.colorBackButton(toolbar );
WebView webView = findViewById(R.id.license); WebView webView = findViewById(R.id.license);
try { try {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();

View file

@ -39,7 +39,7 @@ class SettingsActivity : AbsBaseActivity() {
setTitleTextColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorOnPrimary)) setTitleTextColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorOnPrimary))
setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary)) setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary))
setNavigationOnClickListener { onBackPressed() } setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorOnSecondary)) ToolbarContentTintHelper.colorBackButton(toolbar)
} }
appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary)) appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary))

View file

@ -19,7 +19,6 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
@ -67,7 +66,7 @@ public class WhatsNewActivity extends AbsBaseActivity {
//setSupportActionBar(toolbar); //setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(v -> onBackPressed()); toolbar.setNavigationOnClickListener(v -> onBackPressed());
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.INSTANCE.resolveColor(this, R.attr.colorOnSecondary)); ToolbarContentTintHelper.colorBackButton(toolbar);
try { try {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();

View file

@ -19,6 +19,7 @@ import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsThemeActivity import code.name.monkey.retromusic.activities.base.AbsThemeActivity
import code.name.monkey.retromusic.activities.bugreport.model.DeviceInfo import code.name.monkey.retromusic.activities.bugreport.model.DeviceInfo
@ -58,7 +59,6 @@ open class BugReportActivity : AbsThemeActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_bug_report) setContentView(R.layout.activity_bug_report)
setStatusbarColorAuto() setStatusbarColorAuto()
setNavigationbarColorAuto() setNavigationbarColorAuto()
setTaskDescriptionColorAuto() setTaskDescriptionColorAuto()
@ -68,53 +68,51 @@ open class BugReportActivity : AbsThemeActivity() {
if (TextUtils.isEmpty(title)) if (TextUtils.isEmpty(title))
setTitle(R.string.report_an_issue) 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.colorPrimary) val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
toolbar!!.setBackgroundColor(primaryColor) toolbar.setBackgroundColor(primaryColor)
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
ToolbarContentTintHelper.colorBackButton(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
TintHelper.setTintAuto(optionUseAccount, accentColor, false)
optionUseAccount?.setOnClickListener {
inputTitle.isEnabled = true
inputDescription.isEnabled = true
inputUsername.isEnabled = true
inputPassword.isEnabled = true
supportActionBar!!.setDisplayHomeAsUpEnabled(true) optionAnonymous.isChecked = false
sendFab.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
TintHelper.setTintAuto(optionUseAccount!!, accentColor, false)
optionUseAccount!!.setOnClickListener {
inputTitle!!.isEnabled = true
inputDescription!!.isEnabled = true
inputUsername!!.isEnabled = true
inputPassword!!.isEnabled = true
optionAnonymous!!.isChecked = false
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
@ -122,10 +120,10 @@ open class BugReportActivity : AbsThemeActivity() {
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)
@ -134,10 +132,10 @@ open class BugReportActivity : AbsThemeActivity() {
} }
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()
@ -151,43 +149,42 @@ open class BugReportActivity : AbsThemeActivity() {
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.setPrimaryClip(clip) clipboard.primaryClip = clip
Toast.makeText(this@BugReportActivity, R.string.copied_device_info_to_clipboard, Toast.LENGTH_LONG).show() Toast.makeText(this@BugReportActivity, R.string.copied_device_info_to_clipboard, Toast.LENGTH_LONG).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
@ -204,8 +201,8 @@ open class BugReportActivity : AbsThemeActivity() {
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()

View file

@ -16,7 +16,6 @@ package code.name.monkey.retromusic.extensions
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -25,7 +24,7 @@ fun AppCompatActivity.applyToolbar(toolbar: Toolbar) {
toolbar.apply { toolbar.apply {
setNavigationOnClickListener { onBackPressed() } setNavigationOnClickListener { onBackPressed() }
setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp) setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp)
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.textColorSecondary(this@applyToolbar)) ToolbarContentTintHelper.colorBackButton(toolbar )
setBackgroundColor(ATHUtil.resolveColor(this@applyToolbar, R.attr.colorPrimary)) setBackgroundColor(ATHUtil.resolveColor(this@applyToolbar, R.attr.colorPrimary))
} }
setSupportActionBar(toolbar) setSupportActionBar(toolbar)

View file

@ -151,7 +151,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
}); });
getMainActivity().setSupportActionBar(toolbar); getMainActivity().setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(v -> showMainMenu(OptionsSheetDialogFragment.LIBRARY)); toolbar.setNavigationOnClickListener(v -> showMainMenu(OptionsSheetDialogFragment.LIBRARY));
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorOnSurface)); ToolbarContentTintHelper.colorBackButton(toolbar );
toolbar.setTitleTextColor(ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorOnSecondary)); toolbar.setTitleTextColor(ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorOnSecondary));
} }

View file

@ -16,6 +16,7 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/report_bug" app:title="@string/report_bug"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" /> app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />

View file

@ -130,6 +130,7 @@
android:fadingEdge="horizontal" android:fadingEdge="horizontal"
android:singleLine="true" android:singleLine="true"
android:text="@string/general_settings_title" android:text="@string/general_settings_title"
android:textColor="?colorOnPrimary"
android:textAppearance="@style/TextViewSubtitle1" android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold" /> android:textStyle="bold" />

View file

@ -13,6 +13,7 @@
<color name="pitch_black">#000000</color> <color name="pitch_black">#000000</color>
<color name="lightColorPrimary">#FFFFFF</color> <color name="lightColorPrimary">#FFFFFF</color>
<color name="lightColorOnPrimary">#202020</color>
<color name="lightColorSecondary">#FEFEFE</color> <color name="lightColorSecondary">#FEFEFE</color>
<color name="lightColorBackground">#FFFFFF</color> <color name="lightColorBackground">#FFFFFF</color>
<color name="lightColorSurface">#FEFEFE</color> <color name="lightColorSurface">#FEFEFE</color>

View file

@ -42,10 +42,10 @@
</style> </style>
<style name="ToolbarTextAppearanceNormal"> <style name="ToolbarTextAppearanceNormal">
<item name="android:textSize">20sp</item>
<item name="android:textAppearance">@style/TextAppearance.MaterialComponents.Headline6
</item>
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
<item name="android:textAllCaps">false</item>
<item name="android:textSize">20sp</item>
<item name="android:letterSpacing">0.0125</item>
</style> </style>
<style name="ToolbarSubTitleTextAppearance"> <style name="ToolbarSubTitleTextAppearance">

View file

@ -146,7 +146,7 @@
<item name="colorSecondary">@color/lightColorSecondary</item> <item name="colorSecondary">@color/lightColorSecondary</item>
<item name="colorPrimaryVariant">@color/md_red_400</item> <item name="colorPrimaryVariant">@color/md_red_400</item>
<item name="colorOnPrimary">@color/mi_text_color_primary_light</item> <item name="colorOnPrimary">@color/lightColorOnPrimary</item>
<item name="colorAccent">@color/md_deep_purple_A200</item> <item name="colorAccent">@color/md_deep_purple_A200</item>
<item name="colorOnSecondary">@color/mi_text_color_secondary_light</item> <item name="colorOnSecondary">@color/mi_text_color_secondary_light</item>
<item name="colorSecondaryVariant">@color/md_green_A700</item> <item name="colorSecondaryVariant">@color/md_green_A700</item>

View file

@ -84,14 +84,15 @@ public final class ToolbarContentTintHelper {
} }
} }
public static void colorBackButton(@NonNull Toolbar toolbar, @ColorInt int color) { public static void colorBackButton(@NonNull Toolbar toolbar) {
int color = ATHUtil.INSTANCE.resolveColor(toolbar.getContext(), R.attr.colorOnPrimary);
final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY); final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY);
for (int i = 0; i < toolbar.getChildCount(); i++) { for (int i = 0; i < toolbar.getChildCount(); i++) {
final View backButton = toolbar.getChildAt(i); final View backButton = toolbar.getChildAt(i);
if (backButton instanceof ImageView) { if (backButton instanceof ImageView) {
((ImageView) backButton).getDrawable().setColorFilter(colorFilter); ((ImageView) backButton).getDrawable().setColorFilter(colorFilter);
} else if (backButton instanceof TextView) { } else if (backButton instanceof TextView) {
// ((TextView) backButton).setTextColor(color); // ((TextView) backButton).setTextColor(color);
} }
} }
} }