6.6.2 - Alpha4 - 导航栏设置为透明或半透明以增强视觉体验

This commit is contained in:
SuperMonster003
2025-03-10 23:20:04 +08:00
parent 48326fbc48
commit fc6c912dec
65 changed files with 1033 additions and 820 deletions

View File

@@ -19,6 +19,9 @@
"打包页面支持 Pinyin 库选项", "打包页面支持 Pinyin 库选项",
"打包应用主活动页面优化状态栏背景及文字颜色", "打包应用主活动页面优化状态栏背景及文字颜色",
"控件的文字及图标根据主题色亮度值自动切换合适的颜色", "控件的文字及图标根据主题色亮度值自动切换合适的颜色",
"应用内页面导航栏设置为透明或半透明以增强视觉体验",
"长按应用主页 \"文件\" 标签可切换浮动按钮可见状态",
"日志页面浮动按钮可见状态与列表滚动操作联动",
"脚本项目配置文件 project.json 支持更多打包选项 _[`issue #305`](http://issues.autojs6.com/305)_ _[`issue #306`](http://issues.autojs6.com/306)_", "脚本项目配置文件 project.json 支持更多打包选项 _[`issue #305`](http://issues.autojs6.com/305)_ _[`issue #306`](http://issues.autojs6.com/306)_",
"脚本项目配置文件 project.json 支持选项名称宽松匹配及别名兼容", "脚本项目配置文件 project.json 支持选项名称宽松匹配及别名兼容",
"APK 文件类型信息对话框增加文件大小与签名方案信息", "APK 文件类型信息对话框增加文件大小与签名方案信息",

View File

@@ -149,7 +149,7 @@ open class ApkBuilder(apkInputStream: InputStream?, private val outApkFile: File
prepareManifestConfiguration(this) prepareManifestConfiguration(this)
setArscPackageName(packageName) setArscPackageName(packageName)
updateProjectConfig(this) updateProjectConfig(this)
copyAssetsRecursively("", File(buildDir, "assets")) copyAssetsRecursively("", File(buildPath, "assets"))
copyLibrariesByConfig(this) copyLibrariesByConfig(this)
setScriptFile(sourcePath) setScriptFile(sourcePath)
} }

View File

@@ -26,8 +26,8 @@ import org.autojs.autojs.tool.MapBuilder;
import org.autojs.autojs.ui.enhancedfloaty.ResizableExpandableFloatyWindow; import org.autojs.autojs.ui.enhancedfloaty.ResizableExpandableFloatyWindow;
import org.autojs.autojs.ui.log.LogActivity; import org.autojs.autojs.ui.log.LogActivity;
import org.autojs.autojs.util.DisplayUtils; import org.autojs.autojs.util.DisplayUtils;
import org.autojs.autojs.util.ViewUtils;
import org.autojs.autojs6.R; import org.autojs.autojs6.R;
import org.jetbrains.annotations.NotNull;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
@@ -61,17 +61,17 @@ public class ConsoleView extends FrameLayout implements ConsoleImpl.LogListener
public ConsoleView(Context context) { public ConsoleView(Context context) {
super(context); super(context);
init(null); init(null, 0);
} }
public ConsoleView(Context context, @Nullable AttributeSet attrs) { public ConsoleView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs); super(context, attrs);
init(attrs); init(attrs, 0);
} }
public ConsoleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { public ConsoleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
init(attrs); init(attrs, defStyleAttr);
} }
public Map<Integer, Integer> getTextColors() { public Map<Integer, Integer> getTextColors() {
@@ -79,14 +79,16 @@ public class ConsoleView extends FrameLayout implements ConsoleImpl.LogListener
} }
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
private void init(@Nullable AttributeSet attrs) { private void init(@Nullable AttributeSet attrs, int defStyleAttr) {
inflate(getContext(), R.layout.console_view, this); inflate(getContext(), R.layout.console_view, this);
Map<Integer, Integer> logLevelColorResIdMap = getLogLevelMap(); Map<Integer, Integer> logLevelColorResIdMap = getLogLevelMap();
Map<Integer, Integer> logLevelColorIntMap = getLogLevelMap(); Map<Integer, Integer> logLevelColorIntMap = getLogLevelMap();
boolean isExcludeFromNavigationBar = false;
if (attrs != null) { if (attrs != null) {
TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.ConsoleView); TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.ConsoleView, defStyleAttr, 0);
logLevelColorIntMap.put(Log.VERBOSE, ta.getColor(R.styleable.ConsoleView_color_verbose, Color.TRANSPARENT)); logLevelColorIntMap.put(Log.VERBOSE, ta.getColor(R.styleable.ConsoleView_color_verbose, Color.TRANSPARENT));
logLevelColorIntMap.put(Log.DEBUG, ta.getColor(R.styleable.ConsoleView_color_debug, Color.TRANSPARENT)); logLevelColorIntMap.put(Log.DEBUG, ta.getColor(R.styleable.ConsoleView_color_debug, Color.TRANSPARENT));
@@ -95,6 +97,8 @@ public class ConsoleView extends FrameLayout implements ConsoleImpl.LogListener
logLevelColorIntMap.put(Log.ERROR, ta.getColor(R.styleable.ConsoleView_color_error, Color.TRANSPARENT)); logLevelColorIntMap.put(Log.ERROR, ta.getColor(R.styleable.ConsoleView_color_error, Color.TRANSPARENT));
logLevelColorIntMap.put(Log.ASSERT, ta.getColor(R.styleable.ConsoleView_color_assert, Color.TRANSPARENT)); logLevelColorIntMap.put(Log.ASSERT, ta.getColor(R.styleable.ConsoleView_color_assert, Color.TRANSPARENT));
isExcludeFromNavigationBar = ta.getBoolean(R.styleable.ConsoleView_excludeFromNavigationBar, false);
ta.recycle(); ta.recycle();
} }
@@ -128,6 +132,10 @@ public class ConsoleView extends FrameLayout implements ConsoleImpl.LogListener
initEditText(); initEditText();
initSubmitButton(); initSubmitButton();
if (isExcludeFromNavigationBar) {
ViewUtils.excludePaddingClippableViewFromNavigationBar(mLogListRecyclerView);
}
} }
@NonNull @NonNull

View File

