附录代码Word格式文档下载.docx

上传人:b****1 文档编号:4081632 上传时间:2023-05-02 格式:DOCX 页数:58 大小:30.45KB
下载 相关 举报
附录代码Word格式文档下载.docx_第1页
第1页 / 共58页
附录代码Word格式文档下载.docx_第2页
第2页 / 共58页
附录代码Word格式文档下载.docx_第3页
第3页 / 共58页
附录代码Word格式文档下载.docx_第4页
第4页 / 共58页
附录代码Word格式文档下载.docx_第5页
第5页 / 共58页
附录代码Word格式文档下载.docx_第6页
第6页 / 共58页
附录代码Word格式文档下载.docx_第7页
第7页 / 共58页
附录代码Word格式文档下载.docx_第8页
第8页 / 共58页
附录代码Word格式文档下载.docx_第9页
第9页 / 共58页
附录代码Word格式文档下载.docx_第10页
第10页 / 共58页
附录代码Word格式文档下载.docx_第11页
第11页 / 共58页
附录代码Word格式文档下载.docx_第12页
第12页 / 共58页
附录代码Word格式文档下载.docx_第13页
第13页 / 共58页
附录代码Word格式文档下载.docx_第14页
第14页 / 共58页
附录代码Word格式文档下载.docx_第15页
第15页 / 共58页
附录代码Word格式文档下载.docx_第16页
第16页 / 共58页
附录代码Word格式文档下载.docx_第17页
第17页 / 共58页
附录代码Word格式文档下载.docx_第18页
第18页 / 共58页
附录代码Word格式文档下载.docx_第19页
第19页 / 共58页
附录代码Word格式文档下载.docx_第20页
第20页 / 共58页
亲,该文档总共58页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

附录代码Word格式文档下载.docx

《附录代码Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《附录代码Word格式文档下载.docx(58页珍藏版)》请在冰点文库上搜索。

附录代码Word格式文档下载.docx

