Hi TrianguloY I have Dark theme on LL settings
Hi TrianguloY I have Dark theme on LL settings
So perhaps something wrong in your script … Could you check please ?
]]>Hi TrianguloY I have Dark theme on LL settings
So perhaps something wrong in your script … Could you check please ?
]]>
< ![CDATA[
Are the other dialogs (when inputting data) also white?
]]>
< ![CDATA[
Yes
]]>
< ![CDATA[
Ah, ok. I though you were asking to change all the others.
Let me think on it
[ Lukas Morawietz: do you know how to? I’m not asking you to search a way, only in case you already know how to do it 🙂 ]
]]>
< ![CDATA[
Pierre Hébert how to have the theme chosen on LL settings ? I have set Dark theme
]]>
< ![CDATA[
TrianguloY
That depends on how you created that dialog, but I think you can get the theme from the activity.
]]>
< ![CDATA[
I used your function from your multi tool to create a dialog list.
]]>
< ![CDATA[
But one thing. I have the black theme on lightning settings, however all dialogs shown from scripts are white.
I guess the dialogs use the theme of android itself. Why with DialogBuilder it doesn’t have the correct theme is unknown.
]]>
< ![CDATA[
TrianguloY yes I think the same.+Pierre Hébert Could you change this ? Following the LL theme ?
]]>
< ![CDATA[
The dialog inherits from the activity theme, which is Light. However you may be able to change it using ContextThemeWrapper just as with https://plus.google.com/u/0/+SimoneBoccuzziKLR/posts/dowtUT96WU5
I don’t plan to allow different themes for the home screen because it is too much work when compared to the benefit (almost all Light theme elements are editor tools, except the popup menu)
]]>
< ![CDATA[
Pierre Hébert my active theme is Dark
]]>
< ![CDATA[
TrianguloY Could you try with ContextThemeWrapper please ?
]]>
< ![CDATA[
Dark and light themes apply to settings screen only.
]]>
< ![CDATA[
Bruno-Isa LAMOUR-ARNOULD sorry for answering so late, but I tested and couldn’t find how to do it. Now that Pierre answered I tried again…and I think I have it now. Test this:
//classes
LL.bindClass(“android.app.AlertDialog”);
LL.bindClass(“android.content.DialogInterface”);
LL.bindClass(“java.io.BufferedReader”);
LL.bindClass(“java.io.FileReader”);
LL.bindClass(“java.io.File”);
LL.bindClass(“android.view.ContextThemeWrapper”);
LL.bindClass(“android.R”);
//global variables
var newvariabletext=” — create a new variable — “;
var vars;
var names;
//starts
show();
function show(){
LL.save();//save to force the file to be updated
vars=JSON.parse(read(“data/data/net.pierrox.lightning_launcher_extreme/files/variables”));//reads the content of the file
names=vars.v==null?[]:vars.v.map(function(a){return a.n+”: ‘”+a.v+”‘”});//extracts the variable names, if any
names.push(newvariabletext);//adds the ‘create variable’ entry
list(names,clicked,”Choose a variable, or create a new one”);//shows the list
}
//when clicked an element
function clicked(dialog,which){
var variable=vars.v[which];
if(which==names.length-1){
//the ‘add a variable’ entry chosen
addvariable();
}else{
//a variable chosen
editvariable(variable);
}
setTimeout(show,0);//shows the list again. On a timeout so the startActivity() is correctly launched before
}
//editing a variable
function editvariable(variable){
var name=variable.n;
//gets it’s type
var llvar=LL.getVariables();
var type=llvar.getType(variable.n);
/*
//gets its value
var oldv;
switch(type){
case “FLOAT”: oldv=llvar.getFloat(name); break;
case “INTEGER”: oldv=llvar.getInteger(name); break;
case “BOOLEAN”: oldv=llvar.getBoolean(name); break;
default: oldv=llvar.getString(name);
}
*/
//gets its value
var oldv=variable.v//vars.v.filter(function(obj){return obj.n==name})[0].v;
//asks for a new value
var newv=prompt(name+” (“+type+”)”,oldv);
if(newv==null){
//cancelled. delete?
if(confirm(“Do you want to delete this variable?”))llvar.edit().setString(name,null).commit();
return;
}
//update the value
lightningcall(name,newv);
}
//adding a variable
function addvariable(){
var name=””;
do{
//ask for a not-used name
name=prompt(“Name of the variable”,name);
}while(names.indexOf(name)!=-1&& !confirm(“This variable name is already used, do you want to continue? (will be overwritten)”));
if(name==null)return;//cancelled
//asks for the value
var value=prompt(“Value of the variable ‘”+name+”‘”,””);
if(value==null)return;//cancelled
//create the variable
lightningcall(name,value);
}
//calls lightning action ‘set a variable’
function lightningcall(name,value){
var intent=new Intent.getIntent(“#Intent;component=net.pierrox.lightning_launcher_extreme/net.pierrox.lightning_launcher.activities.Dashboard;i.a=41;end”);//the base intent
intent.putExtra(“d”,name+”/”+value);//the extra data
LL.startActivity(intent);
}
//function to display a List in a Popup, where the user can select one item. Taken from Lukas Morawietz’s Multi tool script
function list(items,onClickFunction,title){
var builder=new AlertDialog.Builder(new ContextThemeWrapper(LL.getContext(), R.style.Theme_DeviceDefault));
var listener=new DialogInterface.OnClickListener()
{
onClick:function(dialog,which)
{
dialog.dismiss();
setTimeout(function(){onClickFunction(dialog,which);},0);
return true;
}
}
builder.setItems(items,listener);
builder.setCancelable(true);
builder.setTitle(title);
builder.setNegativeButton(“Cancel”,new DialogInterface.OnClickListener(){onClick:function(dialog,id){dialog.cancel();}});//it has a Cancel Button
builder.show();
}
function read(filePath){
var file=new File(filePath);
var r=new BufferedReader(new FileReader(file));
var s=””;
var l;
while((l=r.readLine())!=null)s+=(l+”\n”);
return s.substring(0, s.length – 1);
}
]]>
< ![CDATA[
Perfect.Thanks TrianguloY
]]>