@@ -288,7 +288,9 @@ public class RootAutomator implements Shell.Callback {
@Override @Override
public void onInitialized() { public void onInitialized() {
String path = RootAutomatorEngine.getExecutablePath(mContext); String path = RootAutomatorEngine.getExecutablePath(mContext);
String deviceNameOrPath = RootAutomatorEngine.getDeviceNameOrPath(mContext, InputDevices.getTouchDeviceName()); // @Reference to ozobiozobi (https://github.com/ozobiozobi) by SuperMonster003 on Mar 10, 2025.
// ! https://github.com/aiselp/AutoX/commit/8fe5d674f080c0ab109ce13f7cabd98795c22a1f#diff-dc753defa5bc4d7d6fab4f2e59a219ce7b89d7bcff2c9585f87c96964081ad72R290-R291
String deviceNameOrPath = "'" + RootAutomatorEngine.getDeviceNameOrPath(mContext, InputDevices.getTouchDeviceName()) + "'";
Log.d(LOG_TAG, "deviceNameOrPath: " + deviceNameOrPath); Log.d(LOG_TAG, "deviceNameOrPath: " + deviceNameOrPath);
mShell.exec("chmod 777 " + path); mShell.exec("chmod 777 " + path);
String command = String.format(Locale.getDefault(), String command = String.format(Locale.getDefault(),

View File

@@ -28,4 +28,5 @@ public class PermissionRequestActivity extends Activity {
super.onRequestPermissionsResult(requestCode, permissions, grantResults); super.onRequestPermissionsResult(requestCode, permissions, grantResults);
finish(); finish();
} }
} }

View File

@@ -6,6 +6,7 @@ import org.autojs.autojs.core.ui.inflater.ResourceParser
import org.autojs.autojs.core.ui.inflater.util.Dimensions import org.autojs.autojs.core.ui.inflater.util.Dimensions
import org.autojs.autojs.runtime.ScriptRuntime import org.autojs.autojs.runtime.ScriptRuntime
import org.autojs.autojs.util.ColorUtils import org.autojs.autojs.util.ColorUtils
import org.autojs.autojs.util.ViewUtils
/** /**
* Modified by SuperMonster003 as of Jan 21, 2023. * Modified by SuperMonster003 as of Jan 21, 2023.
@@ -26,6 +27,7 @@ open class FloatingActionButtonAttributes(scriptRuntime: ScriptRuntime, resource
registerAttrs(arrayOf("backgroundTint", "bgTint")) { view.backgroundTintList = ColorUtils.toColorStateList(view, it) } registerAttrs(arrayOf("backgroundTint", "bgTint")) { view.backgroundTintList = ColorUtils.toColorStateList(view, it) }
registerAttr("ensureMinTouchTargetSize") { view.setEnsureMinTouchTargetSize(it.toBoolean()) } registerAttr("ensureMinTouchTargetSize") { view.setEnsureMinTouchTargetSize(it.toBoolean()) }
registerAttr("maxImageSize") { view.setMaxImageSize(it.toInt()) } registerAttr("maxImageSize") { view.setMaxImageSize(it.toInt()) }
registerAttr("excludeFromNavigationBar") { ViewUtils.excludeFloatingActionButtonFromNavigationBar(view) }
} }
} }

View File

@@ -40,6 +40,7 @@ class TaskPrefEditActivity : AbstractAppCompatPluginActivity() {
binding.editScript.setOnClickListener { editPreExecuteScript() } binding.editScript.setOnClickListener { editPreExecuteScript() }
ViewUtils.setToolbarAsBack(this, R.string.text_please_choose_a_script) ViewUtils.setToolbarAsBack(this, R.string.text_please_choose_a_script)
ViewUtils.excludePaddingClippableViewFromNavigationBar(binding.scriptList)
initScriptListRecyclerView() initScriptListRecyclerView()
} }

View File

@@ -6,12 +6,14 @@ import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import org.autojs.autojs.model.explorer.Explorer; import org.autojs.autojs.model.explorer.Explorer;
import org.autojs.autojs.model.explorer.ExplorerDirPage; import org.autojs.autojs.model.explorer.ExplorerDirPage;
import org.autojs.autojs.model.explorer.ExplorerFileProvider; import org.autojs.autojs.model.explorer.ExplorerFileProvider;
import org.autojs.autojs.model.script.Scripts; import org.autojs.autojs.model.script.Scripts;
import org.autojs.autojs.ui.BaseActivity; import org.autojs.autojs.ui.BaseActivity;
import org.autojs.autojs.ui.explorer.ExplorerView; import org.autojs.autojs.ui.explorer.ExplorerView;
import org.autojs.autojs.util.ViewUtils;
import org.autojs.autojs.util.WorkingDirectoryUtils; import org.autojs.autojs.util.WorkingDirectoryUtils;
import org.autojs.autojs6.R; import org.autojs.autojs6.R;
import org.autojs.autojs6.databinding.ActivityScriptWidgetSettingsBinding; import org.autojs.autojs6.databinding.ActivityScriptWidgetSettingsBinding;
@@ -38,6 +40,10 @@ public class ScriptWidgetSettingsActivity extends BaseActivity {
initScriptListRecyclerView(); initScriptListRecyclerView();
} }
private void setUpToolbarColors() {
ViewUtils.setToolbarMenuIconsColorByThemeColorLuminance(this, binding.toolbar);
}
private void initScriptListRecyclerView() { private void initScriptListRecyclerView() {
mExplorer = new Explorer(new ExplorerFileProvider(Scripts.FILE_FILTER), 0); mExplorer = new Explorer(new ExplorerFileProvider(Scripts.FILE_FILTER), 0);
ExplorerView explorerView = binding.scriptList; ExplorerView explorerView = binding.scriptList;
@@ -47,6 +53,10 @@ public class ScriptWidgetSettingsActivity extends BaseActivity {
mSelectedScriptFilePath = file.getPath(); mSelectedScriptFilePath = file.getPath();
finish(); finish();
}); });
RecyclerView explorerItemListView = explorerView.getExplorerItemListView();
if (explorerItemListView != null) {
ViewUtils.excludePaddingClippableViewFromNavigationBar(explorerItemListView);
}
} }
@Override @Override
@@ -62,6 +72,7 @@ public class ScriptWidgetSettingsActivity extends BaseActivity {
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.script_widget_settings_menu, menu); getMenuInflater().inflate(R.menu.script_widget_settings_menu, menu);
setUpToolbarColors();
return true; return true;
} }

View File

@@ -5,13 +5,12 @@ import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import androidx.appcompat.widget.Toolbar
import org.autojs.autojs.core.console.ConsoleImpl import org.autojs.autojs.core.console.ConsoleImpl
import org.autojs.autojs.core.console.ConsoleView
import org.autojs.autojs.inrt.autojs.AutoJs import org.autojs.autojs.inrt.autojs.AutoJs
import org.autojs.autojs.inrt.launch.GlobalProjectLauncher import org.autojs.autojs.inrt.launch.GlobalProjectLauncher
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.ActivityMainInrtBinding
class LogActivity : BaseActivity() { class LogActivity : BaseActivity() {
@@ -24,12 +23,16 @@ class LogActivity : BaseActivity() {
} }
private fun setupView() { private fun setupView() {
setContentView(R.layout.activity_main_inrt) ActivityMainInrtBinding.inflate(layoutInflater).also { binding ->
val toolbar = findViewById<Toolbar>(R.id.toolbar) setContentView(binding.root)
setSupportActionBar(toolbar) binding.toolbar.apply {
val consoleView = findViewById<ConsoleView>(R.id.console) setSupportActionBar(this)
consoleView.setConsole(AutoJs.instance.globalConsole as ConsoleImpl) }
consoleView.findViewById<View>(R.id.input_container).visibility = View.GONE binding.console.apply {
setConsole(AutoJs.instance.globalConsole as ConsoleImpl)
findViewById<View>(R.id.input_container).visibility = View.GONE
}
}
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
@@ -47,4 +50,5 @@ class LogActivity : BaseActivity() {
const val EXTRA_LAUNCH_SCRIPT = "launch_script" const val EXTRA_LAUNCH_SCRIPT = "launch_script"
} }
} }

View File

@@ -2,8 +2,8 @@ package org.autojs.autojs.inrt
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.ActivitySettingsInrtBinding
/** /**
* Created by Stardust on Dec 8, 2017. * Created by Stardust on Dec 8, 2017.
@@ -13,16 +13,16 @@ class SettingsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setupViews() val binding = ActivitySettingsInrtBinding.inflate(layoutInflater).also { setContentView(it.root) }
} supportFragmentManager
.beginTransaction()
private fun setupViews() { .replace(R.id.fragment_setting, PreferenceFragment())
setContentView(R.layout.activity_settings_inrt) .commit()
supportFragmentManager.beginTransaction().replace(R.id.fragment_setting, PreferenceFragment()).commit() binding.toolbar.apply {
val toolbar = findViewById<Toolbar>(R.id.toolbar) setTitle(R.string.text_settings)
toolbar.setTitle(R.string.text_settings) setSupportActionBar(this)
setSupportActionBar(toolbar) setNavigationOnClickListener { finish() }
toolbar.setNavigationOnClickListener { finish() } }
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
} }

View File

@@ -59,6 +59,9 @@ class Classes {
@JvmField @JvmField
val Settings = android.provider.Settings::class val Settings = android.provider.Settings::class
@JvmField
val TextToSpeech = android.speech.tts.TextToSpeech::class
@JvmField @JvmField
val InputType = android.text.InputType::class val InputType = android.text.InputType::class

View File

@@ -1,8 +1,6 @@
package org.autojs.autojs.runtime.api.augment.global package org.autojs.autojs.runtime.api.augment.global
import org.autojs.autojs.annotation.AugmentableSimpleGetterProxyInterface import org.autojs.autojs.annotation.AugmentableSimpleGetterProxyInterface
import org.autojs.autojs.annotation.RhinoStandardFunctionInterface
import org.autojs.autojs.runtime.ScriptRuntime
import org.autojs.autojs.runtime.api.augment.SimpleGetterProxy import org.autojs.autojs.runtime.api.augment.SimpleGetterProxy
import org.mozilla.javascript.NativeJavaClass import org.mozilla.javascript.NativeJavaClass
import org.mozilla.javascript.Scriptable import org.mozilla.javascript.Scriptable

View File

@@ -1,6 +1,7 @@
package org.autojs.autojs.theme package org.autojs.autojs.theme
import android.app.Activity import android.app.Activity
import android.content.Context
import android.graphics.Paint import android.graphics.Paint
import android.view.View import android.view.View
import org.autojs.autojs.util.ColorUtils import org.autojs.autojs.util.ColorUtils
@@ -76,6 +77,12 @@ object ThemeColorManager {
currentThemeColor.saveIn() currentThemeColor.saveIn()
} }
@JvmStatic
fun getDayOrNightColorByLuminance(context: Context): Int = context.getColor(getDayOrNightColorResByLuminance())
@JvmStatic
fun getDayOrNightColorResByLuminance(): Int = if (isThemeColorLuminanceLight()) R.color.day else R.color.night
private object BackgroundColorManager { private object BackgroundColorManager {
private val views: MutableList<WeakReference<View>> = LinkedList() private val views: MutableList<WeakReference<View>> = LinkedList()

View File

@@ -50,6 +50,7 @@ class ColorSelectActivity : BaseActivity() {
handleIntent() handleIntent()
binding = MtActivityColorSelectBinding.inflate(layoutInflater).also { binding = MtActivityColorSelectBinding.inflate(layoutInflater).also {
setUpUI(it) setUpUI(it)
ViewUtils.excludePaddingClippableViewFromNavigationBar(it.colorSettingRecyclerView)
} }
} }

View File

@@ -16,6 +16,7 @@ import org.autojs.autojs6.R;
* Created by Stardust on Aug 16, 2016. * Created by Stardust on Aug 16, 2016.
*/ */
public class ThemeColorFloatingActionButton extends FloatingActionButton implements ThemeColorMutable { public class ThemeColorFloatingActionButton extends FloatingActionButton implements ThemeColorMutable {
public ThemeColorFloatingActionButton(Context context) { public ThemeColorFloatingActionButton(Context context) {
super(context); super(context);
init(); init();

View File

@@ -1,7 +1,6 @@
package org.autojs.autojs.theme.widget; package org.autojs.autojs.theme.widget;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@@ -49,15 +48,8 @@ public class ThemeColorToolbar extends Toolbar implements ThemeColorMutable {
int colorPrimary = color.colorPrimary; int colorPrimary = color.colorPrimary;
setBackgroundColor(colorPrimary); setBackgroundColor(colorPrimary);
int aimColor; int aimColor = ThemeColorManager.getDayOrNightColorByLuminance(getContext());
int popupTheme; int popupTheme = ThemeColorManager.isThemeColorLuminanceLight() ? R.style.PopupMenuThemeLight : R.style.PopupMenuThemeDark;
if (ThemeColorManager.isThemeColorLuminanceLight()) {
aimColor = getResources().getColor(R.color.day, null);
popupTheme = R.style.PopupMenuThemeLight;
} else {
aimColor = getResources().getColor(R.color.night, null);
popupTheme = R.style.PopupMenuThemeDark;
}
setTitleTextColor(aimColor); setTitleTextColor(aimColor);
setSubtitleTextColor(aimColor); setSubtitleTextColor(aimColor);

View File

@@ -5,8 +5,8 @@ package org.autojs.autojs.ui
import android.content.Context import android.content.Context
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.View
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN import android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE import android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE
import android.view.WindowManager import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
@@ -18,6 +18,7 @@ import org.autojs.autojs.theme.ThemeColorManager
import org.autojs.autojs.util.LocaleUtils import org.autojs.autojs.util.LocaleUtils
import org.autojs.autojs.util.ViewUtils import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.BuildConfig import org.autojs.autojs6.BuildConfig
import org.autojs.autojs6.R
/** /**
* Created by Stardust on Jan 23, 2017. * Created by Stardust on Jan 23, 2017.
@@ -26,14 +27,21 @@ import org.autojs.autojs6.BuildConfig
abstract class BaseActivity : AppCompatActivity() { abstract class BaseActivity : AppCompatActivity() {
open val handleStatusBarThemeColorAutomatically = true open val handleStatusBarThemeColorAutomatically = true
open val handleNavigationBarContrastEnforcedAutomatically = true
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@Suppress("DEPRECATION") ViewUtils.addWindowFlags(this, WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
ViewUtils.appendSystemUiVisibility(this, SYSTEM_UI_FLAG_LAYOUT_STABLE or SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) @Suppress("DEPRECATION")
ViewUtils.appendSystemUiVisibility(this, SYSTEM_UI_FLAG_LAYOUT_STABLE or SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
if (handleNavigationBarContrastEnforcedAutomatically) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
window.navigationBarColor = getColor(R.color.black_alpha_44)
}
}
setApplicationLocale(this) setApplicationLocale(this)

View File

@@ -14,6 +14,7 @@ import org.autojs.autojs.ui.main.ViewPagerFragment
import org.autojs.autojs.ui.main.ViewStatesManageable import org.autojs.autojs.ui.main.ViewStatesManageable
import org.autojs.autojs.ui.widget.NestedWebView import org.autojs.autojs.ui.widget.NestedWebView
import org.autojs.autojs.util.DocsUtils.getUrl import org.autojs.autojs.util.DocsUtils.getUrl
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs.util.WebViewUtils.Companion.adaptDarkMode import org.autojs.autojs.util.WebViewUtils.Companion.adaptDarkMode
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.FragmentOnlineDocsBinding import org.autojs.autojs6.databinding.FragmentOnlineDocsBinding
@@ -51,6 +52,7 @@ open class DocumentationFragment : ViewPagerFragment(ROTATION_GONE), BackPressed
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
webView = binding!!.ewebView.webView.also { webView = binding!!.ewebView.webView.also {
adaptDarkMode(requireContext(), it) adaptDarkMode(requireContext(), it)
ViewUtils.excludePaddingClippableViewFromNavigationBar(it)
} }
restoreViewStates() restoreViewStates()
(activity as? MainActivity)?.apply { (activity as? MainActivity)?.apply {

View File

@@ -10,6 +10,7 @@ import android.util.Log
import android.view.ActionMode import android.view.ActionMode
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import androidx.appcompat.widget.Toolbar
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
@@ -21,10 +22,10 @@ import org.autojs.autojs.core.permission.PermissionRequestProxyActivity
import org.autojs.autojs.core.permission.RequestPermissionCallbacks import org.autojs.autojs.core.permission.RequestPermissionCallbacks
import org.autojs.autojs.pio.PFiles import org.autojs.autojs.pio.PFiles
import org.autojs.autojs.storage.file.TmpScriptFiles import org.autojs.autojs.storage.file.TmpScriptFiles
import org.autojs.autojs.theme.ThemeColorManager
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.ui.main.MainActivity import org.autojs.autojs.ui.main.MainActivity
import org.autojs.autojs.util.Observers import org.autojs.autojs.util.Observers
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.ActivityEditBinding import org.autojs.autojs6.databinding.ActivityEditBinding
import java.io.File import java.io.File
@@ -36,6 +37,7 @@ import java.io.IOException
*/ */
open class EditActivity : BaseActivity(), DelegateHost, PermissionRequestProxyActivity { open class EditActivity : BaseActivity(), DelegateHost, PermissionRequestProxyActivity {
private var mToolbar: Toolbar? = null
private val mMediator = OnActivityResultDelegate.Mediator() private val mMediator = OnActivityResultDelegate.Mediator()
private lateinit var mEditorView: EditorView private lateinit var mEditorView: EditorView
@@ -48,20 +50,16 @@ open class EditActivity : BaseActivity(), DelegateHost, PermissionRequestProxyAc
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val binding = ActivityEditBinding.inflate(layoutInflater) val binding = ActivityEditBinding.inflate(layoutInflater).also { setContentView(it.root) }
setContentView(binding.root) mToolbar = findViewById(R.id.toolbar)
mEditorView = binding.editorView.apply { mEditorView = binding.editorView.apply {
handleIntent(intent) handleIntent(intent)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(Observers.emptyConsumer()) { ex: Throwable -> onLoadFileError(ex.message) } .subscribe(Observers.emptyConsumer()) { ex: Throwable -> onLoadFileError(ex.message) }
} }
mEditorMenu = EditorMenu(mEditorView) mEditorMenu = EditorMenu(mEditorView)
mNewTask = intent.flags and Intent.FLAG_ACTIVITY_NEW_TASK != 0 mNewTask = intent.flags and Intent.FLAG_ACTIVITY_NEW_TASK != 0
setUpToolbar() setUpToolbar()
window.statusBarColor = ThemeColorManager.colorPrimary
} }
override fun onWindowStartingActionMode(callback: ActionMode.Callback): ActionMode? { override fun onWindowStartingActionMode(callback: ActionMode.Callback): ActionMode? {
@@ -88,6 +86,7 @@ open class EditActivity : BaseActivity(), DelegateHost, PermissionRequestProxyAc
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_editor, menu) menuInflater.inflate(R.menu.menu_editor, menu)
ViewUtils.setToolbarMenuIconsColorByThemeColorLuminance(this, mToolbar)
return true return true
} }

View File

@@ -1,110 +1,109 @@
package org.autojs.autojs.ui.error; package org.autojs.autojs.ui.error
import android.annotation.SuppressLint; import android.annotation.SuppressLint
import android.content.ClipData; import android.content.ClipData
import android.content.ClipboardManager; import android.content.ClipboardManager
import android.os.Build; import android.content.Context
import android.os.Bundle; import android.content.Intent
import android.util.Log; import android.os.Build
import android.os.Bundle
import androidx.appcompat.widget.Toolbar; import android.util.Log
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.MaterialDialog; import org.autojs.autojs.app.GlobalAppContext
import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.ui.BaseActivity; import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs.util.ViewUtils; import org.autojs.autojs6.BuildConfig
import org.autojs.autojs6.BuildConfig; import org.autojs.autojs6.R
import org.autojs.autojs6.R; import org.autojs.autojs6.databinding.ActivityErrorReportBinding
import java.util.*
import java.util.Locale;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
/** /**
* Created by Stardust on Feb 2, 2017. * Created by Stardust on Feb 2, 2017.
* Transformed by SuperMonster003 on Mar 10, 2025.
*/ */
public class ErrorReportActivity extends BaseActivity { class ErrorReportActivity : BaseActivity() {
private static final String TAG = ErrorReportActivity.class.getSimpleName(); override fun onCreate(savedInstanceState: Bundle?) {
private String mTitle;
protected void onCreate(Bundle savedInstanceState) {
try { try {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState)
mTitle = getString(R.string.text_app_crashed); ActivityErrorReportBinding.inflate(layoutInflater).also { binding ->
setUpUI(); setContentView(binding.root)
handleIntent(); binding.toolbar.apply {
} catch (Throwable throwable) { title = getString(R.string.text_error_report)
Log.e(TAG, "", throwable); setSupportActionBar(this)
exitAfter(3000); }
supportActionBar?.setHomeButtonEnabled(false)
}
} catch (t: Throwable) {
t.message?.let { msg ->
copyToClip(msg)
ViewUtils.showToast(this, msg)
}
Log.e(TAG, t.message ?: "", t)
exitAfter(3000)
}
}
override fun onResume() {
super.onResume()
val message = intent.getStringExtra("message")
val errorDetail = intent.getStringExtra("error")
val errorMessage = buildString {
appendLine("Version: ${BuildConfig.VERSION_CODE}")
appendLine("Android: ${Build.VERSION.SDK_INT}")
message?.let { appendLine().appendLine(it) }
errorDetail?.let { appendLine().appendLine(it) }
}
MaterialDialog.Builder(this)
.title(R.string.text_app_crashed)
.content(R.string.crash_feedback)
.positiveText(R.string.text_exit)
.negativeText(R.string.text_copy_debug_info)
.onPositive { _, _ -> exit() }
.onNegative { _, _ ->
copyToClip(errorMessage)
exitAfter(1500)
}
.cancelable(false)
.show()
}
private fun exitAfter(delay: Int) {
Timer().schedule(object : TimerTask() {
override fun run() = exit()
}, delay.toLong())
}
private fun copyToClip(text: String) {
val clipboardManager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
clipboardManager.setPrimaryClip(ClipData.newPlainText("Debug", text))
ViewUtils.showToast(this, R.string.text_already_copied_to_clip)
}
@Deprecated("Deprecated in Java")
@SuppressLint("MissingSuperCall")
override fun onBackPressed() = exit()
private fun exit() = finishAffinity()
companion object {
private val TAG: String = ErrorReportActivity::class.java.simpleName
@JvmStatic
@JvmOverloads
fun test(context: Context = GlobalAppContext.get()) {
Intent(context, ErrorReportActivity::class.java)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra("message", "Test message\nSecond line")
.putExtra("error", "Test error\nSecond line")
.let { context.startActivity(it) }
} }
} }
private void handleIntent() {
String message = getIntent().getStringExtra("message");
final String errorDetail = getIntent().getStringExtra("error");
showErrorMessageByDialog(message, errorDetail);
}
private void showErrorMessageByDialog(String message, final String errorDetail) {
new MaterialDialog.Builder(this)
.title(mTitle)
.content(R.string.crash_feedback)
.positiveText(R.string.text_exit)
.negativeText(R.string.text_copy_debug_info)
.onPositive((dialog, which) -> exit())
.onNegative((dialog, which) -> {
copyToClip(getDeviceMessage() + message + "\n" + errorDetail);
exitAfter(1500);
})
.cancelable(false)
.show();
}
private String getDeviceMessage() {
return String.format(Locale.getDefault(), "Version: %s\nAndroid: %d\n", BuildConfig.VERSION_CODE, Build.VERSION.SDK_INT);
}
private void exitAfter(int delay) {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
exit();
}
}, delay);
}
private void copyToClip(String text) {
((ClipboardManager) getSystemService(CLIPBOARD_SERVICE))
.setPrimaryClip(ClipData.newPlainText("Debug", text));
ViewUtils.showToast(ErrorReportActivity.this, R.string.text_already_copied_to_clip);
}
private void setUpUI() {
setContentView(R.layout.activity_error_report);
setUpToolbar();
}
private void setUpToolbar() {
Toolbar toolbar;
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(getString(R.string.text_error_report));
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setHomeButtonEnabled(false);
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
exit();
}
private void exit() {
finishAffinity();
}
} }

View File

@@ -107,7 +107,7 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
val currentDirectory: ScriptFile val currentDirectory: ScriptFile
get() = currentPage.toScriptFile() get() = currentPage.toScriptFile()
protected var explorerItemListView: RecyclerView? = null var explorerItemListView: RecyclerView? = null
private set private set
private lateinit var mProjectToolbar: ExplorerProjectToolbar private lateinit var mProjectToolbar: ExplorerProjectToolbar
@@ -717,7 +717,7 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
mFirstChar.setIcon(ExplorerViewHelper.getIcon(item)) mFirstChar.setIcon(ExplorerViewHelper.getIcon(item))
when (item.type) { when (item.type) {
FileUtils.TYPE.JAVASCRIPT, FileUtils.TYPE.AUTO -> mFirstChar FileUtils.TYPE.JAVASCRIPT, FileUtils.TYPE.AUTO -> mFirstChar
.setIconTextByThemeColorLuminance() .setIconTextColorByThemeColorLuminance()
.setStrokeThemeColor() .setStrokeThemeColor()
.setFillThemeColor() .setFillThemeColor()
else -> mFirstChar else -> mFirstChar

View File

@@ -46,7 +46,7 @@ class ExplorerItemViewHolder extends BindableViewHolder<Object> {
switch (explorerItem.getType()) { switch (explorerItem.getType()) {
case JAVASCRIPT, AUTO -> firstCharIconBinding.firstChar case JAVASCRIPT, AUTO -> firstCharIconBinding.firstChar
.setIconTextByThemeColorLuminance() .setIconTextColorByThemeColorLuminance()
.setStrokeThemeColor() .setStrokeThemeColor()
.setFillColorDayNight(); .setFillColorDayNight();
default -> firstCharIconBinding.firstChar default -> firstCharIconBinding.firstChar

View File

@@ -19,11 +19,12 @@ import com.mcal.apksigner.utils.KeyStoreHelper
import org.autojs.autojs.apkbuilder.keystore.AESUtils import org.autojs.autojs.apkbuilder.keystore.AESUtils
import org.autojs.autojs.apkbuilder.keystore.KeyStore import org.autojs.autojs.apkbuilder.keystore.KeyStore
import org.autojs.autojs.core.pref.Pref import org.autojs.autojs.core.pref.Pref
import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.ActivityManageKeyStoreBinding
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.ui.keystore.NewKeyStoreDialog.NewKeyStoreConfigs import org.autojs.autojs.ui.keystore.NewKeyStoreDialog.NewKeyStoreConfigs
import org.autojs.autojs.ui.viewmodel.KeyStoreViewModel import org.autojs.autojs.ui.viewmodel.KeyStoreViewModel
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.ActivityManageKeyStoreBinding
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
@@ -82,8 +83,11 @@ class ManageKeyStoreActivity : BaseActivity() {
keyStoreViewModel = keyStoreViewModel =
ViewModelProvider(this, KeyStoreViewModel.Factory(this))[KeyStoreViewModel::class.java] ViewModelProvider(this, KeyStoreViewModel.Factory(this))[KeyStoreViewModel::class.java]
binding.fab.setOnClickListener { binding.fab.apply {
NewKeyStoreDialog(newKeyStoreDialogCallback).show(supportFragmentManager, null) setOnClickListener {
NewKeyStoreDialog(newKeyStoreDialogCallback).show(supportFragmentManager, null)
}
ViewUtils.excludeFloatingActionButtonFromNavigationBar(this)
} }
keyStoreAdapter = KeyStoreAdaptor(keyStoreAdapterCallback) keyStoreAdapter = KeyStoreAdaptor(keyStoreAdapterCallback)
@@ -91,6 +95,7 @@ class ManageKeyStoreActivity : BaseActivity() {
adapter = keyStoreAdapter adapter = keyStoreAdapter
layoutManager = LinearLayoutManager(this@ManageKeyStoreActivity) layoutManager = LinearLayoutManager(this@ManageKeyStoreActivity)
itemAnimator = DefaultItemAnimator() itemAnimator = DefaultItemAnimator()
ViewUtils.excludePaddingClippableViewFromNavigationBar(this)
} }
binding.swipeRefreshLayout.setOnRefreshListener { binding.swipeRefreshLayout.setOnRefreshListener {
loadKeyStores() loadKeyStores()
@@ -113,6 +118,7 @@ class ManageKeyStoreActivity : BaseActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_manage_key_store, menu) menuInflater.inflate(R.menu.menu_manage_key_store, menu)
ViewUtils.setToolbarMenuIconsColorByThemeColorLuminance(this)
return true return true
} }
@@ -126,8 +132,6 @@ class ManageKeyStoreActivity : BaseActivity() {
deleteAllKeyStores() deleteAllKeyStores()
}.show() }.show()
} }
else -> {}
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }
@@ -264,4 +268,5 @@ class ManageKeyStoreActivity : BaseActivity() {
private fun showToast(message: String) { private fun showToast(message: String) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show() Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
} }
} }