publicvoidrun(){

Filefile=newFile(getFilesDir(),"

antivirus.db"

);

if(file.exists()&

&

file.length()>

0){

tv_splash_version.setText("

病毒库已成功导入"

}else{

AssetCopyUtil.copy1(getApplicationContext(),"

file.getAbsolutePath(),null);

try{

Thread.sleep(3000);

}catch(InterruptedExceptione){

e.printStackTrace();

handler.sendEmptyMessage(0);

}.start();

}

二、主界面

publicclassMainActivityextendsActivity{

privateGridViewgv_mian;

privateMainUIAdapteradapter;

privateLayoutInflaterinflater;

privateSharedPreferencessp;

//建立返回键监听对话框

publicvoidDiolog(){

AlertDialog.Builderdialog=newAlertDialog.Builder(MainActivity.this);

dialog.setMessage("

确定要退出吗?

"

dialog.setTitle("

提示"

dialog.setPositiveButton("

确定"

newDialogInterface.OnClickListener(){

publicvoidonClick(DialogInterfacedialogInterface,inti){

ExitApplication.getInstance().exit();

});

dialog.setNegativeButton("

取消"

newDialogInterface.OnClickListener(){

return;

dialog.create().show();

//返回键监听

publicbooleanonKeyDown(intkeyCode,KeyEventevent){

if(keyCode==KeyEvent.KEYCODE_BACK&

event.getRepeatCount()==0){

moveTaskToBack(false);

Diolog();

returnfalse;

}elseif(keyCode==KeyEvent.KEYCODE_MENU){

Intentintent=newIntent(MainActivity.this,SelectPicPopupWindow.class);

startActivity(intent);

returnsuper.onKeyDown(keyCode,event);

setContentView(R.layout.activity_main);

 

sp=this.getSharedPreferences("

config"

Context.MODE_PRIVATE);

gv_mian=(GridView)findViewById(R.id.gv_main);

adapter=newMainUIAdapter(this);

gv_mian.setAdapter(adapter);

gv_mian.setOnItemClickListener(newAdapterView.OnItemClickListener(){

publicvoidonItemClick(AdapterView<

?

>

adapterView,Viewview,inti,longl){

switch(i){

case0:

Intentintent1=newIntent(MainActivity.this,LostProtectedActivity.class);

startActivity(intent1);

break;

case1:

Intentintent2=newIntent(MainActivity.this,AntiVirusActivity.class);

startActivity(intent2);

case2:

Intentintent3=newIntent(MainActivity.this,AppLockActivity.class);

startActivity(intent3);

//主界面gridview布局

publicclassMainUIAdapterextendsBaseAdapter{

privateContextcontext;

privatestaticfinalString[]NAMES=newString[]{"

手机防盗"

"

手机杀毒"

程序锁"

privatestaticfinalint[]ICONS=newint[]{R.drawable.widget01,R.drawable.widget06,R.drawable.widget08};

publicMainUIAdapter(Contextcontext){

this.context=context;

inflater=LayoutInflater.from(this.context);

sp=context.getSharedPreferences("

publicintgetCount(){

returnNAMES.length;

publicObjectgetItem(inti){

returni;

publiclonggetItemId(inti){

publicViewgetView(inti,ViewconvertView,ViewGroupviewGroup){

ViewHolderholder;

convertView=inflater.inflate(R.layout.main_item,null);

holder=newViewHolder();

holder.imageView=(ImageView)convertView.findViewById(R.id.iv_main_icon);

holder.textView=(TextView)convertView.findViewById(R.id.tv_main_name);

holder.imageView.setImageResource(ICONS[i]);

holder.textView.setText(NAMES[i]);

convertView.setTag(holder);

returnconvertView;

staticclassViewHolder{

TextViewtextView;

ImageViewimageView;

//开启程序锁服务

publicclassSelectPicPopupWindowextendsActivity{

privateCheckBoxcb_applock;

setContentView(R.layout.bottom);

MODE_PRIVATE);

cb_applock=(CheckBox)findViewById(R.id.cb_applock);

booleanflag=sp.getBoolean("

flag"

false);

if(flag){

cb_applock.setText("

程序锁服务已开启"

cb_applock.setChecked(true);

程序锁服务未开启"

cb_applock.setChecked(false);

cb_applock.setOnCheckedChangeListener(newCompoundButton.OnCheckedChangeListener(){

publicvoidonCheckedChanged(CompoundButtoncompoundButton,booleanb){

Intentintent=newIntent(SelectPicPopupWindow.this,WatchDogService.class);

if(b){

startService(intent);

if(intent!

=null)

stopService(intent);

三、手机防盗

publicclassLostProtectedActivityextendsActivityimplementsView.OnClickListener{

//设置存储对象

//第一次进入手机防盗界面时的界面控件对象

privateEditTextet_first_dialog_pwd;

privateEditTextet_first_dialog_pwd_confirm;

privateButtonbtn_first_dialog_ok;

privateButtonBtn_first_dialog_cancle;

//第二次进入手机防盗界面时的控件对象

privateEditTextet_normal_dialog_pwd;

privateButtonbtn_normal_dialog_ok;

privateButtonbtn_normal_dialog_cancle;

//对话框对象

privateAlertDialogdialog;

sp=getSharedPreferences("

MODE_PRIVATE);

//判断用户是否设置过密码

if(isSetuppwd()){

showNormalEntryDialog();

}else{

showFirstEntryDialog();

//第一次进入手机防盗是要显示的对话框

privatevoidshowFirstEntryDialog(){

AlertDialog.Builderdialog=newAlertDialog.Builder(this);

Viewview=View.inflate(this,R.layout.first_entry_dialog,null);

et_first_dialog_pwd=(EditText)view.findViewById(R.id.et_first_dialog_pwd);

et_first_dialog_pwd_confirm=(EditText)view.findViewById(R.id.et_first_dialog_pwd_confirm);

btn_first_dialog_ok=(Button)view.findViewById(R.id.btn_first_dialog_ok);

Btn_first_dialog_cancle=(Button)view.findViewById(R.id.btn_first_dialog_cancle);

btn_first_dialog_ok.setOnClickListener(this);

Btn_first_dialog_cancle.setOnClickListener(this);

dialog.setCancelable(false);

dialog.setView(view);

privatevoidshowNormalEntryDialog(){

AlertDialog.Builderdiolog=newAlertDialog.Builder(this);

//当单击取消按钮是,直接结束当前的avtivity,程序会进入到主界面

diolog.setOnCancelListener(newDialogInterface.OnCancelListener(){

publicvoidonCancel(DialogInterfacedialogInterface){

finish();

Viewview=View.inflate(this,R.layout.normal_entry_dialog,null);

et_normal_dialog_pwd=(EditText)view.findViewById(R.id.et_normal_dialog_pwd);

btn_normal_dialog_ok=(Button)view.findViewById(R.id.btn_normal_dialog_ok);

btn_normal_dialog_cancle=(Button)view.findViewById(R.id.btn_normal_dialog_cancle);

btn_normal_dialog_ok.setOnClickListener(this);

btn_normal_dialog_cancle.setOnClickListener(this);

diolog.setCancelable(false);

diolog.setView(view);

diolog.create().show();

privatebooleanisSetuppwd(){

Stringsavedpwd=sp.getString("

password"

if(TextUtils.isEmpty(savedpwd)){

returntrue;

privatebooleanisSetupGuide()

{

returnsp.getBoolean("

issetup"

false);

publicvoidonClick(Viewview){

switch(view.getId()){

caseR.id.btn_first_dialog_ok:

Stringpwd=et_first_dialog_pwd.getText().toString().trim();

Stringpwd_confirm=et_first_dialog_pwd_confirm.getText().toString().trim();

if(TextUtils.isEmpty(pwd)||TextUtils.isEmpty(pwd_confirm)){

Toast.makeText(LostProtectedActivity.this,"

密码不能为空"

Toast.LENGTH_SHORT).show();

if(pwd.equals(pwd_confirm)){

SharedPreferences.Editoreditor=sp.edit();

editor.putString("

pwd);

mit();

if(!

isSetupGuide()){

//进入手机防盗设置界面

IntentfirstentryIntent=newIntent(LostProtectedActivity.this,Guide1.class);

startActivity(firstentryIntent);

Intentintent1=newIntent(LostProtectedActivity.this,LostProtectedMainActivity.class);

startActivity(intent1);

Toast.makeText(this,"

两次密码不相同,请重新输入!

}

caseR.id.btn_first_dialog_cancle:

caseR.id.btn_normal_dialog_cancle:

caseR.id.btn_normal_dialog_ok:

Stringuserentrypwd=et_normal_dialog_pwd.getText().toString().trim();

if(TextUtils.isEmpty(userentrypwd)){

if(userentrypwd.equals(savedpwd)){

密码正确!

//进入手机防盗界面

IntentnormalertryIntent=newIntent(LostProtectedActivity.this,Guide1.class);

startActivity(normalertryIntent);

else{

Intentintent2=newIntent(LostProtectedActivity.this,LostProtectedMainActivity.class);

startAct

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 幼儿教育 > 幼儿读物

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2