private void sendMessage(final Activity activity) {
   SharedPreferences prefs =
       activity.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE);
   prefs
       .edit()
       .putBoolean(Constants.PREF_KEY_MESSAGE_CENTER_SHOULD_SHOW_INTRO_DIALOG, false)
       .commit();
   // Save the email.
   if (interaction.isAskForEmail()) {
     if (email != null && email.length() != 0) {
       PersonManager.storePersonEmail(activity, email.toString());
       Person person = PersonManager.storePersonAndReturnDiff(activity);
       if (person != null) {
         Log.d("Person was updated.");
         Log.v(person.toString());
         ApptentiveDatabase.getInstance(activity).addPayload(person);
       } else {
         Log.d("Person was not updated.");
       }
     }
   }
   // Send the message.
   final TextMessage textMessage = new TextMessage();
   textMessage.setBody(message.toString());
   textMessage.setRead(true);
   /*
   		// TODO: Figure out how to add custom data here.
   		textMessage.setCustomData(customData);
   		customData = null;
   */
   MessageManager.sendMessage(activity, textMessage);
 }
Пример #2
0
  public boolean checkWidgetEquivalence(View testee, String theType, String theName) {
    Log.i("nofatclips", "Retrieved from return list id=" + testee.getId());
    String testeeSimpleType = getSimpleType(testee);
    String testeeType = testee.getClass().getName();
    Log.i(
        "nofatclips",
        "Testing for type (" + testeeType + ") against the original (" + theType + ")");
    String testeeText =
        (testee instanceof TextView) ? (((TextView) testee).getText().toString()) : "";

    String testeeName = testeeText;
    if (testee instanceof EditText) {
      CharSequence hint = ((EditText) testee).getHint();
      testeeName = (hint == null) ? "" : hint.toString();
    }

    //		String testeeName = (testee instanceof
    // EditText)?(((EditText)testee).getHint().toString()):testeeText;
    Log.i(
        "nofatclips",
        "Testing for name (" + testeeName + ") against the original (" + theName + ")");
    if (((theType.equals(testeeType)) || (theType.equals(testeeSimpleType)))
        && (theName.equals(testeeName))) {
      return true;
    }
    return false;
  }
  private void validateForm(ApptentiveDialogButton sendButton) {
    boolean passedEmail = true;
    if (emailRequired) {
      passedEmail = !(email == null || email.length() == 0);
    }
    boolean passedMessage = !(message == null || message.length() == 0);

    sendButton.setEnabled(passedEmail && passedMessage);
  }
  private void validateForm(Button sendButton) {
    boolean passedEmail = true;
    if (interaction.isEmailRequired()) {
      passedEmail = !(email == null || email.length() == 0);
    }
    boolean passedMessage = !(message == null || message.length() == 0);

    sendButton.setEnabled(passedEmail && passedMessage);
  }
 @Override
 public void beforeTextChanged(CharSequence ss, int start, int count, int after) {
   charSequence = ss;
   Log.v(
       "TextWatcher-beforeTextChanged-->",
       " text="
           + ss.toString()
           + " length="
           + ss.length()
           + " start="
           + start
           + " count-"
           + count
           + " after="
           + after);
 }
Пример #6
0
  @Override
  public void onTextChanged(CharSequence s, int start, int before, int count) {
    if (cursor != null) {
      if (!cursor.isClosed()) {
        MyLogger.i(TAG, "onTextChanged cursor.isClosed(): " + cursor.isClosed());
        cursor.close();
      }
    }

    cursor = ApiAllFansInfoDb.getCursorBySearchKey(context, s.toString());
    adapter.changeCursor(cursor);
    MyLogger.i(TAG, "cursor.getCount(): " + cursor.getCount());
  }
 @Override
 public void onTextChanged(CharSequence s, int start, int before, int count) {
   String bankId = "";
   for (int i = 0; i < s.length(); i++) {
     if ((i + 1) % 4 == 0) {
       bankId += " ";
     }
     bankId += s.charAt(i);
   }
   bankcardnum.setText(bankId);
   Log.v(
       "TextWatcher-onTextChanged-->",
       " text="
           + s.toString()
           + " length="
           + s.length()
           + " start="
           + start
           + " before-"
           + before
           + " count="
           + count);
 }
        @Override
        public void afterTextChanged(Editable s) {
          Log.v("TextWatcher-afterTextChanged-->", s.toString() + "length" + s.length());
          // 输入的时候,只有一个光标,那么这两个值应该是相等的。。。
          editStart = et_user_ban.getSelectionStart();
          editEnd = et_user_ban.getSelectionEnd();

          // 限定EditText只能输入19个数字,并且达到19个的时候用红色显示
          if (charSequence.length() > 19) {
            Toast.makeText(AddBankCardActivity.this, "你输入的字数已经超过了限制,不能再输入!", Toast.LENGTH_SHORT)
                .show();
            // 默认光标在最前端,所以当输入第19个数字的时候,删掉(光标位置从11-1到11)的数字,这样就无法输入超过19个以后的数字
            s.delete(editStart - 1, editEnd);
            // 当输入超过第19个数字的时候,改变字体颜色为红色
          }
        }
Пример #9
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    if (((CheckedTextView) v).isChecked()) {

      CharSequence num = ((CheckedTextView) v).getText();
      getcontactsList.add(num.toString());
    }
    if (!((CheckedTextView) v).isChecked()) {
      CharSequence num = ((CheckedTextView) v).getText();
      if ((num.toString()).indexOf("[") > 0) {
        String phoneNum = num.toString().substring(0, (num.toString()).indexOf("\n"));
        getcontactsList.remove(phoneNum);
        Log.d("remove_num", "" + phoneNum);
      } else {
        getcontactsList.remove(num.toString());
        Log.d("remove_num", "" + num.toString());
      }
    }
    super.onListItemClick(l, v, position, id);
  }