Example usage for android.text.method HideReturnsTransformationMethod getInstance

List of usage examples for android.text.method HideReturnsTransformationMethod getInstance

Introduction

In this page you can find the example usage for android.text.method HideReturnsTransformationMethod getInstance.

Prototype

public static HideReturnsTransformationMethod getInstance() 

Source Link

Usage

From source file:com.android.mms.rcs.FavoriteDetailAdapter.java

private void initTextMsgView(final TextView bodyText) {
    bodyText.setText(//from  w ww .  ja  v a 2s  .  c  o  m
            mCursor.getString(mCursor.getColumnIndexOrThrow(FavoriteMessageProvider.FavoriteMessage.CONTENT)));
    bodyText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mBodyFontSize);
    bodyText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
    bodyText.setTextIsSelectable(true);
    bodyText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            MessageUtils.onMessageContentClick(mContext, bodyText);
        }
    });
}

From source file:nl.hnogames.domoticz.Welcome.WelcomePage3.java

private void getLayoutReferences() {

    remote_server_input = (FloatingLabelEditText) v.findViewById(R.id.remote_server_input);
    remote_port_input = (FloatingLabelEditText) v.findViewById(R.id.remote_port_input);
    remote_username_input = (FloatingLabelEditText) v.findViewById(R.id.remote_username_input);
    remote_password_input = (FloatingLabelEditText) v.findViewById(R.id.remote_password_input);
    remote_directory_input = (FloatingLabelEditText) v.findViewById(R.id.remote_directory_input);
    remote_protocol_spinner = (Spinner) v.findViewById(R.id.remote_protocol_spinner);
    local_server_input = (FloatingLabelEditText) v.findViewById(R.id.local_server_input);
    local_port_input = (FloatingLabelEditText) v.findViewById(R.id.local_port_input);
    local_username_input = (FloatingLabelEditText) v.findViewById(R.id.local_username_input);
    local_password_input = (FloatingLabelEditText) v.findViewById(R.id.local_password_input);
    local_directory_input = (FloatingLabelEditText) v.findViewById(R.id.local_directory_input);
    local_protocol_spinner = (Spinner) v.findViewById(R.id.local_protocol_spinner);
    local_wifi_spinner = (MultiSelectionSpinner) v.findViewById(R.id.local_wifi);
    cbShowPassword = (CheckBox) v.findViewById(R.id.showpassword);
    cbShowPasswordLocal = (CheckBox) v.findViewById(R.id.showpasswordlocal);

    startScreen_spinner = (Spinner) v.findViewById(R.id.startScreen_spinner);
    btnManualSSID = (Button) v.findViewById(R.id.set_ssid);
    btnManualSSID.setOnClickListener(new View.OnClickListener() {
        @Override//from  w w  w.  j av a2 s  . c  o m
        public void onClick(View v) {
            new MaterialDialog.Builder(getContext()).title(R.string.welcome_ssid_button_prompt)
                    .content(R.string.welcome_msg_no_ssid_found)
                    .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)
                    .input(null, null, new MaterialDialog.InputCallback() {
                        @Override
                        public void onInput(MaterialDialog dialog, CharSequence input) {
                            Set<String> ssidFromPrefs = mServerUtil.getActiveServer().getLocalServerSsid();
                            final ArrayList<String> ssidListFromPrefs = new ArrayList<>();
                            if (ssidFromPrefs != null) {
                                if (ssidFromPrefs.size() > 0) {
                                    for (String wifi : ssidFromPrefs) {
                                        ssidListFromPrefs.add(wifi);
                                    }
                                }
                            }
                            ssidListFromPrefs.add(String.valueOf(input));
                            mServerUtil.getActiveServer().setLocalServerSsid(ssidListFromPrefs);

                            setSsid_spinner();
                        }
                    }).show();
        }
    });

    if (callingInstance == SETTINGS) {
        // Hide these settings if being called by settings (instead of welcome wizard)
        startScreen_spinner.setVisibility(View.GONE);
        v.findViewById(R.id.startScreen_title).setVisibility(View.GONE);
        v.findViewById(R.id.server_settings_title).setVisibility(View.GONE);
    }

    final LinearLayout localServerSettingsLayout = (LinearLayout) v.findViewById(R.id.local_server_settings);
    localServer_switch = (Switch) v.findViewById(R.id.localServer_switch);
    localServer_switch.setChecked(mSharedPrefs.isAdvancedSettingsEnabled());

    localServer_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
            if (checked)
                localServerSettingsLayout.setVisibility(View.VISIBLE);
            else
                localServerSettingsLayout.setVisibility(View.GONE);
        }
    });

    final LinearLayout advancedSettings_layout = (LinearLayout) v.findViewById(R.id.advancedSettings_layout);

    advancedSettings_switch = (Switch) v.findViewById(R.id.advancedSettings_switch);
    advancedSettings_switch.setChecked(mSharedPrefs.isAdvancedSettingsEnabled());

    if (mSharedPrefs.isAdvancedSettingsEnabled())
        advancedSettings_layout.setVisibility(View.VISIBLE);

    advancedSettings_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mSharedPrefs.setAdvancedSettingsEnabled(isChecked);

            if (isChecked)
                advancedSettings_layout.setVisibility(View.VISIBLE);
            else
                advancedSettings_layout.setVisibility(View.GONE);
        }
    });

    cbShowPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (!isChecked) {
                remote_password_input.getInputWidget()
                        .setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                remote_password_input.getInputWidget()
                        .setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
        }
    });

    cbShowPasswordLocal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (!isChecked) {
                local_password_input.getInputWidget()
                        .setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                local_password_input.getInputWidget()
                        .setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
        }
    });
}