View File

@@ -6,15 +6,14 @@ import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View
import org.autojs.autojs.AutoJs.Companion.instance import org.autojs.autojs.AutoJs.Companion.instance
import org.autojs.autojs.core.console.GlobalConsole import org.autojs.autojs.core.console.GlobalConsole
import org.autojs.autojs.runtime.api.Mime import org.autojs.autojs.runtime.api.Mime
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs.util.ViewUtils.showToast import org.autojs.autojs.util.ViewUtils.showToast
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.ActivityLogBinding import org.autojs.autojs6.databinding.ActivityLogBinding
import org.autojs.autojs6.databinding.ConsoleViewBinding
class LogActivity : BaseActivity() { class LogActivity : BaseActivity() {
@@ -24,21 +23,20 @@ class LogActivity : BaseActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val activityLogBinding = ActivityLogBinding.inflate(layoutInflater) val activityLogBinding = ActivityLogBinding.inflate(layoutInflater)
setContentView(activityLogBinding.root)
setContentView(activityLogBinding.root)
setToolbarAsBack(R.string.text_log) setToolbarAsBack(R.string.text_log)
val mConsoleView = activityLogBinding.console activityLogBinding.console.apply {
setConsole(instance.globalConsole.also { mConsoleImpl = it })
setLogActivity(this@LogActivity)
setPinchToZoomEnabled(true)
}
mConsoleImpl = instance.globalConsole activityLogBinding.fab.apply {
mConsoleView.setConsole(mConsoleImpl) setOnClickListener { mConsoleImpl.clear() }
mConsoleView.setLogActivity(this) ViewUtils.excludeFloatingActionButtonFromNavigationBar(this)
mConsoleView.setPinchToZoomEnabled(true) }
val consoleViewBinding = ConsoleViewBinding.inflate(layoutInflater)
consoleViewBinding.inputContainer.visibility = View.GONE
activityLogBinding.fab.setOnClickListener { mConsoleImpl.clear() }
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {

View File

@@ -161,10 +161,10 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
if (mOnFloatingActionButtonClickListener != null) { if (mOnFloatingActionButtonClickListener != null) {
mOnFloatingActionButtonClickListener.onClick((FloatingActionButton) v, (int) v.getTag()); mOnFloatingActionButtonClickListener.onClick((FloatingActionButton) v, (int) v.getTag());
} }
} }
public void setOnFloatingActionButtonClickListener(OnFloatingActionButtonClickListener onFloatingActionButtonClickListener) { public void setOnFloatingActionButtonClickListener(OnFloatingActionButtonClickListener onFloatingActionButtonClickListener) {
mOnFloatingActionButtonClickListener = onFloatingActionButtonClickListener; mOnFloatingActionButtonClickListener = onFloatingActionButtonClickListener;
} }
} }

