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);
 }
Ejemplo n.º 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;
  }
Ejemplo n.º 3
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 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);
 }
 @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);
 }
Ejemplo n.º 6
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);
  }