@Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.back:
       finish();
       break;
     case R.id.button_djs:
       // 点击获得验证码
       try {
         isMobileNet = HttpUtils.isMobileDataEnable(getApplicationContext());
         isWifiNet = HttpUtils.isWifiDataEnable(getApplicationContext());
         if (!isMobileNet && !isWifiNet) {
           Toast.makeText(this, R.string.network_error, Toast.LENGTH_SHORT).show();
           return;
         }
       } catch (Exception e) {
         e.printStackTrace();
       }
       mobile_str = mobile.getText().toString();
       if (StringUtil.isNullOrEmpty(mobile_str)) {
         Toast.makeText(this, R.string.reg_error_one, Toast.LENGTH_SHORT).show();
         return;
       }
       button_djs.setClickable(false); // 不可点击
       MyTimer myTimer = new MyTimer(60000, 1000);
       myTimer.start();
       getCard();
       break;
     case R.id.next:
       // 下一步
       try {
         isMobileNet = HttpUtils.isMobileDataEnable(getApplicationContext());
         isWifiNet = HttpUtils.isWifiDataEnable(getApplicationContext());
         if (!isMobileNet && !isWifiNet) {
           Toast.makeText(this, R.string.network_error, Toast.LENGTH_SHORT).show();
           return;
         }
       } catch (Exception e) {
         e.printStackTrace();
       }
       mobile_str = mobile.getText().toString();
       card_str = card.getText().toString();
       if (StringUtil.isNullOrEmpty(mobile_str)) {
         Toast.makeText(this, R.string.reg_error_one, Toast.LENGTH_SHORT).show();
         return;
       }
       if (StringUtil.isNullOrEmpty(card_str)) {
         Toast.makeText(this, R.string.reg_error_five, Toast.LENGTH_SHORT).show();
         return;
       }
       getReg();
       break;
     case R.id.quest:
       // 问题
       break;
   }
 }
  protected void onListItemClick(ListView l, View v, int position, long id) {
    ProfilerAudioAdapter profileAudioAdapter = (ProfilerAudioAdapter) getListAdapter();
    String selectedValue = profileAudioAdapter.getItem(position);
    Toast.makeText(this, selectedValue, Toast.LENGTH_SHORT).show();

    GetFile task = new GetFile();
    String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
    File folder = new File(extStorageDirectory, "Audio");
    folder.mkdir();
    ArrayList<String> params = new ArrayList<String>();
    params.add(fileLocation[position]);
    params.add(fileName[position]);
    params.add(String.valueOf(folder));
    task.execute(new ArrayList[] {params});

    try {
      Intent intent = new Intent();
      intent.setAction(Intent.ACTION_VIEW);
      File fileToRead = new File(folder + "/" + fileName[position]);
      Uri uri = Uri.fromFile(fileToRead.getAbsoluteFile());
      intent.setDataAndType(uri, "audio/mp3");
      startActivity(intent);
    } catch (ActivityNotFoundException activityNotFoundException) {
      activityNotFoundException.printStackTrace();
      Toast.makeText(this, "There doesn't seem to be an Audio player installed.", Toast.LENGTH_LONG)
          .show();
    } catch (Exception ex) {
      ex.printStackTrace();
      Toast.makeText(this, "Cannot open the selected file.", Toast.LENGTH_LONG).show();
    }
  }
    @Override
    protected String[] doInBackground(String... params) {
      // bankNumber:银行卡号 accountNumber:证件号 mobile:手机号码 accountname:用户姓名

      FastpayBean fastpayBean = new FastpayBean();
      fastpayBean.setService("query_timestamp");
      fastpayBean.setPartner(Url.Partner);
      fastpayBean.setSign_type("MD5");
      fastpayBean.setInput_charset("UTF-8");

      String urlPath = "https://www.ebatong.com/gateway.htm";
      urlPath += "?service=query_timestamp";
      urlPath =
          urlPath
              + "&partner="
              + Url.Partner
              + "&input_charset=UTF-8&sign_type=MD5&sign="
              + fastpayBean.getNeedSignCode();

      Log.i("lyjtest", "urlPath:" + urlPath);

      String[] result = new String[2];
      InputStream is = null;
      try {
        is = NetTool.sendGetData(urlPath);
        result = NetTool.readXML(is);
      } catch (Exception e) {
        e.printStackTrace();
      }

      return result;
    }
 private void sendExceptionMsg(int what, Exception e) {
   e.printStackTrace();
   Message msg = Message.obtain();
   msg.obj = e;
   msg.what = what;
   queryHandler.sendMessage(msg);
 }
 @Override
 public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
   if (parent == mSpinnerGeology) {
     geologyIndex = position;
     new PreferencesUtil(getContext()).save("geologyIndex", geologyIndex);
     initConditions(getActivity());
     initConditions(getActivity());
     initConditiontValue(getActivity());
     changeAllGeology();
   }
   if (parent == mSpinnerCondition) {
     conditionIndex = position;
     initConditions(getActivity());
     initConditiontValue(getActivity());
   }
   if (parent == mSpinnerConditionValue) {
     conditionValueIndex = position;
   }
   String selectItem = null;
   try {
     selectItem = mSpinnerConditionValue.getSelectedItem().toString();
   } catch (Exception e) {
     e.printStackTrace();
   }
   slog.p(TAG, "selectItem " + selectItem);
   if (mETValue1 != null && mETValue2 != null) {
     if (selectItem != null && selectItem.equals("自定义")) {
       mETValue1.setVisibility(View.VISIBLE);
       mETValue2.setVisibility(View.VISIBLE);
     } else {
       mETValue1.setVisibility(View.GONE);
       mETValue2.setVisibility(View.GONE);
     }
   }
 }
    @Override
    protected String doInBackground(String... params) {
      // bankNumber:银行卡号 accountNumber:证件号 mobile:手机号码 accountname:用户姓名

      FastpayBean fastpayBean = new FastpayBean();
      fastpayBean.setService("ebatong_mp_unbind");
      fastpayBean.setPartner(Url.Partner);
      fastpayBean.setSign_type("MD5");
      fastpayBean.setInput_charset("UTF-8");
      fastpayBean.setBank_card_no(getIntent().getStringExtra("bankNumber"));
      fastpayBean.setOut_trade_no(billno);
      fastpayBean.setPhone(getIntent().getStringExtra("phone"));
      fastpayBean.setNotify_url("www.hao123.com");
      fastpayBean.setCustomerId(PreferenceUtils.getUserId() + "");
      fastpayBean.setSubject("描述");

      String urlPath = "https://www.ebatong.com/mobileFast/unbind.htm";
      String postJson = fastpayBean.getPostJson();
      Log.i("lyjtest", "getPostJson:" + postJson);
      byte[] data = postJson.getBytes();
      InputStream is = null;
      try {
        is = NetTool.sendXMLData(urlPath, data, "UTF-8");
        data = NetTool.readStream(is);
        Log.i("lyjtest", new String(data));
      } catch (Exception e) {
        e.printStackTrace();
      }

      return new String(data);
    }
 /**
  * 获取所有会话
  *
  * @return +
  */
 private List<EMConversation> loadConversationsWithRecentChat() {
   // 获取所有会话,包括陌生人
   Hashtable<String, EMConversation> conversations =
       EMChatManager.getInstance().getAllConversations();
   // 过滤掉messages size为0的conversation
   /**
    * 如果在排序过程中有新消息收到,lastMsgTime会发生变化 影响排序过程,Collection.sort会产生异常 保证Conversation在Sort过程中最后一条消息的时间不变
    * 避免并发问题
    */
   List<Pair<Long, EMConversation>> sortList = new ArrayList<Pair<Long, EMConversation>>();
   synchronized (conversations) {
     for (EMConversation conversation : conversations.values()) {
       if (conversation.getAllMessages().size() != 0) {
         // if(conversation.getType() != EMConversationType.ChatRoom){
         sortList.add(
             new Pair<Long, EMConversation>(
                 conversation.getLastMessage().getMsgTime(), conversation));
         // }
       }
     }
   }
   try {
     // Internal is TimSort algorithm, has bug
     sortConversationByLastChatTime(sortList);
   } catch (Exception e) {
     e.printStackTrace();
   }
   List<EMConversation> list = new ArrayList<EMConversation>();
   for (Pair<Long, EMConversation> sortItem : sortList) {
     list.add(sortItem.second);
   }
   return list;
 }
 /**
  * This method takes a string as an argument; Decrypts it and return it as a string. Or it returns
  * null
  *
  * @param text of type string
  * @return a string
  */
 public static final String decrypt(String data) {
   try {
     return new String(decrypt(hex2byte(data.getBytes())));
   } catch (Exception e5) {
     e5.printStackTrace();
   }
   return null;
 }
 /**
  * This method takes a string as an argument; Encrypts it and return it as a string. Or it returns
  * null
  *
  * @param text of type string
  * @return a string
  */
 public static final String encrypt(String text) {
   try {
     return byte2hex(encrypt(text, pubKey));
   } catch (Exception e4) {
     e4.printStackTrace();
   }
   return null;
 }
  public void mediaControls(View view) {
    switch (view.getId()) {
      case R.id.recordbutton:
        // TODO Auto-generated method stub
        if (recording) {
          mediaRecorder.stop();
          releaseMediaRecorder();
          camerabtn.setBackgroundDrawable(
              getResources().getDrawable(R.drawable.button_notrecording));

          SavePreferences("customVideoPath", customVideoPath.toString());
          SavePreferences("MEDIA_TYPE", "5");
          Intent intent = new Intent(media_Video.this, categories_Writemessage.class);
          startActivity(intent);
          finish();

        } else {
          releaseCamera();
          if (!prepareMediaRecorder()) {
            finish();
          }
          try {
            mediaRecorder.start();
            doInBackground();
            gotimer();
          } catch (Exception e) {
            e.printStackTrace();
          }
          camerabtn.setBackgroundDrawable(
              getResources().getDrawable(R.drawable.button_isrecording));
          recording = true;
        }
        break;

      case R.id.flashbutton:
        if (!flashLight) {
          flashLight = true;
          flashbtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.camera_flash));
        } else {
          flashLight = false;
          flashbtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.camera_flashoff));
        }
        break;

      case R.id.switchbtn:
        switchCameras();
        break;

      case R.id.backbtn:
        finish();
        if (isPLaying == true) {
          player.stop();
          isPLaying = false;
        }
        break;
    }
  }
  public void onSensorChanged(String sensorStr) {
    Log.v(TAG, "onSensorChanged : " + sensorStr);

    String[] fs = sensorStr.split(",");
    if (fs.length == 4) {
      acceValusW = Float.parseFloat(fs[0]) * (BASE - 10);
      // 获得x轴的值
      acceValusX = Float.parseFloat(fs[1]) * (BASE - 10);
      // 获得y轴的值
      acceValusY = Float.parseFloat(fs[2]) * (BASE - 10);
      // 获得z轴的值
      acceValusZ = Float.parseFloat(fs[3]) * (BASE - 10);
      // 锁定整个SurfaceView
      Canvas mCanvas = mSurfaceHolder.lockCanvas();
      try {
        if (mCanvas != null) {
          // 画笔的颜色(红)
          mPaint.setColor(Color.RED);
          // 画X轴的点
          mCanvas.drawPoint(x, (int) (BASE + acceValusX), mPaint);
          // 画笔的颜色(绿)
          mPaint.setColor(Color.GREEN);
          // 画Y轴的点
          mCanvas.drawPoint(x, (int) (BASE * 2 + acceValusY), mPaint);
          // 画笔的颜色(蓝)
          mPaint.setColor(Color.CYAN);
          // 画Z轴的点
          mCanvas.drawPoint(x, (int) (BASE * 3 + acceValusZ), mPaint);
          // 画笔的颜色(huang)
          mPaint.setColor(Color.WHITE);
          // 画W轴的点
          mCanvas.drawPoint(x, (int) (BASE * 4 + acceValusW), mPaint);
          // 横坐标+1

          x++;
          // 如果已经画到了屏幕的最右边
          // if (x > getWindowManager().getDefaultDisplay().getWidth()) {
          if (x > mCanvas.getWidth()) {
            x = 0;
            // 清屏
            mCanvas.drawColor(Color.BLACK);
          }
          // 绘制完成,提交修改
          mSurfaceHolder.unlockCanvasAndPost(mCanvas);
        }
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        if (mCanvas != null) {
          // 重新锁一次
          mSurfaceHolder.lockCanvas(new Rect(0, 0, 0, 0));
          mSurfaceHolder.unlockCanvasAndPost(mCanvas);
        }
      }
    }
  }
 private Camera getCameraInstance(int x) {
   // TODO Auto-generated method stub
   Camera c = null;
   try {
     c = Camera.open(x); // attempt to get a Camera instance
   } catch (Exception e) {
     e.printStackTrace();
   }
   return c; // returns null if camera is unavailable
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {
      String sdStatus = Environment.getExternalStorageState();
      if (!sdStatus.equals(Environment.MEDIA_MOUNTED)) { // 检测sd是否可用
        Log.i("TestFile", "SD card is not avaiable/writeable right now.");
        return;
      }
      String name =
          new DateFormat().format("yyyyMMdd_hhmmss", Calendar.getInstance(Locale.CHINA)) + ".jpg";
      Toast.makeText(this, name, Toast.LENGTH_LONG).show();
      Bundle bundle = data.getExtras();
      Bitmap bitmap = (Bitmap) bundle.get("data"); // 获取相机返回的数据,并转换为Bitmap图片格式

      FileOutputStream b = null;
      File file = new File("/sdcard/myImage/");
      if (!file.exists()) file.mkdirs(); // 创建文件夹

      String fileName = "/sdcard/myImage/" + name;
      File photofile = new File(fileName);
      if (!photofile.exists()) {
        try {
          photofile.createNewFile();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      try {
        b = new FileOutputStream(photofile);
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, b); // 把数据写入文件
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        try {
          b.flush();
          b.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      // 动态的改变gridview中的一个Item的内容
      bitmapList.set(currentIndex, bitmap);
      myGalleryAdapter.notifyDataSetChanged();
      updatePhoto(
          Long.valueOf(phoneNumberToId.get(phoneNumber.get(currentIndex))), bitmapToBytes(bitmap));
      //            ((ImageView) findViewById(R.id.imageView)).setImageBitmap(bitmap);//
      // 将图片显示在ImageView里
      Intent intent = new Intent(ContactActivity.this, ContactActivity.class);
      this.startActivity(intent);
      this.finish();
    }
  }
  private Bitmap getVideoDrawable(String path) throws OutOfMemoryError {

    try {
      Bitmap thumb =
          ThumbnailUtils.createVideoThumbnail(path, MediaStore.Images.Thumbnails.MINI_KIND);
      return thumb;
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }
 private double getEditValue(EditText etvalue) {
   try {
     if (etvalue.getVisibility() == View.VISIBLE) {
       double value = Double.parseDouble(etvalue.getText().toString());
       return value;
     }
   } catch (Exception e) {
     slog.e(TAG, "getMaxValue error mETValue1.getText() " + etvalue.getText());
     e.printStackTrace();
   }
   return -1;
 }
    @Override
    protected String doInBackground(String... params) {
      // bankNumber:银行卡号 accountNumber:证件号 mobile:手机号码 accountname:用户姓名

      FastpayBean fastpayBean = new FastpayBean();
      fastpayBean.setService("create_direct_pay_by_mp");
      fastpayBean.setPartner(Url.Partner);
      fastpayBean.setSign_type("MD5");
      fastpayBean.setInput_charset("UTF-8");
      fastpayBean.setBank_card_no(bankid);

      fastpayBean.setCardHolderName(name);

      fastpayBean.setIdType("01");
      fastpayBean.setCardHolderId(idcard);

      fastpayBean.setPhone(phone);
      fastpayBean.setOut_trade_no(params[0]);
      fastpayBean.setTotal_fee(params[3]); // (8,2) 位数至少2位
      fastpayBean.setSign_type("MD5");
      fastpayBean.setNotify_url("www.hao123.com");
      fastpayBean.setToken(params[1]);
      fastpayBean.setValidCode(params[2]);
      fastpayBean.setCustomerId(PreferenceUtils.getUserId() + "");
      fastpayBean.setDefault_bank(bank_code);

      fastpayBean.setExter_invoke_ip("11.11.11.11");
      fastpayBean.setAnti_phishing_key(params[4]);

      fastpayBean.setSubject("txwl");
      fastpayBean.setBody("spms");
      fastpayBean.setShow_url("spzs");
      fastpayBean.setExtend_param("ggcs");
      fastpayBean.setExtra_common_param("hccs");
      fastpayBean.setPay_method("");
      //            fastpayBean.setBankId("CCB");

      String urlPath = "https://www.ebatong.com/mobileFast/pay.htm";
      String postJson = fastpayBean.getPostJson();
      Log.i("lyjtest", "getPostJson:" + postJson);
      byte[] data = postJson.getBytes();
      InputStream is = null;
      try {
        is = NetTool.sendXMLData(urlPath, data, "UTF-8");
        data = NetTool.readStream(is);
        Log.i("lyjtest", new String(data));
      } catch (Exception e) {
        e.printStackTrace();
      }

      return new String(data);
    }
 @Override
 protected Void doInBackground(Integer... params) {
   try {
     Log.v("drive", "2exit");
     if (driver.drive2Exit() == false) {
       Toast.makeText(StatePlay.this, "Fuel Empty", Toast.LENGTH_SHORT).show();
       Intent i = new Intent(StatePlay.this, AMazeActivity.class);
       startActivity(i);
     }
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return (null);
 }
 public String getClasses() {
   String name = "";
   try {
     URL site = new URL("http://www.marksonvisuals.com/sitapp/cc.php");
     URLConnection yc = site.openConnection();
     BufferedReader out = new BufferedReader(new InputStreamReader(yc.getInputStream()));
     String inputLine;
     while ((inputLine = out.readLine()) != null) {
       name += inputLine + "\n";
     }
     out.close();
   } catch (Exception e) {
     e.printStackTrace();
   }
   return name.trim();
 }
Exemple #19
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   try {
     if (resultCode == TickerMonitorEditActivity.APPLY_RESULT) {
       Monitor.Data monitorData =
           data.getExtras().getParcelable(TickerMonitorEditActivity.MONITOR_DATA);
       long id = data.getLongExtra(TickerMonitorEditActivity.MONITOR_ID, -1);
       if (monitorData != null
           && id != -1) { // we might get null if something went wrong in the edit activity
         monitoringService.applyMonitorChange(id, monitorData);
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   try {
     generateKey();
   } catch (Exception e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
   }
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   final Button encryptButton = (Button) findViewById(R.id.encryptbutton);
   final Button decryptButton = (Button) findViewById(R.id.decryptbutton);
   final EditText input = (EditText) findViewById(R.id.secretMessage);
   final EditText CodedMessage = (EditText) findViewById(R.id.encryptedCode);
   final EditText output = (EditText) findViewById(R.id.originalMessage);
   encryptButton.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           try {
             CodedMessage.setText(encrypt(input.getText().toString()));
           } catch (Exception e2) {
             // TODO Auto-generated catch block
             e2.printStackTrace();
           }
         };
       });
   decryptButton.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           try {
             output.setText(String.valueOf(decrypt(CodedMessage.getText().toString())));
           } catch (Exception e3) {
             // TODO Auto-generated catch block
             e3.printStackTrace();
           }
         }
       });
 }
  @Override
  public void onClick(View view) {
    switch (view.getId()) {
      case R.id.backBtn:
        DeviceRestActivity.this.finish();
        break;
      case R.id.button1:
        try {
          String startTime = startTimeTV.getText().toString();
          String endTime = endTimeTV.getText().toString();
          StringBuffer bufferOne = new StringBuffer();
          StringBuffer bufferTwo = new StringBuffer();
          if (checkTVOne1.isChecked()) {
            bufferOne.append("1");
          } else {
            bufferOne.append("0");
          }
          if (checkTVOne2.isChecked()) {
            bufferOne.append("2");
          } else {
            bufferOne.append("0");
          }
          if (checkTVOne3.isChecked()) {
            bufferOne.append("3");
          } else {
            bufferOne.append("0");
          }
          if (checkTVOne4.isChecked()) {
            bufferOne.append("4");
          } else {
            bufferOne.append("0");
          }
          if (checkTVOne5.isChecked()) {
            bufferOne.append("5");
          } else {
            bufferOne.append("0");
          }
          if (checkTVOne6.isChecked()) {
            bufferOne.append("6");
          } else {
            bufferOne.append("0");
          }
          if (checkTVOne7.isChecked()) {
            bufferOne.append("7");
          } else {
            bufferOne.append("0");
          }

          if (checkTV1.isChecked()) {
            bufferTwo.append("1");
          } else {
            bufferTwo.append("0");
          }
          if (checkTV2.isChecked()) {
            bufferTwo.append("2");
          } else {
            bufferTwo.append("0");
          }
          if (checkTV3.isChecked()) {
            bufferTwo.append("3");
          } else {
            bufferTwo.append("0");
          }
          if (checkTV4.isChecked()) {
            bufferTwo.append("4");
          } else {
            bufferTwo.append("0");
          }
          if (checkTV5.isChecked()) {
            bufferTwo.append("5");
          } else {
            bufferTwo.append("0");
          }
          if (checkTV6.isChecked()) {
            bufferTwo.append("6");
          } else {
            bufferTwo.append("0");
          }
          if (checkTV7.isChecked()) {
            bufferTwo.append("7");
          } else {
            bufferTwo.append("0");
          }
          String content =
              String.format(
                  "%s-%s,%s,%s-%s,%s",
                  startTimeTV.getText().toString(),
                  endTimeTV.getText().toString(),
                  bufferOne,
                  startTimeTV1.getText().toString(),
                  endTimeTV1.getText().toString(),
                  bufferTwo);
          // String content =
          // startTime+"-"+endTime+","+startTime+"-"+endTime+","+bufferTwo.toString();
          content = content.replace(":", "");
          if (Session.getInstance().getDevice() != null) {
            sendCommand(content);
          }
          //					addFence(object);
        } catch (Exception e) {
          e.printStackTrace();
        }
        break;
      case R.id.checkTV1:
        if (checkTV1.isChecked()) {
          checkTV1.setChecked(false);
        } else {
          checkTV1.setChecked(true);
        }
        break;
      case R.id.checkTV2:
        if (checkTV2.isChecked()) {
          checkTV2.setChecked(false);
        } else {
          checkTV2.setChecked(true);
        }
        break;
      case R.id.checkTV3:
        if (checkTV3.isChecked()) {
          checkTV3.setChecked(false);
        } else {
          checkTV3.setChecked(true);
        }
        break;
      case R.id.checkTV4:
        if (checkTV4.isChecked()) {
          checkTV4.setChecked(false);
        } else {
          checkTV4.setChecked(true);
        }
        break;
      case R.id.checkTV5:
        if (checkTV5.isChecked()) {
          checkTV5.setChecked(false);
        } else {
          checkTV5.setChecked(true);
        }
        break;
      case R.id.checkTV6:
        if (checkTV6.isChecked()) {
          checkTV6.setChecked(false);
        } else {
          checkTV6.setChecked(true);
        }
        break;
      case R.id.checkTV7:
        if (checkTV7.isChecked()) {
          checkTV7.setChecked(false);
        } else {
          checkTV7.setChecked(true);
        }
        break;
      case R.id.checkTV_all:
        if (checkTVAll.isChecked()) {
          checkTV1.setChecked(false);
          checkTV2.setChecked(false);
          checkTV3.setChecked(false);
          checkTV4.setChecked(false);
          checkTV5.setChecked(false);
          checkTV6.setChecked(false);
          checkTV7.setChecked(false);
          checkTVAll.setChecked(false);
        } else {
          checkTV1.setChecked(true);
          checkTV2.setChecked(true);
          checkTV3.setChecked(true);
          checkTV4.setChecked(true);
          checkTV5.setChecked(true);
          checkTV6.setChecked(true);
          checkTV7.setChecked(true);
          checkTVAll.setChecked(true);
        }
        break;

      case R.id.checkTV_one_1:
        if (checkTVOne1.isChecked()) {
          checkTVOne1.setChecked(false);
        } else {
          checkTVOne1.setChecked(true);
        }
        break;
      case R.id.checkTV_one_2:
        if (checkTVOne2.isChecked()) {
          checkTVOne2.setChecked(false);
        } else {
          checkTVOne2.setChecked(true);
        }
        break;
      case R.id.checkTV_one_3:
        if (checkTVOne3.isChecked()) {
          checkTVOne3.setChecked(false);
        } else {
          checkTVOne3.setChecked(true);
        }
        break;
      case R.id.checkTV_one_4:
        if (checkTVOne4.isChecked()) {
          checkTVOne4.setChecked(false);
        } else {
          checkTVOne4.setChecked(true);
        }
        break;
      case R.id.checkTV_one_5:
        if (checkTVOne5.isChecked()) {
          checkTVOne5.setChecked(false);
        } else {
          checkTVOne5.setChecked(true);
        }
        break;
      case R.id.checkTV_one_6:
        if (checkTVOne6.isChecked()) {
          checkTVOne6.setChecked(false);
        } else {
          checkTVOne6.setChecked(true);
        }
        break;
      case R.id.checkTV_one_7:
        if (checkTVOne7.isChecked()) {
          checkTVOne7.setChecked(false);
        } else {
          checkTVOne7.setChecked(true);
        }
        break;
      case R.id.checkTV_one_all:
        if (checkTVOneAll.isChecked()) {
          checkTVOne1.setChecked(false);
          checkTVOne2.setChecked(false);
          checkTVOne3.setChecked(false);
          checkTVOne4.setChecked(false);
          checkTVOne5.setChecked(false);
          checkTVOne6.setChecked(false);
          checkTVOne7.setChecked(false);
          checkTVOneAll.setChecked(false);
        } else {
          checkTVOne1.setChecked(true);
          checkTVOne2.setChecked(true);
          checkTVOne3.setChecked(true);
          checkTVOne4.setChecked(true);
          checkTVOne5.setChecked(true);
          checkTVOne6.setChecked(true);
          checkTVOne7.setChecked(true);
          checkTVOneAll.setChecked(true);
        }
        break;

      case R.id.startTimeTV:
        showTimeDialog(startTimeTV.getText().toString(), (TextView) view);
        break;
      case R.id.endTimeTV:
        showTimeDialog(endTimeTV.getText().toString(), (TextView) view);
        break;
      case R.id.startTimeTV2:
        showTimeDialog(startTimeTV1.getText().toString(), (TextView) view);
        break;
      case R.id.endTimeTV2:
        showTimeDialog(endTimeTV1.getText().toString(), (TextView) view);
        break;
    }
  }
  private void parser(XmlParser xmlParser, XmlPullParser xrp, String name, boolean start) {
    if (name == null) {
      return;
    }

    if (name.equals("PropertySearch")) {
      if (start) {
        bean = new GeologyBean();
      }
    }
    if (name.equals("GeoObject")) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 2) {
          mylog.e(TAG, "attribute count error below 2 " + count);
        }
        try {
          String id = xrp.getAttributeValue(0);
          if (id.equals("11")) {
            System.out.println("11");
          }
          String attName = xrp.getAttributeValue(1);
          if (bean != null) {
            geoobj = bean.createOneGeoObj(id, attName);
          } else {
            mylog.e(TAG, "W : bean is null ");
          }
        } catch (Exception e) {
          mylog.e(TAG, "E : " + e);
          e.printStackTrace();
        }
      }
    }
    if (name.equals("GeoCondition")) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 3) {
          mylog.e(TAG, "attribute count error below 3 " + count);
        }

        try {
          String id = xrp.getAttributeValue(0);
          String attName = xrp.getAttributeValue(1);
          String state = xrp.getAttributeValue(2);
          if (geoobj != null) {
            condition = geoobj.createOneConditionObj(id, attName, state);
          } else {
            mylog.e(TAG, "W : geoobj is null ");
          }
        } catch (Exception e) {
          mylog.e(TAG, "E : " + e);
          e.printStackTrace();
        }
      }
    }
    if (isValue(name)) {
      if (start) {
        try {
          int count = xrp.getAttributeCount();
          if (count < 2) {
            mylog.e(
                TAG, "attribute count error below 2 " + count + xmlParser.debugAttributeValue(xrp));
          }
          String id = xrp.getAttributeValue(0);
          String attName = xrp.getAttributeValue(1);
          if (condition != null) {
            mValues = condition.createOneVaueObj(id, attName);
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      } else {
        mValues = null;
      }
    }

    if (isFvalue(name)) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 2) {
          mylog.e(TAG, "attribute count error below 2 " + count);
        }
        String id = xrp.getAttributeValue(0);
        String attName = xrp.getAttributeValue(1);
        if (mValues != null) {
          mFvalue = mValues.createFValue(id, attName);
        } else if (condition != null) {
          slog.p(TAG, "mValues is null , use condition " + condition.name + " " + attName);
          mFvalue = condition.createFVaueObj(id, attName);
        }
      }
    }

    if (isSvalue(name)) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 2) {
          mylog.e(TAG, "attribute count error below 2 " + count);
        }
        String id = xrp.getAttributeValue(0);
        String attName = xrp.getAttributeValue(1);

        if (mFvalue != null) {
          svalue = mFvalue.createSValue(id, attName);
        }
      } else {
        svalue = null;
      }
    }
    if (isTvalue(name)) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 2) {
          mylog.e(TAG, "attribute count error below 2 " + count);
        }
        String id = xrp.getAttributeValue(0);
        String attName = xrp.getAttributeValue(1);

        if (svalue != null) {
          svalue.createSValue(id, attName);
        } else {
          mylog.e(TAG, "error svalue is null " + name);
        }
      }
    }
  }
 @Override
 public void onGetResult(DocAbstractRequest request) {
   DocGlobalVars.getInstance().dismissProgressDialog();
   if (request instanceof DocSignForMessageCenterRequest) {
     DocMessageBean msg = ((DocSignForMessageCenterRequest) request).msg;
     String docId = msg.getDocID();
     String decrptResult = request.getDecryptedResult();
     if (DocStringUtils.isEmpty(decrptResult)) {
       return;
     }
     String replaceResult = decrptResult.replace("\n\\MobileOA", "");
     replaceResult = replaceResult.replace("\\MobileOA", "");
     replaceResult = DocProjectUtil.replacePoint(replaceResult);
     if (replaceResult.equals("NoData")) {
       // DocAndroidUtils.Alert(getActivity(), "温馨提示", "未查到任何数据",
       // "确定");
     } else if (replaceResult.equals("Failed")) {
       // DocAndroidUtils.Alert(getActivity(), "温馨提示", "查询失败", "确定");
     } else {
       String[] docs = replaceResult.split("\n");
       Log.d("", docs.toString());
       if (docs.length > 0) {
         if (mDocList != null) {
           mDocList.clear();
         } else {
           mDocList = new ArrayList<DocumentListItem>();
         }
         DocumentListItem document = null;
         String[] temparray = null;
         for (int i = 0; i < docs.length; i++) {
           try {
             document = new DocumentListItem();
             document.setIsNewDoc(false);
             temparray = docs[i].split("\t");
             if (temparray.length >= 5) {
               document.setDocumentId(temparray[0]);
               document.setLitmitTime(temparray[1]);
               document.setUrgencyLevel(temparray[2]);
               document.setDocumentTitle(DocProjectUtil.replacePoint(temparray[3]));
               document.setUniteSignType(temparray[4].replace("\r", ""));
               document.setUserId(temparray[5]);
               document.setUserName(temparray[6]);
               mDocList.add(document);
             }
           } catch (Exception e) {
             e.printStackTrace();
           }
         }
       }
     }
     redirect(msg);
   } else if (request instanceof DocConsultationFileListRequest) {
     String docId = ((DocConsultationFileListRequest) request).docId;
     List<DocConsultationFile> list = ((DocConsultationFileListRequest) request).consultationFiles;
     if (list == null) {
       Toast.makeText(getActivity(), "无此公文信息", Toast.LENGTH_SHORT).show();
       return;
     }
     DocConsultationFile cons = null;
     for (DocConsultationFile con : list) {
       if (docId.equals(con.getCniCommonPartId())) {
         cons = con;
         break;
       }
     }
     if (cons == null) {
       Toast.makeText(getActivity(), "无此公文信息", Toast.LENGTH_SHORT).show();
       return;
     } else {
       Intent intent = new Intent();
       intent.setClass(getActivity(), DocFeedbackActivity.class);
       intent.putExtra(DocConstants.KEY_CONSULTATION, cons);
       getActivity().startActivity(intent);
     }
   }
 }