From source file:nl.hnogames.domoticz.Welcome.SetupServerSettings.java

private void getLayoutReferences() {
    useSameAddress = (Switch) v.findViewById(R.id.localServer_switch);
    saveButton = (Button) v.findViewById(R.id.save_server);
    server_name_input = (FloatingLabelEditText) v.findViewById(R.id.server_name_input);
    remote_server_input = (FloatingLabelEditText) v.findViewById(R.id.remote_server_input);
    remote_port_input = (FloatingLabelEditText) v.findViewById(R.id.remote_port_input);
    remote_username_input = (FloatingLabelEditText) v.findViewById(R.id.remote_username_input);
    remote_password_input = (FloatingLabelEditText) v.findViewById(R.id.remote_password_input);
    remote_directory_input = (FloatingLabelEditText) v.findViewById(R.id.remote_directory_input);
    remote_protocol_spinner = (Spinner) v.findViewById(R.id.remote_protocol_spinner);
    local_server_input = (FloatingLabelEditText) v.findViewById(R.id.local_server_input);
    local_port_input = (FloatingLabelEditText) v.findViewById(R.id.local_port_input);
    local_username_input = (FloatingLabelEditText) v.findViewById(R.id.local_username_input);
    local_password_input = (FloatingLabelEditText) v.findViewById(R.id.local_password_input);
    local_directory_input = (FloatingLabelEditText) v.findViewById(R.id.local_directory_input);
    local_protocol_spinner = (Spinner) v.findViewById(R.id.local_protocol_spinner);
    local_wifi_spinner = (MultiSelectionSpinner) v.findViewById(R.id.local_wifi);
    cbShowPassword = (CheckBox) v.findViewById(R.id.showpassword);
    cbShowPasswordLocal = (CheckBox) v.findViewById(R.id.showpasswordlocal);

    startScreen_spinner = (Spinner) v.findViewById(R.id.startScreen_spinner);

    btnManualSSID = (Button) v.findViewById(R.id.set_ssid);
    btnManualSSID.setOnClickListener(new View.OnClickListener() {
        @Override//w  w  w  .j  a v a2 s .co  m
        public void onClick(View v) {
            new MaterialDialog.Builder(getContext()).title(R.string.welcome_ssid_button_prompt)
                    .content(R.string.welcome_msg_no_ssid_found)
                    .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)
                    .input(null, null, new MaterialDialog.InputCallback() {
                        @Override
                        public void onInput(MaterialDialog dialog, CharSequence input) {
                            Set<String> ssidFromPrefs = mServerUtil.getActiveServer().getLocalServerSsid();
                            final ArrayList<String> ssidListFromPrefs = new ArrayList<>();
                            if (ssidFromPrefs != null) {
                                if (ssidFromPrefs.size() > 0) {
                                    for (String wifi : ssidFromPrefs) {
                                        ssidListFromPrefs.add(wifi);
                                    }
                                }
                            }
                            ssidListFromPrefs.add(String.valueOf(input));
                            mServerUtil.getActiveServer().setLocalServerSsid(ssidListFromPrefs);

                            setSsid_spinner();
                        }
                    }).show();
        }
    });

    startScreen_spinner.setVisibility(View.GONE);
    v.findViewById(R.id.startScreen_title).setVisibility(View.GONE);
    v.findViewById(R.id.server_settings_title).setVisibility(View.GONE);

    useSameAddress.setChecked(false);
    final LinearLayout localServerSettingsLayout = (LinearLayout) v.findViewById(R.id.local_server_settings);
    localServer_switch = (Switch) v.findViewById(R.id.localServer_switch);
    localServer_switch.setChecked(false);//default setting
    localServer_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
            if (checked)
                localServerSettingsLayout.setVisibility(View.VISIBLE);
            else
                localServerSettingsLayout.setVisibility(View.GONE);
        }
    });

    final LinearLayout advancedSettings_layout = (LinearLayout) v.findViewById(R.id.advancedSettings_layout);
    advancedSettings_switch = (Switch) v.findViewById(R.id.advancedSettings_switch);
    advancedSettings_layout.setVisibility(View.INVISIBLE);
    advancedSettings_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mSharedPrefs.setAdvancedSettingsEnabled(isChecked);

            if (isChecked)
                advancedSettings_layout.setVisibility(View.VISIBLE);
            else
                advancedSettings_layout.setVisibility(View.GONE);
        }
    });
    advancedSettings_layout.setVisibility(View.GONE);
    advancedSettings_switch.setChecked(false);
    cbShowPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (!isChecked) {
                remote_password_input.getInputWidget()
                        .setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                remote_password_input.getInputWidget()
                        .setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
        }
    });
    cbShowPasswordLocal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (!isChecked) {
                local_password_input.getInputWidget()
                        .setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                local_password_input.getInputWidget()
                        .setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
        }
    });

    saveButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            checkConnectionData();
        }
    });
}

