Add: tasker plugin support, injectable webview
This commit is contained in:
@@ -40,25 +40,13 @@ public class ImportIntentActivity extends BaseActivity {
|
||||
private void handleIntent() {
|
||||
Intent intent = getIntent();
|
||||
final String path = intent.getData().getPath();
|
||||
if (!TextUtils.isEmpty(path)) {
|
||||
new ThemeColorMaterialDialogBuilder(this)
|
||||
.title(R.string.text_please_input_name)
|
||||
.input(getString(R.string.text_name), FileUtils.getNameWithoutExtension(path), new MaterialDialog.InputCallback() {
|
||||
@Override
|
||||
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
|
||||
ScriptFileList.getImpl().add(new ScriptFile(input.toString(), path));
|
||||
startMainActivity();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
if (!TextUtils.isEmpty(path))
|
||||
MainActivity.importScriptFile(this, path);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void startMainActivity() {
|
||||
startActivity(new Intent(this, MainActivity.class)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,16 @@ import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.stardust.scriptdroid.external.shortcut.ShortcutActivity;
|
||||
import com.stardust.scriptdroid.droid.Droid;
|
||||
import com.stardust.scriptdroid.droid.PathChecker;
|
||||
import com.stardust.scriptdroid.droid.RunningConfig;
|
||||
import com.stardust.scriptdroid.external.CommonUtils;
|
||||
import com.stardust.scriptdroid.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/2/22.
|
||||
*/
|
||||
@@ -30,11 +34,20 @@ public class RunIntentActivity extends Activity {
|
||||
|
||||
private void handleIntent() {
|
||||
Intent intent = getIntent();
|
||||
String path = intent.getData().getPath();
|
||||
if (!TextUtils.isEmpty(path)) {
|
||||
startActivity(new Intent(this, ShortcutActivity.class)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.putExtra("path", path));
|
||||
String path = getPath(intent);
|
||||
String script = intent.getStringExtra(CommonUtils.EXTRA_KEY_PREPARE_SCRIPT);
|
||||
if (path == null && script != null) {
|
||||
Droid.getInstance().runScript(script);
|
||||
} else {
|
||||
if (new PathChecker(this).checkAndToastError(path)) {
|
||||
Droid.getInstance().runScriptFile(new File(path), null, new RunningConfig().prepareScript(script));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getPath(Intent intent) {
|
||||
if (intent.getData() != null && intent.getData().getPath() != null)
|
||||
return intent.getData().getPath();
|
||||
return intent.getStringExtra(CommonUtils.EXTRA_KEY_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user