【开发者教程】自带浏览器添加退出按钮

前言:
大家好,从今天开始现实的你我都将会把HTC ONE\M7 SENSE5系列的教程公布出来,供大家学习参考,共同提升。如有不详细之处,请大神指导。。。(非常感谢现实的你我分享的教程!原帖:http://lt.imobile.com.cn/thread-10343220-1-1.html)

直接开场(这里所使用的工具、修改方法等基础性的请自行百度)

反编译Browser.apk

\smali\com\android\browser\HtcNavigationBarPhone$MyExpandableListAdapter.smali

搜索:

.method public updateMenu()V
    .locals 10
    const v9, 0x7f0f0159
    const v8, 0x7f0f0156
    const v7, 0x7f0f0153
    const v5, 0x7f0f0118
    const/4 v6, 0x0
    iget-object v2, p0, 
Lcom/android/browser/HtcNavigationBarPhone$MyExpandableListAdapter;->mMenu:Lcom/android/internal/view/menu/MenuBuilder;
    if-nez v2, :cond_0
    new-instance v2, 
Lcom/android/internal/view/menu/MenuBuilder;
    iget-object v3, p0, 
Lcom/android/browser/HtcNavigationBarPhone$MyExpandableListAdapter;->this$0:Lcom/android/browser/HtcNavigationBarPhone;
    #getter for: 
Lcom/android/browser/HtcNavigationBarPhone;->mContext:Landroid/content/Context;
    
invoke-static {v3}, 
Lcom/android/browser/HtcNavigationBarPhone;->access$400(Lcom/android/browser/HtcNavigationBarPhone;)Landroid/content/Context;
    move-result-object v3
    invoke-direct {v2, v3}, 
Lcom/android/internal/view/menu/MenuBuilder;-><init>(Landroid/content/Context;)V
    iput-object v2, p0, 
Lcom/android/browser/HtcNavigationBarPhone$MyExpandableListAdapter;->mMenu:Lcom/android/internal/view/menu/MenuBuilder;
    new-instance v0, Landroid/view/MenuInflater;
    iget-object v2, p0, 
Lcom/android/browser/HtcNavigationBarPhone$MyExpandableListAdapter;->this$0:Lcom/android/browser/HtcNavigationBarPhone;
    #getter for: 
Lcom/android/browser/HtcNavigationBarPhone;->mContext:Landroid/content/Context;
    
invoke-static {v2}, 
Lcom/android/browser/HtcNavigationBarPhone;->access$500(Lcom/android/browser/HtcNavigationBarPhone;)Landroid/content/Context;
    move-result-object v2
    invoke-direct {v0, v2}, 
Landroid/view/MenuInflater;-><init>(Landroid/content/Context;)V
    const v2, 0x7f11000a
    iget-object v3, p0, 
Lcom/android/browser/HtcNavigationBarPhone$MyExpandableListAdapter;->mMenu:Lcom/android/internal/view/menu/MenuBuilder;
    invoke-virtual {v0, v2, v3}, 
Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V
    :cond_0
    iget-object v2, p0, 
Lcom/android/browser/HtcNavigationBarPhone$MyExpandableListAdapter;->this$0:Lcom/android/browser/HtcNavigationBarPhone;
    invoke-virtual {v2}, 
Lcom/android/browser/HtcNavigationBarPhone;->getResources()Landroid/content/res/Resources;
    move-result-object v1
    invoke-static {}, 
Lcom/android/browser/BrowserSettings;->getInstance()Lcom/android/browser/BrowserSettings;
    move-result-object v2
    invoke-virtual {v2}, 
Lcom/android/browser/BrowserSettings;->isFPAvailable()Z
    move-result v2
    if-nez v2, :cond_6
    iget-object v2, p0, 
Lcom/android/browser/HtcNavigationBarPhone$MyExpandableListAdapter;->mMenu:Lcom/android/internal/view/menu/MenuBuilder;
    invoke-virtual {v2, v8}, 
Lcom/android/internal/view/menu/MenuBuilder;->removeItem(I)V
    :cond_1
    
:goto_0
    sget-short v2, 
Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_PROJECT_flag:S
    const/16 v3, 0xa8
    if-eq v2, v3, :cond_7
    sget-short v2, 
Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_PROJECT_flag:S
    const/16 v3, 0xd0
    if-eq v2, v3, :cond_7
    iget-object v2, p0, 
Lcom/android/browser/HtcNavigationBarPhone$MyExpandableListAdapter;->mMenu:Lcom/android/internal/view/menu/MenuBuilder;
    invoke-virtual {v2, v5}, 
Lcom/android/internal/view/menu/MenuBuilder;->removeItem(I)V
    :cond_2
    
:goto_1
    sget-short v2, 
Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_LANGUAGE_flag:S

把下面这句

  1. const/4 v3, 0x2

修改为

  1. const/4 v3, 0x0

保存回编译



原文链接:,转发请注明来源!

发表评论

要发表评论,您必须先登录