Exemple #24
0
  private void slideToNextPage() {
    System.out.println("debug slide to next");
    try {
      if (preparingWindow == null && !prepareFail)
        preparingWindow =
            forward ? slidingWindows.getNextWindow() : slidingWindows.getPreviousWindow();
      else {
        if (previousDirection != forward) {
          if (previousDirection) {
            if (currentPageIndex == 0) {
              finishActivity();
              return;
            }
            preparingWindow = slidingWindows.getPreviousWindow();
            preparingWindow = slidingWindows.getPreviousWindow();
          } else {
            preparingWindow = slidingWindows.getNextWindow();
            preparingWindow = slidingWindows.getNextWindow();
          }
        }
        if (next.isLastPage()) {
          handler.post(
              new Runnable() {
                public void run() {
                  showAnimation();
                }
              });
          return;
        }
        boolean preparingWindowReady = preparingWindow.isLoaded();
        if (!preparingWindowReady) {
          preparingWindow.registerOnLoadListener(PageActivity.this);
          handler.post(
              new Runnable() {
                public void run() {
                  current.showLoading();
                }
              });
          return;
        }
      }
      final com.goal98.flipdroid.model.Window nextWindow = preparingWindow;
      preparingWindow = null;
      if (nextWindow.isLoading()) {
        // Log.d("SLIDING", "register on load listener...");

        handler.post(
            new Runnable() {
              public void run() {
                nextWindow.registerOnLoadListener(PageActivity.this);
                current.showLoading();
              }
            });
        return;
      } else if (nextWindow.isSkip()) {
        // Log.d("SLIDING", "slide to next page...");
        current.setLoadingNext(false);
        slideToNextPage();
        return;
      } else {
        if (next.isLastPage()) {
          //// System.out.println("lastpage");
        } else {
          if (forward) next = nextWindow.get();
          else previous = nextWindow.get();
        }

        handler.post(
            new Runnable() {
              public void run() {
                if (forward) next.removeLoadingIfNecessary();
                else {
                  if (previous == null) return;
                  previous.removeLoadingIfNecessary();
                }
                showAnimation();
              }
            });
      }
    } catch (Exception e) {
      e.printStackTrace();
      next = pageViewFactory.createLastPage();
      handler.post(
          new Runnable() {
            public void run() {
              showAnimation();
            }
          });
    }
  }
    protected Boolean doInBackground(ArrayList... params) {
      download_photos.this.runOnUiThread(
          new Runnable() {
            public void run() {
              mtext.setText(
                  getText(R.string.download_textview_message_1) + " " + path.toString() + ". ");
            }
          });

      if (resume_file.exists()) {
        initial_value = readProgress()[0];
      } else {
        initial_value = 1;
      }

      for (int i = initial_value - 1; i < links.size(); i++) {
        // asynctask expects more than one ArrayList<String> item, but we are sending only one,
        // which is params[0]
        Uri imageuri = Uri.parse(params[0].get(i).toString());
        URL imageurl = null;
        HttpURLConnection connection = null;
        total_files_to_download = links.size();
        completed_downloads = i + 1;
        try {
          imageurl = new URL(params[0].get(i).toString());
          connection = (HttpURLConnection) imageurl.openConnection();
          connection.connect();
        } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        // extracts the real file name of the photo from url
        path_segments = imageuri.getPathSegments();
        int total_segments = path_segments.size();
        file_name = path_segments.get(total_segments - 1);

        path.mkdirs();

        // if(i==0)
        //	first_image = path.toString() + "/" + file_name;

        InputStream input;
        OutputStream output;
        try {
          input = new BufferedInputStream(imageurl.openStream());
          fully_qualified_file_name = new File(path, file_name);
          output = new BufferedOutputStream(new FileOutputStream(fully_qualified_file_name));
          byte data[] = new byte[1024];
          int count;
          while ((count = input.read(data)) != -1) {
            output.write(data, 0, count);
          }
          output.flush();
          output.close();
          input.close();
          connection.disconnect();

          new folder_scanner(getApplicationContext(), fully_qualified_file_name);

          publishProgress(completed_downloads, total_files_to_download);
          if (this.isCancelled()) {
            writeProgress(completed_downloads, total_files_to_download);
            break;
          }

        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        // creates required folders and subfolders if they do not exist already
        // boolean success = path.mkdirs();

        // makes request to download photos
        // DownloadManager.Request request = new DownloadManager.Request(imageuri);

        // set path for downloads
        // request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES,sub_path);

        // request.setDescription("Downloaded using Facebook Album Downloader");

        // DownloadManager dm = (DownloadManager)getSystemService(DOWNLOAD_SERVICE);

        // download is enqueue in download list. it returns unique id for each download
        // download_id = dm.enqueue(request);

      }
      // returns the unique id. we are not using this id
      return true;
    }