Show toast when disabling scripts.

(note: I don't fully understand the string naming convention, probably needs a different name)
This commit is contained in:
TrianguloY 2019-03-16 23:16:52 +01:00
parent e7a5b19775
commit 5894104e6d
3 changed files with 10 additions and 2 deletions

View file

@ -6,6 +6,8 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.widget.Toast;
import net.pierrox.lightning_launcher.LLApp; import net.pierrox.lightning_launcher.LLApp;
import net.pierrox.lightning_launcher.R; import net.pierrox.lightning_launcher.R;
import net.pierrox.lightning_launcher.api.ScreenIdentity; import net.pierrox.lightning_launcher.api.ScreenIdentity;
@ -68,7 +70,9 @@ public class MultiPurposeTransparentActivity extends ResourceWrapperActivity {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
// should pass the base dir of the engine in the intent and use it instead of the default engine // should pass the base dir of the engine in the intent and use it instead of the default engine
LLApp.get().getAppEngine().getScriptManager().getOrLoadScript(script_id).setFlag(Script.FLAG_DISABLED, true); LLApp llApp = LLApp.get();
llApp.getAppEngine().getScriptManager().getOrLoadScript(script_id).setFlag(Script.FLAG_DISABLED, true);
Toast.makeText(llApp, R.string.sc_disable_toast, Toast.LENGTH_LONG).show();
finish(); finish();
} }
}); });

View file

@ -344,6 +344,7 @@ public class ScriptExecutor {
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
mCurrentScriptDialog = false; mCurrentScriptDialog = false;
mCurrentScript.setFlag(Script.FLAG_DISABLED, true); mCurrentScript.setFlag(Script.FLAG_DISABLED, true);
Toast.makeText(context, R.string.sc_disable_toast, Toast.LENGTH_LONG).show();
} }
}); });
builder.setCancelable(false); builder.setCancelable(false);
@ -406,6 +407,7 @@ public class ScriptExecutor {
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
mCurrentScriptDialog = false; mCurrentScriptDialog = false;
script.setFlag(Script.FLAG_DISABLED, true); script.setFlag(Script.FLAG_DISABLED, true);
Toast.makeText(context, R.string.sc_disable_toast, Toast.LENGTH_LONG).show();
continuePendingContinuation(pending, input == null ? false : null); continuePendingContinuation(pending, input == null ? false : null);
} }
}); });

View file

@ -1309,7 +1309,9 @@
<string name="permission_label">Use Script Service</string> <string name="permission_label">Use Script Service</string>
<string name="permission_description">Allows to view, create, editm delete and run scripts in Lightning Launcher.</string> <string name="permission_description">Allows to view, create, edit, delete and run scripts in Lightning Launcher.</string>
<string name="sc_disable_toast">Script disabled. Open it in the editor to enable again</string>
<!-- deprecated: before 90 --> <!-- deprecated: before 90 -->