List of usage examples for android.text Editable toString
public String toString();
From source file:org.thoughtcrime.securesms.PassphraseChangeActivity.java
private void verifyAndSavePassphrases() { Editable originalText = this.originalPassphrase.getText(); Editable newText = this.newPassphrase.getText(); Editable repeatText = this.repeatPassphrase.getText(); String original = (originalText == null ? "" : originalText.toString()); String passphrase = (newText == null ? "" : newText.toString()); String passphraseRepeat = (repeatText == null ? "" : repeatText.toString()); if (TextSecurePreferences.isPasswordDisabled(this)) { original = MasterSecretUtil.UNENCRYPTED_PASSPHRASE; }/*from w w w. jav a2s . co m*/ if (!passphrase.equals(passphraseRepeat)) { Toast.makeText(getApplicationContext(), R.string.PassphraseChangeActivity_passphrases_dont_match_exclamation, Toast.LENGTH_SHORT) .show(); this.newPassphrase.setText(""); this.repeatPassphrase.setText(""); } else if (passphrase.equals("")) { Toast.makeText(getApplicationContext(), R.string.PassphraseChangeActivity_enter_new_passphrase_exclamation, Toast.LENGTH_SHORT).show(); } else { Intent changePhrase = new Intent(this, ChangePassphraseService.class); changePhraseReceiver.disableOKButton(); String[] params = { original, passphrase }; changePhrase.putExtra("params", params); this.startService(changePhrase); } }
From source file:com.master.metehan.filtereagle.ActivityPro.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "Create"); Util.setTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.pro);//from w w w.j av a2 s . c o m getSupportActionBar().setTitle(R.string.title_pro); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); // Initial state updateState(); TextView tvLogTitle = (TextView) findViewById(R.id.tvLogTitle); TextView tvFilterTitle = (TextView) findViewById(R.id.tvFilterTitle); TextView tvNotifyTitle = (TextView) findViewById(R.id.tvNotifyTitle); TextView tvSpeedTitle = (TextView) findViewById(R.id.tvSpeedTitle); TextView tvThemeTitle = (TextView) findViewById(R.id.tvThemeTitle); TextView tvAllTitle = (TextView) findViewById(R.id.tvAllTitle); Linkify.TransformFilter filter = new Linkify.TransformFilter() { @Override public String transformUrl(Matcher match, String url) { return ""; } }; Linkify.addLinks(tvLogTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_LOG, null, filter); Linkify.addLinks(tvFilterTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_FILTER, null, filter); Linkify.addLinks(tvNotifyTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_NOTIFY, null, filter); Linkify.addLinks(tvSpeedTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_SPEED, null, filter); Linkify.addLinks(tvThemeTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_THEME, null, filter); Linkify.addLinks(tvAllTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_PRO1, null, filter); // Challenge TextView tvChallenge = (TextView) findViewById(R.id.tvChallenge); tvChallenge.setText(Build.SERIAL); // Response try { final String response = Util.md5(Build.SERIAL, "FilterEagle"); EditText etResponse = (EditText) findViewById(R.id.etResponse); etResponse.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // Do nothing } @Override public void afterTextChanged(Editable editable) { if (response.equals(editable.toString().toUpperCase())) { IAB.setBought(SKU_DONATION, ActivityPro.this); updateState(); } } }); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } try { iab = new IAB(new IAB.Delegate() { @Override public void onReady(final IAB iab) { Log.i(TAG, "IAB ready"); try { iab.updatePurchases(); updateState(); final Button btnLog = (Button) findViewById(R.id.btnLog); final Button btnFilter = (Button) findViewById(R.id.btnFilter); final Button btnNotify = (Button) findViewById(R.id.btnNotify); final Button btnSpeed = (Button) findViewById(R.id.btnSpeed); final Button btnTheme = (Button) findViewById(R.id.btnTheme); final Button btnAll = (Button) findViewById(R.id.btnAll); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { try { PendingIntent pi = null; if (view == btnLog) pi = iab.getBuyIntent(SKU_LOG); else if (view == btnFilter) pi = iab.getBuyIntent(SKU_FILTER); else if (view == btnNotify) pi = iab.getBuyIntent(SKU_NOTIFY); else if (view == btnSpeed) pi = iab.getBuyIntent(SKU_SPEED); else if (view == btnTheme) pi = iab.getBuyIntent(SKU_THEME); else if (view == btnAll) pi = iab.getBuyIntent(SKU_PRO1); if (pi != null) startIntentSenderForResult(pi.getIntentSender(), view.getId(), new Intent(), 0, 0, 0); } catch (Throwable ex) { Log.i(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); Util.sendCrashReport(ex, ActivityPro.this); } } }; btnLog.setOnClickListener(listener); btnFilter.setOnClickListener(listener); btnNotify.setOnClickListener(listener); btnSpeed.setOnClickListener(listener); btnTheme.setOnClickListener(listener); btnAll.setOnClickListener(listener); btnLog.setEnabled(true); btnFilter.setEnabled(true); btnNotify.setEnabled(true); btnSpeed.setEnabled(true); btnTheme.setEnabled(true); btnAll.setEnabled(true); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }, this); iab.bind(); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } }
From source file:me.acristoffers.tracker.fragments.PackageListFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); final Activity activity = getActivity(); final View view = getView(); if (view == null || activity == null) { return;/*from w w w. j a v a 2s . co m*/ } PreferenceManager.setDefaultValues(activity, R.xml.preferences, false); AlarmReceiver.setAlarm(activity); recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView); if (recyclerView == null) { activity.finish(); System.exit(0); } final RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(activity); recyclerView.setLayoutManager(layoutManager); final PackageListAdapter recyclerViewAdapter = new PackageListAdapter(activity, (PackageListActivity) activity); recyclerView.setAdapter(recyclerViewAdapter); swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); if (swipeRefreshLayout == null) { activity.finish(); System.exit(0); } swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { if (updating == 0) { checkForUpdates(); } } }); final Button button = (Button) view.findViewById(R.id.addButton); if (button != null) { button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final View view = View.inflate(activity, R.layout.search_package, null); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.search_for_package); builder.setView(view); final EditText code = (EditText) view.findViewById(R.id.code); if (code != null) { code.addTextChangedListener(new TrackCodeFormattingTextWatcher(code)); } builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { final EditText code = (EditText) view.findViewById(R.id.code); final EditText name = (EditText) view.findViewById(R.id.name); Package p = null; if (code != null) { Editable editable = code.getText(); if (editable != null) { String s = editable.toString(); p = new Package(s, getActivity(), null); } } if (name != null && p != null) { final Editable editable = name.getText(); if (editable != null) { final String s = editable.toString(); p.setName(s); p.setActive(true); p.save(); checkForUpdates(); } } dialogInterface.dismiss(); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); final AlertDialog dialog = builder.create(); dialog.show(); } }); } }
From source file:eu.faircode.adblocker.ActivityPro.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "Create"); Util.setTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.pro);//w w w .jav a 2 s. c o m getSupportActionBar().setTitle(R.string.title_pro); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); // Initial state updateState(); TextView tvLogTitle = (TextView) findViewById(R.id.tvLogTitle); TextView tvFilterTitle = (TextView) findViewById(R.id.tvFilterTitle); TextView tvNotifyTitle = (TextView) findViewById(R.id.tvNotifyTitle); TextView tvSpeedTitle = (TextView) findViewById(R.id.tvSpeedTitle); TextView tvThemeTitle = (TextView) findViewById(R.id.tvThemeTitle); TextView tvAllTitle = (TextView) findViewById(R.id.tvAllTitle); Linkify.TransformFilter filter = new Linkify.TransformFilter() { @Override public String transformUrl(Matcher match, String url) { return ""; } }; Linkify.addLinks(tvLogTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_LOG, null, filter); Linkify.addLinks(tvFilterTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_FILTER, null, filter); Linkify.addLinks(tvNotifyTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_NOTIFY, null, filter); Linkify.addLinks(tvSpeedTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_SPEED, null, filter); Linkify.addLinks(tvThemeTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_THEME, null, filter); Linkify.addLinks(tvAllTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_PRO1, null, filter); // Challenge TextView tvChallenge = (TextView) findViewById(R.id.tvChallenge); tvChallenge.setText(Build.SERIAL); // Response try { final String response = Util.md5(Build.SERIAL, "NetGuard"); EditText etResponse = (EditText) findViewById(R.id.etResponse); etResponse.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // Do nothing } @Override public void afterTextChanged(Editable editable) { if (response.equals(editable.toString().toUpperCase())) { IAB.setBought(SKU_DONATION, ActivityPro.this); updateState(); } } }); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } try { iab = new IAB(new IAB.Delegate() { @Override public void onReady(final IAB iab) { Log.i(TAG, "IAB ready"); try { iab.updatePurchases(); updateState(); final Button btnLog = (Button) findViewById(R.id.btnLog); final Button btnFilter = (Button) findViewById(R.id.btnFilter); final Button btnNotify = (Button) findViewById(R.id.btnNotify); final Button btnSpeed = (Button) findViewById(R.id.btnSpeed); final Button btnTheme = (Button) findViewById(R.id.btnTheme); final Button btnAll = (Button) findViewById(R.id.btnAll); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { try { PendingIntent pi = null; if (view == btnLog) pi = iab.getBuyIntent(SKU_LOG); else if (view == btnFilter) pi = iab.getBuyIntent(SKU_FILTER); else if (view == btnNotify) pi = iab.getBuyIntent(SKU_NOTIFY); else if (view == btnSpeed) pi = iab.getBuyIntent(SKU_SPEED); else if (view == btnTheme) pi = iab.getBuyIntent(SKU_THEME); else if (view == btnAll) pi = iab.getBuyIntent(SKU_PRO1); if (pi != null) startIntentSenderForResult(pi.getIntentSender(), view.getId(), new Intent(), 0, 0, 0); } catch (Throwable ex) { Log.i(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); Util.sendCrashReport(ex, ActivityPro.this); } } }; btnLog.setOnClickListener(listener); btnFilter.setOnClickListener(listener); btnNotify.setOnClickListener(listener); btnSpeed.setOnClickListener(listener); btnTheme.setOnClickListener(listener); btnAll.setOnClickListener(listener); btnLog.setEnabled(true); btnFilter.setEnabled(true); btnNotify.setEnabled(true); btnSpeed.setEnabled(true); btnTheme.setEnabled(true); btnAll.setEnabled(true); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }, this); iab.bind(); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } }
From source file:com.zion.htf.ui.DonateActivity.java
@Override public void afterTextChanged(Editable s) { int previousAmount = this.amount; int value;/*from w ww . j av a 2 s.c o m*/ try { value = (int) (Float.valueOf(s.toString().replace(',', '.')) * 100); } catch (NumberFormatException e) { value = 0; } if (DonateActivity.MIN_DONATION > value) { this.amount = DonateActivity.MIN_DONATION; previousAmount = -1;// Forces controls update } else if (DonateActivity.MAX_DONATION < value) { this.amount = DonateActivity.MAX_DONATION; previousAmount = -1;// Forces controls update } else { this.amount = value; } int cursorPosition = this.amountEditText.getSelectionStart(); if (previousAmount != this.amount) this.updateControls(); if (cursorPosition < this.amountEditText.length()) this.amountEditText.setSelection(cursorPosition); }
From source file:com.apptentive.android.sdk.module.messagecenter.view.holder.MessageComposerHolder.java
public void bindView(final MessageCenterFragment fragment, final MessageCenterRecyclerViewAdapter adapter, final Composer composer) { title.setText(composer.title);//from w w w . j a v a2 s. c o m closeButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (!TextUtils.isEmpty(message.getText().toString().trim()) || !images.isEmpty()) { Bundle bundle = new Bundle(); bundle.putString("message", composer.closeBody); bundle.putString("positive", composer.closeDiscard); bundle.putString("negative", composer.closeCancel); ApptentiveAlertDialog.show(fragment, bundle, Constants.REQUEST_CODE_CLOSE_COMPOSING_CONFIRMATION); } else { if (adapter.getListener() != null) { adapter.getListener().onCancelComposing(); } } } }); sendButton.setContentDescription(composer.sendButton); sendButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (adapter.getListener() != null) { adapter.getListener().onFinishComposing(); } } }); message.setHint(composer.messageHint); message.removeTextChangedListener(textWatcher); textWatcher = new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (adapter.getListener() != null) { adapter.getListener().beforeComposingTextChanged(charSequence); } } @Override public void onTextChanged(CharSequence charSequence, int start, int before, int count) { if (adapter.getListener() != null) { adapter.getListener().onComposingTextChanged(charSequence); } } @Override public void afterTextChanged(Editable editable) { if (adapter.getListener() != null) { adapter.getListener().afterComposingTextChanged(editable.toString()); } Linkify.addLinks(editable, Linkify.WEB_URLS | Linkify.PHONE_NUMBERS | Linkify.EMAIL_ADDRESSES | Linkify.MAP_ADDRESSES); } }; message.addTextChangedListener(textWatcher); attachButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (adapter.getListener() != null) { adapter.getListener().onAttachImage(); } } }); attachments.setupUi(); attachments.setupLayoutListener(); attachments.setListener(new ApptentiveImageGridView.ImageItemClickedListener() { @Override public void onClick(int position, ImageItem image) { if (adapter.getListener() != null) { adapter.getListener().onClickAttachment(position, image); } } }); attachments.setAdapterIndicator(R.drawable.apptentive_ic_remove_attachment); attachments.setImageIndicatorCallback(fragment); //Initialize image attachments band with empty data clearImageAttachmentBand(); attachments.setVisibility(View.GONE); attachments.setData(new ArrayList<ImageItem>()); setAttachButtonState(); if (adapter.getListener() != null) { adapter.getListener().onComposingViewCreated(this, message, attachments); } }
From source file:com.grarak.kerneladiutor.fragments.tools.BuildpropFragment.java
@Override protected void init() { super.init(); addViewPagerFragment(mSearchFragment = SearchFragment.newInstance(mKeyText, mValueText, new TextWatcher() { @Override/* ww w . jav a 2s .co m*/ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable s) { mKeyText = s.toString(); reload(false); } }, new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { mValueText = s.toString(); reload(false); } })); if (mAddDialog != null) { mAddDialog.show(); } if (mItemOptionsDialog != null) { mItemOptionsDialog.show(); } if (mDeleteDialog != null) { mDeleteDialog.show(); } if (mKey != null) { modify(mKey, mValue); } }
From source file:com.taokeba.wizard.ui.CustomerInfoFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mStudentNumView.addTextChangedListener(new TextWatcher() { @Override/*from ww w . j ava 2 s. com*/ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(CustomerInfoPage.STUDENT_NUM_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mNamelView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(CustomerInfoPage.NAME_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mNickNameView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(CustomerInfoPage.NICK_NAME_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mQQView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(CustomerInfoPage.QQ_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mPasswordView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(CustomerInfoPage.PASSWORD_DATA_KAY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mPasswordAgainView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(CustomerInfoPage.PASSWORD_AGAIN_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); }
From source file:com.taokeba.fragment.RegistBasicFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mStudentNumView.addTextChangedListener(new TextWatcher() { @Override/*from w w w . j a v a 2s . com*/ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(RegistBasicPage.STUDENT_NUM_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mNamelView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(RegistBasicPage.NAME_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mNickNameView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(RegistBasicPage.NICK_NAME_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mQQView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(RegistBasicPage.QQ_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mPasswordView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(RegistBasicPage.PASSWORD_DATA_KAY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); mPasswordAgainView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(RegistBasicPage.PASSWORD_AGAIN_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); }
From source file:org.thoughtcrime.securesms.PassphrasePromptActivity.java
private void handlePassphrase() { try {/*from w w w .j av a 2s .c o m*/ Editable text = passphraseText.getText(); String passphrase = (text == null ? "" : text.toString()); MasterSecret masterSecret = MasterSecretUtil.getMasterSecret(this, passphrase); setMasterSecret(masterSecret); } catch (InvalidPassphraseException ipe) { passphraseText.setText(""); passphraseText.setError(getString(R.string.PassphrasePromptActivity_invalid_passphrase_exclamation)); } }