Ejemplo n.º 1
0
  // obsługa przycisku zatwierdz
  public void sendSmsByManager() {
    try {

      smsModel.setPhone(phoneNumber.getText().toString());
      smsModel.setSms(smsBody.getText().toString() + " ");
      dateTextView.setText("");
      timeTextView.setText("");
      phoneNumber.setText("");
      smsBody.setText("");
      if (Patterns.PHONE.matcher(smsModel.getPhone()).matches()) {
        Message msg = Message.obtain(null, SMSService.SEND_SMS, 0, 0);
        Bundle bundle = new Bundle();
        bundle.putParcelable("sms", smsModel);
        msg.setData(bundle);
        try {
          messenger.send(msg);
        } catch (RemoteException e) {
          e.printStackTrace();
        }
      } else {
        Toast.makeText(getApplicationContext(), R.string.invalidPhone, Toast.LENGTH_LONG).show();
      }

    } catch (Exception ex) {
      Toast.makeText(getApplicationContext(), R.string.failedToSendSms, Toast.LENGTH_LONG).show();
      ex.printStackTrace();
    }
  }
Ejemplo n.º 2
0
 /**
  * 获取站内信
  *
  * @param string
  * @return
  */
 public static ArrayList<MessageModel> getMessageLists(String string) {
   ArrayList<MessageModel> models = new ArrayList<>();
   try {
     JSONObject object = new JSONObject(string);
     JSONObject result = object.getJSONObject("result");
     JSONObject data = result.getJSONObject("data");
     JSONArray data1 = data.getJSONArray("data");
     for (int i = 0; i < data1.length(); i++) {
       JSONObject object1 = data1.getJSONObject(i);
       MessageModel model = new MessageModel();
       model.setNotice_id(object1.getInt("notice_id"));
       model.setFrom_id(object1.getString("from_id"));
       model.setTo_id(object1.getString("to_id"));
       model.setType(object1.getString("type"));
       model.setTitle(object1.getString("title"));
       model.setContent(object1.getString("content"));
       model.setCreate_time(object1.getInt("create_time"));
       model.setStatus(object1.getString("status"));
       model.setUser_name(object1.getString("user_name"));
       models.add(model);
     }
   } catch (JSONException e) {
     e.printStackTrace();
   }
   return models;
 }
Ejemplo n.º 3
0
  @Override
  protected void readSingleChildElement(
      XMLStreamReader reader,
      ParsingInfo parsingInfo,
      RawRoot root,
      Map<String, Object> objectMap,
      MessageGroup object)
      throws XMLStreamException {

    if (s_dictRefReader.canRead(reader)) {
      MdmiDomainDictionaryReference ref =
          s_dictRefReader.readAndBuild(reader, parsingInfo, root, objectMap);
      ref.setMessageGroup(object);
      object.setDomainDictionary(ref);
    } else if (s_modelReader.canRead(reader)) {
      MessageModel model = s_modelReader.readAndBuild(reader, parsingInfo, root, objectMap);
      model.setGroup(object);
      object.addModel(model);
    } else if (s_dataRuleReader.canRead(reader)) {
      DataRule rule = s_dataRuleReader.readAndBuild(reader, parsingInfo, root, objectMap);
      rule.setScope(object);
      object.addDataRule(rule);
    } else if (s_extTypeReader.canRead(reader)) {
      DTExternal type = s_extTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_choiceTypeReader.canRead(reader)) {
      DTCChoice type = s_choiceTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_structTypeReader.canRead(reader)) {
      DTCStructured type = s_structTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_enumTypeReader.canRead(reader)) {
      DTSEnumerated type = s_enumTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_derivedTypeReader.canRead(reader)) {
      DTSDerived type = s_derivedTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_primTypeReader.canRead(reader)) {
      DTSPrimitive type = s_primTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
    }
  }
Ejemplo n.º 4
0
 @Override
 public void add(MessageModel messageModel) {
   List<MessageModel> messageModelList;
   List<MessageModel> allMessModelList = cache.get(messageKey);
   String prefixKey = messageModel.getStartGeohash().substring(0, prefixLength);
   messageModelList = cache.get(prefixKey);
   if (messageModelList == null) {
     messageModelList = new ArrayList<>();
     cache.put(prefixKey, messageModelList, true);
   }
   messageModelList.add(messageModel);
   if (allMessModelList == null) {
     allMessModelList = new ArrayList<>();
     cache.put(messageKey, allMessModelList, true);
   }
   allMessModelList.add(messageModel);
 }
Ejemplo n.º 5
0
  public Model handle(final MessageModel _model, final FlowController _controller)
      throws ModelHandlerException {
    Assert.notNull(_model, "Model is null");
    Assert.notNull(_controller, "Controller is null");

    try {
      Model result = new NotImplementedModel();

      switch (_model.getNextModel()) {
        case CHOOSE_MAIN_TASK:
          {
            result = new MainTasksModel();
            break;
          }
        case CHOOSE_WORKSPACE_TASK:
          {
            result = new ChooseWorkspaceTaskModel();
            break;
          }
        case LOADING_WORKSPACE:
          {
            result = new LoadingWorkspaceModel(_controller.getWorkspace());
            break;
          }
        case CHOOSE_FEEDERS_TASK:
          {
            result =
                new FeedersTasksModel(
                    _controller.getWorkspace(),
                    _controller.getGuiSettings().externalEditorAvailable());
            break;
          }
      }

      return result;
    } catch (Throwable t) {
      throw new ModelHandlerException(t);
    }
  }