package com.gdufs.xman;
import
android.app.Activity;
import
android.app.AlertDialog.Builder;
import
android.content.ComponentName;
import
android.content.DialogInterface.OnClickListener;
import
android.content.DialogInterface;
import
android.content.Intent;
import
android.os.Bundle;
import
android.os.Process;
import
android.util.Log;
import
android.view.Menu;
import
android.view.View.OnClickListener;
import
android.view.View;
import
android.widget.Button;
import
android.widget.Toast;
public
class
MainActivity extends Activity {
private Button btn1;
private static String workString;
public void doRegister() {
new AlertDialog.Builder(this).setTitle(
"注册"
).setMessage(
"Flag就在前方!"
).setPositiveButton(
"注册"
, new DialogInterface.OnClickListener() {
@Override
/
/
android.content.DialogInterface$OnClickListener
public void onClick(DialogInterface dialog,
int
which) {
Intent intent
=
new Intent();
intent.setComponent(new ComponentName(
"com.gdufs.xman"
,
"com.gdufs.xman.RegActivity"
));
MainActivity.this.startActivity(intent);
MainActivity.this.finish();
}
}).setNegativeButton(
"不玩了"
, new DialogInterface.OnClickListener() {
@Override
/
/
android.content.DialogInterface$OnClickListener
public void onClick(DialogInterface dialog,
int
which) {
Process.killProcess(Process.myPid());
}
}).show();
}
@Override
/
/
android.app.Activity
public void onCreate(Bundle savedInstanceState) {
String str2;
super
.onCreate(savedInstanceState);
this.setContentView(
0x7F04001A
);
/
/
layout:activity_main
Log.d(
"com.gdufs.xman m="
,
"Xman"
);
this.getApplication();
int
m
=
MyApp.m;
if
(m
=
=
0
) {
str2
=
"未注册"
;
}
else
{
str2
=
m
=
=
1
?
"已注册"
:
"已混乱"
;
}
this.setTitle(
"Xman"
+
str2);
this.btn1
=
(Button)this.findViewById(
0x7F0B0054
);
/
/
id
:button1
this.btn1.setOnClickListener(new View.OnClickListener() {
@Override
/
/
android.view.View$OnClickListener
public void onClick(View v) {
MainActivity.this.getApplication();
if
(MyApp.m
=
=
0
) {
MainActivity.this.doRegister();
return
;
}
((MyApp)MainActivity.this.getApplication()).work();
Toast.makeText(MainActivity.this.getApplicationContext(), MainActivity.workString,
0
).show();
}
});
}
@Override
/
/
android.app.Activity
public boolean onCreateOptionsMenu(Menu menu) {
this.getMenuInflater().inflate(
0x7F0D0000
, menu);
/
/
menu:menu_main
return
1
;
}
public void work(String
str
) {
MainActivity.workString
=
str
;
}
}