Exemplo n.º 1
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   UIUtils.initDisplayMetrics(this, getWindowManager(), false);
   ResourceUtils.init(this);
   PathDefine.init();
   super.onCreate(savedInstanceState);
   registerReceiver(receiverClose, filterClose);
   if (!MiscUtils.isSDCardExists()) {
     new AlertDialog.Builder(this)
         .setTitle(R.string.hint)
         .setMessage(R.string.no_sdcard)
         .setPositiveButton(
             R.string.ok,
             new DialogInterface.OnClickListener() {
               @Override
               public void onClick(DialogInterface dialog, int which) {
                 finish();
               }
             })
         .show();
     return;
   }
   if (!YugiohDatabase.isDatabaseFileExists()) {
     UpdateInfo updateInfo = new UpdateInfo();
     updateInfo.setUpdateApk(0);
     updateInfo.setUpdateData(1);
     Intent inUpdate = new Intent(this, UpdateActivity.class);
     inUpdate.putExtra("update", updateInfo);
     startActivity(inUpdate);
     finish();
   } else {
     checkUpdate();
   }
 }
Exemplo n.º 2
0
 @Override
 public void handleMessage(Message msg) {
   if (msg.what == 1) {
     UpdateInfo updateInfo = (UpdateInfo) msg.obj;
     if (updateInfo != null) {
       int hasUpdate = updateInfo.getUpdateApk() + updateInfo.getUpdateData();
       if (hasUpdate != 0) {
         Toast.makeText(MainActivity.this, R.string.update_hint, Toast.LENGTH_LONG).show();
       }
     }
   }
   super.handleMessage(msg);
 }