From source file:org.nypl.simplified.app.MainSettingsAccountActivity.java

@Override
protected void onActivityResult(final int request_code, final int result_code, final Intent data) {
    if (request_code == 1) {
        // Challenge completed, proceed with using cipher
        final CheckBox in_pin_reveal = NullCheck.notNull(this.findViewById(R.id.settings_reveal_password));

        if (result_code == RESULT_OK) {
            final TextView in_pin_text = NullCheck.notNull(this.findViewById(R.id.settings_pin_text));
            in_pin_text.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            in_pin_reveal.setChecked(true);
        } else {// w w w .  j a  v a  2 s . c  om
            // The user canceled or didn't complete the lock screen
            // operation. Go to error/cancellation flow.
            in_pin_reveal.setChecked(false);
        }
    }
}

From source file:com.app.jdy.ui.RegirsterActivity.java

public void init() {
    mContext = this;
    mBackImg = (ImageView) findViewById(R.id.back_img);
    mBackImg.setVisibility(View.VISIBLE);
    title = (TextView) findViewById(R.id.title_tv);
    title.setText("");
    new_username = (EditText) findViewById(R.id.new_username);
    new_password = (EditText) findViewById(R.id.new_password);
    regirster_code = (EditText) findViewById(R.id.regirster_code);

    pwdEye = (ImageView) findViewById(R.id.regist_eye);
    pwdEye.setOnClickListener(new OnClickListener() {

        @Override//w  w  w. j  a v  a2  s  .co m
        public void onClick(View v) {
            if (pwdShow) {
                new_password.setTransformationMethod(PasswordTransformationMethod.getInstance());
                pwdEye.setImageResource(R.drawable.register_eye_false);
            } else {
                new_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                pwdEye.setImageResource(R.drawable.register_eye);
            }
            pwdShow = !pwdShow;
        }
    });

    // new_password_message = (TextView)
    // findViewById(R.id.new_password_message);
    // new_repassword_message = (TextView)
    // findViewById(R.id.new_repassword_message);
    // regirster_code_message = (TextView)
    // findViewById(R.id.regirster_code_message);

    // back_login = (TextView) findViewById(R.id.back_login);
    get_regirster_code = (Button) findViewById(R.id.get_regirster_code);
    get_regirster_code.setBackgroundResource(R.drawable.regirster_code_false);
    get_regirster_code.setTextColor(getResources().getColor(R.color.text_hint));

    sumbit_regirster = (Button) findViewById(R.id.sumbit_regirster);

}

