List of usage examples for android.text.util Linkify addLinks
public static final boolean addLinks(@NonNull Spannable spannable, @NonNull Pattern pattern, @Nullable String scheme, @Nullable MatchFilter matchFilter, @Nullable TransformFilter transformFilter)
From source file:Main.java
public static void formatHtmlString(String string, TextView textView) { textView.setText(Html.fromHtml(string)); Linkify.addLinks(textView, Pattern.compile(FILICK_URL_EXPRESSION), "http://", new MatchFilter() { //$NON-NLS-1$ @Override//from www.j a va2s. co m public boolean acceptMatch(CharSequence s, int start, int end) { return true; } }, new TransformFilter() { @Override public String transformUrl(Matcher matcher, String data) { if (data.length() > 2) { return data.substring(1, data.length() - 1); } return data; } }); }
From source file:info.icefilms.icestream.HelpFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { // Call the base class method super.onActivityCreated(savedInstanceState); // Get the contact and about views TextView support = (TextView) getActivity().findViewById(R.id.support); TextView about = (TextView) getActivity().findViewById(R.id.about); // Linkify the support view Linkify.addLinks(support, Pattern.compile("(Ice Stream Support Thread)"), "", null, new TransformFilter() { public String transformUrl(Matcher match, String url) { // Return the proper link return "http://forum.icefilms.info/viewtopic.php?t=58350"; }//from w ww . j a v a 2 s . c om }); // Get the version information String version; try { version = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), PackageManager.GET_META_DATA).versionName; } catch (PackageManager.NameNotFoundException exception) { version = "?.?.?"; } // Format the about text with the correct info and add it to the view about.setText(String.format(getString(R.string.help_about), getString(R.string.app_name), version)); // Linkify the about view Linkify.addLinks(about, Linkify.WEB_URLS); }
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 .java 2s.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.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 .jav a2 s .com 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:eu.faircode.netguard.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 .ja v a 2 s. c om*/ getSupportActionBar().setTitle(R.string.title_pro); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); // Initial state updateState(); TextView tvLogTitle = findViewById(R.id.tvLogTitle); TextView tvFilterTitle = findViewById(R.id.tvFilterTitle); TextView tvNotifyTitle = findViewById(R.id.tvNotifyTitle); TextView tvSpeedTitle = findViewById(R.id.tvSpeedTitle); TextView tvThemeTitle = findViewById(R.id.tvThemeTitle); TextView tvAllTitle = findViewById(R.id.tvAllTitle); TextView tvDev1Title = findViewById(R.id.tvDev1Title); TextView tvDev2Title = findViewById(R.id.tvDev2Title); 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); Linkify.addLinks(tvDev1Title, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_SUPPORT1, null, filter); Linkify.addLinks(tvDev2Title, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_SUPPORT2, null, filter); String android_id = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); String challenge = (Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? Build.SERIAL : "O3" + android_id); String seed = (Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? "NetGuard2" : "NetGuard3"); // Challenge TextView tvChallenge = findViewById(R.id.tvChallenge); tvChallenge.setText(challenge); // Response try { final String response = Util.md5(challenge, seed); EditText etResponse = 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 = findViewById(R.id.btnLog); final Button btnFilter = findViewById(R.id.btnFilter); final Button btnNotify = findViewById(R.id.btnNotify); final Button btnSpeed = findViewById(R.id.btnSpeed); final Button btnTheme = findViewById(R.id.btnTheme); final Button btnAll = findViewById(R.id.btnAll); final Button btnDev1 = findViewById(R.id.btnDev1); final Button btnDev2 = findViewById(R.id.btnDev2); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { try { int id = 0; PendingIntent pi = null; if (view == btnLog) { id = SKU_LOG_ID; pi = iab.getBuyIntent(SKU_LOG, false); } else if (view == btnFilter) { id = SKU_FILTER_ID; pi = iab.getBuyIntent(SKU_FILTER, false); } else if (view == btnNotify) { id = SKU_NOTIFY_ID; pi = iab.getBuyIntent(SKU_NOTIFY, false); } else if (view == btnSpeed) { id = SKU_SPEED_ID; pi = iab.getBuyIntent(SKU_SPEED, false); } else if (view == btnTheme) { id = SKU_THEME_ID; pi = iab.getBuyIntent(SKU_THEME, false); } else if (view == btnAll) { id = SKU_PRO1_ID; pi = iab.getBuyIntent(SKU_PRO1, false); } else if (view == btnDev1) { id = SKU_SUPPORT1_ID; pi = iab.getBuyIntent(SKU_SUPPORT1, true); } else if (view == btnDev2) { id = SKU_SUPPORT2_ID; pi = iab.getBuyIntent(SKU_SUPPORT2, true); } if (id > 0 && pi != null) startIntentSenderForResult(pi.getIntentSender(), id, new Intent(), 0, 0, 0); } catch (Throwable ex) { Log.i(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; btnLog.setOnClickListener(listener); btnFilter.setOnClickListener(listener); btnNotify.setOnClickListener(listener); btnSpeed.setOnClickListener(listener); btnTheme.setOnClickListener(listener); btnAll.setOnClickListener(listener); btnDev1.setOnClickListener(listener); btnDev2.setOnClickListener(listener); btnLog.setEnabled(true); btnFilter.setEnabled(true); btnNotify.setEnabled(true); btnSpeed.setEnabled(true); btnTheme.setEnabled(true); btnAll.setEnabled(true); btnDev1.setEnabled(true); btnDev2.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.lendingtree.view.BaseActivity.java
public static void addLink(TextView textView, String patternToMatch, final String link) { Linkify.TransformFilter filter = new Linkify.TransformFilter() { @Override/*from www.ja va2s . c o m*/ public String transformUrl(Matcher match, String url) { return link; } }; Linkify.addLinks(textView, Pattern.compile(patternToMatch), null, null, filter); }
From source file:org.wso2.iot.agent.activities.AuthenticationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else {/*from w ww .j ava 2 s . c o m*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } setContentView(R.layout.activity_authentication); RelativeLayout relativeLayout = (RelativeLayout) this.findViewById(R.id.relavtiveLayoutAuthentication); if (Constants.DEFAULT_OWNERSHIP.equals(Constants.OWNERSHIP_COSU)) { relativeLayout.setVisibility(RelativeLayout.GONE); } deviceInfo = new DeviceInfo(context); etDomain = (EditText) findViewById(R.id.etDomain); etUsername = (EditText) findViewById(R.id.etUsername); etPassword = (EditText) findViewById(R.id.etPassword); etDomain.setFocusable(true); etDomain.requestFocus(); btnSignIn = (Button) findViewById(R.id.btnSignIn); btnSignIn.setOnClickListener(onClickAuthenticate); btnSignIn.setEnabled(false); // change button color background till user enters a valid input btnSignIn.setBackgroundResource(R.drawable.btn_grey); btnSignIn.setTextColor(ContextCompat.getColor(this, R.color.black)); TextView textViewSignIn = (TextView) findViewById(R.id.textViewSignIn); LinearLayout loginLayout = (LinearLayout) findViewById(R.id.loginLayout); if (Preference.hasPreferenceKey(context, Constants.TOKEN_EXPIRED)) { etDomain.setEnabled(false); etDomain.setTextColor(ContextCompat.getColor(this, R.color.black)); etUsername.setEnabled(false); etUsername.setTextColor(ContextCompat.getColor(this, R.color.black)); btnSignIn.setText(R.string.btn_sign_in); etPassword.setFocusable(true); etPassword.requestFocus(); String tenantedUserName = Preference.getString(context, Constants.USERNAME); int tenantSeparator = tenantedUserName.lastIndexOf('@'); etUsername.setText(tenantedUserName.substring(0, tenantSeparator)); etDomain.setText(tenantedUserName.substring(tenantSeparator + 1, tenantedUserName.length())); isReLogin = true; textViewSignIn.setText(R.string.msg_need_to_sign_in); } else if (Constants.CLOUD_MANAGER != null) { isCloudLogin = true; etDomain.setVisibility(View.GONE); textViewSignIn.setText(R.string.txt_sign_in_cloud); } if (Preference.getBoolean(context, Constants.PreferenceFlag.DEVICE_ACTIVE) && !isReLogin) { Intent intent = new Intent(AuthenticationActivity.this, AlreadyRegisteredActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); return; } TextView textViewSignUp = (TextView) findViewById(R.id.textViewSignUp); if (!isReLogin && Constants.SIGN_UP_URL != null) { Linkify.TransformFilter transformFilter = new Linkify.TransformFilter() { @Override public String transformUrl(Matcher match, String url) { return Constants.SIGN_UP_URL; } }; Pattern pattern = Pattern.compile(getResources().getString(R.string.txt_sign_up_linkify)); Linkify.addLinks(textViewSignUp, pattern, null, null, transformFilter); } else { textViewSignUp.setVisibility(View.GONE); } if (Constants.HIDE_LOGIN_UI) { loginLayout.setVisibility(View.GONE); } if (Constants.OWNERSHIP_COSU.equals(Constants.DEFAULT_OWNERSHIP)) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { startLockTask(); } } TextView textViewWipeData = (TextView) this.findViewById(R.id.textViewWipeData); if (Constants.OWNERSHIP_COSU.equals(Constants.DEFAULT_OWNERSHIP) && Constants.DISPLAY_WIPE_DEVICE_BUTTON) { textViewWipeData.setVisibility(View.VISIBLE); textViewWipeData.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { new AlertDialog.Builder(AuthenticationActivity.this).setTitle(getString(R.string.app_name)) .setMessage(R.string.wipe_confirmation) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { DevicePolicyManager devicePolicyManager = (DevicePolicyManager) getApplicationContext() .getSystemService(Context.DEVICE_POLICY_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { devicePolicyManager.wipeData(DevicePolicyManager.WIPE_EXTERNAL_STORAGE | DevicePolicyManager.WIPE_RESET_PROTECTION_DATA); } else { devicePolicyManager.wipeData(DevicePolicyManager.WIPE_EXTERNAL_STORAGE); } } }).setNegativeButton(android.R.string.no, null).show(); } }); } ImageView logo = (ImageView) findViewById(R.id.imageViewLogo); if (Constants.COSU_SECRET_EXIT) { logo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { kioskExit++; if (kioskExit == 6) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { stopLockTask(); } finish(); } } }); } etUsername.addTextChangedListener(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) { enableSubmitIfReady(); } @Override public void afterTextChanged(Editable s) { enableSubmitIfReady(); } }); etPassword.addTextChangedListener(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) { enableSubmitIfReady(); } @Override public void afterTextChanged(Editable s) { enableSubmitIfReady(); } }); if (org.wso2.iot.agent.proxy.utils.Constants.Authenticator.AUTHENTICATOR_IN_USE .equals(org.wso2.iot.agent.proxy.utils.Constants.Authenticator.MUTUAL_SSL_AUTHENTICATOR)) { AuthenticatorFactory authenticatorFactory = new AuthenticatorFactory(); ClientAuthenticator authenticator = authenticatorFactory.getClient( org.wso2.iot.agent.proxy.utils.Constants.Authenticator.AUTHENTICATOR_IN_USE, AuthenticationActivity.this, Constants.AUTHENTICATION_REQUEST_CODE); authenticator.doAuthenticate(); } //This is an override to ownership type. if (Constants.DEFAULT_OWNERSHIP != null) { deviceType = Constants.DEFAULT_OWNERSHIP; Preference.putString(context, Constants.DEVICE_TYPE, deviceType); } else { deviceType = Constants.OWNERSHIP_BYOD; } if (Constants.OWNERSHIP_COSU.equals(Constants.DEFAULT_OWNERSHIP)) { Intent intent = getIntent(); if (intent.hasExtra("android.app.extra.token")) { adminAccessToken = intent.getStringExtra("android.app.extra.token"); proceedToAuthentication(); } } // This is added so that in case due to an agent customisation, if the authentication // activity is called the AUTO_ENROLLMENT_BACKGROUND_SERVICE_ENABLED is set, the activity // must be finished. if (Constants.AUTO_ENROLLMENT_BACKGROUND_SERVICE_ENABLED) { finish(); } }
From source file:org.catnut.util.CatnutUtils.java
/** * ??##@//w ww . ja va2 s.c o m * * @param text ? * @param imageSpan ??null */ public static void vividTweet(TweetTextView text, TweetImageSpan imageSpan) { if (imageSpan != null) { text.setText(imageSpan.getImageSpan(text.getText())); } Linkify.addLinks(text, MENTION_PATTERN, MENTION_SCHEME, null, MENTION_FILTER); Linkify.addLinks(text, TOPIC_PATTERN, TOPIC_SCHEME, null, TOPIC_FILTER); Linkify.addLinks(text, WEB_URL, null, null, URL_FILTER); removeLinkUnderline(text); }