新增 编辑文件时在多任务中分任务显示
This commit is contained in:
1
.idea/dictionaries/Stardust.xml
generated
1
.idea/dictionaries/Stardust.xml
generated
@@ -11,6 +11,7 @@
|
|||||||
<w>loopers</w>
|
<w>loopers</w>
|
||||||
<w>opencv</w>
|
<w>opencv</w>
|
||||||
<w>prefill</w>
|
<w>prefill</w>
|
||||||
|
<w>recents</w>
|
||||||
<w>scriptable</w>
|
<w>scriptable</w>
|
||||||
<w>storages</w>
|
<w>storages</w>
|
||||||
<w>tasker</w>
|
<w>tasker</w>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_SedTORAGE"/>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
|
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
|
||||||
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
|
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
|
||||||
@@ -85,6 +85,7 @@
|
|||||||
android:name=".ui.edit.EditActivity_"
|
android:name=".ui.edit.EditActivity_"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:multiprocess="true"
|
android:multiprocess="true"
|
||||||
|
android:taskAffinity="org.autojs.autojs.edit"
|
||||||
android:theme="@style/EditorTheme">
|
android:theme="@style/EditorTheme">
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".ui.settings.AboutActivity_"/>
|
<activity android:name=".ui.settings.AboutActivity_"/>
|
||||||
@@ -275,6 +276,7 @@
|
|||||||
<data android:mimeType="text/plain"/>
|
<data android:mimeType="text/plain"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.stardust.notification.NotificationListenerService"
|
android:name="com.stardust.notification.NotificationListenerService"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
@@ -91,22 +91,22 @@ object Scripts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun edit(file: ScriptFile) {
|
fun edit(context: Context, file: ScriptFile) {
|
||||||
EditActivity.editFile(GlobalAppContext.get(), file.simplifiedName, file.path)
|
EditActivity.editFile(context, file.simplifiedName, file.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun edit(path: String) {
|
fun edit(context: Context, path: String) {
|
||||||
edit(ScriptFile(path))
|
edit(context, ScriptFile(path))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(file: ScriptFile): ScriptExecution? {
|
fun run(file: ScriptFile): ScriptExecution? {
|
||||||
try {
|
return try {
|
||||||
return AutoJs.getInstance().scriptEngineService.execute(file.toSource(),
|
AutoJs.getInstance().scriptEngineService.execute(file.toSource(),
|
||||||
ExecutionConfig(workingDirectory = file.parent))
|
ExecutionConfig(workingDirectory = file.parent))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Toast.makeText(GlobalAppContext.get(), e.message, Toast.LENGTH_LONG).show()
|
Toast.makeText(GlobalAppContext.get(), e.message, Toast.LENGTH_LONG).show()
|
||||||
return null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public class ScriptOperations {
|
|||||||
}
|
}
|
||||||
notifyFileCreated(mCurrentDirectory, new ScriptFile(path));
|
notifyFileCreated(mCurrentDirectory, new ScriptFile(path));
|
||||||
if (edit)
|
if (edit)
|
||||||
Scripts.INSTANCE.edit(path);
|
Scripts.INSTANCE.edit(mContext, path);
|
||||||
} else {
|
} else {
|
||||||
showMessage(R.string.text_create_fail);
|
showMessage(R.string.text_create_fail);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import android.annotation.SuppressLint;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ActionMode;
|
import android.view.ActionMode;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -195,7 +198,15 @@ public class EditActivity extends BaseActivity implements OnActivityResultDelega
|
|||||||
showExitConfirmDialog();
|
showExitConfirmDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.finish();
|
finishAndRemoveFromRecents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finishAndRemoveFromRecents() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
finishAndRemoveTask();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showExitConfirmDialog() {
|
private void showExitConfirmDialog() {
|
||||||
@@ -207,9 +218,9 @@ public class EditActivity extends BaseActivity implements OnActivityResultDelega
|
|||||||
.neutralText(R.string.text_exit_directly)
|
.neutralText(R.string.text_exit_directly)
|
||||||
.onNegative((dialog, which) -> {
|
.onNegative((dialog, which) -> {
|
||||||
mEditorView.saveFile();
|
mEditorView.saveFile();
|
||||||
EditActivity.super.finish();
|
finishAndRemoveFromRecents();
|
||||||
})
|
})
|
||||||
.onNeutral((dialog, which) -> EditActivity.super.finish())
|
.onNeutral((dialog, which) -> finishAndRemoveFromRecents())
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,4 +305,5 @@ public class EditActivity extends BaseActivity implements OnActivityResultDelega
|
|||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
mRequestPermissionCallbacks.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
mRequestPermissionCallbacks.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ public class ExplorerView extends ThemeColorSwipeRefreshLayout implements SwipeR
|
|||||||
|
|
||||||
@OnClick(R.id.edit)
|
@OnClick(R.id.edit)
|
||||||
void edit() {
|
void edit() {
|
||||||
Scripts.INSTANCE.edit(new ScriptFile(mExplorerItem.getPath()));
|
Scripts.INSTANCE.edit(getContext(), new ScriptFile(mExplorerItem.getPath()));
|
||||||
notifyOperated();
|
notifyOperated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class CommunityWebView extends EWebView {
|
|||||||
.subscribe(file ->
|
.subscribe(file ->
|
||||||
Snackbar.make(CommunityWebView.this, getResources().getString(R.string.format_file_downloaded, file.getPath())
|
Snackbar.make(CommunityWebView.this, getResources().getString(R.string.format_file_downloaded, file.getPath())
|
||||||
, Snackbar.LENGTH_LONG)
|
, Snackbar.LENGTH_LONG)
|
||||||
.setAction(R.string.text_open, v -> Scripts.INSTANCE.edit(file))
|
.setAction(R.string.text_open, v -> Scripts.INSTANCE.edit(getContext(), file))
|
||||||
.show(),
|
.show(),
|
||||||
error -> {
|
error -> {
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class MyScriptListFragment extends ViewPagerFragment implements FloatingA
|
|||||||
mExplorerView.setExplorer(Explorers.workspace(), ExplorerDirPage.createRoot(Pref.getScriptDirPath()));
|
mExplorerView.setExplorer(Explorers.workspace(), ExplorerDirPage.createRoot(Pref.getScriptDirPath()));
|
||||||
mExplorerView.setOnItemClickListener((view, item) -> {
|
mExplorerView.setOnItemClickListener((view, item) -> {
|
||||||
if (item.isEditable()) {
|
if (item.isEditable()) {
|
||||||
Scripts.INSTANCE.edit(item.toScriptFile());
|
Scripts.INSTANCE.edit(getActivity(), item.toScriptFile());
|
||||||
} else {
|
} else {
|
||||||
IntentUtil.viewFile(GlobalAppContext.get(), item.getPath(), AppFileProvider.AUTHORITY);
|
IntentUtil.viewFile(GlobalAppContext.get(), item.getPath(), AppFileProvider.AUTHORITY);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user