From source file:com.android.mms.ui.MessageListItem.java

private void bindCommonMessage(final boolean sameItem) {
    if (mDownloadButton != null) {
        mDownloadButton.setVisibility(View.GONE);
        mDownloading.setVisibility(View.GONE);
    }//from ww  w.jav  a  2 s  . c  o m

    // Since the message text should be concatenated with the sender's
    // address(or name), I have to display it here instead of
    // displaying it by the Presenter.
    mBodyTextView.setTransformationMethod(HideReturnsTransformationMethod.getInstance());

    boolean haveLoadedPdu = mMessageItem.isSms() || mMessageItem.mSlideshow != null;
    // Here we're avoiding reseting the avatar to the empty avatar when we're rebinding
    // to the same item. This happens when there's a DB change which causes the message item
    // cache in the MessageListAdapter to get cleared. When an mms MessageItem is newly
    // created, it has no info in it except the message id. The info is eventually loaded
    // and bindCommonMessage is called again (see onPduLoaded below). When we haven't loaded
    // the pdu, we don't want to call updateAvatarView because it
    // will set the avatar to the generic avatar then when this method is called again
    // from onPduLoaded, it will reset to the real avatar. This test is to avoid that flash.
    if (!sameItem || haveLoadedPdu) {
        boolean isSelf = Sms.isOutgoingFolder(mMessageItem.mBoxId);
        String addr = isSelf ? null : mMessageItem.mAddress;
        updateAvatarView(addr, isSelf);
    }

    // Add SIM sms address above body.
    if (isSimCardMessage()) {
        mSimMessageAddress.setVisibility(VISIBLE);
        SpannableStringBuilder buf = new SpannableStringBuilder();
        if (mMessageItem.mBoxId == Sms.MESSAGE_TYPE_INBOX) {
            buf.append(mContext.getString(R.string.from_label));
        } else {
            buf.append(mContext.getString(R.string.to_address_label));
        }
        buf.append(Contact.get(mMessageItem.mAddress, true).getName());
        mSimMessageAddress.setText(buf);
    }

    // Get and/or lazily set the formatted message from/on the
    // MessageItem.  Because the MessageItem instances come from a
    // cache (currently of size ~50), the hit rate on avoiding the
    // expensive formatMessage() call is very high.
    CharSequence formattedMessage = mMessageItem.getCachedFormattedMessage();
    if (formattedMessage == null) {
        formattedMessage = formatMessage(mMessageItem, mMessageItem.mBody, mMessageItem.mSubject,
                mMessageItem.mHighlight, mMessageItem.mTextContentType);
        mMessageItem.setCachedFormattedMessage(formattedMessage);
    }
    if (!sameItem || haveLoadedPdu) {
        mBodyTextView.setText(formattedMessage);
    }
    updateSimIndicatorView(mMessageItem.mSubId);
    // Debugging code to put the URI of the image attachment in the body of the list item.
    if (DEBUG) {
        String debugText = null;
        if (mMessageItem.mSlideshow == null) {
            debugText = "NULL slideshow";
        } else {
            SlideModel slide = ((SlideshowModel) mMessageItem.mSlideshow).get(0);
            if (slide == null) {
                debugText = "NULL first slide";
            } else if (!slide.hasImage()) {
                debugText = "Not an image";
            } else {
                debugText = slide.getImage().getUri().toString();
            }
        }
        mBodyTextView.setText(mPosition + ": " + debugText);
    }

    // If we're in the process of sending a message (i.e. pending), then we show a "SENDING..."
    // string in place of the timestamp.
    if (!sameItem || haveLoadedPdu) {
        boolean isCountingDown = mMessageItem.getCountDown() > 0
                && MessagingPreferenceActivity.getMessageSendDelayDuration(mContext) > 0;
        int sendingTextResId = isCountingDown ? R.string.sent_countdown : R.string.sending_message;
        mDateView.setText(buildTimestampLine(
                mMessageItem.isSending() ? mContext.getResources().getString(sendingTextResId)
                        : mMessageItem.mTimestamp));
    }
    if (mMessageItem.isSms()) {
        showMmsView(false);
        mMessageItem.setOnPduLoaded(null);
    } else {
        if (DEBUG) {
            Log.v(TAG,
                    "bindCommonMessage for item: " + mPosition + " " + mMessageItem.toString()
                            + " mMessageItem.mAttachmentType: " + mMessageItem.mAttachmentType + " sameItem: "
                            + sameItem);
        }
        if (mMessageItem.mAttachmentType != WorkingMessage.TEXT) {
            if (!sameItem) {
                setImage(null, null);
            }
            setOnClickListener(mMessageItem);
            drawPlaybackButton(mMessageItem);
        } else {
            showMmsView(false);
        }
        if (mMessageItem.mSlideshow == null) {
            final int mCurrentAttachmentType = mMessageItem.mAttachmentType;
            mMessageItem.setOnPduLoaded(new MessageItem.PduLoadedCallback() {
                public void onPduLoaded(MessageItem messageItem) {
                    if (DEBUG) {
                        Log.v(TAG,
                                "PduLoadedCallback in MessageListItem for item: " + mPosition + " "
                                        + (mMessageItem == null ? "NULL" : mMessageItem.toString())
                                        + " passed in item: "
                                        + (messageItem == null ? "NULL" : messageItem.toString()));
                    }
                    if (messageItem != null && mMessageItem != null
                            && messageItem.getMessageId() == mMessageItem.getMessageId()) {
                        mMessageItem.setCachedFormattedMessage(null);
                        bindCommonMessage(mCurrentAttachmentType == messageItem.mAttachmentType);
                    }
                }
            });
        } else {
            if (mPresenter == null) {
                mPresenter = PresenterFactory.getPresenter("MmsThumbnailPresenter", mContext, this,
                        mMessageItem.mSlideshow);
            } else {
                mPresenter.setModel(mMessageItem.mSlideshow);
                mPresenter.setView(this);
            }
            if (mImageLoadedCallback == null) {
                mImageLoadedCallback = new ImageLoadedCallback(this);
            } else {
                mImageLoadedCallback.reset(this);
            }
            mPresenter.present(mImageLoadedCallback);
        }
    }
    drawRightStatusIndicator(mMessageItem);
    requestLayout();
}