android开发 底部导航栏出现时按钮点击事件修改位置

1.packages/apps/Launcher3/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java#onButtonClick

public void onButtonClick(@TaskbarButton int buttonType, View view) {
        // Provide the same haptic feedback that the system offers for virtual keys.
        view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
        boolean isInstallCtsView = SystemProperties.getBoolean("persist.skg.isinstall.cts.view", false);
        boolean isOnboardDone = SystemProperties.getBoolean("persist.sys.skg.abletouchc", false);
        boolean isOobeStatus = (Settings.Global.getInt(mService.getContentResolver(), Settings.Global.DEVICE_PROVISIONED,0) == 0
                && Settings.Secure.getInt(mService.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE,0) == 0 );
        switch (buttonType) {
            case BUTTON_BACK:
                if (!isInstallCtsView) {
                    if(isOobeStatus){
                        logEvent(LAUNCHER_TASKBAR_BACK_BUTTON_TAP);
                        executeBack();
                    }else{
                        if (isOnboardDone) {
                            logEvent(LAUNCHER_TASKBAR_BACK_BUTTON_TAP);
                            executeBack();
                        }else{
                            Toast.makeText(mService, "Please complete device registration first", Toast.LENGTH_SHORT).show();
                        }
                    }
                }else {
                    logEvent(LAUNCHER_TASKBAR_BACK_BUTTON_TAP);
                    executeBack();
                }
                break;
            case BUTTON_HOME:
                if (!isInstallCtsView) {
                    if(isOobeStatus){
                        logEvent(LAUNCHER_TASKBAR_HOME_BUTTON_TAP);
                        navigateHome();
                    }else{
                        if (isOnboardDone) {
                            logEvent(LAUNCHER_TASKBAR_HOME_BUTTON_TAP);
                            navigateHome();
                        }else{
                            Toast.makeText(mService, "Please complete device registration first", Toast.LENGTH_SHORT).show();
                        }
                    }
                }else {
                    logEvent(LAUNCHER_TASKBAR_HOME_BUTTON_TAP);
                    navigateHome();
                }
                break;
            case BUTTON_RECENTS:
                if (!isInstallCtsView) {
                    if (isOnboardDone) {
                        logEvent(LAUNCHER_TASKBAR_OVERVIEW_BUTTON_TAP);
                        navigateToOverview();
                    }else{
                        Toast.makeText(mService, "Please complete device registration first", Toast.LENGTH_SHORT).show();
                    }
                }else {
                    logEvent(LAUNCHER_TASKBAR_OVERVIEW_BUTTON_TAP);
                    navigateToOverview();
                }
                break;
            case BUTTON_IME_SWITCH:
                logEvent(LAUNCHER_TASKBAR_IME_SWITCHER_BUTTON_TAP);
                showIMESwitcher();
                break;
            case BUTTON_A11Y:
                logEvent(LAUNCHER_TASKBAR_A11Y_BUTTON_TAP);
                notifyA11yClick(false /* longClick */);
                break;
            case BUTTON_QUICK_SETTINGS:
                showQuickSettings();
                break;
            case BUTTON_NOTIFICATIONS:
                showNotifications();
                break;
        }
    }

2.packages/apps/Launcher3/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java#getAllAppsButtonClickListener

public View.OnClickListener getAllAppsButtonClickListener() {
            return v -> {
                mActivity.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP);
                boolean isInstallCtsView = SystemProperties.getBoolean("persist.skg.isinstall.cts.view", false);
                boolean isOnboardDone = SystemProperties.getBoolean("persist.sys.skg.abletouchc", false);
                if (!isInstallCtsView) {
                    if (!isOnboardDone) {
                        Toast.makeText(mActivity, "Please complete device registration first", Toast.LENGTH_SHORT).show();
                    }else{
                        mControllers.taskbarAllAppsController.toggle();
                    }
                }else {
                    mControllers.taskbarAllAppsController.toggle();
                }
                //mControllers.taskbarAllAppsController.toggle();
            };
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿陌名!

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值