码迷,mamicode.com
首页 > 移动开发 > 详细

android 5.0 让主菜单的背景显示为壁纸

时间:2015-02-04 12:59:33      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

1、 AppsCustomizePagedView.java修改两处如下:
1)  private void setupPage(AppsCustomizeCellLayout layout) {
        layout.setGridSize(mCellCountX, mCellCountY);
        // Note: We force a measure here to get around the fact that when we do layout calculations
        // immediately after syncing, we don‘t have a proper width.  That said, we already know the
        // expected page width, so we can actually optimize by hiding all the TextView-based
        // children that are expensive to measure, and let that happen naturally later.
        setVisibilityOnChildren(layout, View.GONE);
        int widthSpec = MeasureSpec.makeMeasureSpec(mContentWidth, MeasureSpec.AT_MOST);
        int heightSpec = MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.AT_MOST);
        layout.measure(widthSpec, heightSpec);
        if(!Launcher.DISABLE_APPLIST_WHITE_BG) {//add
            Drawable bg = getContext().getResources().getDrawable(R.drawable.quantum_panel);
        if (bg != null) {
            bg.setAlpha(mPageBackgroundsVisible ? 255: 0);
            layout.setBackground(bg);
            }
        } else {//add
            layout.setBackground(null);//add
        }//add
        setVisibilityOnChildren(layout, View.VISIBLE);
    }
 
2)  public void syncAppsPageItems(int page, boolean immediate) {
    ......
            AppInfo info = mApps.get(i);
            BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
                    R.layout.apps_customize_application, layout, false);
            if(Launcher.DISABLE_APPLIST_WHITE_BG) {//add
                icon.setTextColor(getContext().getResources().getColor(R.color.quantum_panel_transparent_bg_text_color));//add
            }//add
            icon.applyFromApplicationInfo(info);
            icon.setOnClickListener(mLauncher);
            icon.setOnLongClickListener(this);
    ......


2、colors.xml中新增:
    <color name="quantum_panel_transparent_bg_text_color">#FFFFFF</color>
3、 DeviceProfile.java修改layout(Launcher launcher)方法如下:
    ......
               pagedView.setWidgetsPageIndicatorPadding(pageIndicatorHeight);
                if(Launcher.DISABLE_APPLIST_WHITE_BG) {//add
                    fakePage.setBackground(null);//add
                } else {//add
                    fakePage.setBackground(res.getDrawable(R.drawable.quantum_panel));
                }//add
                // Horizontal padding for the whole paged view
                int pagedFixedViewPadding =
                        res.getDimensionPixelSize(R.dimen.apps_customize_horizontal_padding);
    ......
 
4. Launcher.java
1)新增:  
   //add begin
    /// M: Disable applist white background for jitter performance issue {@
    public static boolean DISABLE_APPLIST_WHITE_BG = true;
    public static final String PROP_DISABLE_APPLIST_WHITE_BG = "launcher.whitebg.disable";
    // should kill and restart launcher process to re-execute static block if reset properties
    // adb shell setprop launcher.applist.whitebg.disable true/false
    // adb shell stop
    // adb shell start
    static {
        DISABLE_APPLIST_WHITE_BG = android.os.SystemProperties.getBoolean(PROP_DISABLE_APPLIST_WHITE_BG, true);
    }
    /// @}
    //add end
2)showAppsCustomizeHelper方法修改如下:
    ......
            if (isWidgetTray) {
                revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark));
            } else {
                if(Launcher.DISABLE_APPLIST_WHITE_BG) {//add
                    revealView.setBackground(null);//add
                } else {//add
                    revealView.setBackground(res.getDrawable(R.drawable.quantum_panel));
                }//add
            }
    ......
3) hideAppsCustomizeHelper方法修改如下:
    ......
                if (isWidgetTray) {
                    revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark));
                } else {
                    if(Launcher.DISABLE_APPLIST_WHITE_BG) {//add
                        revealView.setBackground(null);//add
                    } else {//add
                        revealView.setBackground(res.getDrawable(R.drawable.quantum_panel));
                    }//add
                }
    ......

android 5.0 让主菜单的背景显示为壁纸

标签:

原文地址:http://blog.csdn.net/sergeycao/article/details/43484139

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!