Example #1
0
  public void setTransport(TransportOption transport) {
    final String enterKeyType = SMSSecurePreferences.getEnterKeyType(getContext());

    int imeOptions = (getImeOptions() & ~EditorInfo.IME_MASK_ACTION) | EditorInfo.IME_ACTION_SEND;
    int inputType = getInputType();

    if (isLandscape()) setImeActionLabel(transport.getComposeHint(), EditorInfo.IME_ACTION_SEND);
    else setImeActionLabel(null, 0);

    inputType =
        !isLandscape() && enterKeyType.equals("send")
            ? inputType & ~InputType.TYPE_TEXT_FLAG_MULTI_LINE
            : inputType | InputType.TYPE_TEXT_FLAG_MULTI_LINE;

    inputType =
        enterKeyType.equals("emoji")
            ? inputType | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE
            : inputType & ~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;

    imeOptions =
        enterKeyType.equals("send")
            ? imeOptions & ~EditorInfo.IME_FLAG_NO_ENTER_ACTION
            : imeOptions | EditorInfo.IME_FLAG_NO_ENTER_ACTION;

    setInputType(inputType);
    setImeOptions(imeOptions);
    setHint(transport.getComposeHint());
  }
Example #2
0
 @Override
 public void onChange(TransportOption newTransport) {
   setImageResource(newTransport.getDrawable());
   setContentDescription(newTransport.getDescription());
 }
Example #3
0
 @Override
 public void onSelected(TransportOption option) {
   transportOptions.setSelectedTransport(option.getType());
   getTransportOptionsPopup().dismiss();
 }