List of usage examples for android.text.method LinkMovementMethod getInstance
public static MovementMethod getInstance()
From source file:com.nexus.nsnik.randomno.view.fragments.dailogFragments.AboutDialogFragment.java
private void initialize() { if (getActivity() != null) { mResources = getActivity().getResources(); }/*from w w w . j a v a 2 s . c o m*/ mCompositeDisposable = new CompositeDisposable(); mAboutNikhil.setMovementMethod(LinkMovementMethod.getInstance()); mSourceCodeLink.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:org.liberty.android.fantastischmemo.downloader.DownloaderFE.java
@Override protected void fetchDatabase(final DownloadItem di) { View alertView = View.inflate(this, R.layout.link_alert, null); TextView textView = (TextView) alertView.findViewById(R.id.link_alert_message); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setText(//from w w w . j a v a2s . c o m Html.fromHtml(getString(R.string.downloader_download_alert_message) + di.getDescription())); new AlertDialog.Builder(this).setView(alertView) .setTitle(getString(R.string.downloader_download_alert) + di.getTitle()) .setPositiveButton(getString(R.string.yes_text), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { mProgressDialog = ProgressDialog.show(DownloaderFE.this, getString(R.string.loading_please_wait), getString(R.string.loading_downloading)); new Thread() { public void run() { try { downloadDatabase(di); mHandler.post(new Runnable() { public void run() { mProgressDialog.dismiss(); String dbpath = AMEnv.DEFAULT_ROOT_PATH; new AlertDialog.Builder(DownloaderFE.this) .setTitle(R.string.downloader_download_success) .setMessage( getString(R.string.downloader_download_success_message) + dbpath + di.getTitle() + ".db") .setPositiveButton(R.string.ok_text, null).create().show(); } }); } catch (final Exception e) { Log.e(TAG, "Error downloading", e); mHandler.post(new Runnable() { public void run() { mProgressDialog.dismiss(); new AlertDialog.Builder(DownloaderFE.this) .setTitle(R.string.downloader_download_fail) .setMessage(getString(R.string.downloader_download_fail_message) + " " + e.toString()) .setPositiveButton(R.string.ok_text, null).create().show(); } }); } } }.start(); } }).setNegativeButton(getString(R.string.no_text), null).show(); }
From source file:org.anhonesteffort.flock.SelectServiceProviderFragment.java
private void initRadioButtons(View fragmentView) { final LinearLayout rowSelectOws = (LinearLayout) fragmentView.findViewById(R.id.row_service_ows); final LinearLayout rowSelectOther = (LinearLayout) fragmentView.findViewById(R.id.row_service_other); final RadioButton radioButtonOws = (RadioButton) fragmentView.findViewById(R.id.radio_button_service_ows); final RadioButton radioButtonOther = (RadioButton) fragmentView .findViewById(R.id.radio_button_service_other); final TextView serviceDescription = (TextView) fragmentView.findViewById(R.id.sync_service_description); final Double costPerYearUsd = (double) getResources().getInteger(R.integer.cost_per_year_usd); rowSelectOws.setOnClickListener(new View.OnClickListener() { @Override/*from ww w . j a va 2s . c om*/ public void onClick(View view) { if (!radioButtonOws.isChecked()) { radioButtonOws.setChecked(true); radioButtonOther.setChecked(false); serviceDescription.setText(Html.fromHtml( getString(R.string.flock_sync_is_a_service_run_by_open_whisper_systems_available, costPerYearUsd))); serviceDescription.setMovementMethod(LinkMovementMethod.getInstance()); } } }); rowSelectOther.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!radioButtonOther.isChecked()) { radioButtonOther.setChecked(true); radioButtonOws.setChecked(false); serviceDescription .setText(R.string.you_may_chose_to_run_and_configure_your_own_webdav_compliant_server); } } }); radioButtonOws.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { if (isChecked) { radioButtonOws.setChecked(true); radioButtonOther.setChecked(false); serviceDescription.setText(Html.fromHtml( getString(R.string.flock_sync_is_a_service_run_by_open_whisper_systems_available, costPerYearUsd))); serviceDescription.setMovementMethod(LinkMovementMethod.getInstance()); } } }); radioButtonOther.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { if (isChecked) { radioButtonOther.setChecked(true); radioButtonOws.setChecked(false); serviceDescription .setText(R.string.you_may_chose_to_run_and_configure_your_own_webdav_compliant_server); } } }); }
From source file:com.ubuntuone.android.files.fragment.SignUpFragment.java
private void setupViews(View content) { fullnameEditText = (EditTextPlus) content.findViewById(R.id.sso_fullname); emailErrorTextView = (TextViewPlus) content.findViewById(R.id.email_error); emailEditText = (EditTextPlus) content.findViewById(R.id.sso_username); passwordErrorTextView = (TextViewPlus) content.findViewById(R.id.password_error); passwordEditText = (EditTextPlus) content.findViewById(R.id.sso_password); passwordVisibleCheckBox = (CheckBoxPlus) content.findViewById(R.id.password_toggle); passwordVisibleCheckBox.setOnClickListener(this); captchaErrorTextView = (TextViewPlus) content.findViewById(R.id.captcha_error); signupButton = (Button) content.findViewById(R.id.sso_signup); signupButton.setOnClickListener(onButtonClickedListener); final TextView footer = (TextView) content.findViewById(R.id.signup_footer_tos); footer.setText(Html.fromHtml(getString(R.string.signup_footer_tos))); footer.setLinkTextColor(getResources().getColor(R.color.web_url)); footer.setMovementMethod(LinkMovementMethod.getInstance()); setupCaptchaImageView(content);//from w w w. j a v a2 s. c o m }
From source file:edu.cmu.cylab.starslinger.view.FindContactActivity.java
public void generateView() { setContentView(R.layout.contact_adder); final ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); bar.setTitle(R.string.app_name);/*from w w w. j a v a 2 s.c o m*/ bar.setSubtitle(R.string.title_find); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); // Obtain handles to UI objects mEditTextName = (EditText) findViewById(R.id.contactNameEditText); mButtonDone = (Button) findViewById(R.id.contactDoneButton); mEditTextPassNext = (EditText) findViewById(R.id.EditTextPassphrase); mEditTextPassDone = (EditText) findViewById(R.id.EditTextPassphraseAgain); mTextViewLicensePrivacy = (TextView) findViewById(R.id.textViewLicensePrivacy); mSpinnerLanguage = (Spinner) findViewById(R.id.spinnerLanguage); final ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); final ArrayList<String> codes = SafeSlinger.getApplication().getListLanguages(true); mSpinnerLanguage.setPrompt(getText(R.string.title_language)); mSpinnerLanguage.setAdapter(adapter); ArrayList<String> all = SafeSlinger.getApplication().getListLanguages(false); for (String l : all) { adapter.add(l); } mSpinnerLanguage.setSelection(codes.indexOf(SafeSlingerPrefs.getLanguage())); // read defaults and set them mSelectedName = SafeSlingerPrefs.getContactName(); // see if name is there... if (mSelectedName != null) { mEditTextName.setText(mSelectedName); } mEditTextPassNext.setVisibility(View.VISIBLE); mEditTextPassNext.setHint(R.string.label_PassHintCreate); mEditTextPassDone.setHint(R.string.label_PassHintRepeat); // enable hyperlinks mTextViewLicensePrivacy.setText(Html.fromHtml("<a href=\"" + SafeSlingerConfig.EULA_URL + "\">" + getText(R.string.menu_License) + "</a> / <a href=\"" + SafeSlingerConfig.PRIVACY_URL + "\">" + getText(R.string.menu_PrivacyPolicy) + "</a>")); mTextViewLicensePrivacy.setMovementMethod(LinkMovementMethod.getInstance()); mSpinnerLanguage.setOnItemSelectedListener(new OnItemSelectedListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long i) { if (!codes.get(position).equals(SafeSlingerPrefs.getLanguage())) { SafeSlingerPrefs.setLanguage(codes.get(position)); SafeSlinger.getApplication().updateLanguage(codes.get(position)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { recreate(); } else { generateView(); } } } @Override public void onNothingSelected(AdapterView<?> parent) { // We don't need to worry about nothing being selected } }); mEditTextName.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { mSelectedName = mEditTextName.getText().toString(); } }); mButtonDone.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onDoneButtonClicked(); } }); mEditTextPassDone.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { doValidatePassphrase(); return true; } return false; } }); }
From source file:com.trellmor.berrytubechat.ChatActivity.java
@SuppressLint("NewApi") @Override//from w w w . j av a 2 s . c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { getActionBar().setDisplayHomeAsUpEnabled(false); } mEditChatMsg = (EditText) findViewById(R.id.edit_chat_msg); TextView.OnEditorActionListener chatMsgListener = new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEND) { sendChatMsg(); } else if (actionId == EditorInfo.IME_NULL && event.getAction() == KeyEvent.ACTION_UP && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { sendChatMsg(); } return true; } }; mEditChatMsg.setOnEditorActionListener(chatMsgListener); mTextDrinks = (TextView) findViewById(R.id.text_drinks); registerForContextMenu(mTextDrinks); mCurrentVideo = (TextView) findViewById(R.id.text_video); mCurrentVideo.setMovementMethod(LinkMovementMethod.getInstance()); mTextNick = (TextView) findViewById(R.id.text_nick); mTextNick.setText("Anonymous"); mListChat = (ListView) findViewById(R.id.list_chat); Intent intent = getIntent(); mUsername = intent.getStringExtra(MainActivity.KEY_USERNAME); mPassword = intent.getStringExtra(MainActivity.KEY_PASSWORD); if (savedInstanceState != null) { mDrinkCount = savedInstanceState.getInt(KEY_DRINKCOUT); mMyDrinkCount = savedInstanceState.getInt(KEY_MYDRINKCOUNT); if (mUsername == null) mUsername = savedInstanceState.getString(MainActivity.KEY_USERNAME); if (mPassword == null) mPassword = savedInstanceState.getString(MainActivity.KEY_PASSWORD); } startService(new Intent(this, BerryTube.class)); bindService(new Intent(this, BerryTube.class), mService, BIND_ABOVE_CLIENT); }
From source file:com.vuze.android.remote.fragment.TorrentTagsFragment.java
private void createTags() { if (tvTags == null) { if (AndroidUtils.DEBUG) { Log.e(TAG, "no tvTags"); }// www.j a va2s. c om return; } List<Map<?, ?>> manualTags = new ArrayList<>(); List<Map<?, ?>> allTags = sessionInfo.getTags(); if (allTags == null) { tvTags.setText(""); return; } for (Map<?, ?> mapTag : allTags) { int type = MapUtils.getMapInt(mapTag, "type", 0); if (type == 3) { // manual manualTags.add(mapTag); } } if (spanTags != null) { List<Map<?, ?>> tagMaps = spanTags.getTagMaps(); if (tagMaps.size() == manualTags.size()) { // TODO: More robust comparison return; } } tvTags.setMovementMethod(LinkMovementMethod.getInstance()); SpanTags.SpanTagsListener l = new SpanTags.SpanTagsListener() { @Override public void tagClicked(Map mapTag, String name) { final Object[] tags = new Object[] { MapUtils.getMapObject(mapTag, "uid", name, Object.class) }; final boolean isRemove = isTagSelected(mapTag); mapPendingTagChanges.put(tags[0], !isRemove); updateTags(); sessionInfo.executeRpc(new SessionInfo.RpcExecuter() { @Override public void executeRpc(TransmissionRPC rpc) { if (isRemove) { rpc.removeTagFromTorrents(TAG, new long[] { torrentID }, tags); } else { rpc.addTagToTorrents(TAG, new long[] { torrentID }, tags); } } }); } @Override public int getTagState(Map mapTag, String name) { Object uid = MapUtils.getMapObject(mapTag, "uid", name, Object.class); Boolean pendingState = mapPendingTagChanges.get(uid); if (pendingState != null) { int state = SpanTags.TAG_STATE_UPDATING; if (pendingState) { state |= SpanTags.TAG_STATE_SELECTED; } else { state |= SpanTags.TAG_STATE_UNSELECTED; } return state; } boolean tagSelected = isTagSelected(mapTag); return tagSelected ? SpanTags.TAG_STATE_SELECTED : SpanTags.TAG_STATE_UNSELECTED; } }; spanTags = new SpanTags(getContext(), sessionInfo, tvTags, l); spanTags.setTagMaps(manualTags); }
From source file:org.da_cha.android.bluegnss.MainActivity.java
private void displayAboutDialog() { View messageView = getLayoutInflater().inflate(R.layout.about, null, false); // we need this to enable html links TextView textView = (TextView) messageView.findViewById(R.id.about_license); textView.setMovementMethod(LinkMovementMethod.getInstance()); // When linking text, force to always use default color. This works // around a pressed color state bug. int defaultColor = textView.getTextColors().getDefaultColor(); textView.setTextColor(defaultColor); textView = (TextView) messageView.findViewById(R.id.about_sources); textView.setTextColor(defaultColor); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.about_title); builder.setIcon(R.drawable.gplv3_icon); builder.setView(messageView);//from w ww . j a v a 2s . com builder.show(); }
From source file:com.limewoodmedia.nsdroid.activities.World.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.world);/*from w w w .j ava 2 s. com*/ setTitle(R.string.world); // Fetch flag LoadingHelper.loadHomeFlag(this); imageLoader = Utils.getImageLoader(this); this.options = Utils.getImageLoaderDisplayOptions(); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); Utils.setupNavigationDrawer(this); viewPager = (ViewPager) findViewById(R.id.pager); // WFE featured = (ViewGroup) getLayoutInflater().inflate(R.layout.world_featured, viewPager, false); regionName = (TextView) featured.findViewById(R.id.region_name); regionName.setMovementMethod(LinkMovementMethod.getInstance()); flag = (ImageView) featured.findViewById(R.id.region_flag); delegate = (TextView) featured.findViewById(R.id.region_delegate); founder = (TextView) featured.findViewById(R.id.region_founder); text = (TextView) featured.findViewById(R.id.wfe); delegate.setMovementMethod(LinkMovementMethod.getInstance()); founder.setMovementMethod(LinkMovementMethod.getInstance()); text.setMovementMethod(LinkMovementMethod.getInstance()); fieldset = (ViewGroup) featured.findViewById(R.id.fieldset); header = (TextView) featured.findViewById(R.id.wfe_header); ViewTreeObserver observer = header.getViewTreeObserver(); observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { fieldset.setPadding(fieldset.getPaddingLeft(), header.getHeight() - (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, getResources().getDisplayMetrics()), fieldset.getPaddingRight(), fieldset.getPaddingBottom()); } }); layout = (ViewGroup) featured.findViewById(R.id.region_layout); // Search search = (ViewGroup) getLayoutInflater().inflate(R.layout.world_search, viewPager, false); numbers = (TextView) search.findViewById(R.id.world_numbers); searchField = (EditText) search.findViewById(R.id.search_field); searchButton = (Button) search.findViewById(R.id.search_button); searchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doSearch(searchField.getText().toString()); } }); searchResults = (LinearLayout) search.findViewById(R.id.search_results); // Set up view pager viewPager.setAdapter(new WorldPagerAdapter()); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { // Update context menu supportInvalidateOptionsMenu(); } @Override public void onPageScrollStateChanged(int state) { } }); // Check if going straight to a page if (getIntent().hasExtra("page")) { showPage(getIntent().getIntExtra("page", 0)); } // if(savedInstanceState == null) { loadRegion(); // } else { // // Restore state // rData = savedInstanceState.getParcelable("region_data"); // doSetup(); // } }
From source file:com.limewoodmedia.nsdroid.fragments.RMBFragment.java
@Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { root = inflater.inflate(R.layout.rmb, null, false); list = (ListView) root.findViewById(R.id.rmb_messages); dimmer = (FrameLayout) root.findViewById(R.id.dimmer); messageBox = (EditText) root.findViewById(R.id.rmb_post_message); postArea = (ViewGroup) root.findViewById(R.id.rmb_post_area); postClose = (Button) postArea.findViewById(R.id.rmb_post_close); postClose.setOnClickListener(this); postSend = (Button) postArea.findViewById(R.id.rmb_post_send); postSend.setOnClickListener(this); posts = new ArrayList<RMBMessage>(); final String deletedMessage = getString(R.string.message_deleted_by_author); listAdapter = new ArrayAdapter<RMBMessage>(context, 0, posts) { @Override// ww w .j a va 2s . c o m public View getView(int position, View convertView, ViewGroup parent) { View view; TextView nation = null, msg; RMBMessage post = getItem(position); if (convertView == null) { if (post.message.compareTo(deletedMessage) == 0) { // This is a deleted message view = inflater.inflate(R.layout.rmb_post_deleted, null); view.setTag(deletedMessage); } else { view = inflater.inflate(R.layout.rmb_post, null); nation = (TextView) view.findViewById(R.id.rmb_poster); nation.setMovementMethod(LinkMovementMethod.getInstance()); } msg = (TextView) view.findViewById(R.id.rmb_message); msg.setMovementMethod(LinkMovementMethod.getInstance()); } else { if ((post.message.compareTo(deletedMessage) == 0 && convertView.getTag() == deletedMessage) || (post.message.compareTo(deletedMessage) != 0 && convertView.getTag() != deletedMessage)) { view = convertView; msg = (TextView) view.findViewById(R.id.rmb_message); } else { if (post.message.compareTo(deletedMessage) == 0) { // This is a deleted message view = inflater.inflate(R.layout.rmb_post_deleted, null); view.setTag(deletedMessage); } else { view = inflater.inflate(R.layout.rmb_post, null); nation = (TextView) view.findViewById(R.id.rmb_poster); nation.setMovementMethod(LinkMovementMethod.getInstance()); } msg = (TextView) view.findViewById(R.id.rmb_message); msg.setMovementMethod(LinkMovementMethod.getInstance()); } nation = (TextView) view.findViewById(R.id.rmb_poster); } if (view.getTag() == deletedMessage) { msg.setText(Html.fromHtml("Post self-deleted by <a href='com.limewoodMedia.nsdroid.nation://" + post.nation + "'>" + TagParser.idToName(post.nation) + "</a>.")); } else { long timestamp = post.timestamp; String time = TagParser.parseTimestamp(getContext(), timestamp); String poster = "<a href=\"com.limewoodMedia.nsdroid.nation://" + post.nation + "\">" + TagParser.idToName(post.nation) + "</a><br />" + time; if (post.embassy != null) { poster += " from<br /><a href=\"com.limewoodMedia.nsdroid.region://" + TagParser.nameToId(post.embassy) + "\">" + post.embassy + "</a>"; } nation.setText(Html.fromHtml(poster)); msg.setText(TagParser.parseTagsFromHtml(post.message, true)); } return view; } }; list.setAdapter(listAdapter); registerForContextMenu(list); return root; }