View File

@@ -19,12 +19,10 @@ import android.view.MenuItem
import android.view.View import android.view.View
import androidx.activity.result.contract.ActivityResultContracts.RequestMultiplePermissions import androidx.activity.result.contract.ActivityResultContracts.RequestMultiplePermissions
import androidx.appcompat.app.ActionBarDrawerToggle import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.core.view.forEach
import androidx.drawerlayout.widget.DrawerLayout import androidx.drawerlayout.widget.DrawerLayout
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import androidx.viewpager.widget.ViewPager.SimpleOnPageChangeListener import androidx.viewpager.widget.ViewPager.SimpleOnPageChangeListener
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import com.huaban.analysis.jieba.CharsDictionaryDatabase import com.huaban.analysis.jieba.CharsDictionaryDatabase
import com.huaban.analysis.jieba.PhrasesDictionaryDatabase import com.huaban.analysis.jieba.PhrasesDictionaryDatabase
@@ -49,6 +47,7 @@ import org.autojs.autojs.runtime.api.WrappedShizuku
import org.autojs.autojs.service.ForegroundService import org.autojs.autojs.service.ForegroundService
import org.autojs.autojs.theme.ThemeColorManager import org.autojs.autojs.theme.ThemeColorManager
import org.autojs.autojs.theme.ThemeColorManager.addViewBackground import org.autojs.autojs.theme.ThemeColorManager.addViewBackground
import org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton
import org.autojs.autojs.theme.widget.ThemeColorToolbar import org.autojs.autojs.theme.widget.ThemeColorToolbar
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.ui.doc.DocumentationFragment import org.autojs.autojs.ui.doc.DocumentationFragment
@@ -82,7 +81,7 @@ class MainActivity : BaseActivity(), DelegateHost, HostActivity {
private var binding: ActivityMainBinding? = null private var binding: ActivityMainBinding? = null
private lateinit var mViewPager: ViewPager private lateinit var mViewPager: ViewPager
private lateinit var mFab: FloatingActionButton private lateinit var mFab: ThemeColorFloatingActionButton
private lateinit var mTab: TabLayout private lateinit var mTab: TabLayout
private lateinit var mToolbar: ThemeColorToolbar private lateinit var mToolbar: ThemeColorToolbar
private lateinit var mPagerAdapter: StoredFragmentPagerAdapter private lateinit var mPagerAdapter: StoredFragmentPagerAdapter
@@ -104,18 +103,23 @@ class MainActivity : BaseActivity(), DelegateHost, HostActivity {
return pageTitle != null && getString(R.string.text_documentation).contentEquals(pageTitle) return pageTitle != null && getString(R.string.text_documentation).contentEquals(pageTitle)
} }
val filesItemIndex: Int
get() = findPageIndexByTitle(R.string.text_file)
val docsItemIndex: Int val docsItemIndex: Int
get() { get() = findPageIndexByTitle(R.string.text_documentation)
var i = 0
while (i < mPagerAdapter.count) { private fun findPageIndexByTitle(titleRes: Int): Int {
val pageTitle = mPagerAdapter.getPageTitle(i) var i = 0
if (pageTitle != null && getString(R.string.text_documentation).contentEquals(pageTitle)) { while (i < mPagerAdapter.count) {
return i val pageTitle = mPagerAdapter.getPageTitle(i)
} if (pageTitle != null && getString(titleRes).contentEquals(pageTitle)) {
i += 1 return i
} }
return -1 i += 1
} }
return -1
}
val requestMultiplePermissionsLauncher = registerForActivityResult(RequestMultiplePermissions()) { val requestMultiplePermissionsLauncher = registerForActivityResult(RequestMultiplePermissions()) {
it.forEach { (key: String, isGranted: Boolean) -> it.forEach { (key: String, isGranted: Boolean) ->
@@ -134,7 +138,7 @@ class MainActivity : BaseActivity(), DelegateHost, HostActivity {
binding = it binding = it
setContentView(it.root) setContentView(it.root)
mViewPager = it.viewpager mViewPager = it.viewpager
mFab = it.fab mFab = it.fab.apply { ViewUtils.excludeFloatingActionButtonFromNavigationBar(this) }
mTab = it.tab mTab = it.tab
mToolbar = it.toolbar mToolbar = it.toolbar
addViewBackground(it.appBar) addViewBackground(it.appBar)
@@ -270,13 +274,7 @@ class MainActivity : BaseActivity(), DelegateHost, HostActivity {
} }
private fun setUpToolbarColors() { private fun setUpToolbarColors() {
val aimColor = when { ViewUtils.setToolbarMenuIconsColorByThemeColorLuminance(this, mToolbar)
ThemeColorManager.isThemeColorLuminanceLight() -> getColor(R.color.day)
else -> getColor(R.color.night)
}
mToolbar.menu.forEach { menuItem ->
menuItem.icon?.colorFilter = PorterDuffColorFilter(aimColor, PorterDuff.Mode.SRC_IN)
}
mSearchViewItem?.initThemeColors() mSearchViewItem?.initThemeColors()
} }

View File

@@ -30,6 +30,10 @@ public abstract class ViewPagerFragment extends Fragment implements BackPressedH
mFab = fab; mFab = fab;
} }
public FloatingActionButton getFab() {
return mFab;
}
protected abstract void onFabClick(FloatingActionButton fab); protected abstract void onFabClick(FloatingActionButton fab);
@CallSuper @CallSuper

View File

@@ -59,6 +59,7 @@ abstract class BaseDisplayContentActivity : BaseActivity() {
internalTextView = binding.textView internalTextView = binding.textView
internalFabView = binding.fab.apply { internalFabView = binding.fab.apply {
setOnClickListener { view -> showPopupMenu(view, internalTextView) } setOnClickListener { view -> showPopupMenu(view, internalTextView) }
ViewUtils.excludeFloatingActionButtonFromNavigationBar(this)
} }
val scaleGestureDetector = ScaleGestureDetector(this, ScaleListener(internalTextView)) val scaleGestureDetector = ScaleGestureDetector(this, ScaleListener(internalTextView))
@@ -107,6 +108,7 @@ abstract class BaseDisplayContentActivity : BaseActivity() {
else -> super.onTouchEvent(event) else -> super.onTouchEvent(event)
} }
} }
ViewUtils.excludePaddingClippableViewFromNavigationBar(it)
} }
// 使用协程加载内容 // 使用协程加载内容

View File

@@ -1,12 +1,19 @@
package org.autojs.autojs.ui.main.scripts package org.autojs.autojs.ui.main.scripts
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.marginBottom
import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.tabs.TabLayout
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import org.autojs.autojs.app.GlobalAppContext import org.autojs.autojs.app.GlobalAppContext
import org.autojs.autojs.model.explorer.ExplorerItem import org.autojs.autojs.model.explorer.ExplorerItem
@@ -16,11 +23,14 @@ import org.autojs.autojs.ui.common.ScriptOperations
import org.autojs.autojs.ui.explorer.ExplorerView import org.autojs.autojs.ui.explorer.ExplorerView
import org.autojs.autojs.ui.main.FloatingActionMenu import org.autojs.autojs.ui.main.FloatingActionMenu
import org.autojs.autojs.ui.main.FloatingActionMenu.OnFloatingActionButtonClickListener import org.autojs.autojs.ui.main.FloatingActionMenu.OnFloatingActionButtonClickListener
import org.autojs.autojs.ui.main.MainActivity
import org.autojs.autojs.ui.main.QueryEvent import org.autojs.autojs.ui.main.QueryEvent
import org.autojs.autojs.ui.main.ViewPagerFragment import org.autojs.autojs.ui.main.ViewPagerFragment
import org.autojs.autojs.ui.main.ViewStatesManageable import org.autojs.autojs.ui.main.ViewStatesManageable
import org.autojs.autojs.ui.project.ProjectConfigActivity import org.autojs.autojs.ui.project.ProjectConfigActivity
import org.autojs.autojs.ui.widget.ScrollAwareFABBehavior
import org.autojs.autojs.util.IntentUtils import org.autojs.autojs.util.IntentUtils
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.FragmentExplorerBinding import org.autojs.autojs6.databinding.FragmentExplorerBinding
import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.EventBus
@@ -33,10 +43,12 @@ import org.greenrobot.eventbus.Subscribe
*/ */
open class ExplorerFragment : ViewPagerFragment(0), OnFloatingActionButtonClickListener, ViewStatesManageable { open class ExplorerFragment : ViewPagerFragment(0), OnFloatingActionButtonClickListener, ViewStatesManageable {
private var mBottomInset: Int = 0
private var binding: FragmentExplorerBinding? = null private var binding: FragmentExplorerBinding? = null
private var mExplorerView: ExplorerView? = null private var mExplorerView: ExplorerView? = null
private var mFloatingActionMenu: FloatingActionMenu? = null private var mFloatingActionMenu: FloatingActionMenu? = null
private var mIsCurrentPageFiles = false
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@@ -49,8 +61,12 @@ open class ExplorerFragment : ViewPagerFragment(0), OnFloatingActionButtonClickL
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
mExplorerView = binding!!.itemList.apply { ViewCompat.setOnApplyWindowInsetsListener(view) { _, insets ->
setOnItemClickListener(object : ExplorerView.OnItemClickListener { mBottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom
insets
}
mExplorerView = binding!!.itemList.also { explorerView ->
explorerView.setOnItemClickListener(object : ExplorerView.OnItemClickListener {
override fun onItemClick(view: View?, item: ExplorerItem) { override fun onItemClick(view: View?, item: ExplorerItem) {
when { when {
item.isTextEditable -> Scripts.edit(requireActivity(), item.toScriptFile()) item.isTextEditable -> Scripts.edit(requireActivity(), item.toScriptFile())
@@ -60,29 +76,63 @@ open class ExplorerFragment : ViewPagerFragment(0), OnFloatingActionButtonClickL
} }
} }
}) })
explorerView.explorerItemListView?.let { ViewUtils.excludePaddingClippableViewFromNavigationBar(it) }
}
(activity as? MainActivity)?.apply {
val tabLayout: TabLayout = findViewById(R.id.tab)
val docsTab = tabLayout.getTabAt(filesItemIndex)
docsTab?.view?.let { setTabViewClickListeners(it) }
} }
restoreViewStates() restoreViewStates()
} }
private fun setTabViewClickListeners(tabView: TabLayout.TabView) {
tabView.setOnLongClickListener { if (mIsCurrentPageFiles) true.also { toggleFabVisibility() } else false }
}
private fun toggleFabVisibility() {
val behavior = (fab.layoutParams as? CoordinatorLayout.LayoutParams)?.behavior as? ScrollAwareFABBehavior
when {
behavior == null || fab.translationY == 0f -> {
if (fab.isShown) fab.hide() else fab.show()
}
else -> fab.animate()
.translationY(0f)
.setDuration(ScrollAwareFABBehavior.DURATION)
.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
behavior.setHidden(false)
}
})
.start()
}
}
private fun viewFile(item: ExplorerItem) = IntentUtils.viewFile(GlobalAppContext.get(), item.path) private fun viewFile(item: ExplorerItem) = IntentUtils.viewFile(GlobalAppContext.get(), item.path)
override fun onFabClick(fab: FloatingActionButton) { override fun onFabClick(fab: FloatingActionButton) {
mFloatingActionMenu ?: let { initFloatingActionMenuIfNeeded(fab).run { if (isExpanded) collapse() else expand() }
mFloatingActionMenu = requireActivity().findViewById<FloatingActionMenu?>(R.id.floating_action_menu).also { menu -> }
menu.state
.observeOn(AndroidSchedulers.mainThread()) private fun initFloatingActionMenuIfNeeded(fab: FloatingActionButton): FloatingActionMenu {
.subscribe(object : SimpleObserver<Boolean?>() { return mFloatingActionMenu ?: requireActivity().findViewById<FloatingActionMenu>(R.id.floating_action_menu).also { menu ->
override fun onNext(expanding: Boolean) { menu.state
fab.animate() .observeOn(AndroidSchedulers.mainThread())
.rotation((if (expanding) 45 else 0).toFloat()) .subscribe(object : SimpleObserver<Boolean?>() {
.setDuration(300) override fun onNext(expanding: Boolean) {
.start() fab.animate()
} .rotation((if (expanding) 45 else 0).toFloat())
}) .setDuration(300)
menu.setOnFloatingActionButtonClickListener(this) .start()
}
})
menu.setOnFloatingActionButtonClickListener(this)
menu.layoutParams.runCatching {
javaClass.getField("bottomMargin").setInt(this, fab.marginBottom)
} }
mFloatingActionMenu = menu
} }
mFloatingActionMenu!!.let { if (it.isExpanded) it.collapse() else it.expand() }
} }
override fun onBackPressed(activity: Activity): Boolean { override fun onBackPressed(activity: Activity): Boolean {
@@ -101,9 +151,15 @@ open class ExplorerFragment : ViewPagerFragment(0), OnFloatingActionButtonClickL
return false return false
} }
override fun onPageShow() {
super.onPageShow()
mIsCurrentPageFiles = true
}
override fun onPageHide() { override fun onPageHide() {
super.onPageHide() super.onPageHide()
mFloatingActionMenu?.let { if (it.isExpanded) it.collapse() } mFloatingActionMenu?.let { if (it.isExpanded) it.collapse() }
mIsCurrentPageFiles = false
} }
@Subscribe @Subscribe

