去除Launcher默认的google search bar

N/M
请修改Launcher3/src/com/android/launcher3/Launcher.java的getOrCreateQsbBar()方法,直接return null。
放置到代码最前面才起效
KCM_REMOVE_GOOGLE_SEARCH_BAR = no
import android.os.SystemProperties;//added by kamari remove google search bar at 20160810
public View getOrCreateQsbBar() {
//added by kamari remove google search bar at 20160810
if(SystemProperties.get("ro.remove_google_search_bar").equals("1")){
return null;
}//add end
}
L1:
请修改Launcher3/src/com/android/launcher3/Launcher.java的getQsbBar()方法,直接return null。
L1:
请修改Launcher3/src/com/android/launcher3/Launcher.java的getQsbBar()方法,直接return null。
L0/KK:
1. 请修改Launcher3/res/layout-port/qsb.xml( L0 )或者Launcher3/res/layout-port/search_bar.xml( KK ),如下:
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/search_frame"
android:visibility="gone" >  
2. 请修改Launcher3/res/layout-port/launcher.xml,将voice_button_proxy这个view的clickable设置为false,并去掉 onClick="onClickVoiceButton" ,如下:
       
            android:id="@+id/voice_button_proxy"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_gravity="top|end"
            android:clickable=" false "
            android:importantForAccessibility="no"
            launcher:sourceViewId="@+id/voice_button" />
 
3.  请修改Launcher3/src/com/android/launcher3/SearchDropTargetBar.java的setup()方法,如下:
......
        if (mEnableDropDownDropTargets) {
            mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "translationY",  -mBarHeight ,
                    -mBarHeight);
        } else {
            mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "alpha",  0f , 0f);
        }
......
 
4.  请修改Launcher3/src/com/android/launcher3/SearchDropTargetBar.java的showSearchBar()方法,如下:
    public void showSearchBar(boolean animated) {
        boolean needToCancelOngoingAnimation = mQSBSearchBarAnim.isRunning() && !animated;
        if (!mIsSearchBarHidden && !needToCancelOngoingAnimation) return;
        if (animated) {
            prepareStartAnimation(mQSBSearchBar);
            mQSBSearchBarAnim.reverse();
        } else {
            mQSBSearchBarAnim.cancel();
            if (mEnableDropDownDropTargets) {
                mQSBSearchBar.setTranslationY(0);
            } else {
                mQSBSearchBar.setAlpha( 0f );
            }
        }
        mIsSearchBarHidden = false;
    }
 
5.  请修改Launcher3/src/com/android/launcher3/Workspace.java的getChangeStateAnimation()方法,如下:
......
        float finalSearchBarAlpha = !stateIsNormal ? 0f :  0f ;
......
JB2/JB3/JB5/JB9:  
 
1. 请修改 Launcher2/res/layout/qsb_bar.xml,如下:
    
        layout="@layout/search_bar"
         android:visibility="gone"  /> 
 
2.  请修改Launcher2/res/layout-port/launcher.xml,将voice_button_proxy这个view的clickable设置为false,并去掉 onClick="onClickVoiceButton" ,如下:
            android:id="@+id/voice_button_proxy"
            android:layout_width="80dp"
            android:layout_height="@dimen/qsb_bar_height"
            android:layout_gravity="top|right"
            android:clickable=" false "  
            android:importantForAccessibility="no"
            launcher:sourceViewId="@+id/voice_button" />
 
3.  请修改Launcher2/src/com/android/launcher2/SearchDropTargetBar.java的onFinishInflate() 方法,如下:
......
        // Create the various fade animations
        if (mEnableDropDownDropTargets) {
            mDropTargetBar.setTranslationY(-mBarHeight);
            mDropTargetBarAnim = ObjectAnimator.ofFloat(mDropTargetBar, "translationY",
                    -mBarHeight, 0f);
            mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "translationY",  -mBarHeight ,
                    -mBarHeight); 
        } else {
            mDropTargetBar.setAlpha(0f);
            mDropTargetBarAnim = ObjectAnimator.ofFloat(mDropTargetBar, "alpha", 0f, 1f);
            mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "alpha",  0f , 0f); 
        }
......
 
4.  请修改Launcher2/src/com/android/launcher2/SearchDropTargetBar.java的showSearchBar()方法,如下:
public void showSearchBar(boolean animated) {
        if (!mIsSearchBarHidden) return;
        if (animated) {
            prepareStartAnimation(mQSBSearchBar);
            mQSBSearchBarAnim.reverse();
        } else {
            mQSBSearchBarAnim.cancel();
            if (mEnableDropDownDropTargets) {
                mQSBSearchBar.setTranslationY(0);
            } else {
                mQSBSearchBar.setAlpha( 0f );
            }
        }
        mIsSearchBarHidden = false;
    }

 

你可能感兴趣的:(MTK笔记)