gpt4 book ai didi

java - Smali - 如何在此代码中编辑点击时的 url

转载 作者:太空宇宙 更新时间:2023-11-04 10:27:00 25 4
gpt4 key购买 nike

按照 smali 代码,通过单击查看按钮在 web View 中查看 url。但链接后面是结果 url 中的 PackageName 。那么我应该在以下 smali 代码中更改什么才能仅转到链接?

  .class final Lcom/elkurdi/calloutalerter/MainActivity$ReviewButtonListener;
.super Ljava/lang/Object;
.source "MainActivity.java"

# interfaces
.implements Landroid/view/View$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/elkurdi/calloutalerter/MainActivity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x12
name = "ReviewButtonListener"
.end annotation


# instance fields
.field final synthetic this$0:Lcom/elkurdi/calloutalerter/MainActivity;


# direct methods
.method private constructor <init>(Lcom/elkurdi/calloutalerter/MainActivity;)V
.locals 0

.prologue
.line 83
iput-object p1, p0, Lcom/elkurdi/calloutalerter/MainActivity$ReviewButtonListener;->this$0:Lcom/elkurdi/calloutalerter/MainActivity;

invoke-direct {p0}, Ljava/lang/Object;-><init>()V

return-void
.end method

.method synthetic constructor <init>(Lcom/elkurdi/calloutalerter/MainActivity;Lcom/elkurdi/calloutalerter/MainActivity$ReviewButtonListener;)V
.locals 0

.prologue
.line 83
invoke-direct {p0, p1}, Lcom/elkurdi/calloutalerter/MainActivity$ReviewButtonListener;-><init>(Lcom/elkurdi/calloutalerter/MainActivity;)V

return-void
.end method


# virtual methods
.method public onClick(Landroid/view/View;)V
.locals 4
.param p1, "v" # Landroid/view/View;

.prologue
.line 88
new-instance v2, Ljava/lang/StringBuilder;

const-string v3, "https://www.google.com/"

invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

.line 89
iget-object v3, p0, Lcom/elkurdi/calloutalerter/MainActivity$ReviewButtonListener;->this$0:Lcom/elkurdi/calloutalerter/MainActivity;

invoke-virtual {v3}, Lcom/elkurdi/calloutalerter/MainActivity;->getApplicationContext()Landroid/content/Context;

move-result-object v3

invoke-virtual {v3}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

move-result-object v3

invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v2

.line 88
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v2

invoke-static {v2}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

.line 90
.local v1, "uri":Landroid/net/Uri;
new-instance v0, Landroid/content/Intent;

const-string v2, "android.intent.action.VIEW"

invoke-direct {v0, v2, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

.line 92
.local v0, "rateAppIntent":Landroid/content/Intent;
iget-object v2, p0, Lcom/elkurdi/calloutalerter/MainActivity$ReviewButtonListener;->this$0:Lcom/elkurdi/calloutalerter/MainActivity;

invoke-virtual {v2}, Lcom/elkurdi/calloutalerter/MainActivity;->getPackageManager()Landroid/content/pm/PackageManager;

move-result-object v2

const/4 v3, 0x0

invoke-virtual {v2, v0, v3}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;

move-result-object v2

.line 93
invoke-interface {v2}, Ljava/util/List;->size()I

move-result v2

if-lez v2, :cond_0

.line 94
iget-object v2, p0, Lcom/elkurdi/calloutalerter/MainActivity$ReviewButtonListener;->this$0:Lcom/elkurdi/calloutalerter/MainActivity;

invoke-virtual {v2, v0}, Lcom/elkurdi/calloutalerter/MainActivity;->startActivity(Landroid/content/Intent;)V

.line 98
:goto_0
return-void

.line 96
:cond_0
const-string v2, "setting"

const-string v3, "error while asking for review"

invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

goto :goto_0
.end method

提前谢谢您。抱歉代码很长,因为我已经复制了 smali 文件中的所有代码。我是新手,所以请帮忙。

最佳答案

嗯,你看,有几行将包名称附加到 StringBuilder。删除这些行并确保寄存器匹配并且你是黄金。将第一个 move-result-object 的寄存器更改为 v2,然后删除接下来的 4 行。

关于java - Smali - 如何在此代码中编辑点击时的 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50422044/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com