View File

@@ -11,6 +11,7 @@ import org.autojs.autojs.AutoJs
import org.autojs.autojs.ui.main.ViewPagerFragment import org.autojs.autojs.ui.main.ViewPagerFragment
import org.autojs.autojs.ui.main.ViewStatesManageable import org.autojs.autojs.ui.main.ViewStatesManageable
import org.autojs.autojs.ui.widget.SimpleAdapterDataObserver import org.autojs.autojs.ui.widget.SimpleAdapterDataObserver
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.databinding.FragmentTaskManagerBinding import org.autojs.autojs6.databinding.FragmentTaskManagerBinding
/** /**
@@ -48,6 +49,7 @@ open class TaskManagerFragment : ViewPagerFragment(45), ViewStatesManageable {
recyclerView.postDelayed({ refreshLayout.isRefreshing = false }, 800) recyclerView.postDelayed({ refreshLayout.isRefreshing = false }, 800)
} }
} }
ViewUtils.excludePaddingClippableViewFromNavigationBar(recyclerView)
} }
restoreViewStates() restoreViewStates()
} }

View File

@@ -282,6 +282,10 @@ public class BuildActivity extends BaseActivity implements ApkBuilder.ProgressCa
mFlexboxPermissionsView = binding.flexboxPermissions; mFlexboxPermissionsView = binding.flexboxPermissions;
binding.fab.setOnClickListener(v -> buildApk()); binding.fab.setOnClickListener(v -> buildApk());
ViewUtils.excludeFloatingActionButtonFromNavigationBar(binding.fab);
ViewUtils.excludePaddingClippableViewFromNavigationBar(binding.scrollView);
binding.selectSource.setOnClickListener(v -> selectSourceFilePath()); binding.selectSource.setOnClickListener(v -> selectSourceFilePath());
binding.selectOutput.setOnClickListener(v -> selectOutputDirPath()); binding.selectOutput.setOnClickListener(v -> selectOutputDirPath());
binding.textAbis.setOnClickListener(v -> toggleAllFlexboxChildren(mFlexboxAbisView)); binding.textAbis.setOnClickListener(v -> toggleAllFlexboxChildren(mFlexboxAbisView));

View File

@@ -28,6 +28,7 @@ import org.autojs.autojs.project.ProjectConfig
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.ui.shortcut.AppsIconSelectActivity import org.autojs.autojs.ui.shortcut.AppsIconSelectActivity
import org.autojs.autojs.ui.widget.SimpleTextWatcher import org.autojs.autojs.ui.widget.SimpleTextWatcher
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs.util.ViewUtils.showToast import org.autojs.autojs.util.ViewUtils.showToast
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.ActivityProjectConfigBinding import org.autojs.autojs6.databinding.ActivityProjectConfigBinding
@@ -85,7 +86,14 @@ class ProjectConfigActivity : BaseActivity() {
setOnClickListener { selectIcon() } setOnClickListener { selectIcon() }
} }
binding.fab.setOnClickListener { commit() } binding.fab.apply {
setOnClickListener { commit() }
ViewUtils.excludeFloatingActionButtonFromNavigationBar(this)
}
binding.scrollView.apply {
ViewUtils.excludePaddingClippableViewFromNavigationBar(this)
}
mNewProject = intent.getBooleanExtra(EXTRA_NEW_PROJECT, false) mNewProject = intent.getBooleanExtra(EXTRA_NEW_PROJECT, false)

View File

@@ -1,32 +1,38 @@
package org.autojs.autojs.ui.settings; package org.autojs.autojs.ui.settings
import android.os.Bundle; import android.os.Bundle
import org.autojs.autojs.theme.ThemeColorManager
import androidx.annotation.Nullable; import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.util.ViewUtils.setToolbarAsBack
import org.autojs.autojs.ui.BaseActivity; import org.autojs.autojs6.R
import org.autojs.autojs.util.ViewUtils; import org.autojs.autojs6.databinding.ActivityDeveloperOptionsBinding
import org.autojs.autojs6.R;
import org.autojs.autojs6.databinding.ActivityDeveloperOptionsBinding;
/** /**
* Created by SuperMonster003 on Jun 2, 2022. * Created by SuperMonster003 on Jun 2, 2022.
*/ */
public class DeveloperOptionsActivity extends BaseActivity { class DeveloperOptionsActivity : BaseActivity() {
@Override private lateinit var binding: ActivityDeveloperOptionsBinding
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityDeveloperOptionsBinding binding = ActivityDeveloperOptionsBinding.inflate(getLayoutInflater()); override fun onCreate(savedInstanceState: Bundle?) {
setContentView(binding.getRoot()); super.onCreate(savedInstanceState)
ViewUtils.setToolbarAsBack(this, R.string.text_developer_options); binding = ActivityDeveloperOptionsBinding.inflate(layoutInflater).also { binding ->
setContentView(binding.root)
binding.toolbar.setNavigationOnClickListener { finish() }
}
getSupportFragmentManager().beginTransaction() setToolbarAsBack(this, R.string.text_developer_options)
.replace(R.id.fragment_developer_options, new DeveloperOptionsFragment())
.disallowAddToBackStack() supportFragmentManager.beginTransaction()
.commit(); .replace(R.id.fragment_developer_options, DeveloperOptionsFragment())
.disallowAddToBackStack()
.commit()
}
override fun onStart() {
super.onStart()
binding.toolbar.navigationIcon?.setTint(ThemeColorManager.getDayOrNightColorByLuminance(this))
} }
} }

View File

@@ -1,7 +1,9 @@
package org.autojs.autojs.ui.settings package org.autojs.autojs.ui.settings
import android.os.Bundle import android.os.Bundle
import android.view.View
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.R import org.autojs.autojs6.R
class DeveloperOptionsFragment : PreferenceFragmentCompat() { class DeveloperOptionsFragment : PreferenceFragmentCompat() {
@@ -10,4 +12,9 @@ class DeveloperOptionsFragment : PreferenceFragmentCompat() {
setPreferencesFromResource(R.xml.fragment_developer_options, rootKey) setPreferencesFromResource(R.xml.fragment_developer_options, rootKey)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
ViewUtils.excludePaddingClippableViewFromNavigationBar(listView)
}
} }

View File

@@ -3,7 +3,6 @@ package org.autojs.autojs.ui.settings
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.core.content.ContextCompat
import org.autojs.autojs.app.GlobalAppContext import org.autojs.autojs.app.GlobalAppContext
import org.autojs.autojs.theme.ThemeColorManager import org.autojs.autojs.theme.ThemeColorManager
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
@@ -16,7 +15,7 @@ import org.autojs.autojs6.databinding.ActivityPreferencesBinding
*/ */
open class PreferencesActivity : BaseActivity() { open class PreferencesActivity : BaseActivity() {
private var binding: ActivityPreferencesBinding? = null private lateinit var binding: ActivityPreferencesBinding
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@@ -38,18 +37,7 @@ open class PreferencesActivity : BaseActivity() {
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
binding!!.toolbar.navigationIcon?.let { binding.toolbar.navigationIcon?.setTint(ThemeColorManager.getDayOrNightColorByLuminance(this))
val aimColor = when {
ThemeColorManager.isThemeColorLuminanceLight() -> ContextCompat.getColor(this, R.color.day)
else -> ContextCompat.getColor(this, R.color.night)
}
it.setTint(aimColor)
}
}
override fun onDestroy() {
super.onDestroy()
binding = null
} }
companion object { companion object {

View File

@@ -3,6 +3,7 @@ package org.autojs.autojs.ui.settings
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.R import org.autojs.autojs6.R
class PreferencesFragment : PreferenceFragmentCompat() { class PreferencesFragment : PreferenceFragmentCompat() {
@@ -15,6 +16,7 @@ class PreferencesFragment : PreferenceFragmentCompat() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
listView.isHorizontalScrollBarEnabled = false listView.isHorizontalScrollBarEnabled = false
listView.isVerticalScrollBarEnabled = false listView.isVerticalScrollBarEnabled = false
ViewUtils.excludePaddingClippableViewFromNavigationBar(listView)
} }
} }

View File

@@ -24,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
import org.autojs.autojs.groundwork.WrapContentGridLayoutManger; import org.autojs.autojs.groundwork.WrapContentGridLayoutManger;
import org.autojs.autojs.runtime.api.Mime; import org.autojs.autojs.runtime.api.Mime;
import org.autojs.autojs.ui.BaseActivity; import org.autojs.autojs.ui.BaseActivity;
import org.autojs.autojs.util.ViewUtils;
import org.autojs.autojs6.R; import org.autojs.autojs6.R;
import org.autojs.autojs6.databinding.ActivityAppsIconSelectBinding; import org.autojs.autojs6.databinding.ActivityAppsIconSelectBinding;
@@ -39,7 +40,7 @@ import io.reactivex.schedulers.Schedulers;
*/ */
public class AppsIconSelectActivity extends BaseActivity { public class AppsIconSelectActivity extends BaseActivity {
private RecyclerView mApps; private RecyclerView mAppsRecyclerView;
public static final String EXTRA_PACKAGE_NAME = "extra_package_name"; public static final String EXTRA_PACKAGE_NAME = "extra_package_name";
private PackageManager mPackageManager; private PackageManager mPackageManager;
@@ -58,12 +59,14 @@ public class AppsIconSelectActivity extends BaseActivity {
setToolbarAsBack(R.string.text_select_icon); setToolbarAsBack(R.string.text_select_icon);
mApps = binding.apps; mAppsRecyclerView = binding.apps;
mApps.setAdapter(new AppsAdapter()); mAppsRecyclerView.setAdapter(new AppsAdapter());
ViewUtils.excludePaddingClippableViewFromNavigationBar(mAppsRecyclerView);
WrapContentGridLayoutManger manager = new WrapContentGridLayoutManger(this, 5); WrapContentGridLayoutManger manager = new WrapContentGridLayoutManger(this, 5);
manager.setDebugInfo("IconSelectView"); manager.setDebugInfo("IconSelectView");
mApps.setLayoutManager(manager); mAppsRecyclerView.setLayoutManager(manager);
loadApps(); loadApps();
} }
@@ -80,7 +83,7 @@ public class AppsIconSelectActivity extends BaseActivity {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(icon -> { .subscribe(icon -> {
mAppList.add(icon); mAppList.add(icon);
mApps.getAdapter().notifyItemInserted(mAppList.size() - 1); mAppsRecyclerView.getAdapter().notifyItemInserted(mAppList.size() - 1);
}); });
} }

View File

@@ -108,6 +108,8 @@ public class ShortcutCreateActivity extends AppCompatActivity {
// ! can only accept String type data returned by getText(). // ! can only accept String type data returned by getText().
// ! If CharSequence type data is directly passed in, the shortcut will fail to create properly. // ! If CharSequence type data is directly passed in, the shortcut will fail to create properly.
// ! // !
// ! Refer to: http://issues.autojs6.com/221
// !
// ! zh-CN: // ! zh-CN:
// ! // !
// ! 此处需要转换为 String 类型, 而不能保留 getText() 方法得到的 CharSequence 类型. // ! 此处需要转换为 String 类型, 而不能保留 getText() 方法得到的 CharSequence 类型.
@@ -115,6 +117,8 @@ public class ShortcutCreateActivity extends AppCompatActivity {
// ! ShortcutInfoCompat.Builder#setShortLabel 及 setLongLabel 只能接受 getText() 返回的 String 类型数据, // ! ShortcutInfoCompat.Builder#setShortLabel 及 setLongLabel 只能接受 getText() 返回的 String 类型数据,
// ! 如果直接传入 CharSequence 类型数据, 快捷方式将无法正常创建. // ! 如果直接传入 CharSequence 类型数据, 快捷方式将无法正常创建.
// ! // !
// ! 参阅: http://issues.autojs6.com/221
// !
// # CharSequence name = mName.getText(); // # CharSequence name = mName.getText();
String name = mName.getText().toString(); String name = mName.getText().toString();

View File

@@ -4,10 +4,11 @@ import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.widget.LinearLayout
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.ui.floating.FloatyWindowManger import org.autojs.autojs.ui.floating.FloatyWindowManger
import org.autojs.autojs.ui.main.MainActivity import org.autojs.autojs.ui.main.MainActivity
import org.autojs.autojs6.R import org.autojs.autojs6.databinding.ActivitySplashBinding
/** /**
* Created by Stardust on Jul 7, 2017. * Created by Stardust on Jul 7, 2017.
@@ -19,6 +20,8 @@ class SplashActivity : BaseActivity() {
override val handleStatusBarThemeColorAutomatically = false override val handleStatusBarThemeColorAutomatically = false
private var binding: ActivitySplashBinding? = null
private var mAlreadyEnterNextActivity = false private var mAlreadyEnterNextActivity = false
private var mPaused = false private var mPaused = false
@@ -26,7 +29,9 @@ class SplashActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash)
val binding = ActivitySplashBinding.inflate(layoutInflater).also { binding = it }
setContentView(binding.root)
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
mHandler = Looper.myLooper()?.let { Handler(it) } ?: Handler() mHandler = Looper.myLooper()?.let { Handler(it) } ?: Handler()
@@ -48,6 +53,11 @@ class SplashActivity : BaseActivity() {
} }
} }
override fun onDestroy() {
super.onDestroy()
binding = null
}
private fun enterNextActivity() { private fun enterNextActivity() {
if (!mAlreadyEnterNextActivity && !mPaused) { if (!mAlreadyEnterNextActivity && !mPaused) {
mAlreadyEnterNextActivity = true mAlreadyEnterNextActivity = true

View File

@@ -43,6 +43,7 @@ import org.autojs.autojs.timing.TimedTaskManager.removeTask
import org.autojs.autojs.timing.TimedTaskManager.updateTask import org.autojs.autojs.timing.TimedTaskManager.updateTask
import org.autojs.autojs.tool.MapBuilder import org.autojs.autojs.tool.MapBuilder
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs.util.ViewUtils.showToast import org.autojs.autojs.util.ViewUtils.showToast
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.autojs.autojs6.databinding.ActivityTimedTaskSettingBinding import org.autojs.autojs6.databinding.ActivityTimedTaskSettingBinding
@@ -138,6 +139,8 @@ class TimedTaskSettingActivity : BaseActivity() {
mWeeklyTaskTimePicker.setIs24HourView(true) mWeeklyTaskTimePicker.setIs24HourView(true)
findDayOfWeekCheckBoxes(mWeeklyTaskContainer) findDayOfWeekCheckBoxes(mWeeklyTaskContainer)
setUpTaskSettings(this) setUpTaskSettings(this)
ViewUtils.excludePaddingClippableViewFromNavigationBar(binding.scrollView)
} }
private fun findDayOfWeekCheckBoxes(parent: ViewGroup) { private fun findDayOfWeekCheckBoxes(parent: ViewGroup) {

View File

@@ -72,12 +72,7 @@ class FirstCharView : TextView {
fun setIconTextColorRes(@ColorRes colorRes: Int) = also { setTextColor(convertColorResToInt(colorRes)) } fun setIconTextColorRes(@ColorRes colorRes: Int) = also { setTextColor(convertColorResToInt(colorRes)) }
fun setIconTextByThemeColorLuminance() = also { fun setIconTextColorByThemeColorLuminance() = also { setIconTextColorRes(ThemeColorManager.getDayOrNightColorResByLuminance()) }
when {
ThemeColorManager.isThemeColorLuminanceLight() -> setIconTextColorRes(R.color.day)
else -> setIconTextColorRes(R.color.night)
}
}
fun setIconTextThemeColor() = setIconTextColor(ThemeColorManagerCompat.getColorPrimary()) fun setIconTextThemeColor() = setIconTextColor(ThemeColorManagerCompat.getColorPrimary())

View File

@@ -18,10 +18,11 @@ import android.view.View;
*/ */
public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior { public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
private static final long DURATION = 200;
private static final TimeInterpolator INTERPOLATOR = new FastOutSlowInInterpolator(); private static final TimeInterpolator INTERPOLATOR = new FastOutSlowInInterpolator();
private boolean mHidden = false; private boolean mHidden = false;
public static final long DURATION = 200;
public ScrollAwareFABBehavior(Context context, AttributeSet attrs) { public ScrollAwareFABBehavior(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
} }
@@ -59,7 +60,7 @@ public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
.setListener(new AnimatorListenerAdapter() { .setListener(new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
mHidden = false; setHidden(false);
} }
}) })
.start(); .start();
@@ -80,10 +81,14 @@ public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
.setListener(new AnimatorListenerAdapter() { .setListener(new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
mHidden = true; setHidden(true);
} }
}) })
.start(); .start();
} }
public void setHidden(boolean b) {
mHidden = b;
}
} }

