Back button will be dark
This commit is contained in:
parent
5ff9d5bcd8
commit
54c50b1a98
15 changed files with 68 additions and 71 deletions
|
@ -13,8 +13,8 @@ android {
|
|||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
applicationId "code.name.monkey.retromusic"
|
||||
versionCode 380
|
||||
versionName '3.4.400-beta06'
|
||||
versionCode 381
|
||||
versionName '3.4.400-beta07'
|
||||
|
||||
multiDexEnabled true
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,6 @@ import android.view.View
|
|||
import androidx.core.app.ShareCompat
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK
|
||||
import code.name.monkey.retromusic.Constants.APP_TELEGRAM_LINK
|
||||
|
@ -69,7 +68,7 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
|
|||
|
||||
loadContributors()
|
||||
setSupportActionBar(toolbar)
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.resolveColor(this, R.attr.colorOnSurface))
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar )
|
||||
appVersion.text = getAppVersion()
|
||||
setUpView()
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.io.InputStreamReader;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
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.ToolbarContentTintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
@ -66,7 +65,7 @@ public class LicenseActivity extends AbsBaseActivity {
|
|||
setLightNavigationBar(true);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.INSTANCE.resolveColor(this, R.attr.colorOnSurface));
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar );
|
||||
WebView webView = findViewById(R.id.license);
|
||||
try {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
|
|
@ -39,7 +39,7 @@ class SettingsActivity : AbsBaseActivity() {
|
|||
setTitleTextColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorOnPrimary))
|
||||
setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary))
|
||||
setNavigationOnClickListener { onBackPressed() }
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorOnSecondary))
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||
}
|
||||
appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary))
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.io.InputStreamReader;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
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.ToolbarContentTintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
@ -67,7 +66,7 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
|||
//setSupportActionBar(toolbar);
|
||||
|
||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.INSTANCE.resolveColor(this, R.attr.colorOnSecondary));
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar);
|
||||
|
||||
try {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
|
|
@ -19,6 +19,7 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
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.activities.base.AbsThemeActivity
|
||||
import code.name.monkey.retromusic.activities.bugreport.model.DeviceInfo
|
||||
|
@ -58,7 +59,6 @@ open class BugReportActivity : AbsThemeActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_bug_report)
|
||||
|
||||
|
||||
setStatusbarColorAuto()
|
||||
setNavigationbarColorAuto()
|
||||
setTaskDescriptionColorAuto()
|
||||
|
@ -68,53 +68,51 @@ open class BugReportActivity : AbsThemeActivity() {
|
|||
if (TextUtils.isEmpty(title))
|
||||
setTitle(R.string.report_an_issue)
|
||||
|
||||
|
||||
deviceInfo = DeviceInfo(this)
|
||||
airTextDeviceInfo!!.text = deviceInfo!!.toString()
|
||||
airTextDeviceInfo.text = deviceInfo.toString()
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
val accentColor = ThemeStore.accentColor(this)
|
||||
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
|
||||
toolbar!!.setBackgroundColor(primaryColor)
|
||||
toolbar.setBackgroundColor(primaryColor)
|
||||
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)
|
||||
|
||||
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() {
|
||||
optionAnonymous.isChecked = false
|
||||
sendFab.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
||||
override fun onHidden(fab: FloatingActionButton?) {
|
||||
super.onHidden(fab)
|
||||
sendFab!!.setImageResource(R.drawable.ic_send_white_24dp)
|
||||
sendFab!!.show()
|
||||
sendFab.setImageResource(R.drawable.ic_send_white_24dp)
|
||||
sendFab.show()
|
||||
}
|
||||
})
|
||||
}
|
||||
TintHelper.setTintAuto(optionAnonymous!!, accentColor, false)
|
||||
optionAnonymous!!.setOnClickListener {
|
||||
inputTitle!!.isEnabled = false
|
||||
inputDescription!!.isEnabled = false
|
||||
inputUsername!!.isEnabled = false
|
||||
inputPassword!!.isEnabled = false
|
||||
TintHelper.setTintAuto(optionAnonymous, accentColor, false)
|
||||
optionAnonymous.setOnClickListener {
|
||||
inputTitle.isEnabled = false
|
||||
inputDescription.isEnabled = false
|
||||
inputUsername.isEnabled = false
|
||||
inputPassword.isEnabled = false
|
||||
|
||||
optionUseAccount!!.isChecked = false
|
||||
sendFab!!.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
||||
optionUseAccount.isChecked = false
|
||||
sendFab.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
||||
override fun onHidden(fab: FloatingActionButton?) {
|
||||
super.onHidden(fab)
|
||||
sendFab!!.setImageResource(R.drawable.ic_open_in_browser_white_24dp)
|
||||
sendFab!!.show()
|
||||
sendFab.setImageResource(R.drawable.ic_open_in_browser_white_24dp)
|
||||
sendFab.show()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
inputPassword!!.setOnEditorActionListener { _, actionId, _ ->
|
||||
inputPassword.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
||||
reportIssue()
|
||||
return@setOnEditorActionListener true
|
||||
|
@ -122,10 +120,10 @@ open class BugReportActivity : AbsThemeActivity() {
|
|||
false
|
||||
}
|
||||
|
||||
airTextDeviceInfo!!.setOnClickListener { copyDeviceInfoToClipBoard() }
|
||||
airTextDeviceInfo.setOnClickListener { copyDeviceInfoToClipBoard() }
|
||||
|
||||
TintHelper.setTintAuto(sendFab!!, accentColor, true)
|
||||
sendFab!!.setOnClickListener { reportIssue() }
|
||||
TintHelper.setTintAuto(sendFab, accentColor, true)
|
||||
sendFab.setOnClickListener { reportIssue() }
|
||||
|
||||
MaterialUtil.setTint(inputLayoutTitle, false)
|
||||
MaterialUtil.setTint(inputLayoutDescription, false)
|
||||
|
@ -134,10 +132,10 @@ open class BugReportActivity : AbsThemeActivity() {
|
|||
}
|
||||
|
||||
private fun reportIssue() {
|
||||
if (optionUseAccount!!.isChecked) {
|
||||
if (optionUseAccount.isChecked) {
|
||||
if (!validateInput()) return
|
||||
val username = inputUsername!!.text!!.toString()
|
||||
val password = inputPassword!!.text!!.toString()
|
||||
val username = inputUsername.text.toString()
|
||||
val password = inputPassword.text.toString()
|
||||
sendBugReport(GithubLogin(username, password))
|
||||
} else {
|
||||
copyDeviceInfoToClipBoard()
|
||||
|
@ -151,43 +149,42 @@ open class BugReportActivity : AbsThemeActivity() {
|
|||
|
||||
private fun copyDeviceInfoToClipBoard() {
|
||||
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clip = ClipData.newPlainText(getString(R.string.device_info), deviceInfo!!.toMarkdown())
|
||||
clipboard.setPrimaryClip(clip)
|
||||
|
||||
val clip = ClipData.newPlainText(getString(R.string.device_info), deviceInfo?.toMarkdown())
|
||||
clipboard.primaryClip = clip
|
||||
Toast.makeText(this@BugReportActivity, R.string.copied_device_info_to_clipboard, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
private fun validateInput(): Boolean {
|
||||
var hasErrors = false
|
||||
|
||||
if (optionUseAccount!!.isChecked) {
|
||||
if (TextUtils.isEmpty(inputUsername!!.text)) {
|
||||
setError(inputLayoutUsername!!, R.string.bug_report_no_username)
|
||||
if (optionUseAccount.isChecked) {
|
||||
if (TextUtils.isEmpty(inputUsername.text)) {
|
||||
setError(inputLayoutUsername, R.string.bug_report_no_username)
|
||||
hasErrors = true
|
||||
} else {
|
||||
removeError(inputLayoutUsername!!)
|
||||
removeError(inputLayoutUsername)
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(inputPassword!!.text)) {
|
||||
setError(inputLayoutPassword!!, R.string.bug_report_no_password)
|
||||
if (TextUtils.isEmpty(inputPassword.text)) {
|
||||
setError(inputLayoutPassword, R.string.bug_report_no_password)
|
||||
hasErrors = true
|
||||
} else {
|
||||
removeError(inputLayoutPassword!!)
|
||||
removeError(inputLayoutPassword)
|
||||
}
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(inputTitle!!.text)) {
|
||||
setError(inputLayoutTitle!!, R.string.bug_report_no_title)
|
||||
if (TextUtils.isEmpty(inputTitle.text)) {
|
||||
setError(inputLayoutTitle, R.string.bug_report_no_title)
|
||||
hasErrors = true
|
||||
} else {
|
||||
removeError(inputLayoutTitle!!)
|
||||
removeError(inputLayoutTitle)
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(inputDescription!!.text)) {
|
||||
setError(inputLayoutDescription!!, R.string.bug_report_no_description)
|
||||
if (TextUtils.isEmpty(inputDescription.text)) {
|
||||
setError(inputLayoutDescription, R.string.bug_report_no_description)
|
||||
hasErrors = true
|
||||
} else {
|
||||
removeError(inputLayoutDescription!!)
|
||||
removeError(inputLayoutDescription)
|
||||
}
|
||||
|
||||
return !hasErrors
|
||||
|
@ -204,8 +201,8 @@ open class BugReportActivity : AbsThemeActivity() {
|
|||
private fun sendBugReport(login: GithubLogin) {
|
||||
if (!validateInput()) return
|
||||
|
||||
val bugTitle = inputTitle!!.text!!.toString()
|
||||
val bugDescription = inputDescription!!.text!!.toString()
|
||||
val bugTitle = inputTitle.text.toString()
|
||||
val bugDescription = inputDescription.text.toString()
|
||||
|
||||
val extraInfo = ExtraInfo()
|
||||
onSaveExtraInfo()
|
||||
|
|
|
@ -16,7 +16,6 @@ package code.name.monkey.retromusic.extensions
|
|||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
|
@ -25,7 +24,7 @@ fun AppCompatActivity.applyToolbar(toolbar: Toolbar) {
|
|||
toolbar.apply {
|
||||
setNavigationOnClickListener { onBackPressed() }
|
||||
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))
|
||||
}
|
||||
setSupportActionBar(toolbar)
|
||||
|
|
|
@ -151,7 +151,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
});
|
||||
getMainActivity().setSupportActionBar(toolbar);
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:layout_collapseMode="pin"
|
||||
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
|
||||
app:title="@string/report_bug"
|
||||
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/general_settings_title"
|
||||
android:textColor="?colorOnPrimary"
|
||||
android:textAppearance="@style/TextViewSubtitle1"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<color name="pitch_black">#000000</color>
|
||||
|
||||
<color name="lightColorPrimary">#FFFFFF</color>
|
||||
<color name="lightColorOnPrimary">#202020</color>
|
||||
<color name="lightColorSecondary">#FEFEFE</color>
|
||||
<color name="lightColorBackground">#FFFFFF</color>
|
||||
<color name="lightColorSurface">#FEFEFE</color>
|
||||
|
|
|
@ -42,10 +42,10 @@
|
|||
</style>
|
||||
|
||||
<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:textAllCaps">false</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:letterSpacing">0.0125</item>
|
||||
</style>
|
||||
|
||||
<style name="ToolbarSubTitleTextAppearance">
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
<item name="colorSecondary">@color/lightColorSecondary</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="colorOnSecondary">@color/mi_text_color_secondary_light</item>
|
||||
<item name="colorSecondaryVariant">@color/md_green_A700</item>
|
||||
|
|
|
@ -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);
|
||||
for (int i = 0; i < toolbar.getChildCount(); i++) {
|
||||
final View backButton = toolbar.getChildAt(i);
|
||||
if (backButton instanceof ImageView) {
|
||||
((ImageView) backButton).getDrawable().setColorFilter(colorFilter);
|
||||
} else if (backButton instanceof TextView) {
|
||||
// ((TextView) backButton).setTextColor(color);
|
||||
// ((TextView) backButton).setTextColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue