User Tools

Site Tools


script_menu_look_changer

====== About the script ====== * Purpose : This script allow you to change the look of the default menu * Author : F43nd1r * Current Version : 1.0 * Link : https://plus.google.com/115366157037831519359/posts/1uVyt9qKrsf * Picture : https://plus.google.com/115366157037831519359/posts/W4aHJCNuQq9 ====== Changelog ====== * Version 1.0 (15/2/2015): initial release in wiki ====== How to use the script ====== * Set in resumed event of every desktop * Set the colors you want as hex values in the config section * Put all elements you want to hide in all menus into the arra yin the config section (e.g. ["Items","Scripts"]) ====== Issues and Hints ====== * If you want to hide items with ... at the end, just put them without the three dots into the array //please report all bugs in the g+ community!// ====== Script ====== <sxh javascript;>//config var color=0xFF707070; var selectionColor=0xFF202020; 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(0xFF707070); 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(color); 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<list.getChildCount();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(selectionColor)); drawable.addState(StateSet.WILD_CARD,new ColorDrawable(0x00000000)); item.setBackground(drawable); } return true; } }); </sxh>

script_menu_look_changer.txt · Last modified: 2016/06/28 12:26 by f43nd1r