bug-Gallery2-menu-No1-20160818
来源:互联网 发布:天子网络 编辑:程序博客网 时间:2024/05/18 00:46
bug描述:
1. Launch camera app;
2. Switch to record video and record a video;
3. Tap the preview button;
4. Tap the options menu---->tap edit option
视频文件是不能编辑的,而图库菜单中却可以编辑,点击编辑无任何反应。解决办法去掉编辑控件。
首先找到菜单的xml文件,在res/menu/ 下,将setting设置成英文,编辑英文叫edit,在menu下grep edit 即可。
<item android:id="@+id/action_edit"
android:title="@string/edit"
android:showAsAction="never"
android:visible="false" />
接下来在源代码中grep action_edit
packages/apps/Gallery2/src/com/android/gallery3d/ui/MenuExecutor.java:194
setMenuItemVisible(menu, R.id.action_edit, supportEdit);
case R.id.action_edit: { .....}
注释掉代码 setMenuItemVisible(menu, R.id.action_edit, supportEdit); 发现编辑控件全没有了。
supportEdit 是在
boolean supportEdit = (supported & MediaObject.SUPPORT_EDIT) != 0; 定义的。
MediaObject.SUPPORT_EDIT 是常量。
supported 决定控件可见与不可见。
找updateMenuOperation()方法调用的地方。
在src/com/android/gallery3d/app/PhotoPage.java中
763 private void updateMenuOperations() { 764 Menu menu = mActionBar.getMenu(); 765 766 // it could be null if onCreateActionBar has not been called yet 767 if (menu == null) return; 768 769 MenuItem item = menu.findItem(R.id.action_slideshow); 770 if (item != null) { 771 item.setVisible((mSecureAlbum == null) && canDoSlideShow()); 772 } 773 if (mCurrentPhoto == null) return; 774 775 int supportedOperations = mCurrentPhoto.getSupportedOperations(); 776 777 if (mReadOnlyView) { 778 779 supportedOperations ^= MediaObject.SUPPORT_EDIT; 780 //supportedOperations &= ~MediaObject.SUPPORT_EDIT; 781 Log.e("snmu","supportedOperations6666---is--" + supportedOperations); 782 } 783 if (mSecureAlbum != null) { 784 supportedOperations &= MediaObject.SUPPORT_DELETE; 785 } else { 786 787 mCurrentPhoto.getPanoramaSupport(mUpdatePanoramaMenuItemsCallback); 788 if (!mHaveImageEditor) { 789 790 supportedOperations &= ~MediaObject.SUPPORT_EDIT; 791 } 792 } 793 794 MenuExecutor.updateMenuOperation(menu, supportedOperations); 795 }
最终定位到779行
<pre name="code" class="html">if (mReadOnlyView)supportedOperations ^= MediaObject.SUPPORT_EDIT
if条件是只读预览时,也就是从camera点击图库预览图片时 ,走这行代码。
问题就出在这行代码,不应该异或(会造成图片不可编辑,视频可编辑),而应该是与非。
menu控件的用法可见此博文 http://blog.csdn.net/flying_tao/article/details/6570098
- bug-Gallery2-menu-No1-20160818
- Gallery2中Menu的分析
- gallery2
- No1
- NO1
- No1
- NO1
- NO1
- NO1
- no1
- MFC自绘Menu的Bug
- The Ultimate Toolbox UI Menu bar bug
- bug纪录:删除了使用中的menu
- Gallery2:FAQ
- NO1::WINMAIN
- No1 Java
- No1篇
- No1.css
- c/c++第十八天
- mv命令
- 动态规划
- 2016.08.18【初中部 NOIP普及组 】模拟赛
- xenserver 恢复从pool中删除的机器状态
- bug-Gallery2-menu-No1-20160818
- coding.net项目管理
- Bootstrap 关于背景图像的自适应和行的栅格化
- Matrix
- poj 1905
- echarts图表showLoading遮盖层显示问题
- 每日一记-防止重复提交
- jzoj 2050. 【8.18】游戏
- C++笔记