From bfabef6a0ebd45e38b3a3c72af8968dffe8f97ee Mon Sep 17 00:00:00 2001 From: hyb1996 <946994919@qq.com> Date: Mon, 3 Apr 2017 00:43:15 +0800 Subject: [PATCH] Refactor: split into modules autojs, common, app and automator --- .idea/dictionaries/Stardust.xml | 8 + .idea/gradle.xml | 2 + .idea/misc.xml | 12 +- .idea/modules.xml | 2 + app/build.gradle | 2 + app/src/main/AndroidManifest.xml | 1 - .../WrapContentLinearLayoutManager.java | 2 +- .../main/java/com/stardust/app/Fragment.java | 4 +- .../app/SimpleActivityLifecycleCallbacks.java | 47 + .../com/stardust/hover/HoverMenuService.java | 129 -- .../com/stardust/hover/HoverMenuView.java | 1109 ----------------- app/src/main/java/com/stardust/pio/PFile.java | 31 - .../java/com/stardust/scriptdroid/App.java | 98 +- .../java/com/stardust/scriptdroid/Pref.java | 3 +- .../stardust/scriptdroid/autojs/AutoJs.java | 123 ++ .../com/stardust/scriptdroid/droid/Droid.java | 172 --- .../scriptdroid/droid/PathChecker.java | 64 - .../scriptdroid/droid/RunningConfig.java | 35 - .../droid/runtime/DroidRuntime.java | 436 ------- .../droid/runtime/ScriptStopException.java | 24 - .../droid/runtime/action/Able.java | 49 - .../droid/runtime/action/Action.java | 40 - .../droid/runtime/action/ActionFactory.java | 64 - .../ActionPerformAccessibilityDelegate.java | 82 -- .../droid/runtime/action/ActionTarget.java | 68 - .../action/DepthFirstSearchTargetAction.java | 40 - .../droid/runtime/action/FilterAction.java | 165 --- .../droid/runtime/action/GetTextAction.java | 42 - .../droid/runtime/action/ScrollAction.java | 57 - .../droid/runtime/action/ScrollMaxAction.java | 70 -- .../runtime/action/SearchTargetAction.java | 47 - .../runtime/action/SearchUpTargetAction.java | 30 - .../runtime/api/InjectableWebClient.java | 140 --- .../droid/runtime/api/InjectableWebView.java | 39 - .../scriptdroid/droid/runtime/api/Shell.java | 85 -- .../droid/script/JavaScriptEngine.java | 61 - .../droid/script/NodeJsJavaScriptEngine.java | 71 -- .../droid/script/RhinoJavaScriptEngine.java | 191 --- .../droid/script/ScriptExecuteActivity.java | 65 - .../droid/script/file/ScriptFile.java | 104 -- .../droid/script/file/ScriptFileList.java | 42 - .../script/file/SharedPrefScriptFileList.java | 103 -- .../script/file/StorageScriptFileList.java | 92 -- .../floating_window/FloatingWindowManger.java | 11 +- .../floating_window/HoverMenuService.java | 9 +- .../content/MainMenuNavigatorContent.java | 30 +- .../content/RecordNavigatorContent.java | 3 +- .../content/ScritpListNavigatorContent.java | 3 +- .../view/FloatingScriptFileListView.java | 11 +- .../external/open/ImportIntentActivity.java | 9 - .../external/open/RunIntentActivity.java | 29 +- .../external/shortcut/ShortcutActivity.java | 10 +- .../external/tasker/TaskPrefEditActivity.java | 3 +- .../layout_inspector/LayoutInspector.java | 7 - .../view/LayoutBoundsView.java | 4 +- .../view/LayoutHierarchyView.java | 4 +- .../view/LayoutInspectView.java | 3 +- .../layout_inspector/view/NodeInfoView.java | 7 +- .../AccessibilityActionConverter.java | 2 +- .../AccessibilityActionRecorder.java | 11 +- .../inputevent/InputEventConverter.java | 5 - .../scriptdroid/scripts}/PathChecker.java | 10 +- .../scriptdroid/scripts}/ScriptFile.java | 17 +- .../scriptdroid/scripts}/ScriptFileList.java | 2 +- .../scripts}/SharedPrefScriptFileList.java | 6 +- .../scripts/StorageScriptProvider.java | 55 +- .../scripts/sample/SampleFileManager.java | 4 +- .../tool/AccessibilityServiceTool.java | 1 + .../stardust/scriptdroid/tool/ClassTool.java | 22 - .../scriptdroid/tool/ClipboardTool.java | 19 - .../tool}/CrashHandler.java | 4 +- .../stardust/scriptdroid/ui/BaseActivity.java | 3 +- .../scriptdroid/ui/console/TimberConsole.java | 87 ++ .../scriptdroid/ui/edit/EditActivity.java | 32 +- .../completion/InputMethodEnhanceBar.java | 5 +- .../sidemenu/FunctionListRecyclerView.java | 6 +- .../ui/help/DocumentationActivity.java | 10 +- .../ui/help/HelpCatalogueActivity.java | 5 +- .../ui/help/LocalWebViewActivity.java | 4 +- .../scriptdroid/ui/main/MainActivity.java | 14 +- .../ui/main/SlideMenuFragment.java | 6 +- .../my_script_list/MyScriptListFragment.java | 18 +- .../ScriptAndFolderListRecyclerView.java | 23 +- .../ScriptListRecyclerView.java | 16 +- .../main/operation/ScriptFileOperation.java | 11 +- .../ScriptFileOperationPopupMenu.java | 9 +- .../sample_list/SampleScriptListFragment.java | 11 +- .../ui/settings/AboutActivity.java | 10 +- .../ui/settings/SettingsActivity.java | 4 +- .../main/java/com/stardust/view/Floaty.java | 2 +- .../com/stardust/view/ResizableFloaty.java | 4 +- .../stardust/scriptdroid/ExampleUnitTest.java | 23 - autojs/build.gradle | 6 +- .../autojs}/ExampleInstrumentedTest.java | 4 +- autojs/src/main/AndroidManifest.xml | 11 +- .../src/main/assets/javascript_engine_init.js | 180 +-- .../src/main/assets/nodejs_engine_init.js | 0 autojs/src/main/java/autojs/Droid.java | 172 --- .../src/main/java/autojs/RunningConfig.java | 32 - .../java/autojs/runtime/DroidRuntime.java | 442 ------- .../java/autojs/runtime/action/Action.java | 40 - .../ActionPerformAccessibilityDelegate.java | 75 -- .../java/autojs/runtime/api/UiSelector.java | 227 ---- .../java/autojs/script/JavaScriptEngine.java | 61 - .../autojs/script/NodeJsJavaScriptEngine.java | 59 - .../autojs/script/RhinoJavaScriptEngine.java | 191 --- .../autojs/script/ScriptExecuteActivity.java | 65 - .../script/file/StorageScriptFileList.java | 92 -- .../com/stardust/autojs/ExecutionConfig.java | 34 + .../stardust/autojs/ScriptEngineService.java | 140 +++ .../autojs/ScriptEngineServiceBuilder.java | 49 + .../autojs/engine/JavaScriptEngine.java | 22 + .../engine/JavaScriptEngineManager.java | 103 ++ .../autojs/engine/NodeJsJavaScriptEngine.java | 42 + .../engine/NodeJsJavaScriptEngineManager.java | 25 + .../autojs/engine/RhinoJavaScriptEngine.java | 110 ++ .../engine/RhinoJavaScriptEngineManager.java | 110 ++ .../autojs/engine/ScriptExecuteActivity.java | 67 + .../engine/ScriptExecutionListener.java | 18 + .../autojs/engine/ScriptExecutionTask.java | 55 + .../engine/SimpleScriptExecutionListener.java | 24 + .../autojs/runtime/AccessibilityBridge.java | 22 + .../autojs/runtime/JavascriptField.java | 15 + .../autojs/runtime/JavascriptInterface.java | 14 + .../autojs/runtime/ScriptRuntime.java | 103 ++ .../autojs/runtime/ScriptStopException.java | 2 +- .../stardust}/autojs/runtime/action/Able.java | 2 +- .../autojs/runtime/action/Action.java | 31 + .../runtime/action/ActionAutomator.java | 246 ++++ .../autojs/runtime/action/ActionFactory.java | 2 +- .../ActionPerformAccessibilityDelegate.java | 77 ++ .../autojs/runtime/action/ActionTarget.java | 2 +- .../action/DepthFirstSearchTargetAction.java | 2 +- .../autojs/runtime/action/FilterAction.java | 2 +- .../autojs/runtime/action/GetTextAction.java | 2 +- .../autojs/runtime/action/ScrollAction.java | 2 +- .../runtime/action/ScrollMaxAction.java | 2 +- .../runtime/action/SearchTargetAction.java | 2 +- .../runtime/action/SearchUpTargetAction.java | 2 +- .../stardust/autojs/runtime/api/AppUtils.java | 55 + .../stardust/autojs/runtime/api/Console.java | 31 + .../runtime/api/InjectableWebClient.java | 5 +- .../autojs/runtime/api/InjectableWebView.java | 2 +- .../stardust}/autojs/runtime/api/Shell.java | 4 +- .../autojs}/runtime/api/UiSelector.java | 20 +- .../autojs/script/FileScriptSource.java | 36 + .../autojs/script/MultiScriptSource.java | 25 + .../stardust/autojs/script/ScriptSource.java | 64 + .../autojs/script/StringScriptSource.java | 20 + autojs/src/main/res/values/strings.xml | 8 + .../autojs/ExampleUnitTest.java | 2 +- automator/build.gradle | 1 + .../AccessibilityEventCommandHost.java | 6 - .../AccessibilityInfoProvider.java | 12 +- {shell => common}/.gitignore | 0 {shell => common}/build.gradle | 13 +- {shell => common}/proguard-rules.pro | 0 .../stardust}/ExampleInstrumentedTest.java | 4 +- .../src/main/AndroidManifest.xml | 2 +- .../src/main/java/com/stardust/pio/PFile.java | 239 ++++ .../java/com/stardust/pio/PReadableFile.java | 2 +- .../java/com/stardust/pio/PWritableFile.java | 0 .../stardust/pio/UncheckedIOException.java | 0 .../java/com/stardust/util/AssetsCache.java | 2 - .../stardust/util}/BackPressedHandler.java | 14 +- .../java/com/stardust/util/ClipboardUtil.java | 18 + .../main/java/com/stardust/util/Consumer.java | 0 .../java/com/stardust/util/FileSorter.java | 2 - .../java/com/stardust/util}/FileUtils.java | 14 +- .../stardust/util/FloatingWindowUtils.java | 9 +- .../java/com/stardust/util/IntentUtil.java | 35 +- .../com/stardust/util/LimitedHashMap.java | 2 +- .../java/com/stardust/util/MapEntries.java | 0 .../java/com/stardust/util/MessageEvent.java | 2 - .../main/java/com/stardust/util}/Shell.java | 8 +- .../com/stardust/util/SparseArrayEntries.java | 0 .../java/com/stardust/util/StateObserver.java | 0 .../main/java/com/stardust/util/ViewUtil.java | 7 +- common/src/main/res/values/strings.xml | 3 + .../java/com/stardust}/ExampleUnitTest.java | 2 +- settings.gradle | 2 +- shell/src/main/res/values/strings.xml | 3 - 182 files changed, 2498 insertions(+), 5817 deletions(-) create mode 100644 .idea/dictionaries/Stardust.xml rename app/src/main/java/android/{bug => workground}/WrapContentLinearLayoutManager.java (97%) create mode 100644 app/src/main/java/com/stardust/app/SimpleActivityLifecycleCallbacks.java delete mode 100644 app/src/main/java/com/stardust/hover/HoverMenuService.java delete mode 100644 app/src/main/java/com/stardust/hover/HoverMenuView.java delete mode 100644 app/src/main/java/com/stardust/pio/PFile.java create mode 100644 app/src/main/java/com/stardust/scriptdroid/autojs/AutoJs.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/Droid.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/PathChecker.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/RunningConfig.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/DroidRuntime.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/ScriptStopException.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/Able.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/Action.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/ActionFactory.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/ActionPerformAccessibilityDelegate.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/ActionTarget.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/DepthFirstSearchTargetAction.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/FilterAction.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/GetTextAction.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/ScrollAction.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/ScrollMaxAction.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/SearchTargetAction.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/action/SearchUpTargetAction.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/api/InjectableWebClient.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/api/InjectableWebView.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/runtime/api/Shell.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/script/JavaScriptEngine.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/script/NodeJsJavaScriptEngine.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/script/RhinoJavaScriptEngine.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/script/ScriptExecuteActivity.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/script/file/ScriptFile.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/script/file/ScriptFileList.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/script/file/SharedPrefScriptFileList.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/droid/script/file/StorageScriptFileList.java rename {autojs/src/main/java/autojs => app/src/main/java/com/stardust/scriptdroid/scripts}/PathChecker.java (85%) rename {autojs/src/main/java/autojs/script/file => app/src/main/java/com/stardust/scriptdroid/scripts}/ScriptFile.java (80%) rename {autojs/src/main/java/autojs/script/file => app/src/main/java/com/stardust/scriptdroid/scripts}/ScriptFileList.java (95%) rename {autojs/src/main/java/autojs/script/file => app/src/main/java/com/stardust/scriptdroid/scripts}/SharedPrefScriptFileList.java (94%) delete mode 100644 app/src/main/java/com/stardust/scriptdroid/tool/ClassTool.java delete mode 100644 app/src/main/java/com/stardust/scriptdroid/tool/ClipboardTool.java rename app/src/main/java/com/stardust/{util => scriptdroid/tool}/CrashHandler.java (98%) create mode 100644 app/src/main/java/com/stardust/scriptdroid/ui/console/TimberConsole.java rename {shell/src/androidTest/java/com/stardust/shell => autojs/src/androidTest/java/com/stardust/autojs}/ExampleInstrumentedTest.java (85%) rename app/src/main/assets/javasccript_engine_init.js => autojs/src/main/assets/javascript_engine_init.js (64%) rename {app => autojs}/src/main/assets/nodejs_engine_init.js (100%) delete mode 100644 autojs/src/main/java/autojs/Droid.java delete mode 100644 autojs/src/main/java/autojs/RunningConfig.java delete mode 100644 autojs/src/main/java/autojs/runtime/DroidRuntime.java delete mode 100644 autojs/src/main/java/autojs/runtime/action/Action.java delete mode 100644 autojs/src/main/java/autojs/runtime/action/ActionPerformAccessibilityDelegate.java delete mode 100644 autojs/src/main/java/autojs/runtime/api/UiSelector.java delete mode 100644 autojs/src/main/java/autojs/script/JavaScriptEngine.java delete mode 100644 autojs/src/main/java/autojs/script/NodeJsJavaScriptEngine.java delete mode 100644 autojs/src/main/java/autojs/script/RhinoJavaScriptEngine.java delete mode 100644 autojs/src/main/java/autojs/script/ScriptExecuteActivity.java delete mode 100644 autojs/src/main/java/autojs/script/file/StorageScriptFileList.java create mode 100644 autojs/src/main/java/com/stardust/autojs/ExecutionConfig.java create mode 100644 autojs/src/main/java/com/stardust/autojs/ScriptEngineService.java create mode 100644 autojs/src/main/java/com/stardust/autojs/ScriptEngineServiceBuilder.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/JavaScriptEngine.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/JavaScriptEngineManager.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/NodeJsJavaScriptEngine.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/NodeJsJavaScriptEngineManager.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/RhinoJavaScriptEngine.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/RhinoJavaScriptEngineManager.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/ScriptExecuteActivity.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/ScriptExecutionListener.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/ScriptExecutionTask.java create mode 100644 autojs/src/main/java/com/stardust/autojs/engine/SimpleScriptExecutionListener.java create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/AccessibilityBridge.java create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/JavascriptField.java create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/JavascriptInterface.java create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/ScriptRuntime.java rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/ScriptStopException.java (91%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/Able.java (97%) create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/action/Action.java create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/action/ActionAutomator.java rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/ActionFactory.java (98%) create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/action/ActionPerformAccessibilityDelegate.java rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/ActionTarget.java (97%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/DepthFirstSearchTargetAction.java (95%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/FilterAction.java (99%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/GetTextAction.java (95%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/ScrollAction.java (97%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/ScrollMaxAction.java (98%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/SearchTargetAction.java (95%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/action/SearchUpTargetAction.java (94%) create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/api/AppUtils.java create mode 100644 autojs/src/main/java/com/stardust/autojs/runtime/api/Console.java rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/api/InjectableWebClient.java (97%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/api/InjectableWebView.java (95%) rename autojs/src/main/java/{ => com/stardust}/autojs/runtime/api/Shell.java (93%) rename {app/src/main/java/com/stardust/scriptdroid/droid => autojs/src/main/java/com/stardust/autojs}/runtime/api/UiSelector.java (93%) create mode 100644 autojs/src/main/java/com/stardust/autojs/script/FileScriptSource.java create mode 100644 autojs/src/main/java/com/stardust/autojs/script/MultiScriptSource.java create mode 100644 autojs/src/main/java/com/stardust/autojs/script/ScriptSource.java create mode 100644 autojs/src/main/java/com/stardust/autojs/script/StringScriptSource.java rename autojs/src/test/java/com/{example => stardust}/autojs/ExampleUnitTest.java (92%) rename {app/src/main/java/com/stardust/scriptdroid => automator/src/main/java/com/stardust/view}/accessibility/AccessibilityInfoProvider.java (79%) rename {shell => common}/.gitignore (100%) rename {shell => common}/build.gradle (76%) rename {shell => common}/proguard-rules.pro (100%) rename {autojs/src/androidTest/java/com/example/autojs => common/src/androidTest/java/com/stardust}/ExampleInstrumentedTest.java (85%) rename {shell => common}/src/main/AndroidManifest.xml (86%) create mode 100644 common/src/main/java/com/stardust/pio/PFile.java rename {app => common}/src/main/java/com/stardust/pio/PReadableFile.java (98%) rename {app => common}/src/main/java/com/stardust/pio/PWritableFile.java (100%) rename {app => common}/src/main/java/com/stardust/pio/UncheckedIOException.java (100%) rename {app => common}/src/main/java/com/stardust/util/AssetsCache.java (87%) rename {app/src/main/java/com/stardust/scriptdroid/tool => common/src/main/java/com/stardust/util}/BackPressedHandler.java (85%) create mode 100644 common/src/main/java/com/stardust/util/ClipboardUtil.java rename {automator => common}/src/main/java/com/stardust/util/Consumer.java (100%) rename {app => common}/src/main/java/com/stardust/util/FileSorter.java (97%) rename {app/src/main/java/com/stardust/scriptdroid/tool => common/src/main/java/com/stardust/util}/FileUtils.java (94%) rename {app => common}/src/main/java/com/stardust/util/FloatingWindowUtils.java (77%) rename app/src/main/java/com/stardust/scriptdroid/tool/IntentTool.java => common/src/main/java/com/stardust/util/IntentUtil.java (60%) rename {app => common}/src/main/java/com/stardust/util/LimitedHashMap.java (97%) rename {app => common}/src/main/java/com/stardust/util/MapEntries.java (100%) rename {app => common}/src/main/java/com/stardust/util/MessageEvent.java (91%) rename {app/src/main/java/com/stardust/scriptdroid/tool => common/src/main/java/com/stardust/util}/Shell.java (96%) rename {automator => common}/src/main/java/com/stardust/util/SparseArrayEntries.java (100%) rename {app => common}/src/main/java/com/stardust/util/StateObserver.java (100%) rename app/src/main/java/com/stardust/scriptdroid/tool/ViewTool.java => common/src/main/java/com/stardust/util/ViewUtil.java (81%) create mode 100644 common/src/main/res/values/strings.xml rename {shell/src/test/java/com/stardust/shell => common/src/test/java/com/stardust}/ExampleUnitTest.java (92%) delete mode 100644 shell/src/main/res/values/strings.xml diff --git a/.idea/dictionaries/Stardust.xml b/.idea/dictionaries/Stardust.xml new file mode 100644 index 000000000..8244557fd --- /dev/null +++ b/.idea/dictionaries/Stardust.xml @@ -0,0 +1,8 @@ + + + + interruptible + scriptable + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index b37f0af46..d1f394087 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -9,7 +9,9 @@