Ejemplo n.º 1
0
 @SuppressWarnings("deprecation")
 private void inui() throws AppException {
   // TODO Auto-generated method stub
   String loadTime = user.getString("url", "");
   if (loadTime.equals("")) {
     mainLayout.setBackgroundResource(R.drawable.ic_mainbg2);
   } else {
     if (loadTime.startsWith("sd:")) {
       loadTime = loadTime.substring(3);
       mainLayout.setBackground(new BitmapDrawable(BitmapFactory.decodeFile(loadTime)));
     } else {
       try {
         mainLayout.setBackground(
             new BitmapDrawable(BitmapFactory.decodeStream(getAssets().open(loadTime))));
       } catch (IOException e) {
         e.printStackTrace();
       }
     }
   }
   Reminds reminds = null;
   if (!remindfzDB.select().equals("")) {
     reminds = Reminds.parse(remindfzDB.select());
     for (int i = 0; i < reminds.getFileList().size(); i++) {
       remindfs.add(reminds.getFileList().get(i));
     }
   }
   if (remindfs.size() == 0) {
     rels.setVisibility(View.INVISIBLE);
   } else {
     fsize.setText(String.valueOf(remindfs.size()));
   }
   if (!remindzjDB.select().equals("")) {
     reminds = Reminds.parse(remindzjDB.select());
     for (int i = 0; i < reminds.getFileList().size(); i++) {
       remindzj.add(reminds.getFileList().get(i));
     }
   }
   if (remindzj.size() == 0) {
     rels1.setVisibility(View.INVISIBLE);
   } else {
     hsize.setText(String.valueOf(remindzj.size()));
   }
   if (!remindnewsDB.select().equals("")) {
     reminds = Reminds.parse(remindnewsDB.select());
     for (int i = 0; i < reminds.getFileList().size(); i++) {
       remindnews.add(reminds.getFileList().get(i));
     }
   }
   if (remindnews.size() == 0) {
     rels2.setVisibility(View.INVISIBLE);
   } else {
     nsize.setText(String.valueOf(remindnews.size()));
   }
 }
Ejemplo n.º 2
0
 @OnClick({
   R.id.ima_btn1,
   R.id.ima_btn2,
   R.id.right_button,
   R.id.ima_btn5,
   R.id.ima_btn4,
   R.id.ima_btn6,
   R.id.left_button,
   R.id.remindbtn,
   R.id.ima_btn3
 })
 @Override
 public void onClick(View v) {
   // TODO Auto-generated method stub
   switch (v.getId()) {
     case R.id.ima_btn1:
       startProgressDialog();
       loaddata();
       break;
     case R.id.ima_btn2:
       if (remindfs.size() != 0) {
         remindfzDB.delete();
       }
       Intent search = new Intent(MainActivity.this, RankingActivity.class);
       startActivity(search);
       break;
     case R.id.ima_btn5:
       if (remindnews.size() != 0) {
         remindnewsDB.delete();
       }
       Intent intent1 = new Intent(MainActivity.this, INewsActivity.class);
       startActivity(intent1);
       break;
     case R.id.ima_btn4:
       loadMessageData();
       /*Intent intent2 = new Intent(MainActivity.this, SignActivity.class);
       startActivity(intent2);*/
       break;
     case R.id.ima_btn6:
       Intent intent3 = new Intent(MainActivity.this, GloryActivity.class);
       startActivity(intent3);
       break;
     case R.id.left_button:
       Intent intent4 = new Intent(MainActivity.this, SetActivity.class);
       startActivity(intent4);
       finish();
       break;
     case R.id.remindbtn:
       Intent remind = new Intent(MainActivity.this, RemindActivity.class);
       startActivity(remind);
       break;
     case R.id.ima_btn3:
       if (remindzj.size() != 0) {
         remindzjDB.delete();
       }
       Intent interact = new Intent(MainActivity.this, InteractActivity.class);
       startActivity(interact);
       break;
     case R.id.right_button:
       startProgressDialog2();
       deleteTableByDBName(db, table);
       if (timeer == 1) {
         new Thread(
                 new Runnable() {
                   @Override
                   public void run() {
                     Message msg = new Message();
                     timeer = 0;
                     try {
                       msg.obj = outlogin();
                     } catch (JSONException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
                     }
                     handler.sendMessage(msg);
                   }
                 })
             .start();
       }
       break;
   }
 }