Android 系统APK-Camera 修复:预览照片时使用按键盘左右键,底部导航栏焦点也会跟着变动

Posted 王睿丶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android 系统APK-Camera 修复:预览照片时使用按键盘左右键,底部导航栏焦点也会跟着变动相关的知识,希望对你有一定的参考价值。

改成了:默认底部导航栏禁用,但不消失,这样左右键切换时,只切换照片
若需要底部导航功能,按方向下键即可启用底部导航功能,此时左右键只切换底部导航按钮,若需要切换照片,则需要按上键,此时底部导航禁用,照片正常切换。从而达到修复的效果

packages/apps/Camera2/src/com/android/camera/CameraActivity.java

    //wangrui Bottom navigation bar enabled state Default false off, true on
    private boolean bottomPanelFlag = false;
    //wangrui get myFilmstripItem
    private FilmstripItem myFilmstripItem;

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) 
        if (ActivityManager.isUserAMonkey())
            return super.onKeyUp(keyCode, event);
        if (!mFilmstripVisible) 
            // If a module is in the middle of capture, it should
            // consume the key event.
            if (mCurrentModule.onKeyUp(keyCode, event)) 
                Log.i(TAG, "onKeyUp->mCurrentModule->onKeyup->true");
                return true;
             else if (keyCode == KeyEvent.KEYCODE_MENU
                    || keyCode == KeyEvent.KEYCODE_DPAD_LEFT) 
                // Let the mode list view consume the event.
                mCameraAppUI.openModeList();
                return true;
             else if(keyCode == KeyEvent.KEYCODE_DPAD_DOWN)
                Log.i(TAG, "onKeyUp->keycode_dpad_down");
                if(mModeListView.getVisibility() == View.VISIBLE && mCurrentModeIndex == 0)
                    mModeListView.getListView().getChildAt(1).performClick();
                
             else if(keyCode == KeyEvent.KEYCODE_DPAD_UP)
                Log.i(TAG, "onKeyUp->keycode_dpad_up");
                if(mModeListView.getVisibility() == View.VISIBLE && mCurrentModeIndex == 1)
                    mModeListView.getListView().getChildAt(0).performClick();
                
             else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) 
                if (mDataAdapter.getTotalNumber() > 0)
                    mCameraAppUI.showFilmstrip();
                return true;
            
         else 

            // wangrui DOWN,Enable bottom navigation buttons
++            if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN)
++                bottomPanelFlag = true;
++                updateBottomControlsByData(myFilmstripItem);
++            else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) // UP Close bottom navigation buttons
++               bottomPanelFlag = false;
++                updateBottomControlsByData(myFilmstripItem);
++            

            // wangrui When the current state of the bottom navigation bar is true, switching is allowed, otherwise it is not allowed
            if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) 
++                if (!bottomPanelFlag) mFilmstripController.goToNextItem();
                return true;
             else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) 
++                if (!bottomPanelFlag)
                    boolean wentToPrevious = mFilmstripController.goToPreviousItem();
                    if (!wentToPrevious) 
                        // at beginning of filmstrip, hide and go back to preview
                        mCameraAppUI.hideFilmstrip();
                    
++                
                return true;
            
        
        return super.onKeyUp(keyCode, event);
    


以上是关于Android 系统APK-Camera 修复:预览照片时使用按键盘左右键,底部导航栏焦点也会跟着变动的主要内容,如果未能解决你的问题,请参考以下文章

Android 系统APK-Camera 还原默认设置时,依然默认90W像素

Android 系统APK-Camera 设置默认90W像素

Android 系统APK-Camera 移除200W像素

Android 系统APK-Camera 解决录像加速问题

Android 系统APK-Camera 将200W像素改为90W像素

Android 系统APK-Camera 不同尺寸的机器默认不同像素