6.6.2 - Alpha6 - 主题色颜色详情支持使用调色盘直接引用
This commit is contained in:
@@ -28,6 +28,7 @@ class ScreenCapturerForegroundService : Service() {
|
|||||||
override fun onBind(intent: Intent): IBinder = Binder()
|
override fun onBind(intent: Intent): IBinder = Binder()
|
||||||
|
|
||||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||||
|
instance = this
|
||||||
mForegroundServiceCreator = ForegroundServiceCreator.Builder(this)
|
mForegroundServiceCreator = ForegroundServiceCreator.Builder(this)
|
||||||
.setClassName(ScreenCapturerForegroundService::class.java)
|
.setClassName(ScreenCapturerForegroundService::class.java)
|
||||||
.setIntent(
|
.setIntent(
|
||||||
@@ -51,11 +52,20 @@ class ScreenCapturerForegroundService : Service() {
|
|||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
mForegroundServiceCreator?.stopForeground(STOP_FOREGROUND_REMOVE)
|
mForegroundServiceCreator?.stopForeground(STOP_FOREGROUND_REMOVE)
|
||||||
|
instance = null
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val NOTIFICATION_ID = 0xCF
|
const val NOTIFICATION_ID = 0xCF
|
||||||
|
|
||||||
|
var instance: ScreenCapturerForegroundService? = null
|
||||||
|
|
||||||
|
fun stopService() {
|
||||||
|
instance?.stopSelf()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.widget.TextView
|
|||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import com.afollestad.materialdialogs.DialogAction
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -22,7 +23,12 @@ import org.autojs.autojs6.databinding.ColorInfoDialogListItemBinding
|
|||||||
object ColorInfoDialogManager {
|
object ColorInfoDialogManager {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun showColorInfoDialog(context: Context, @ColorInt color: Int?, title: String? = null) {
|
fun showColorInfoDialog(
|
||||||
|
context: Context,
|
||||||
|
@ColorInt color: Int?,
|
||||||
|
title: String? = null,
|
||||||
|
customNeutral: CustomColorInfoDialogNeutral? = null,
|
||||||
|
) {
|
||||||
if (color == null) {
|
if (color == null) {
|
||||||
MaterialDialog.Builder(context)
|
MaterialDialog.Builder(context)
|
||||||
.title(R.string.text_prompt)
|
.title(R.string.text_prompt)
|
||||||
@@ -36,12 +42,21 @@ object ColorInfoDialogManager {
|
|||||||
|
|
||||||
val colorWithoutAlpha = color or -0x1000000
|
val colorWithoutAlpha = color or -0x1000000
|
||||||
|
|
||||||
val dialog = MaterialDialog.Builder(context)
|
val dialog = MaterialDialog.Builder(context).apply {
|
||||||
.title(title ?: context.getString(R.string.dialog_title_color_details))
|
title(title ?: context.getString(R.string.dialog_title_color_details))
|
||||||
.customView(binding.root, false)
|
customView(binding.root, false)
|
||||||
.positiveText(R.string.dialog_button_dismiss)
|
customNeutral?.let { neutral ->
|
||||||
.positiveColorRes(R.color.dialog_button_default)
|
neutral.textRes?.let(::neutralText)
|
||||||
.show()
|
neutral.colorRes?.let(::neutralColorRes)
|
||||||
|
neutral.onNeutralCallback?.let {
|
||||||
|
onNeutral { dialog, which ->
|
||||||
|
it.onClick(dialog, which, colorWithoutAlpha)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
positiveText(R.string.dialog_button_dismiss)
|
||||||
|
positiveColorRes(R.color.dialog_button_default)
|
||||||
|
}.show()
|
||||||
|
|
||||||
title?.run { dialog.makeTextCopyable { it.titleView } }
|
title?.run { dialog.makeTextCopyable { it.titleView } }
|
||||||
|
|
||||||
@@ -98,4 +113,14 @@ object ColorInfoDialogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class CustomColorInfoDialogNeutral(
|
||||||
|
val textRes: Int? = null,
|
||||||
|
val colorRes: Int? = null,
|
||||||
|
val onNeutralCallback: NeutralButtonCallback? = null,
|
||||||
|
) {
|
||||||
|
interface NeutralButtonCallback {
|
||||||
|
fun onClick(dialog: MaterialDialog, which: DialogAction, @ColorInt color: Int)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -52,24 +52,17 @@ class ColorItemAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateSelectedPosition(item: PresetColorItem, positionOfCurrentSelection: Int) {
|
private fun updateSelectedPosition(item: PresetColorItem, positionOfCurrentSelection: Int) {
|
||||||
when (selectedItemId) {
|
if (selectedItemId != SELECT_NONE) {
|
||||||
SELECT_NONE -> {
|
val positionBeforeSelection = items.indexOfFirst {
|
||||||
selectedLibraryId = item.libraryId
|
it.libraryId == selectedLibraryId && it.itemId == selectedItemId
|
||||||
selectedItemId = item.itemId
|
|
||||||
notifyItemChanged(positionOfCurrentSelection)
|
|
||||||
}
|
}
|
||||||
else -> {
|
if (positionBeforeSelection != positionOfCurrentSelection && positionBeforeSelection >= 0) {
|
||||||
val positionBeforeSelection = items.indexOfFirst {
|
notifyItemChanged(positionBeforeSelection)
|
||||||
it.libraryId == selectedLibraryId && it.itemId == selectedItemId
|
|
||||||
}
|
|
||||||
if (positionBeforeSelection != positionOfCurrentSelection && positionBeforeSelection >= 0) {
|
|
||||||
notifyItemChanged(positionBeforeSelection)
|
|
||||||
}
|
|
||||||
selectedLibraryId = item.libraryId
|
|
||||||
selectedItemId = item.itemId
|
|
||||||
notifyItemChanged(positionOfCurrentSelection)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
selectedLibraryId = item.libraryId
|
||||||
|
selectedItemId = item.itemId
|
||||||
|
notifyItemChanged(positionOfCurrentSelection)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun savePrefsAndDatabase(context: Context, item: PresetColorItem) {
|
private fun savePrefsAndDatabase(context: Context, item: PresetColorItem) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import androidx.annotation.ColorInt
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import org.autojs.autojs.theme.ThemeColorHelper
|
import org.autojs.autojs.theme.ThemeColorHelper
|
||||||
|
import org.autojs.autojs.theme.ThemeColorManager
|
||||||
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.PresetColorItem
|
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.PresetColorItem
|
||||||
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.presetColorLibraries
|
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.presetColorLibraries
|
||||||
import org.autojs.autojs.util.ViewUtils
|
import org.autojs.autojs.util.ViewUtils
|
||||||
@@ -37,13 +38,17 @@ class ColorItemViewHolder(itemViewBinding: MtColorLibraryRecyclerViewItemBinding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
subtitleSplitLineView.isVisible = !colorLibraryIdentifierView.text.isNullOrBlank()
|
subtitleSplitLineView.isVisible = !colorLibraryIdentifierView.text.isNullOrBlank()
|
||||||
setChecked(color, selectedLibraryId == item.libraryId && selectedItemId == item.itemId)
|
setChecked(selectedLibraryId == item.libraryId && selectedItemId == item.itemId, color)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setChecked(@ColorInt color: Int, checked: Boolean) {
|
fun setChecked(checked: Boolean, @ColorInt refColor: Int? = null) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
|
val niceRefColor = refColor ?: ThemeColorManager.colorPrimary
|
||||||
|
val tintRes = when (ViewUtils.isLuminanceLight(niceRefColor)) {
|
||||||
|
true -> R.color.day
|
||||||
|
else -> R.color.night
|
||||||
|
}
|
||||||
colorView.setImageResource(R.drawable.mt_ic_check_white_36dp)
|
colorView.setImageResource(R.drawable.mt_ic_check_white_36dp)
|
||||||
val tintRes = if (ViewUtils.isLuminanceLight(color)) R.color.day else R.color.night
|
|
||||||
colorView.imageTintList = ColorStateList.valueOf(context.getColor(tintRes))
|
colorView.imageTintList = ColorStateList.valueOf(context.getColor(tintRes))
|
||||||
} else {
|
} else {
|
||||||
colorView.setImageDrawable(null)
|
colorView.setImageDrawable(null)
|
||||||
|
|||||||
@@ -52,15 +52,24 @@ class ColorItemsActivity : ColorSelectBaseActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
ThemeChangeNotifier.themeChanged.observe(this) {
|
ThemeChangeNotifier.themeChanged.observe(this) {
|
||||||
|
mAdapter.apply {
|
||||||
|
val positionBeforeSelection = items.indexOfFirst {
|
||||||
|
it.libraryId == selectedLibraryId && it.itemId == selectedItemId
|
||||||
|
}
|
||||||
|
setUpSelectedPosition(this)
|
||||||
|
if (positionBeforeSelection in items.indices) {
|
||||||
|
notifyItemChanged(positionBeforeSelection)
|
||||||
|
}
|
||||||
|
}
|
||||||
updateClickListener(binding.toolbar)
|
updateClickListener(binding.toolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
val libraryId = intent.getIntExtra(INTENT_IDENTIFIER_LIBRARY_ID, -1)
|
val libraryId = intent.getIntExtra(INTENT_IDENTIFIER_LIBRARY_ID, SELECT_NONE)
|
||||||
val library = presetColorLibraries.find { it.id == libraryId }?.also { lib ->
|
val library = presetColorLibraries.find { it.id == libraryId }?.also { lib ->
|
||||||
mLibrary = lib
|
mLibrary = lib
|
||||||
} ?: throw RuntimeException("Unknown library id: $libraryId")
|
} ?: throw RuntimeException("Unknown library id: $libraryId")
|
||||||
|
|
||||||
mInitiallyItemIdScrollTo = intent.getIntExtra(INTENT_IDENTIFIER_COLOR_ITEM_ID_SCROLL_TO, -1)
|
mInitiallyItemIdScrollTo = intent.getIntExtra(INTENT_IDENTIFIER_COLOR_ITEM_ID_SCROLL_TO, SELECT_NONE)
|
||||||
|
|
||||||
MtActivityColorItemsBinding.inflate(layoutInflater).let {
|
MtActivityColorItemsBinding.inflate(layoutInflater).let {
|
||||||
binding = it
|
binding = it
|
||||||
@@ -76,9 +85,7 @@ class ColorItemsActivity : ColorSelectBaseActivity() {
|
|||||||
|
|
||||||
binding.colorItemsRecyclerView.let { it ->
|
binding.colorItemsRecyclerView.let { it ->
|
||||||
it.layoutManager = LinearLayoutManager(this)
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
it.adapter = ColorItemAdapter(library.colors) {
|
it.adapter = ColorItemAdapter(library.colors).also { mAdapter = it }
|
||||||
updateAppBarColorContent(ThemeColorManager.colorPrimary)
|
|
||||||
}.also { mAdapter = it }
|
|
||||||
|
|
||||||
it.addItemDecoration(DividerItemDecoration(this, VERTICAL))
|
it.addItemDecoration(DividerItemDecoration(this, VERTICAL))
|
||||||
ViewUtils.excludePaddingClippableViewFromNavigationBar(it)
|
ViewUtils.excludePaddingClippableViewFromNavigationBar(it)
|
||||||
@@ -110,7 +117,7 @@ class ColorItemsActivity : ColorSelectBaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSelectedPosition(adapter: ColorItemAdapter) {
|
private fun setUpSelectedPosition(adapter: ColorItemAdapter) {
|
||||||
when (Pref.getInt(KEY_SELECTED_COLOR_LIBRARY_ID, SELECT_NONE)) {
|
when (val prefLibraryId = Pref.getInt(KEY_SELECTED_COLOR_LIBRARY_ID, SELECT_NONE)) {
|
||||||
SELECT_NONE -> when (val legacyIndex = Pref.getInt(KEY_LEGACY_SELECTED_COLOR_INDEX, SELECT_NONE)) {
|
SELECT_NONE -> when (val legacyIndex = Pref.getInt(KEY_LEGACY_SELECTED_COLOR_INDEX, SELECT_NONE)) {
|
||||||
customColorPosition -> Unit
|
customColorPosition -> Unit
|
||||||
SELECT_NONE, defaultColorPosition -> when (mLibrary.id) {
|
SELECT_NONE, defaultColorPosition -> when (mLibrary.id) {
|
||||||
@@ -131,6 +138,10 @@ class ColorItemsActivity : ColorSelectBaseActivity() {
|
|||||||
adapter.selectedLibraryId = mLibrary.id
|
adapter.selectedLibraryId = mLibrary.id
|
||||||
adapter.selectedItemId = Pref.getInt(KEY_SELECTED_COLOR_ITEM_ID, SELECT_NONE)
|
adapter.selectedItemId = Pref.getInt(KEY_SELECTED_COLOR_ITEM_ID, SELECT_NONE)
|
||||||
}
|
}
|
||||||
|
else -> {
|
||||||
|
adapter.selectedLibraryId = prefLibraryId
|
||||||
|
adapter.selectedItemId = SELECT_NONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ class ColorLibrariesActivity : ColorSelectBaseActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
ThemeChangeNotifier.themeChanged.observe(this) {
|
ThemeChangeNotifier.themeChanged.observe(this) {
|
||||||
updateAppBarColorContent(ThemeColorManager.colorPrimary)
|
|
||||||
libraryAdapter.notifyDataSetChanged()
|
libraryAdapter.notifyDataSetChanged()
|
||||||
colorItemAdapter.notifyDataSetChanged()
|
colorItemAdapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,11 @@ class ColorSelectActivity : ColorSelectBaseActivity() {
|
|||||||
|
|
||||||
private val mOnItemClickListener = object : OnItemClickListener {
|
private val mOnItemClickListener = object : OnItemClickListener {
|
||||||
override fun onItemClick(v: View?, position: Int) {
|
override fun onItemClick(v: View?, position: Int) {
|
||||||
mColorSettingRecyclerView.selectedThemeColor?.let {
|
mColorSettingRecyclerView.selectedColor?.let {
|
||||||
mSelectedPosition = position
|
mSelectedPosition = position
|
||||||
updateAppBarColorContent(it.colorPrimary)
|
if (position == customColorPosition) {
|
||||||
|
isForciblyEnableAppBarColorTransition = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import androidx.recyclerview.widget.DividerItemDecoration
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView.VERTICAL
|
import androidx.recyclerview.widget.RecyclerView.VERTICAL
|
||||||
import androidx.recyclerview.widget.ThemeColorRecyclerView
|
import androidx.recyclerview.widget.ThemeColorRecyclerView
|
||||||
|
import com.afollestad.materialdialogs.DialogAction
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
||||||
@@ -34,6 +35,7 @@ import org.autojs.autojs.theme.app.ColorEntities.ColorHistory
|
|||||||
import org.autojs.autojs.theme.app.ColorEntities.ColorInfo
|
import org.autojs.autojs.theme.app.ColorEntities.ColorInfo
|
||||||
import org.autojs.autojs.theme.app.ColorEntities.PaletteHistory
|
import org.autojs.autojs.theme.app.ColorEntities.PaletteHistory
|
||||||
import org.autojs.autojs.theme.app.ColorHistoryItemViewHolder.Companion.ColorHistoryItem
|
import org.autojs.autojs.theme.app.ColorHistoryItemViewHolder.Companion.ColorHistoryItem
|
||||||
|
import org.autojs.autojs.theme.app.ColorInfoDialogManager.CustomColorInfoDialogNeutral.NeutralButtonCallback
|
||||||
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.COLOR_LIBRARY_ID_DEFAULT
|
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.COLOR_LIBRARY_ID_DEFAULT
|
||||||
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.COLOR_LIBRARY_ID_MATERIAL
|
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.COLOR_LIBRARY_ID_MATERIAL
|
||||||
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.COLOR_LIBRARY_ID_PALETTE
|
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.COLOR_LIBRARY_ID_PALETTE
|
||||||
@@ -83,6 +85,10 @@ abstract class ColorSelectBaseActivity : BaseActivity() {
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
ThemeChangeNotifier.themeChanged.observe(this) {
|
||||||
|
updateAppBarColorContent(ThemeColorManager.colorPrimary)
|
||||||
|
}
|
||||||
|
|
||||||
mTitle = intent.getStringExtra("title") ?: getString(R.string.text_theme_color)
|
mTitle = intent.getStringExtra("title") ?: getString(R.string.text_theme_color)
|
||||||
currentColor = intent.getIntExtra("currentColor", ThemeColorManager.colorPrimary)
|
currentColor = intent.getIntExtra("currentColor", ThemeColorManager.colorPrimary)
|
||||||
|
|
||||||
@@ -238,7 +244,7 @@ abstract class ColorSelectBaseActivity : BaseActivity() {
|
|||||||
return TargetInfoForLocate(targetLibraryId, targetItemIndex)
|
return TargetInfoForLocate(targetLibraryId, targetItemIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun showColorPicker() {
|
protected fun showColorPicker(initialColor: Int? = null) {
|
||||||
ColorPickerDialog.newBuilder()
|
ColorPickerDialog.newBuilder()
|
||||||
.setUseLegacyMode(isLegacyLayout)
|
.setUseLegacyMode(isLegacyLayout)
|
||||||
.setAllowCustom(true)
|
.setAllowCustom(true)
|
||||||
@@ -246,7 +252,7 @@ abstract class ColorSelectBaseActivity : BaseActivity() {
|
|||||||
.setDialogType(ColorPickerDialog.TYPE_CUSTOM)
|
.setDialogType(ColorPickerDialog.TYPE_CUSTOM)
|
||||||
.setShowAlphaSlider(false)
|
.setShowAlphaSlider(false)
|
||||||
.setDialogTitle(R.string.dialog_title_color_palette)
|
.setDialogTitle(R.string.dialog_title_color_palette)
|
||||||
.setColor(customColor)
|
.setColor(initialColor ?: customColor)
|
||||||
.setOldColorPanelOnClickListener { showColorDetails(it.tag as? Int) }
|
.setOldColorPanelOnClickListener { showColorDetails(it.tag as? Int) }
|
||||||
.setNewColorPanelOnClickListener { showColorDetails(it.tag as? Int) }
|
.setNewColorPanelOnClickListener { showColorDetails(it.tag as? Int) }
|
||||||
.setColorHistoriesHandler { showColorPickerHistories(it) }
|
.setColorHistoriesHandler { showColorPickerHistories(it) }
|
||||||
@@ -489,7 +495,17 @@ abstract class ColorSelectBaseActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun showColorDetails(color: Int?, title: String? = null) {
|
protected fun showColorDetails(color: Int?, title: String? = null) {
|
||||||
ColorInfoDialogManager.showColorInfoDialog(this, color, title)
|
val customNeutral = ColorInfoDialogManager.CustomColorInfoDialogNeutral(
|
||||||
|
textRes = R.string.dialog_button_use_palette,
|
||||||
|
colorRes = R.color.dialog_button_hint,
|
||||||
|
onNeutralCallback = object: NeutralButtonCallback{
|
||||||
|
override fun onClick(dialog: MaterialDialog, which: DialogAction, color: Int) {
|
||||||
|
dialog.dismiss()
|
||||||
|
showColorPicker(color)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
ColorInfoDialogManager.showColorInfoDialog(this, color, title, customNeutral)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun showThemeColorDetails() {
|
protected fun showThemeColorDetails() {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import androidx.recyclerview.widget.ThemeColorRecyclerView
|
|||||||
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
||||||
import org.autojs.autojs.core.pref.Pref
|
import org.autojs.autojs.core.pref.Pref
|
||||||
import org.autojs.autojs.theme.ThemeChangeNotifier
|
import org.autojs.autojs.theme.ThemeChangeNotifier
|
||||||
import org.autojs.autojs.theme.ThemeColor
|
|
||||||
import org.autojs.autojs.theme.ThemeColorHelper
|
import org.autojs.autojs.theme.ThemeColorHelper
|
||||||
import org.autojs.autojs.theme.ThemeColorManager
|
import org.autojs.autojs.theme.ThemeColorManager
|
||||||
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.COLOR_LIBRARY_ID_PALETTE
|
import org.autojs.autojs.theme.app.ColorLibrariesActivity.Companion.COLOR_LIBRARY_ID_PALETTE
|
||||||
@@ -46,16 +45,16 @@ class ColorSettingRecyclerView : ThemeColorRecyclerView {
|
|||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle)
|
constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle)
|
||||||
|
|
||||||
|
private val mAdapter: Adapter
|
||||||
private var mOnItemClickListener: ColorSelectBaseActivity.OnItemClickListener? = null
|
private var mOnItemClickListener: ColorSelectBaseActivity.OnItemClickListener? = null
|
||||||
|
|
||||||
private var mSelectedPosition = SELECT_NONE
|
private var mSelectedPosition = SELECT_NONE
|
||||||
|
|
||||||
val selectedThemeColor: ThemeColor?
|
val selectedColor: Int?
|
||||||
get() = when {
|
get() = when {
|
||||||
mSelectedPosition < 0 -> null
|
mSelectedPosition < 0 -> null
|
||||||
mSelectedPosition == customColorPosition -> customColor
|
mSelectedPosition == customColorPosition -> customColor
|
||||||
else -> context.getColor(colorItemsLegacy[mSelectedPosition].first)
|
else -> context.getColor(colorItemsLegacy[mSelectedPosition].first)
|
||||||
}?.let { ThemeColor(it) }
|
}
|
||||||
|
|
||||||
private val customColor: Int
|
private val customColor: Int
|
||||||
get() = Pref.getInt(ColorSelectBaseActivity.KEY_CUSTOM_COLOR, context.getColor(R.color.custom_color_default))
|
get() = Pref.getInt(ColorSelectBaseActivity.KEY_CUSTOM_COLOR, context.getColor(R.color.custom_color_default))
|
||||||
@@ -77,13 +76,12 @@ class ColorSettingRecyclerView : ThemeColorRecyclerView {
|
|||||||
itemId = it.itemId,
|
itemId = it.itemId,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
setSelectedPosition(pos)
|
setSelectedPosition(pos)
|
||||||
mOnItemClickListener?.onItemClick(v, pos)
|
mOnItemClickListener?.onItemClick(v, pos)
|
||||||
|
|
||||||
selectedThemeColor?.colorPrimary?.let { c ->
|
selectedColor?.let { c ->
|
||||||
presetColorLibraries.find { it.isMaterial }!!.colors.find { colorItem ->
|
presetColorLibraries.find { it.isMaterial }!!.colors.find { colorItem ->
|
||||||
context.getColor(colorItem.colorRes) == c
|
context.getColor(colorItem.colorRes) == c
|
||||||
}?.let {
|
}?.let {
|
||||||
@@ -100,25 +98,25 @@ class ColorSettingRecyclerView : ThemeColorRecyclerView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
adapter = Adapter()
|
adapter = Adapter().also { mAdapter = it }
|
||||||
layoutManager = LinearLayoutManager(context)
|
layoutManager = LinearLayoutManager(context)
|
||||||
addItemDecoration(DividerItemDecoration(context, VERTICAL))
|
addItemDecoration(DividerItemDecoration(context, VERTICAL))
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
fun setSelectedPosition(currentPosition: Int) {
|
fun setSelectedPosition(currentPosition: Int) {
|
||||||
if (mSelectedPosition != SELECT_NONE) {
|
if (mSelectedPosition == SELECT_NONE) {
|
||||||
adapter!!.notifyItemChanged(mSelectedPosition)
|
|
||||||
mSelectedPosition = currentPosition
|
mSelectedPosition = currentPosition
|
||||||
adapter!!.notifyItemChanged(currentPosition)
|
mAdapter.notifyDataSetChanged()
|
||||||
} else {
|
} else {
|
||||||
|
mAdapter.notifyItemChanged(mSelectedPosition)
|
||||||
mSelectedPosition = currentPosition
|
mSelectedPosition = currentPosition
|
||||||
adapter!!.notifyDataSetChanged()
|
mAdapter.notifyItemChanged(currentPosition)
|
||||||
}
|
}
|
||||||
savePrefsForLegacy()
|
savePrefsForLegacy()
|
||||||
savePrefsForLibraries()
|
savePrefsForLibraries()
|
||||||
selectedThemeColor?.let {
|
selectedColor?.let {
|
||||||
ThemeColorManager.setThemeColor(it.colorPrimary)
|
ThemeColorManager.setThemeColor(it)
|
||||||
ThemeChangeNotifier.notifyThemeChanged()
|
ThemeChangeNotifier.notifyThemeChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,7 +137,7 @@ class ColorSettingRecyclerView : ThemeColorRecyclerView {
|
|||||||
context.getColor(colorItem.colorRes) == context.getColor(R.color.theme_color_default)
|
context.getColor(colorItem.colorRes) == context.getColor(R.color.theme_color_default)
|
||||||
}?.let { Pref.putInt(KEY_SELECTED_COLOR_ITEM_ID, it.itemId) }
|
}?.let { Pref.putInt(KEY_SELECTED_COLOR_ITEM_ID, it.itemId) }
|
||||||
}
|
}
|
||||||
else -> selectedThemeColor?.colorPrimary?.let { c ->
|
else -> selectedColor?.let { c ->
|
||||||
presetColorLibraries.find { it.isMaterial }!!.colors.find { colorItem ->
|
presetColorLibraries.find { it.isMaterial }!!.colors.find { colorItem ->
|
||||||
context.getColor(colorItem.colorRes) == c
|
context.getColor(colorItem.colorRes) == c
|
||||||
}?.let {
|
}?.let {
|
||||||
@@ -224,7 +222,7 @@ class ColorSettingRecyclerView : ThemeColorRecyclerView {
|
|||||||
fun setChecked(checked: Boolean) {
|
fun setChecked(checked: Boolean) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
colorView.setImageResource(R.drawable.mt_ic_check_white_36dp)
|
colorView.setImageResource(R.drawable.mt_ic_check_white_36dp)
|
||||||
val selectedThemeColorRes = selectedThemeColor?.colorPrimary?.let {
|
val selectedThemeColorRes = selectedColor?.let {
|
||||||
if (ViewUtils.isLuminanceLight(it)) R.color.day else R.color.night
|
if (ViewUtils.isLuminanceLight(it)) R.color.day else R.color.night
|
||||||
} ?: R.color.night_day
|
} ?: R.color.night_day
|
||||||
colorView.imageTintList = ColorStateList.valueOf(context.getColor(selectedThemeColorRes))
|
colorView.imageTintList = ColorStateList.valueOf(context.getColor(selectedThemeColorRes))
|
||||||
|
|||||||
@@ -69,4 +69,10 @@ public class FloatyService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void stopService() {
|
||||||
|
if (instance != null) {
|
||||||
|
instance.stopSelf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,8 +313,8 @@ class MainActivity : BaseActivity(), DelegateHost, HostActivity {
|
|||||||
fun exitCompletely() {
|
fun exitCompletely() {
|
||||||
FloatyWindowManger.hideCircularMenuAndSaveState()
|
FloatyWindowManger.hideCircularMenuAndSaveState()
|
||||||
|
|
||||||
stopService(Intent(this, FloatyService::class.java))
|
FloatyService.stopService()
|
||||||
stopService(Intent(this, ScreenCapturerForegroundService::class.java))
|
ScreenCapturerForegroundService.stopService()
|
||||||
|
|
||||||
AutoJs.instance.scriptEngineService.stopAll()
|
AutoJs.instance.scriptEngineService.stopAll()
|
||||||
|
|
||||||
|
|||||||
@@ -963,5 +963,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">السماح للتطبيق بالوصول إلى جميع الملفات، بما في ذلك التخزين الخارجي</string>
|
<string name="summary_all_files_access_inrt">السماح للتطبيق بالوصول إلى جميع الملفات، بما في ذلك التخزين الخارجي</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">السماح للتطبيق بعرض المحتوى فوق التطبيقات الأخرى</string>
|
<string name="summary_display_over_other_apps_inrt">السماح للتطبيق بعرض المحتوى فوق التطبيقات الأخرى</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">السماح للتطبيق بإنشاء وإرسال الإشعارات</string>
|
<string name="summary_post_notifications_permission_inrt">السماح للتطبيق بإنشاء وإرسال الإشعارات</string>
|
||||||
|
<string name="dialog_button_use_palette">ستخدام اللوحة</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -959,5 +959,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">Allow the application to access all files, including external storage</string>
|
<string name="summary_all_files_access_inrt">Allow the application to access all files, including external storage</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">Allow the application to display content over other apps</string>
|
<string name="summary_display_over_other_apps_inrt">Allow the application to display content over other apps</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">Allow the application to create and send notifications</string>
|
<string name="summary_post_notifications_permission_inrt">Allow the application to create and send notifications</string>
|
||||||
|
<string name="dialog_button_use_palette">Use palette</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -962,5 +962,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">Permitir que la aplicación acceda a todos los archivos, incluido el almacenamiento externo</string>
|
<string name="summary_all_files_access_inrt">Permitir que la aplicación acceda a todos los archivos, incluido el almacenamiento externo</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">Permitir que la aplicación muestre contenido sobre otras aplicaciones</string>
|
<string name="summary_display_over_other_apps_inrt">Permitir que la aplicación muestre contenido sobre otras aplicaciones</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">Permitir que la aplicación cree y envíe notificaciones</string>
|
<string name="summary_post_notifications_permission_inrt">Permitir que la aplicación cree y envíe notificaciones</string>
|
||||||
|
<string name="dialog_button_use_palette">Usar paleta</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -962,5 +962,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">Autoriser l\'application à accéder à tous les fichiers, y compris le stockage externe</string>
|
<string name="summary_all_files_access_inrt">Autoriser l\'application à accéder à tous les fichiers, y compris le stockage externe</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">Autoriser l\'application à afficher du contenu par-dessus d\'autres applications</string>
|
<string name="summary_display_over_other_apps_inrt">Autoriser l\'application à afficher du contenu par-dessus d\'autres applications</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">Autoriser l\'application à créer et envoyer des notifications</string>
|
<string name="summary_post_notifications_permission_inrt">Autoriser l\'application à créer et envoyer des notifications</string>
|
||||||
|
<string name="dialog_button_use_palette">Utiliser la palette</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -962,5 +962,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">アプリが外部ストレージを含むすべてのファイルにアクセスすることを許可する</string>
|
<string name="summary_all_files_access_inrt">アプリが外部ストレージを含むすべてのファイルにアクセスすることを許可する</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">アプリが他のアプリの上にコンテンツを表示することを許可する</string>
|
<string name="summary_display_over_other_apps_inrt">アプリが他のアプリの上にコンテンツを表示することを許可する</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">アプリが通知を作成して送信することを許可する</string>
|
<string name="summary_post_notifications_permission_inrt">アプリが通知を作成して送信することを許可する</string>
|
||||||
|
<string name="dialog_button_use_palette">パレットを使う</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -963,5 +963,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">앱이 외부 저장소를 포함한 모든 파일에 접근할 수 있도록 허용합니다</string>
|
<string name="summary_all_files_access_inrt">앱이 외부 저장소를 포함한 모든 파일에 접근할 수 있도록 허용합니다</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">앱이 다른 애플리케이션 위에 콘텐츠를 표시할 수 있도록 허용합니다</string>
|
<string name="summary_display_over_other_apps_inrt">앱이 다른 애플리케이션 위에 콘텐츠를 표시할 수 있도록 허용합니다</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">앱이 알림을 생성하고 보낼 수 있도록 허용합니다</string>
|
<string name="summary_post_notifications_permission_inrt">앱이 알림을 생성하고 보낼 수 있도록 허용합니다</string>
|
||||||
|
<string name="dialog_button_use_palette">팔레트 사용</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -962,5 +962,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">Разрешить приложению доступ ко всем файлам, включая внешнее хранилище</string>
|
<string name="summary_all_files_access_inrt">Разрешить приложению доступ ко всем файлам, включая внешнее хранилище</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">Разрешить приложению отображать контент поверх других приложений</string>
|
<string name="summary_display_over_other_apps_inrt">Разрешить приложению отображать контент поверх других приложений</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">Разрешить приложению создавать и отправлять уведомления</string>
|
<string name="summary_post_notifications_permission_inrt">Разрешить приложению создавать и отправлять уведомления</string>
|
||||||
|
<string name="dialog_button_use_palette">Использовать палитру</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -960,5 +960,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">允許應用訪問所有文件, 包括外部存儲</string>
|
<string name="summary_all_files_access_inrt">允許應用訪問所有文件, 包括外部存儲</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">允許應用在其他應用之上顯示內容</string>
|
<string name="summary_display_over_other_apps_inrt">允許應用在其他應用之上顯示內容</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">允許應用創建併發送通知</string>
|
<string name="summary_post_notifications_permission_inrt">允許應用創建併發送通知</string>
|
||||||
|
<string name="dialog_button_use_palette">使用調色盤</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -960,5 +960,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">允許應用訪問所有檔案, 包括外部儲存</string>
|
<string name="summary_all_files_access_inrt">允許應用訪問所有檔案, 包括外部儲存</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">允許應用在其他應用之上顯示內容</string>
|
<string name="summary_display_over_other_apps_inrt">允許應用在其他應用之上顯示內容</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">允許應用建立併發送通知</string>
|
<string name="summary_post_notifications_permission_inrt">允許應用建立併發送通知</string>
|
||||||
|
<string name="dialog_button_use_palette">使用調色盤</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -957,5 +957,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">允许应用访问所有文件, 包括外部存储</string>
|
<string name="summary_all_files_access_inrt">允许应用访问所有文件, 包括外部存储</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">允许应用在其他应用之上显示内容</string>
|
<string name="summary_display_over_other_apps_inrt">允许应用在其他应用之上显示内容</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">允许应用创建并发送通知</string>
|
<string name="summary_post_notifications_permission_inrt">允许应用创建并发送通知</string>
|
||||||
|
<string name="dialog_button_use_palette">使用调色盘</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1207,5 +1207,6 @@
|
|||||||
<string name="summary_all_files_access_inrt">Allow the application to access all files, including external storage</string>
|
<string name="summary_all_files_access_inrt">Allow the application to access all files, including external storage</string>
|
||||||
<string name="summary_display_over_other_apps_inrt">Allow the application to display content over other apps</string>
|
<string name="summary_display_over_other_apps_inrt">Allow the application to display content over other apps</string>
|
||||||
<string name="summary_post_notifications_permission_inrt">Allow the application to create and send notifications</string>
|
<string name="summary_post_notifications_permission_inrt">Allow the application to create and send notifications</string>
|
||||||
|
<string name="dialog_button_use_palette">Use palette</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Sun Apr 13 14:00:19 CST 2025
|
#Sun Apr 13 20:26:15 CST 2025
|
||||||
BUILD_TIME=1744524019186
|
BUILD_TIME=1744547175175
|
||||||
COMPILE_SDK_VERSION=35
|
COMPILE_SDK_VERSION=35
|
||||||
JAVA_VERSION=23
|
JAVA_VERSION=23
|
||||||
JAVA_VERSION_MIN_RADICAL=0
|
JAVA_VERSION_MIN_RADICAL=0
|
||||||
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
|
|||||||
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||||
TARGET_SDK_VERSION=35
|
TARGET_SDK_VERSION=35
|
||||||
TARGET_SDK_VERSION_INRT=29
|
TARGET_SDK_VERSION_INRT=29
|
||||||
VERSION_BUILD=3133
|
VERSION_BUILD=3136
|
||||||
VERSION_NAME=6.6.2 Alpha6
|
VERSION_NAME=6.6.2 Alpha6
|
||||||
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user