fix flash when launch a shortcut

This commit is contained in:
hyb1996
2017-07-02 15:28:30 +08:00
parent a87cf6fc3a
commit 306cf4c5d3
7 changed files with 51 additions and 14 deletions

View File

@@ -38,10 +38,11 @@
<activity
android:name=".external.shortcut.ShortcutActivity"
android:theme="@style/AppTheme.NoActionBar">
android:taskAffinity="com.stardust.scriptdroid.external.shortcut.ShortcutActivity"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="com.example.Project.Action"/>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
@@ -151,7 +152,9 @@
<activity
android:name=".external.open.RunIntentActivity"
android:icon="@drawable/ic_ali_run"
android:label="运行脚本">
android:label="运行脚本"
android:taskAffinity="com.stardust.scriptdroid.external.open.RunIntentActivity"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>

View File

@@ -33,7 +33,6 @@ public class CommonUtils {
String directoryPath = null;
String script = intent.getStringExtra(CommonUtils.EXTRA_KEY_PRE_EXECUTE_SCRIPT);
ScriptSource source = null;
Toast.makeText(context, path, Toast.LENGTH_SHORT).show();
if (path == null && script != null) {
source = new StringScriptSource(script);
} else if (path != null && new PathChecker(context).checkAndToastError(path)) {

View File

@@ -2,6 +2,7 @@ package com.stardust.scriptdroid.external.shortcut;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
/**

View File

@@ -23,10 +23,6 @@ public class ShortcutActivity extends Activity {
if (new PathChecker(this).checkAndToastError(path)) {
runScriptFile(path);
}
}
public void onStart() {
super.onStart();
finish();
}

View File

@@ -40,7 +40,7 @@ public class ScriptFile extends File {
if (isDirectory())
return renameTo(new File(getParent(), newName));
else
return renameTo(new File(getParent(), newName + getExtension()));
return renameTo(new File(getParent(), newName + "." + getExtension()));
}
private String getExtension() {