View File

@@ -30,6 +30,7 @@ import org.mozilla.javascript.NativeArray
import org.mozilla.javascript.NativeDate import org.mozilla.javascript.NativeDate
import org.mozilla.javascript.NativeJSON import org.mozilla.javascript.NativeJSON
import org.mozilla.javascript.NativeObject import org.mozilla.javascript.NativeObject
import org.mozilla.javascript.RegExpLoader
import org.mozilla.javascript.ScriptRuntime.emptyArgs import org.mozilla.javascript.ScriptRuntime.emptyArgs
import org.mozilla.javascript.ScriptRuntime.setBuiltinProtoAndParent import org.mozilla.javascript.ScriptRuntime.setBuiltinProtoAndParent
import org.mozilla.javascript.ScriptRuntime.toObject import org.mozilla.javascript.ScriptRuntime.toObject

View File

@@ -29,13 +29,18 @@ import androidx.annotation.IdRes
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat import androidx.core.view.WindowInsetsControllerCompat
import androidx.core.view.forEach
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import org.autojs.autojs.app.GlobalAppContext import org.autojs.autojs.app.GlobalAppContext
import org.autojs.autojs.core.pref.Pref import org.autojs.autojs.core.pref.Pref
import org.autojs.autojs.theme.ThemeColorManager import org.autojs.autojs.theme.ThemeColorManager
import org.autojs.autojs.util.StringUtils.key import org.autojs.autojs.util.StringUtils.key
import org.autojs.autojs6.R import org.autojs.autojs6.R
import kotlin.math.roundToInt
/** /**
* Created by Stardust on Jan 24, 2017. * Created by Stardust on Jan 24, 2017.
@@ -156,6 +161,11 @@ object ViewUtils {
return activity.window.decorView.systemUiVisibility and flags == flags return activity.window.decorView.systemUiVisibility and flags == flags
} }
@JvmStatic
fun addWindowFlags(activity: Activity, flags: Int) {
activity.window.addFlags(flags)
}
@JvmStatic @JvmStatic
fun isStatusBarIconLight(activity: Activity): Boolean { fun isStatusBarIconLight(activity: Activity): Boolean {
return !isStatusBarIconDark(activity) return !isStatusBarIconDark(activity)
@@ -180,7 +190,7 @@ object ViewUtils {
val window = activity.window val window = activity.window
val decorView = window.decorView val decorView = window.decorView
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
decorView.setOnApplyWindowInsetsListener { view, insets -> decorView.setOnApplyWindowInsetsListener { view, insets ->
val statusBarInsets = insets.getInsets(WindowInsets.Type.statusBars()) val statusBarInsets = insets.getInsets(WindowInsets.Type.statusBars())
val contentView: ViewGroup? = activity.findViewById(android.R.id.content) val contentView: ViewGroup? = activity.findViewById(android.R.id.content)
@@ -204,7 +214,7 @@ object ViewUtils {
val window = activity.window val window = activity.window
val decorView = window.decorView val decorView = window.decorView
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
decorView.setOnApplyWindowInsetsListener { view, insets -> decorView.setOnApplyWindowInsetsListener { view, insets ->
val navBarInsets = insets.getInsets(WindowInsets.Type.navigationBars()) val navBarInsets = insets.getInsets(WindowInsets.Type.navigationBars())
val contentView: ViewGroup? = activity.findViewById(android.R.id.content) val contentView: ViewGroup? = activity.findViewById(android.R.id.content)
@@ -224,6 +234,30 @@ object ViewUtils {
} }
} }
@JvmStatic
@JvmOverloads
fun excludeFloatingActionButtonFromNavigationBar(fab: FloatingActionButton, extraMarginBottomDp: Float = 16F) {
ViewCompat.setOnApplyWindowInsetsListener(fab) { view, insets ->
val bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom
view.layoutParams.runCatching {
javaClass.getField("bottomMargin")
.setInt(this, DisplayUtils.dpToPx(extraMarginBottomDp).roundToInt() + bottomInset)
}
insets
}
}
@JvmStatic
@JvmOverloads
fun excludePaddingClippableViewFromNavigationBar(view: View, extraPaddingBottomDp: Float = 0F, clipToPadding: Boolean = false) {
ViewCompat.setOnApplyWindowInsetsListener(view) { _, insets ->
val bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom
view.setPadding(0, 0, 0, DisplayUtils.dpToPx(extraPaddingBottomDp).roundToInt() + bottomInset)
runCatching { view.javaClass.getMethod("setClipToPadding", Boolean::class.java).invoke(view, clipToPadding) }
insets
}
}
private fun appendWindowFlags(activity: Activity, flags: Int) { private fun appendWindowFlags(activity: Activity, flags: Int) {
activity.window.addFlags(flags) activity.window.addFlags(flags)
} }
@@ -296,13 +330,8 @@ object ViewUtils {
toolbar.setNavigationOnClickListener { activity.finish() } toolbar.setNavigationOnClickListener { activity.finish() }
actionBar.setDisplayHomeAsUpEnabled(true) actionBar.setDisplayHomeAsUpEnabled(true)
} }
toolbar.navigationIcon?.let { navigationIcon -> setToolbarMenuIconsColorByThemeColorLuminance(activity, toolbar)
val navigationIconColor = when { setToolbarNavigationIconColorByThemeColorLuminance(activity, toolbar)
ThemeColorManager.isThemeColorLuminanceLight() -> R.color.day
else -> R.color.night
}.let { activity.resources.getColor(it, null) }
navigationIcon.colorFilter = PorterDuffColorFilter(navigationIconColor, PorterDuff.Mode.SRC_IN)
}
} }
@JvmStatic @JvmStatic
@@ -310,6 +339,26 @@ object ViewUtils {
setToolbarAsBack(activity, activity.getString(titleRes)) setToolbarAsBack(activity, activity.getString(titleRes))
} }
@JvmStatic
@JvmOverloads
fun setToolbarMenuIconsColorByThemeColorLuminance(activity: Activity, toolbar: Toolbar? = null) {
val toolbarView = toolbar ?: activity.findViewById(R.id.toolbar) ?: return
val aimColor = ThemeColorManager.getDayOrNightColorByLuminance(activity)
toolbarView.menu.forEach { menuItem ->
menuItem.icon?.colorFilter = PorterDuffColorFilter(aimColor, PorterDuff.Mode.SRC_IN)
}
}
@JvmStatic
@JvmOverloads
fun setToolbarNavigationIconColorByThemeColorLuminance(activity: Activity, toolbar: Toolbar? = null) {
val toolbarView = toolbar ?: activity.findViewById(R.id.toolbar) ?: return
val aimColor = ThemeColorManager.getDayOrNightColorByLuminance(activity)
toolbarView.navigationIcon?.let { navigationIcon ->
navigationIcon.colorFilter = PorterDuffColorFilter(aimColor, PorterDuff.Mode.SRC_IN)
}
}
@JvmStatic @JvmStatic
fun showToast(context: Context, stringRes: Int) = showToast(context, stringRes, false) fun showToast(context: Context, stringRes: Int) = showToast(context, stringRes, false)

View File

@@ -1,7 +1,6 @@
package org.mozilla.javascript; package org.mozilla.javascript;
import android.util.Log; import android.util.Log;
import org.autojs.autojs.engine.RhinoJavaScriptEngine;
import org.autojs.autojs.rhino.AutoJsContext; import org.autojs.autojs.rhino.AutoJsContext;
import org.mozilla.javascript.jdk18.VMBridge_jdk18; import org.mozilla.javascript.jdk18.VMBridge_jdk18;

View File

@@ -27,6 +27,7 @@
android:paddingTop="6dp"> android:paddingTop="6dp">
<ScrollView <ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">

View File

@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -21,26 +20,24 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<FrameLayout <org.autojs.autojs.core.console.ConsoleView
android:id="@+id/console"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingStart="4dp" android:paddingStart="4dp"
android:paddingEnd="2dp"> android:paddingEnd="2dp"
app:excludeFromNavigationBar="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<org.autojs.autojs.core.console.ConsoleView <org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton
android:id="@+id/console" android:id="@+id/fab"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" /> android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:tint="@color/toolbar_text"
app:backgroundTint="?attr/colorPrimary"
app:layout_behavior="org.autojs.autojs.ui.widget.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_clear_white_48dp" />
<org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton </androidx.coordinatorlayout.widget.CoordinatorLayout>
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@drawable/ic_clear_white_48dp"
app:backgroundTint="?attr/colorPrimary"
android:tint="@color/toolbar_text" />
</FrameLayout>
</LinearLayout>

View File

@@ -44,6 +44,7 @@
android:id="@+id/viewpager" android:id="@+id/viewpager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton <org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton

View File

@@ -16,6 +16,8 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
app:titleTextColor="@color/day_full"
app:subtitleTextColor="@color/day_full"
android:theme="@style/ToolBarStyleInrt" android:theme="@style/ToolBarStyleInrt"
app:contentInsetStartWithNavigation="0dp" app:contentInsetStartWithNavigation="0dp"
app:contentInsetEndWithActions="2dp" app:contentInsetEndWithActions="2dp"
@@ -33,6 +35,7 @@
android:id="@+id/console" android:id="@+id/console"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:excludeFromNavigationBar="true"
app:color_verbose="#DFC0C0C0" app:color_verbose="#DFC0C0C0"
app:color_debug="#CC000000" app:color_debug="#CC000000"
app:color_info="#FF43A047" app:color_info="#FF43A047"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@@ -8,51 +8,42 @@
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<org.autojs.autojs.theme.widget.ThemeColorToolbar <org.autojs.autojs.theme.widget.ThemeColorToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="13dp"
android:theme="@style/ToolBarStyle" /> android:theme="@style/ToolBarStyle" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout
<FrameLayout android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="8dp"> android:layout_marginTop="6dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout <androidx.recyclerview.widget.RecyclerView
android:id="@+id/swipe_refresh_layout" android:id="@+id/recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content" />
<ScrollView </org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout>
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton
android:id="@+id/recycler_view" android:id="@+id/fab"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
</ScrollView> android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:alpha="0.9"
android:src="@drawable/ic_add_white_48dp"
android:tint="@color/toolbar_text"
app:backgroundTint="?attr/colorPrimary"
app:layout_behavior="org.autojs.autojs.ui.widget.ScrollAwareFABBehavior" />
</org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
<org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:alpha="0.9"
android:src="@drawable/ic_add_white_48dp"
android:tint="@color/toolbar_text"
app:backgroundTint="?attr/colorPrimary"
app:layout_anchor="@id/viewpager"
app:layout_anchorGravity="bottom|end"
app:layout_behavior="org.autojs.autojs.ui.widget.ScrollAwareFABBehavior" />
</FrameLayout>
</LinearLayout>

View File

@@ -26,6 +26,7 @@
android:paddingTop="6dp"> android:paddingTop="6dp">
<ScrollView <ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">

View File

@@ -1,30 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:clipToPadding="false" android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay"> android:clipToPadding="false"
android:theme="@style/AppTheme.AppBarOverlay">
<org.autojs.autojs.theme.widget.ThemeColorToolbar <org.autojs.autojs.theme.widget.ThemeColorToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:theme="@style/ToolBarStyle" android:theme="@style/ToolBarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay" app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="@string/app_name" /> app:title="@string/app_name" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<org.autojs.autojs.ui.explorer.ExplorerView <org.autojs.autojs.ui.explorer.ExplorerView
android:id="@+id/script_list" android:id="@+id/script_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>

View File

@@ -17,8 +17,8 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
app:titleTextColor="@color/md_black_1000" app:titleTextColor="@color/day_full"
app:subtitleTextColor="@color/md_black_1000" app:subtitleTextColor="@color/day_full"
android:theme="@style/ToolBarStyleInrt" android:theme="@style/ToolBarStyleInrt"
android:background="@color/md_blue_grey_50" android:background="@color/md_blue_grey_50"
app:contentInsetStartWithNavigation="0dp" app:contentInsetStartWithNavigation="0dp"

View File

@@ -1,25 +1,33 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="128dp" android:layout_height="match_parent"
android:layout_gravity="center|bottom"
android:gravity="center"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:orientation="horizontal"> android:gravity="center|bottom">
<ImageView <LinearLayout
android:id="@+id/logo" android:layout_width="match_parent"
android:layout_width="72dp" android:layout_height="wrap_content"
android:layout_height="72dp" android:layout_marginBottom="16dp"
android:layout_gravity="center" android:gravity="center"
android:src="@drawable/autojs6_material" /> android:minHeight="128dp"
android:orientation="horizontal">
<ImageView <ImageView
android:layout_width="100dp" android:id="@+id/logo"
android:layout_height="32dp" android:layout_width="72dp"
android:layout_gravity="center" android:layout_height="72dp"
android:layout_marginTop="4dp" android:layout_gravity="center"
android:layout_marginStart="2dp" android:src="@drawable/autojs6_material" />
android:src="@drawable/autojs6" />
</LinearLayout> <ImageView
android:layout_width="100dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:layout_marginStart="2dp"
android:src="@drawable/autojs6" />
</LinearLayout>
</LinearLayout>

View File

@@ -2,31 +2,39 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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="128dp" android:layout_height="match_parent"
android:layout_gravity="center|bottom" android:fitsSystemWindows="true"
android:layout_marginBottom="16dp" android:gravity="center|bottom">
android:gravity="center"
android:orientation="vertical">
<ImageView <LinearLayout
android:id="@+id/icon" android:layout_width="match_parent"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_gravity="center"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/slug"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_marginBottom="16dp"
android:layout_marginTop="20dp" android:gravity="center"
android:text="@string/text_powered_by_autojs" android:minHeight="128dp"
android:textColor="@color/day_night_full" android:orientation="vertical">
android:textSize="16sp" />
<ImageView
android:id="@+id/icon"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_gravity="center"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/slug"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="@string/text_powered_by_autojs"
android:textColor="@color/day_night_full"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@@ -1,251 +1,252 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
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="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay" android:theme="@style/AppTheme.AppBarOverlay"
android:fitsSystemWindows="true"> android:fitsSystemWindows="true">
<org.autojs.autojs.theme.widget.ThemeColorToolbar <org.autojs.autojs.theme.widget.ThemeColorToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:theme="@style/ToolBarStyle" android:theme="@style/ToolBarStyle"
app:popupTheme="@style/AppTheme.PopupOverlay" /> app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<ScrollView <ScrollView
android:layout_width="match_parent" android:id="@+id/scrollView"
android:layout_height="match_parent"> android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
app:cardCornerRadius="2dp" app:cardCornerRadius="2dp"
app:cardElevation="1dp" app:cardElevation="1dp"
app:cardUseCompatPadding="true"> app:cardUseCompatPadding="true">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:padding="16dp"> android:padding="16dp">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:text="@string/text_timed_task_timing" android:text="@string/text_timed_task_timing"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textColor="?android:textColorSecondary" /> android:textColor="?android:textColorSecondary" />
<RadioGroup <RadioGroup
android:id="@+id/timing_group" android:id="@+id/timing_group"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<RadioButton <RadioButton
android:id="@+id/daily_task_radio" android:id="@+id/daily_task_radio"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="16dp" android:paddingStart="16dp"
android:text="@string/text_daily_task" android:text="@string/text_daily_task"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<com.github.aakira.expandablelayout.ExpandableRelativeLayout <com.github.aakira.expandablelayout.ExpandableRelativeLayout
android:id="@+id/daily_task_relative_layout" android:id="@+id/daily_task_relative_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:ael_expanded="false" app:ael_expanded="false"
app:ael_interpolator="fastOutSlowIn" app:ael_interpolator="fastOutSlowIn"
app:ael_orientation="vertical"> app:ael_orientation="vertical">
<TimePicker <TimePicker
android:id="@+id/daily_task_time_picker" android:id="@+id/daily_task_time_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:timePickerMode="spinner" />
</com.github.aakira.expandablelayout.ExpandableRelativeLayout>
<RadioButton
android:id="@+id/disposable_task_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingStart="16dp"
android:text="@string/text_disposable_task"
tools:ignore="RtlSymmetry" />
<com.github.aakira.expandablelayout.ExpandableRelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
app:ael_expanded="false"
app:ael_interpolator="fastOutSlowIn"
app:ael_orientation="vertical">
<LinearLayout
android:id="@+id/disposable_task_time_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="6dp"
android:paddingBottom="6dp">
<org.autojs.autojs.theme.widget.ThemeColorImageViewCompat
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:gravity="center"
android:src="@drawable/ic_schedule_black_48dp" />
<TextView
android:id="@+id/disposable_task_time"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_marginStart="12dp"
android:gravity="center_vertical"
android:textColor="?android:textColorPrimary"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/disposable_task_date_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/disposable_task_time_container"
android:layout_alignParentBottom="true"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="6dp">
<org.autojs.autojs.theme.widget.ThemeColorImageViewCompat
android:id="@+id/disposable_task_date_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:gravity="center"
android:src="@drawable/ic_date_range_black_48dp" />
<TextView
android:id="@+id/disposable_task_date"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_marginStart="12dp"
android:gravity="center_vertical"
android:textColor="?android:textColorPrimary"
android:textSize="16sp" />
</LinearLayout>
</com.github.aakira.expandablelayout.ExpandableRelativeLayout>
<RadioButton
android:id="@+id/weekly_task_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingStart="16dp"
android:text="@string/text_weekly_task"
tools:ignore="RtlSymmetry" />
<com.github.aakira.expandablelayout.ExpandableRelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ael_expanded="false"
app:ael_interpolator="fastOutSlowIn"
app:ael_orientation="vertical">
<LinearLayout
android:id="@+id/weekly_task_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TimePicker
android:id="@+id/weekly_task_time_picker"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:timePickerMode="spinner" /> android:timePickerMode="spinner" />
</com.github.aakira.expandablelayout.ExpandableRelativeLayout>
<RadioButton
android:id="@+id/disposable_task_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingStart="16dp"
android:text="@string/text_disposable_task"
tools:ignore="RtlSymmetry" />
<com.github.aakira.expandablelayout.ExpandableRelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
app:ael_expanded="false"
app:ael_interpolator="fastOutSlowIn"
app:ael_orientation="vertical">
<LinearLayout
android:id="@+id/disposable_task_time_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="6dp"
android:paddingBottom="6dp">
<org.autojs.autojs.theme.widget.ThemeColorImageViewCompat
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:gravity="center"
android:src="@drawable/ic_schedule_black_48dp" />
<TextView
android:id="@+id/disposable_task_time"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_marginStart="12dp"
android:gravity="center_vertical"
android:textColor="?android:textColorPrimary"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/disposable_task_date_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/disposable_task_time_container"
android:layout_alignParentBottom="true"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="6dp">
<org.autojs.autojs.theme.widget.ThemeColorImageViewCompat
android:id="@+id/disposable_task_date_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:gravity="center"
android:src="@drawable/ic_date_range_black_48dp" />
<TextView
android:id="@+id/disposable_task_date"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_marginStart="12dp"
android:gravity="center_vertical"
android:textColor="?android:textColorPrimary"
android:textSize="16sp" />
</LinearLayout>
</com.github.aakira.expandablelayout.ExpandableRelativeLayout>
<RadioButton
android:id="@+id/weekly_task_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingStart="16dp"
android:text="@string/text_weekly_task"
tools:ignore="RtlSymmetry" />
<com.github.aakira.expandablelayout.ExpandableRelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ael_expanded="false"
app:ael_interpolator="fastOutSlowIn"
app:ael_orientation="vertical">
<LinearLayout
android:id="@+id/weekly_task_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TimePicker
android:id="@+id/weekly_task_time_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:timePickerMode="spinner" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:orientation="horizontal"
android:weightSum="4">
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="25dp" android:layout_weight="1"
android:orientation="horizontal" android:text="@string/text_day1"
android:weightSum="4"> tools:ignore="TooDeepLayout" />
<CheckBox <CheckBox
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/text_day1" android:text="@string/text_day2" />
tools:ignore="TooDeepLayout" />
<CheckBox <CheckBox
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/text_day2" /> android:text="@string/text_day3" />
<CheckBox <CheckBox
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/text_day3" /> android:text="@string/text_day4" />
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/text_day4" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:orientation="horizontal"
android:weightSum="4">
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="25dp" android:layout_weight="1"
android:orientation="horizontal" android:text="@string/text_day5" />
android:weightSum="4">
<CheckBox <CheckBox
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/text_day5" /> android:text="@string/text_day6" />
<CheckBox <CheckBox
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/text_day6" /> android:text="@string/text_day7" />
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/text_day7" />
</LinearLayout> </LinearLayout>
@@ -254,192 +255,192 @@
</com.github.aakira.expandablelayout.ExpandableRelativeLayout> </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
<RadioButton <RadioButton
android:id="@+id/run_on_broadcast" android:id="@+id/run_on_broadcast"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="16dp" android:paddingStart="16dp"
android:text="@string/text_broadcast_task" android:text="@string/text_broadcast_task"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<com.github.aakira.expandablelayout.ExpandableRelativeLayout <com.github.aakira.expandablelayout.ExpandableRelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:ael_expanded="false" app:ael_expanded="false"
app:ael_interpolator="fastOutSlowIn" app:ael_interpolator="fastOutSlowIn"
app:ael_orientation="vertical"> app:ael_orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:orientation="vertical"> android:orientation="vertical">
<RadioGroup <RadioGroup
android:id="@+id/broadcast_group" android:id="@+id/broadcast_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/run_on_startup"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:layout_marginTop="16dp"
android:paddingStart="8dp"
android:text="@string/text_run_on_startup"
tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_startup" android:id="@+id/run_on_boot"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_startup" android:text="@string/text_run_on_boot"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_boot" android:id="@+id/run_on_screen_on"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_boot" android:text="@string/text_run_on_screen_on"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_screen_on" android:id="@+id/run_on_screen_off"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_screen_on" android:text="@string/text_run_on_screen_off"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_screen_off" android:id="@+id/run_on_screen_unlock"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_screen_off" android:text="@string/text_run_on_screen_unlock"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_screen_unlock" android:id="@+id/run_on_battery_change"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_screen_unlock" android:text="@string/text_run_on_battery_change"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_battery_change" android:id="@+id/run_on_power_connect"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_battery_change" android:text="@string/text_run_on_power_connect"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_power_connect" android:id="@+id/run_on_power_disconnect"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_power_connect" android:text="@string/text_run_on_power_disconnect"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_power_disconnect" android:id="@+id/run_on_conn_change"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_power_disconnect" android:text="@string/text_run_on_conn_change"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_conn_change" android:id="@+id/run_on_package_install"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_conn_change" android:text="@string/text_run_on_package_install"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_package_install" android:id="@+id/run_on_package_uninstall"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_package_install" android:text="@string/text_run_on_package_uninstall"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_package_uninstall" android:id="@+id/run_on_package_update"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_package_uninstall" android:text="@string/text_run_on_package_update"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_package_update" android:id="@+id/run_on_headset_plug"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_package_update" android:text="@string/text_run_on_headset_plug"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_headset_plug" android:id="@+id/run_on_config_change"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_headset_plug" android:text="@string/text_run_on_config_change"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_config_change" android:id="@+id/run_on_time_tick"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_config_change" android:text="@string/text_run_on_time_tick"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton <RadioButton
android:id="@+id/run_on_time_tick" android:id="@+id/run_on_other_broadcast"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@string/text_run_on_time_tick" android:text="@string/text_run_on_user_defined_broadcast"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/run_on_other_broadcast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingStart="8dp"
android:text="@string/text_run_on_user_defined_broadcast"
tools:ignore="RtlSymmetry" />
</RadioGroup> </RadioGroup>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="36dp" android:layout_marginStart="36dp"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:hint="@string/text_broadcast_action"> android:hint="@string/text_broadcast_action">
<androidx.appcompat.widget.AppCompatEditText <androidx.appcompat.widget.AppCompatEditText
android:id="@+id/action" android:id="@+id/action"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="2" android:maxLines="2"
android:text="@string/text_broadcast_action_prefix" /> android:text="@string/text_broadcast_action_prefix" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>

View File

@@ -1,66 +1,67 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent" android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools" android:layout_height="match_parent"
android:orientation="vertical"> android:fitsSystemWindows="true"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay" android:fitsSystemWindows="true"
android:fitsSystemWindows="true"> android:theme="@style/AppTheme.AppBarOverlay">
<org.autojs.autojs.theme.widget.ThemeColorToolbarEditor <org.autojs.autojs.theme.widget.ThemeColorToolbarEditor
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:theme="@style/ToolBarStyle" android:background="?attr/colorPrimary"
android:background="?attr/colorPrimary" android:theme="@style/ToolBarStyle"
tools:title="@string/app_name" app:contentInsetEndWithActions="2dp"
app:contentInsetStartWithNavigation="0dp" app:contentInsetStartWithNavigation="0dp"
app:contentInsetEndWithActions="2dp" app:popupTheme="@style/PopupMenuTheme"
app:titleTextAppearance="@style/TextAppearanceEditorTitle" tools:title="@string/app_name"
app:popupTheme="@style/PopupMenuTheme"> app:titleTextAppearance="@style/TextAppearanceEditorTitle">
<FrameLayout <FrameLayout
android:id="@+id/toolbar_menu" android:id="@+id/toolbar_menu"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="end" /> android:layout_gravity="end" />
</org.autojs.autojs.theme.widget.ThemeColorToolbarEditor> </org.autojs.autojs.theme.widget.ThemeColorToolbarEditor>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.drawerlayout.widget.DrawerLayout <androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<org.autojs.autojs.ui.edit.editor.CodeEditor <org.autojs.autojs.ui.edit.editor.CodeEditor
android:id="@+id/editor" android:id="@+id/editor"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_weight="1" />
<RelativeLayout <RelativeLayout
android:id="@+id/input_method_enhance_bar" android:id="@+id/input_method_enhance_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:background="#77f2f3f7"> android:background="#77f2f3f7">
<org.autojs.autojs.ui.edit.completion.CodeCompletionBar <org.autojs.autojs.ui.edit.completion.CodeCompletionBar
android:id="@+id/symbol_bar" android:id="@+id/symbol_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_alignParentBottom="true" /> android:layout_alignParentBottom="true" />
<ImageView <ImageView
android:id="@+id/functions" android:id="@+id/functions"
@@ -75,35 +76,35 @@
app:tint="#222329" /> app:tint="#222329" />
<org.autojs.autojs.ui.edit.completion.CodeCompletionBar <org.autojs.autojs.ui.edit.completion.CodeCompletionBar
android:id="@+id/code_completion_bar" android:id="@+id/code_completion_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_above="@+id/symbol_bar" android:layout_above="@+id/symbol_bar"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/functions" /> android:layout_toEndOf="@+id/functions" />
</RelativeLayout> </RelativeLayout>
<org.autojs.autojs.ui.edit.keyboard.FunctionsKeyboardView <org.autojs.autojs.ui.edit.keyboard.FunctionsKeyboardView
android:id="@+id/functions_keyboard" android:id="@+id/functions_keyboard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone" /> android:visibility="gone" />
<org.autojs.autojs.ui.edit.debug.DebugBar <org.autojs.autojs.ui.edit.debug.DebugBar
android:id="@+id/debug_bar" android:id="@+id/debug_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
<org.autojs.autojs.ui.widget.EWebView <org.autojs.autojs.ui.widget.EWebView
android:id="@+id/docs" android:id="@+id/docs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" /> android:layout_gravity="start" />
</androidx.drawerlayout.widget.DrawerLayout> </androidx.drawerlayout.widget.DrawerLayout>

View File

@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.autojs.autojs.ui.widget.NestedWebView <org.autojs.autojs.ui.widget.NestedWebView
android:id="@+id/web_view" android:id="@+id/web_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout> </org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout>
<ProgressBar <ProgressBar
android:id="@+id/progress_bar" android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="2dp" android:layout_height="2dp"
android:visibility="gone" /> android:visibility="gone" />
</merge> </merge>

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.autojs.autojs.ui.main.task.TaskListRecyclerView <org.autojs.autojs.ui.main.task.TaskListRecyclerView
android:id="@+id/task_list" android:id="@+id/task_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout> </org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout>

View File

@@ -4,10 +4,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:layout_marginStart="6dp" android:layout_margin="2dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="6dp"
android:layout_marginBottom="3dp"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
@@ -18,7 +15,8 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="8dp"> android:paddingHorizontal="16dp"
android:paddingVertical="8dp">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -28,20 +26,20 @@
android:orientation="vertical" android:orientation="vertical"
tools:ignore="RelativeOverlap"> tools:ignore="RelativeOverlap">
<TextView <TextView
android:id="@+id/filename" android:id="@+id/filename"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/text_color_primary" android:textColor="@color/text_color_primary"
tools:text="filename" /> tools:text="File name: foo" />
<TextView <TextView
android:id="@+id/alias" android:id="@+id/alias"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/text_color_primary" android:textColor="@color/text_color_primary"
tools:text="filename" /> tools:text="Alias: bar" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -76,6 +74,9 @@
android:padding="4dp" android:padding="4dp"
android:src="@drawable/ic_key_store_delete" android:src="@drawable/ic_key_store_delete"
app:tint="@color/md_red_500" /> app:tint="@color/md_red_500" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View File

@@ -7,6 +7,7 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="android:windowBackground">@color/window_background</item> <item name="android:windowBackground">@color/window_background</item>
<item name="android:statusBarColor">@color/window_background</item>
<item name="android:navigationBarColor">@color/window_background</item> <item name="android:navigationBarColor">@color/window_background</item>
</style> </style>

View File

@@ -12,7 +12,6 @@
<enum name="single" value="0" /> <enum name="single" value="0" />
<enum name="multiple" value="1" /> <enum name="multiple" value="1" />
</attr> </attr>
<attr name="alwaysExtended" format="boolean" /> <attr name="alwaysExtended" format="boolean" />
<attr name="list" format="reference" /> <attr name="list" format="reference" />
</declare-styleable> </declare-styleable>
@@ -27,10 +26,12 @@
<attr name="positiveText" format="string" /> <attr name="positiveText" format="string" />
<attr name="onConfirmPrompt" format="string" /> <attr name="onConfirmPrompt" format="string" />
</declare-styleable> </declare-styleable>
<declare-styleable name="MaterialPreference"> <declare-styleable name="MaterialPreference">
<attr name="longClickPrompt" format="string" /> <attr name="longClickPrompt" format="string" />
<attr name="longClickPromptMore" format="string" /> <attr name="longClickPromptMore" format="string" />
</declare-styleable> </declare-styleable>
<declare-styleable name="MaterialListPreference"> <declare-styleable name="MaterialListPreference">
<attr name="dialogTitle" /> <attr name="dialogTitle" />
<attr name="dialogContent" /> <attr name="dialogContent" />
@@ -88,5 +89,7 @@
<attr name="color_warn" format="reference|color" /> <attr name="color_warn" format="reference|color" />
<attr name="color_error" format="reference|color" /> <attr name="color_error" format="reference|color" />
<attr name="color_assert" format="reference|color" /> <attr name="color_assert" format="reference|color" />
<attr name="excludeFromNavigationBar" format="boolean" />
</declare-styleable> </declare-styleable>
</resources> </resources>

View File

@@ -22,6 +22,8 @@
<color name="text_color_primary_full">@color/day_night_full</color> <color name="text_color_primary_full">@color/day_night_full</color>
<color name="text_color_primary_alpha_70">@color/day_night_alpha_70</color> <color name="text_color_primary_alpha_70">@color/day_night_alpha_70</color>
<color name="text_color_secondly">#9DA0A2</color> <color name="text_color_secondly">#9DA0A2</color>
<color name="black_alpha_40">#66000000</color>
<color name="black_alpha_44">#70000000</color>
<color name="colorAccent">#03A9F4</color> <color name="colorAccent">#03A9F4</color>
<color name="colorPrimary">@color/theme_color_default</color> <color name="colorPrimary">@color/theme_color_default</color>

View File

@@ -8,6 +8,7 @@
<item name="android:textColorPrimary">@color/text_color_primary</item> <item name="android:textColorPrimary">@color/text_color_primary</item>
<item name="android:textColorSecondary">@color/text_color_secondly</item> <item name="android:textColorSecondary">@color/text_color_secondly</item>
<item name="android:windowBackground">@color/window_background</item> <item name="android:windowBackground">@color/window_background</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@@ -108,6 +109,7 @@
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style> </style>
<style name="MtAppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" /> <style name="MtAppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" />

View File

@@ -1,5 +1,5 @@
#Sat Mar 08 23:27:39 CST 2025 #Mon Mar 10 23:16:02 CST 2025
BUILD_TIME=1741447659779 BUILD_TIME=1741619762219
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=3001 VERSION_BUILD=3009
VERSION_NAME=6.6.2 Alpha3 VERSION_NAME=6.6.2 Alpha4
VSCODE_EXT_REQUIRED_VERSION=1.0.8 VSCODE_EXT_REQUIRED_VERSION=1.0.8