效果:在APP启动时弹出一个提示框,只有确定按钮。
更多APP移花接木教程请参考Sarkozy与水波摇曳的帖子
在启动页oncreate中添加:
invoke-virtual {p0, v0}, L当前页面地址;->setContentView(I)V
#v0是当前页面在public中的数值,p0无所谓,L路径要与当前java路径保持一致
.line 16
invoke-virtual {p0}, L当前页面地址;->Dialog()V
#p0不管,L路径要与当前java路径保持一致
在当前页面(启动页)下添加虚函数(# virtual methods):
.method public Dialog()V
.locals 3
.prologue
.line 20
new-instance v0, Landroid/app/AlertDialog$Builder;
#v0=(UninitRef,Landroid/app/AlertDialog$Builder;);
invoke-direct {v0, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V
.line 21
.local v0, "builder":Landroid/app/AlertDialog$Builder;
#v0=(Reference,Landroid/app/AlertDialog$Builder;);
const/4 v1, 0x0
#v1=(Null);
invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setIcon(Landroid/graphics/drawable/Drawable;)Landroid/app/AlertDialog$Builder;
.line 22
const-string v1, "提示框标题,记得转U码"
#v1=(Reference,Ljava/lang/String;);
invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
.line 23
const-string v1, "提示内容,记得转U码"
invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
.line 24
const-string v1, "确定按钮内容,记得转U码"
new-instance v2, L当前页面地址$尾数;
#L路径要与当前java路径保持一致
invoke-direct {v2, p0}, L当前页面地址$尾数;-><init>(L当前页面地址;)V
#L路径要与当前java路径保持一致
#v2=(Reference,L当前页面地址$尾数;);
invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog$Builder;->setPositiveButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
.line 33
invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;
move-result-object v1
invoke-virtual {v1}, Landroid/app/AlertDialog;->show()V
.line 34
return-void
.end method
插入一个新文件在同目录下:
当前页面地址$尾数.smali(例:MainActivity$1.smali)
#如果出现重名,则递进
该文件内容如下: .class L当前页面地址$尾数;
.super Ljava/lang/Object;
.source "MainActivity.java"
# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = L当前页面地址;->Dialog()V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:L当前页面地址;
# direct methods
.method constructor <init>(L当前页面地址;)V
.locals 0
.prologue
.line 1
iput-object p1, p0, L当前页面地址$尾数;->this$0:L当前页面地址;
.line 24
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
#p0=(Reference,L当前页面地址$尾数;);
return-void
.end method
# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
.locals 0
.param p1, "dialog" # Landroid/content/DialogInterface;
.param p2, "which" # I
.prologue
.line 29
invoke-interface {p1}, Landroid/content/DialogInterface;->dismiss()V
.line 30
return-void
.end method
----------------------------------------------------- 以上文档中出现的中文请自行替换为对应路径。
其实按理说,要将这个提示框添加到任何地方都可以,只是看各位移植的水平了,关于移花接木的问题可以回帖或者以点评形式回复。
小结:从APP中将这个提示框一步一步剥离开来。
你的回复是俺们的动力。关注逆向未来pd521.com
|