private void changeDownUnit() {
   if (downloadUnit == UnitType.KB) {
     downloadUnit = UnitType.MB;
   } else {
     downloadUnit = UnitType.KB;
   }
   tv_downloadUnit.setText(downloadUnit.getText());
 }
  private void changeUpUnit(boolean rise) {

    if (uploadUnit == UnitType.KB) {
      uploadUnit = UnitType.MB;
    } else {
      uploadUnit = UnitType.KB;
    }
    tv_uploadUnit.setText(uploadUnit.getText());
  }
 private void initLimit(ConnectDevice device) {
   qosRule = device.qosRule;
   if (qosRule == null) { // 没有设置流量限制
     qosRule = new QosRule();
     uploadState = false;
     downloadState = false;
   } else {
     if (qosRule.getUplinkSpeed() == null || qosRule.getUplinkSpeed().contains("-")) {
       uploadState = false;
       uploadText.setText("0");
     } else {
       uploadState = true;
       String uploadSeepText = MyUtils.formatNetRate(qosRule.getUplinkSpeed());
       if (uploadSeepText.endsWith("K")) {
         uploadUnit = UnitType.KB;
         uploadText.setText(uploadSeepText.substring(0, uploadSeepText.indexOf("K")).trim());
       } else {
         uploadUnit = UnitType.MB;
         uploadText.setText(uploadSeepText.substring(0, uploadSeepText.indexOf("M")).trim());
       }
       tv_uploadUnit.setText(uploadUnit.getText());
     }
     if (StringUtil.isNullOrEmpty(qosRule.getDownlinkSpeed())
         || qosRule.getDownlinkSpeed().contains("-")) {
       downloadText.setText("0");
       downloadState = false;
     } else {
       downloadState = true;
       String downloadSeepText = MyUtils.formatNetRate(qosRule.getDownlinkSpeed());
       if (downloadSeepText.endsWith("K")) {
         downloadUnit = UnitType.KB;
         downloadText.setText(downloadSeepText.substring(0, downloadSeepText.indexOf("K")).trim());
       } else {
         downloadUnit = UnitType.MB;
         downloadText.setText(downloadSeepText.substring(0, downloadSeepText.indexOf("M")).trim());
       }
       tv_downloadUnit.setText(downloadUnit.getText());
     }
   }
 }