List of usage examples for android.text.method LinkMovementMethod getInstance
public static MovementMethod getInstance()
From source file:com.silentcircle.accounts.AccountStep3.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View stepView = inflater.inflate(R.layout.provisioning_bp_s3, container, false); if (stepView == null) return null; mTcCheckbox = (CheckBox) stepView.findViewById(R.id.CheckBoxTC); mProgress = (ProgressBar) stepView.findViewById(R.id.ProgressBar); mProgressInner = stepView.findViewById(R.id.ProvisioningInProgress); mScroll = (ScrollView) stepView.findViewById(R.id.Scroll); mButtons = (LinearLayout) stepView.findViewById(R.id.ProvisioningButtons); mAuthToken = (TextView) stepView.findViewById(R.id.ProvisioningAuthTokenInput); mAuthToken.setHint(getString(R.string.provisioning_auth_token_hint)); ((TextView) stepView.findViewById(R.id.CheckBoxTCText)).setMovementMethod(LinkMovementMethod.getInstance()); stepView.findViewById(R.id.back).setOnClickListener(this); stepView.findViewById(R.id.create).setOnClickListener(this); TextView headerText = (TextView) stepView.findViewById(R.id.HeaderText); stepView.setBackgroundColor(ContextCompat.getColor(mParent, R.color.auth_background_grey)); if (mUseExistingAccount) { headerText.setText(getString(R.string.sign_in)); ((TextView) stepView.findViewById(R.id.create)).setText(getText(R.string.next)); startLoadingRegisterDevice();/*from w w w . j a va2 s . co m*/ } else { startLoadingCreateAccount(); } mAuthToken.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) { } @Override public void afterTextChanged(Editable s) { // Only enable the button if the token is 6 digits long. View mButton = mButtons.findViewById(R.id.create); Boolean bEnable = s.toString().length() == 6; mButton.setEnabled(bEnable); if (bEnable) mButton.setAlpha((float) 1); else mButton.setAlpha((float) 0.5); } }); return stepView; }
From source file:ngoc.com.pedometer.ui.Fragment_Overview.java
private void showAboutDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.about);/*from w ww .j av a2s . com*/ TextView tv = new TextView(getActivity()); tv.setPadding(10, 10, 10, 10); tv.setText(R.string.about_text_links); try { tv.append(getString(R.string.about_app_version, getActivity().getPackageManager() .getPackageInfo(getActivity().getPackageName(), 0).versionName)); } catch (PackageManager.NameNotFoundException e1) { // should not happen as the app is definitely installed when // seeing the dialog e1.printStackTrace(); } tv.setMovementMethod(LinkMovementMethod.getInstance()); builder.setView(tv); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); }
From source file:me.trashout.fragment.LoginFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_login, container, false); ButterKnife.bind(this, view); user = PreferencesHandler.getUserData(getContext()); auth = FirebaseAuth.getInstance();// w ww.j ava 2 s . c o m // Set the ViewPager adapter LoginOrSignUpPagerAdapter adapter = new LoginOrSignUpPagerAdapter(); pager.setAdapter(adapter); tabs.setupWithViewPager(pager); if (preSelectedTab == R.id.page_sign_up) { pager.setCurrentItem(1); preSelectedTab = -1; } signUpAccpetUserDataCollectionTextView .setText(Html.fromHtml(getString(R.string.global_signUp_acceptRegister_startSentense) + " <a href=\"http://trashout.ngo/policy\">" + getString(R.string.global_signUp_acceptRegister_privatePolicy) + "</a> " + getString(R.string.global_signUp_acceptRegister_and) + " <a href=\"http://trashout.ngo/terms\">" + getString(R.string.global_signUp_acceptRegister_terms) + "</a>")); signUpAccpetUserDataCollectionTextView.setMovementMethod(LinkMovementMethod.getInstance()); return view; }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEvent.java
/** Called when the activity is first created. */ @Override//from w w w. j a v a2 s.c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); BugSenseHandler.initAndStartSession(ViewZenossEvent.this, "44a76a8c"); settings = PreferenceManager.getDefaultSharedPreferences(this); setContentView(R.layout.view_zenoss_event); try { actionbar = getActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setHomeButtonEnabled(true); } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "OnCreate", e); } try { ((TextView) findViewById(R.id.EventTitle)).setText(getIntent().getStringExtra("Device")); ((TextView) findViewById(R.id.Summary)).setText(Html.fromHtml(getIntent().getStringExtra("Summary"))); ((TextView) findViewById(R.id.LastTime)).setText(getIntent().getStringExtra("LastTime")); ((TextView) findViewById(R.id.EventCount)) .setText("Count: " + Integer.toString(getIntent().getIntExtra("Count", 0))); } catch (Exception e) { //We don't need to much more than report it because the direct API request will sort it out for us. BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "OnCreate", e); } firstLoadHandler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss(); try { if (EventObject.has("result") && EventObject.getJSONObject("result").getBoolean("success") == true) { //Log.i("Event",EventObject.toString(3)); TextView Title = (TextView) findViewById(R.id.EventTitle); TextView Component = (TextView) findViewById(R.id.Componant); TextView EventClass = (TextView) findViewById(R.id.EventClass); TextView Summary = (TextView) findViewById(R.id.Summary); TextView FirstTime = (TextView) findViewById(R.id.FirstTime); TextView LastTime = (TextView) findViewById(R.id.LastTime); LinearLayout logList; EventDetails = EventObject.getJSONObject("result").getJSONArray("event").getJSONObject(0); try { if (EventDetails.getString("eventState").equals("Acknowledged")) { ((ImageView) findViewById(R.id.ackIcon)) .setImageResource(R.drawable.ic_acknowledged); } } catch (Exception e) { e.printStackTrace(); } //Log.e("EventDetails",EventDetails.toString(3)); try { Title.setText(EventDetails.getString("device_title")); } catch (Exception e) { Title.setText("Unknown Device - Event Details"); } try { Component.setText(EventDetails.getString("component")); } catch (Exception e) { Component.setText("Unknown Component"); } try { EventClass.setText(EventDetails.getString("eventClassKey")); } catch (Exception e) { EventClass.setText("Unknown Event Class"); } try { ImageView img = (ImageView) findViewById(R.id.summaryImage); URLImageParser p = new URLImageParser(img, ViewZenossEvent.this, Summary); Spanned htmlSpan = Html.fromHtml(EventDetails.getString("message"), p, null); Summary.setText(htmlSpan); //Summary.setText(Html.fromHtml(EventDetails.getString("message"))); //((ImageView) findViewById(R.id.summaryImage)).setImageDrawable(p.drawable); //Log.i("Summary",EventDetails.getString("message")); //((TextView) findViewById(R.id.Summary)).setVisibility(View.GONE); //((WebView) findViewById(R.id.summaryWebView)).loadData(EventDetails.getString("message"), "text/html", null); //((WebView) findViewById(R.id.summaryWebView)).loadDataWithBaseURL(null, EventDetails.getString("message"), "text/html", "UTF-8", "about:blank"); try { Summary.setMovementMethod(LinkMovementMethod.getInstance()); } catch (Exception e) { //Worth a shot } } catch (Exception e) { Summary.setText("No Summary available"); } try { FirstTime.setText(EventDetails.getString("firstTime")); } catch (Exception e) { FirstTime.setText("No Start Date Provided"); } try { LastTime.setText(EventDetails.getString("stateChange")); } catch (Exception e) { LastTime.setText("No Recent Date Provided"); } try { ((TextView) findViewById(R.id.EventCount)) .setText("Count: " + EventDetails.getString("count")); } catch (Exception e) { ((TextView) findViewById(R.id.EventCount)).setText("Count: ??"); } try { ((TextView) findViewById(R.id.Agent)).setText(EventDetails.getString("agent")); } catch (Exception e) { ((TextView) findViewById(R.id.Agent)).setText("unknown"); } try { JSONArray Log = EventDetails.getJSONArray("log"); int LogEntryCount = Log.length(); logList = (LinearLayout) findViewById(R.id.LogList); if (LogEntryCount == 0) { /*String[] LogEntries = {"No log entries could be found"}; ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries));*/ TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText("No log entries could be found"); logList.addView(newLog); } else { LogEntries = new String[LogEntryCount]; for (int i = 0; i < LogEntryCount; i++) { //LogEntries[i] = Log.getJSONArray(i).getString(0) + " set " + Log.getJSONArray(i).getString(2) +"\nAt: " + Log.getJSONArray(i).getString(1); TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText(Html.fromHtml("<strong>" + Log.getJSONArray(i).getString(0) + "</strong> wrote " + Log.getJSONArray(i).getString(2) + "\n<br/><strong>At:</strong> " + Log.getJSONArray(i).getString(1))); newLog.setPadding(0, 6, 0, 6); logList.addView(newLog); } /*try { ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries)); } catch(Exception e) { Toast.makeText(getApplicationContext(), "There was an error trying process the log entries for this event.", Toast.LENGTH_SHORT).show(); }*/ } } catch (Exception e) { TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText("No log entries could be found"); newLog.setPadding(0, 6, 0, 6); ((LinearLayout) findViewById(R.id.LogList)).addView(newLog); /*String[] LogEntries = {"No log entries could be found"}; try { ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries)); } catch(Exception e1) { //BugSenseHandler.log("ViewZenossEvent-LogEntries", e1); }*/ } } else { //Log.e("ViewEvent",EventObject.toString(3)); Toast.makeText(ViewZenossEvent.this, "There was an error loading the Event details", Toast.LENGTH_LONG).show(); //finish(); } } catch (Exception e) { Toast.makeText(ViewZenossEvent.this, "An error was encountered parsing the JSON. An error report has been sent.", Toast.LENGTH_LONG).show(); //BugSenseHandler.log("ViewZenossEvent", e); } } }; dialog = new ProgressDialog(this); dialog.setTitle("Contacting Zenoss"); dialog.setMessage("Please wait:\nLoading Event details...."); dialog.show(); dataPreload = new Thread() { public void run() { try { /*if(API == null) { if(settings.getBoolean("httpBasicAuth", false)) { API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""),settings.getString("BAUser", ""), settings.getString("BAPassword", "")); } else { API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", "")); } } EventObject = API.GetEvent(getIntent().getStringExtra("EventID"));*/ if (settings.getBoolean(ZenossAPI.PREFERENCE_IS_ZAAS, false)) { API = new ZenossAPIZaas(); } else { API = new ZenossAPICore(); } ZenossCredentials credentials = new ZenossCredentials(ViewZenossEvent.this); API.Login(credentials); EventObject = API.GetEvent(getIntent().getStringExtra("EventID")); } catch (Exception e) { firstLoadHandler.sendEmptyMessage(0); BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "DataPreloadThread", e); } finally { firstLoadHandler.sendEmptyMessage(1); } } }; dataPreload.start(); }
From source file:com.doomonafireball.hackerswiperfree.android.activity.MainActivity.java
private void makeLinksFocusable(TextView tv) { MovementMethod m = tv.getMovementMethod(); if ((m == null) || !(m instanceof LinkMovementMethod)) { if (tv.getLinksClickable()) { tv.setMovementMethod(LinkMovementMethod.getInstance()); }//from w ww . j a v a 2 s.c om } }
From source file:fiskinfoo.no.sintef.fiskinfoo.CardViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_card_view, container, false); RelativeLayout textAreaPlaceHolder = (RelativeLayout) rootView.findViewById(R.id.card_view_container); TextView title = (TextView) rootView.findViewById(R.id.card_view_title_text_view); if (subscription != null) { title.setText(subscription.GeoDataServiceName); TextView idView = generateTextViewWithText("id: " + subscription.Id, title); TextView geoDataServiceNameView = generateTextViewWithText( "Navn p kartlaget: " + subscription.GeoDataServiceName, idView); TextView fileFormatTypeView = generateTextViewWithText("Filformat: " + subscription.FileFormatType, geoDataServiceNameView); TextView userEmailView = generateTextViewWithText("Bruker e-post: " + subscription.UserEmail, fileFormatTypeView);/*from w ww. j ava 2 s .c o m*/ TextView subscriptionEmailView = generateTextViewWithText( "Abbonents e-post: " + subscription.SubscriptionEmail, userEmailView); TextView subscriptionIntervalNameView = generateTextViewWithText( "Kartet sendes: " + subscription.SubscriptionIntervalName, subscriptionEmailView); TextView createdView = generateTextViewWithText("Opprettet: " + subscription.Created, subscriptionIntervalNameView); TextView lastModifiedView = generateTextViewWithText("Sist oppdatert: " + subscription.LastModified, createdView); textAreaPlaceHolder.addView(idView); textAreaPlaceHolder.addView(geoDataServiceNameView); textAreaPlaceHolder.addView(fileFormatTypeView); textAreaPlaceHolder.addView(userEmailView); textAreaPlaceHolder.addView(subscriptionEmailView); textAreaPlaceHolder.addView(subscriptionIntervalNameView); textAreaPlaceHolder.addView(createdView); textAreaPlaceHolder.addView(lastModifiedView); } if (propertyDescription != null) { title.setText(propertyDescription.Name); Button notificationIconButton = (Button) rootView.findViewById(R.id.card_notification_image_view); CardViewInformationRow row; Button downloadMapButton; Button showOnMapButton; final ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.card_view_scroll_view); final LinearLayout informationContainer = (LinearLayout) rootView .findViewById(R.id.card_view_information_container); LinearLayout bottomButtonContainer = (LinearLayout) rootView.findViewById(R.id.bottom_button_container); showOnMapButton = new Button(getActivity()); downloadMapButton = (Button) rootView.findViewById(R.id.card_view_download_map_button); row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.last_updated), propertyDescription.LastUpdated.replace('T', ' '), true); informationContainer.addView(row.getView()); String description = (propertyDescription.LongDescription == null || propertyDescription.LongDescription.trim().equals("")) ? propertyDescription.Description : propertyDescription.LongDescription; String hyperlink = null; description = description.replace("<p>", ""); description = description.replace("</p>", ""); // TODO: should rewrite in order to handle multiple links. if (description.contains("<a href=\"")) { hyperlink = "<a href='" + description.substring(description.indexOf("href=") + 6, description.indexOf(">", description.indexOf("href=")) - 1) + "'>" + "\t\t\t* " + getString(R.string.see_more_info) + "</a>"; description = description.substring(0, description.indexOf("<a href")) + description.substring(description.indexOf(">", description.indexOf("<a href")) + 1, description.indexOf("</a")) + "*" + (description.indexOf("a>") > description.length() - 3 ? "" : description.substring(description.indexOf("a>") + 2, description.length())); } row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.information), description, true); informationContainer.addView(row.getView()); if (hyperlink != null) { TextView textView = new TextView(getActivity()); textView.setClickable(true); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setText(Html.fromHtml(hyperlink)); textView.setTextSize(getResources().getInteger(R.integer.hyperlinkTextSize)); informationContainer.addView(textView); } String updateFrequency = (propertyDescription.UpdateFrequencyText == null || propertyDescription.UpdateFrequencyText.trim().equals("")) ? getString(R.string.update_frequency_not_available) : propertyDescription.UpdateFrequencyText; row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.update_frequency), updateFrequency, true); informationContainer.addView(row.getView()); if (ApiErrorType.getType(propertyDescription.ErrorType) == ApiErrorType.WARNING) { row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.error_text), propertyDescription.ErrorText, true); final View dataField = row.getView(); final Animation animation = getBlinkAnimation(); notificationIconButton.setVisibility(View.VISIBLE); notificationIconButton .setBackground(ContextCompat.getDrawable(getActivity(), R.drawable.ic_warning_black_36dp)); row.setTextColor(getResources().getColor(R.color.warning_orange)); notificationIconButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { focusOnView(scrollView, dataField); dataField.startAnimation(animation); } }); informationContainer.addView(row.getView()); } else if (ApiErrorType.getType(propertyDescription.ErrorType) == ApiErrorType.WARNING) { row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.error_text), propertyDescription.ErrorText, true); final TextView dataField = row.getFieldDataTextView(); final Animation animation = getBlinkAnimation(); notificationIconButton.setVisibility(View.VISIBLE); notificationIconButton.setBackground( ContextCompat.getDrawable(getActivity(), R.drawable.ic_error_outline_black_36dp)); row.setTextColor(getResources().getColor(R.color.error_red)); notificationIconButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { focusOnView(scrollView, dataField); dataField.startAnimation(animation); } }); informationContainer.addView(row.getView()); } row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.data_owner), propertyDescription.DataOwner, true); informationContainer.addView(row.getView()); if (propertyDescription.DataOwnerLink != null && !propertyDescription.DataOwnerLink.trim().equals("")) { String partnerLink = (propertyDescription.DataOwnerLink.contains("http") || propertyDescription.DataOwnerLink.contains("www")) ? "<a href='" + propertyDescription.DataOwnerLink + "'>" + propertyDescription.DataOwnerLink + "</a>" : "<a href='" + getString(R.string.about_partners_base_address) + propertyDescription.DataOwnerLink + "'>" + getString(R.string.about_partners_base_address) + propertyDescription.DataOwnerLink + "</a>"; row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.data_owner_link), partnerLink, true); row.setHyperlink(partnerLink); row.getFieldDataTextView().setMovementMethod(LinkMovementMethod.getInstance()); informationContainer.addView(row.getView()); } StringBuilder stringBuilder = new StringBuilder(); for (String format : propertyDescription.Formats) { stringBuilder.append(format); stringBuilder.append("\n"); } row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.formats), stringBuilder.toString().trim(), false); informationContainer.addView(row.getView()); stringBuilder.setLength(0); for (String interval : propertyDescription.SubscriptionInterval) { stringBuilder.append(SubscriptionInterval.getType(interval).toString()); stringBuilder.append("\n"); } row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.subscription_frequencies), stringBuilder.toString().trim(), false); informationContainer.addView(row.getView()); row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.map_creation_date), propertyDescription.Created.substring(0, propertyDescription.Created.indexOf('T')), true); informationContainer.addView(row.getView()); LinearLayout.LayoutParams bottomButtonLayoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); bottomButtonLayoutParams.gravity = Gravity.CENTER_VERTICAL; bottomButtonLayoutParams.weight = (float) 0.5; showOnMapButton.setLayoutParams(bottomButtonLayoutParams); showOnMapButton.setText(getString(R.string.show_on_map)); showOnMapButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //TODO: Need to update the toolbar as well. List<String> layersList = new ArrayList<>(); String layerName = propertyDescription.Name; layersList.add("Grunnkart"); layersList.add(layerName); user.setActiveLayers(layersList); user.writeToSharedPref(getActivity()); getFragmentManager().beginTransaction().replace(R.id.fragment_container, new FiskInfoUtility().createFragment(MapFragment.TAG, user, TAG), MapFragment.TAG) .addToBackStack(null).commit(); } }); bottomButtonContainer.addView(showOnMapButton); downloadMapButton.setOnClickListener(utilityOnClickListeners .getSubscriptionDownloadButtonOnClickListener(getActivity(), propertyDescription, user, TAG)); } if (warning != null) { TextView content = generateTextViewWithText(warning, title); textAreaPlaceHolder.addView(content); } clearIds(); return rootView; }
From source file:com.example.xyzreader.ui.articledetail.ArticleDetailFragment.java
private void bindViews() { if (mRootView == null || mCursor == null) { return;/* w w w . j av a 2 s .c o m*/ } final ImageView detailImageView = (ImageView) mRootView.findViewById(R.id.detail_image); final TextView articleTitle = (TextView) mRootView.findViewById(R.id.article_detail_title); final TextView articleByLine = (TextView) mRootView.findViewById(R.id.article_detail_byline); final TextView bodyView = (TextView) mRootView.findViewById(R.id.article_body); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { long itemId = mCursor.getLong(ArticleLoader.Query._ID); String imageTransitionName = mContext.getString(R.string.image_transition_name) + itemId; detailImageView.setTransitionName(imageTransitionName); // Log.d(LOG_TAG, "detail image transition name = '" + imageTransitionName + "'"); } Picasso.with(mContext).load(mCursor.getString(ArticleLoader.Query.PHOTO_URL)).into(detailImageView, new Callback() { @Override public void onSuccess() { // Log.d(LOG_TAG, "successful image load"); mPalette = generatePalette(detailImageView); if (getUserVisibleHint() && isResumed()) { setAppBarColor(); } } @Override public void onError() { // Log.d(LOG_TAG, "image load FAIL"); } }); articleTitle.setText(mCursor.getString(ArticleLoader.Query.TITLE)); String byLine = DateUtils .getRelativeTimeSpanString(mCursor.getLong(ArticleLoader.Query.PUBLISHED_DATE), System.currentTimeMillis(), DateUtils.HOUR_IN_MILLIS, DateUtils.FORMAT_ABBREV_ALL) .toString() + " by " + mCursor.getString(ArticleLoader.Query.AUTHOR); articleByLine.setText(byLine); // Light up the embedded links in the body of the article bodyView.setMovementMethod(LinkMovementMethod.getInstance()); // bodyView.setTypeface(Typeface.createFromAsset(getResources().getAssets(), "Rosario-Regular.ttf")); bodyView.setText(Html.fromHtml(mCursor.getString(ArticleLoader.Query.BODY))); }
From source file:com.google.android.finsky.detailspage.WarningMessageModule.java
public final void bindView(View paramView) { WarningMessageModuleLayout localWarningMessageModuleLayout = (WarningMessageModuleLayout) paramView; int j;/*from w ww . j a va 2 s . c o m*/ if ((!localWarningMessageModuleLayout.mBinded) || (this.mNeedsRefresh)) { String str = ((WarningMessageModuleData) this.mModuleData).messageText; boolean bool = ((WarningMessageModuleData) this.mModuleData).isMessageLink; int i = ((WarningMessageModuleData) this.mModuleData).messageIconResId; j = ((WarningMessageModuleData) this.mModuleData).detailsDoc.mDocument.backendId; localWarningMessageModuleLayout.mBinded = true; localWarningMessageModuleLayout.mWarningMessageText.setText(str); localWarningMessageModuleLayout.mWarningMessageIcon.setImageResource(i); if (!bool) { break label231; } localWarningMessageModuleLayout.mWarningMessageText.setMovementMethod(LinkMovementMethod.getInstance()); } for (;;) { Context localContext = localWarningMessageModuleLayout.getContext(); ColorStateList localColorStateList = CorpusResourceUtils.getSecondaryTextColor(localContext, j); localWarningMessageModuleLayout.mWarningMessageText.setTextColor(localColorStateList); int k = UiUtils.interpolateColor$4868c7be(CorpusResourceUtils.getPrimaryColor(localContext, j)); int m = localWarningMessageModuleLayout.getPaddingTop(); int n = localWarningMessageModuleLayout.getPaddingBottom(); int i1 = ViewCompat.getPaddingEnd(localWarningMessageModuleLayout); int i2 = ViewCompat.getPaddingStart(localWarningMessageModuleLayout); Drawable[] arrayOfDrawable = new Drawable[2]; arrayOfDrawable[0] = new ColorDrawable(k); arrayOfDrawable[1] = ContextCompat.getDrawable(localContext, 2130837958); localWarningMessageModuleLayout.setBackgroundDrawable(new LayerDrawable(arrayOfDrawable)); ViewCompat.setPaddingRelative(localWarningMessageModuleLayout, i2, m, i1, n); this.mNeedsRefresh = false; return; label231: localWarningMessageModuleLayout.mWarningMessageText.setMovementMethod(null); } }
From source file:org.eyeseetea.malariacare.LoginActivity.java
/** * Shows an alert dialog asking for acceptance of the EULA terms. If ok calls login function, * do//from w w w.ja v a 2s .com * nothing otherwise */ public void askEula(int titleId, int rawId, final Context context) { InputStream message = context.getResources().openRawResource(rawId); String stringMessage = Utils.convertFromInputStreamToString(message).toString(); final SpannableString linkedMessage = new SpannableString(Html.fromHtml(stringMessage)); Linkify.addLinks(linkedMessage, Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS); AlertDialog dialog = new AlertDialog.Builder(context).setTitle(context.getString(titleId)) .setMessage(linkedMessage) .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { rememberEulaAccepted(context); login(serverText.getText().toString(), usernameEditText.getText().toString(), passwordEditText.getText().toString()); } }).setNegativeButton(android.R.string.no, null).create(); dialog.show(); ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:org.getlantern.firetweet.fragment.support.UserListFragment.java
public void displayUserList(final ParcelableUserList userList) { if (userList == null || getActivity() == null) return;//w ww .java 2 s . co m getLoaderManager().destroyLoader(0); mErrorRetryContainer.setVisibility(View.GONE); mProgressContainer.setVisibility(View.GONE); mUserList = userList; mUserListDetails.drawEnd(getAccountColor(getActivity(), userList.account_id)); mListNameView.setText(userList.name); final String displayName = UserColorNameUtils.getDisplayName(getActivity(), userList.user_id, userList.user_name, userList.user_screen_name, false); mCreatedByView.setText(getString(R.string.created_by, displayName)); final String description = userList.description; mDescriptionView.setVisibility(isEmpty(description) ? View.GONE : View.VISIBLE); mDescriptionView.setText(description); final FiretweetLinkify linkify = new FiretweetLinkify( new OnLinkClickHandler(getActivity(), getMultiSelectManager())); linkify.applyAllLinks(mDescriptionView, userList.account_id, false); mDescriptionView.setMovementMethod(LinkMovementMethod.getInstance()); mProfileImageLoader.displayProfileImage(mProfileImageView, userList.user_profile_image_url); invalidateOptionsMenu(); }