Jappie Toutenhoofd
now browsing by tag
After screen rotation it zooms in.
After screen rotation it zooms in.
Look at the top right, icon/shortcuts are out of view
]]>COBOL-guy questions : Why is simple complex?
var
test = {} ;
test.simple = {} ;
test.simple.par1 = 1;
test.complex = test.simple;
test.complex.par2 = 2;
alert( JSON.stringify(
test. simple));
And how to prevent?
]]>Focus goes out of view
I finally have installed a Android-TV-box and (ofcourse) had to install LLX on it. It works lika a charm. And navigation with standard IR-remote work perfectly with the ‘focus-styling’.
But I would expect comming to the last row on my screen and pushing the ‘down’-button on my IR-remote, that the next row would come into view on my screen…
It does not. –> Focus goes out of view.
I think I could make a script to make it work. But I think this should be working without a script.
PS. Yes, Droidmote works better/easier than IR-remote. But has the same issue.
]]>We did get PorterDuff in last beta….but now I want EmbossMaskFilter. (spoiled me).
This I was able to get with bindClass….
But what would be the JS equivalent to:
float[] direction = new float[] {0.0f, -1.0f, 0.5f};
???
Thanks in advance!
]]>Coding Standard Proposal
Since we coders all use item.TAG sooner or later, somehow. I think we need a non interfering way to set it for our purpose
Here’s my proposal :
var cnf = JSON.parse(item.getTag())||{};
if( !(“SaveClr” in cnf)) {cnf.SaveClr = {};}
cnf.SaveClr.BG = px;
cnf.SaveClr.FG = pxtx;
item.setTag(JSON.stringify(cnf));
]]>/////////////////////////////////////////////////
/////////////////////////////////////////////////
//————————————–
// YAPI – Yet Another Page Indicator
// HUD – Head Up Display
//
//————————————–
// Author: Jappie Toutenhoofd
//————————————–
// Install:
// – Set this script on event Position-Changed.
// Upgrade:
// – Delete old Hud-item.
//————————————–
//
// Features in v4.2
// – Full Map (optional)
// – Set on any Container
// – Fade out (optional) by TrianguloY
// – max Frames Per Second
// new
// – IMG-cache (by TrianguloY)
// – Config in item.tag not in script
// – Styles: MAP – HUD has container ratio
// PI – HUD has item ratio
////////////////////////////////////////////////
// Create HUD shortcut – called when not found
function Initialsetup()
{ var config = {};
config.view = {};
config.view.HUD_style=”PI”; // MAP or PI (MAP or PageIndicator-style)
config.view.Full_Map=false; // Draw all items (true or false)
config.color = {};
config.color.BG=0x33000000; // Background
config.color.HUD=0x77FFFFFF; // Current view
config.color.PNL=0xEEFF1122; // Default for items in full map
config.fading = {};
config.fading.opt_Fade=false; // true or false
config.fading.timeUntilFade=1.9; // in seconds
config.fading.timeFading=0.5; // in seconds
config.max_FPS=16; // max Frames Per Second
config.runId=0; // internal use
var newHud = d.addShortcut(“HUD”,new Intent(),0,0);
newHud.setTag(JSON.stringify(config));
d.setItemZIndex(newHud.getId(),d.getItems().getLength());
var pe = newHud.getProperties().edit();
pe.setBoolean(“i.onGrid”,false);
pe.setString(“i.pinMode”,”XY”);
pe.setBoolean(“i.enabled”,false);
pe.setBoolean(“s.iconVisibility”,false);
pe.setBoolean(“s.labelVisibility”,false);
pe.commit();
return newHud;
}
// Create Image on cell-size
var d = LL.getEvent().getContainer();
var hud = d.getItemByLabel(“HUD”);
if (hud==null) { hud=Initialsetup();}
var cnf = JSON.parse(hud.getTag())||{};
if( !(“runId” in cnf)){ alert(“Oops, delete HUD \nSorry, this version is old or corrupt.”);}
// prevent event flouding
if ((LL.getEvent().getDate() – cnf.runId) < (1000 / cnf.max_FPS) )
{return;}
var hudW = hud.getWidth();
var hudH = hud.getHeight();
var hud_ratio = hudW / hudH;
var bb = d.getBoundingBox();
var cntW = bb.getRight() – bb.getLeft();
var cntH = bb.getBottom() – bb.getTop();
var cnt_ratio = cntW / cntH;
if (hud_ratio > cnt_ratio)
{ // Container is higher
var cnt_scale = hudH / cntH;
}else{ // Container is wider
var cnt_scale = hudW / cntW;
}
var p = new Paint();
p.setAntiAlias(true);
if(cnf.view.HUD_style==”PI”)
{ // PageIndicator-style
var img = LL.createImage((cntW*cnt_scale),(cntH*cnt_scale));
}else
{ // Map-style
var img = LL.createImage( hudW,hudH);
}
hud.setBoxBackground(img, “n”);
var c = img.draw();
if(c==null)alert(img);
if(cnf.runId!= 0 && cnf.fading.opt_Fade == true)
{//don’t refresh
c.drawBitmap(hud.getBoxBackground(“s”).bitmap, 0, 0, null);
}else
{//refresh
// Outer Hud base on BoundingBox
p.setStyle(Paint.Style.FILL);
p.setColor(cnf.color.BG);
c.drawRect(0, 0, (cntW * cnt_scale), (cntH * cnt_scale), p);
p.setStyle(Paint.Style.STROKE);
p.setColor(cnf.color.HUD);
p.setStrokeWidth(3);
c.drawRect(0, 0, (cntW * cnt_scale), (cntH * cnt_scale), p);
// Map based on Items
if ( cnf.view.Full_Map )
{ var Mitems = d.getItems();
for( var mi=0;mi { var cMi = Mitems.getAt(mi); if ( cMi.getProperties().getString(“i.pinMode”) == “NONE”) { // Map item size if (cMi.getProperties().getBoolean(“i.onGrid”)) { var ItmL = (cMi.getCell().getLeft() * cMi.getParent().getCellWidth() ) – bb.getLeft(); var ItmT = (cMi.getCell().getTop() * cMi.getParent().getCellHeight()) – bb.getTop() ; }else{ var ItmL = cMi.getPositionX() – bb.getLeft(); var ItmT = cMi.getPositionY() – bb.getTop() ; } var ItmR = ItmL + ( cMi.getWidth() * cMi.getScaleX() ); var ItmB = ItmT + ( cMi.getHeight() * cMi.getScaleY() ); p.setStyle( Paint.Style.FILL); p.setColor(ItemColor(cMi)); c.drawRect(ItmL * cnt_scale , ItmT * cnt_scale , ItmR * cnt_scale , ItmB * cnt_scale , p); } // pinMode } // for } // Full_Map hud.setBoxBackground(copyImage(img),”s”); }//refresh // Inner Hud based on Current View var VwL = d.getPositionX() – bb.getLeft(); var VwT = d.getPositionY() – bb.getTop() ; var VwR = VwL + ( d.getWidth() / d.getPositionScale()); var VwB = VwT + ( d.getHeight() / d.getPositionScale()); p.setStyle(Paint.Style.FILL); p.setColor(cnf.color.HUD); c.drawRect(VwL * cnt_scale , VwT * cnt_scale , VwR * cnt_scale , VwB * cnt_scale , p); img.save(); img.update(); //fade out hud.getProperties().edit().setInteger(“i.alpha”,255).commit(); cnf.runId = LL.getEvent().getDate(); hud.setTag(JSON.stringify(cnf)); if (cnf.fading.opt_Fade) { var blowUp_Alpha = 255+((255 / cnf.fading.timeFading) * cnf.fading.timeUntilFade) setTimeout(function(){fadeOut(hud, blowUp_Alpha, cnf.runId);},(1000/ cnf.max_FPS) ); } // opt_fade function fadeOut(hud,alpha,runId) { var old = JSON.parse(hud.getTag()); if(old.runId != runId){return;} alpha-=255/ cnf.max_FPS / cnf.fading.timeFading; hud.getProperties().edit().setInteger(“i.alpha”,alpha>255?255:alpha<0?0:alpha).commit(); if (alpha<=0) { cnf.runId = 0; hud.setTag(JSON.stringify(cnf)); return; } setTimeout(function() {fadeOut(hud,alpha,runId);},(1000/cnf.max_FPS)); } // fu fadeOut function copyImage(src) { var bmp_orig = src.getBitmap(); var img_copy = LL.createImage(bmp_orig.getWidth(), bmp_orig.getHeight()); img_copy.draw().drawBitmap(bmp_orig, 0, 0, null); img_copy.update(); return img_copy; } function ItemColor(ItemC) { var Cimg = null; var px = 0x00000000; if ((ItemC.getType() == “Shortcut” || ItemC.getType() == “Folder”) && (ItemC.getProperties().getBoolean(“s.iconVisibility”))) { Cimg = ItemC.getCustomIcon()||ItemC.getDefaultIcon(); try{var bmp = Cimg.getBitmap();}catch(e){alert(ItemC);} px = bmp.getPixel(Cimg.getWidth()* .41, Cimg.getHeight()* .71); if (Color.alpha(px) < 255) {px = bmp.getPixel(Cimg.getWidth()* .62, Cimg.getHeight()* .37); } if (Color.alpha(px) < 255) {px = bmp.getPixel(Cimg.getWidth()* .48, Cimg.getHeight()* .51); } } // icon visible if (ItemC.getType() != ” StopPoint” || ItemC.getType() != “Unlocker” || Color.alpha(px) < 99 ) { Cimg = ItemC.getBoxBackground(“n”); if (Cimg != null && !Cimg.isNinePatch()) {var bmp = Cimg.getBitmap(); px = bmp.getPixel(Cimg.getWidth()* .5, Cimg.getHeight()* .5); } } // non stoppoint if (Color.alpha(px) < 50) {px = ItemC.getProperties().getBox(‘i.box’).getColor(‘c’,’n’); } if (Color.alpha(px) < 50) {px = cnf.color.PNL; } return px; }
YAPI-HUD v3 with FadeOut
YAPI-HUD v3 with FadeOut
Thanks go to TrianguloY for the FadeOut.
Max_FPS is experimental.
]]>Little spin-off of my other project (YAPI-HUD).
Little spin-off of my other project (YAPI-HUD).
5 months ago Jay M requested and got a rondom colored App-drawer.
Here is a matching color App-drawer…
..or Flat-UI drawer if you like.
{why can’t I link to this, from mobile app}
]]>YAPI-HUD
YAPI-HUD
Yet Another Page Indicator
Head Up Display – style
Scripted with Canvas Paint.
]]>
D5 Creation