/*

/*

Change the look of the default Menu (HOLO)

Modified 20140317

ck.portable

* Default holo dark

* Added text color var

* Changed color vars name

Original:

About the script

* Purpose : This script allow you to change the look of the default menu

* Author : LM13

* Current Version : 1.0

* Link : https://plus.google.com/115366157037831519359/posts/1uVyt9qKrsf

* Picture : https://plus.google.com/115366157037831519359/posts/W4aHJCNuQq9

*/

//config

// cBG BackGround

// cBGs BackGround selected

// cFG ForeGround

var cBG = 0xFF000000;

var cBGs = 0xff00ffff;

var cFG = 0xffffffff;

var hide=[];

//endconfig

LL.bindClass(“android.R”);

LL.bindClass(“android.view.ViewGroup”);

LL.bindClass(“android.graphics.PorterDuff”);

LL.bindClass(“android.view.ViewTreeObserver”);

LL.bindClass(“android.graphics.drawable.ColorDrawable”);

LL.bindClass(“android.graphics.drawable.StateListDrawable”);

LL.bindClass(“android.util.StateSet”);

var menuRoot = LL.getContext().getWindow().getDecorView().findViewById(R.id.content).getChildAt(0).getChildAt(2).getChildAt(2);

var menu = menuRoot.getChildAt(0);

var triangleDown = menuRoot.getChildAt(1);

var triangleUp = menuRoot.getChildAt(2);

menu.setBackgroundColor(cBG);

var tDown=LL.createImage(40,20);

var c=tDown.draw();

var path=new Path();

path.moveTo(0,0);

path.lineTo(20,20);

path.lineTo(40,0);

path.lineTo(0,0);

path.close();

var paint = new Paint();

paint.setColor(cFG); paint.setStyle(Paint.Style.FILL_AND_STROKE);

paint.setAntiAlias(true);

c.drawPath(path,paint);

triangleDown.setImageBitmap(tDown.getBitmap());

var tUp=LL.createImage(40,20);

var c=tUp.draw();

var path=new Path();

path.moveTo(0,20);

path.lineTo(20,0);

path.lineTo(40,20);

path.lineTo(0,20);

path.close();

c.drawPath(path,paint);

triangleUp.setImageBitmap(tUp.getBitmap());

var obs=menuRoot.getViewTreeObserver();

obs.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){

onGlobalLayout:function()

{

var list=menu.getChildAt(0);

for(var i=0;i

var item=list.getChildAt(i);

if(hide.indexOf(item.getText().replace(“…”,””).replace(“…”,””))!=-1){

list.removeView(item);

continue;

}

var drawable= new StateListDrawable();

drawable.addState(

[R.attr.state_pressed],new ColorDrawable(

cBGs));

drawable.addState(

StateSet.WILD_CARD,

new ColorDrawable(

cBG));

item.setBackground(

drawable);

item.setTextColor(

cFG);

}

return true;

}

});

2 Commentsto /*

  1. CK Portable says:

    Once you run this, context menus in LLx will be holo. Edit colors as needed. Original script on scripts page.

  2. CK Portable says:

    menu.setTextColor would not work, but item did, and seems to work.

Leave a Reply

Your email address will not be published. Required fields are marked *