List of usage examples for android.widget TextView setMovementMethod
public final void setMovementMethod(MovementMethod movement)
From source file:DetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); detector = new GestureDetector(this, new GalleryGestureDetector()); listener = new View.OnTouchListener() { @Override//from ww w. ja va2 s .co m public boolean onTouch(View v, MotionEvent event) { return detector.onTouchEvent(event); } }; ImageIndex = 0; detailImage = (ImageView) findViewById(R.id.detail_image); detailImage.setOnTouchListener(listener); TextView detailName = (TextView) findViewById(R.id.detail_name); TextView detailDistance = (TextView) findViewById(R.id.detail_distance); TextView detailText = (TextView) findViewById(R.id.detail_text); detailText.setMovementMethod(new ScrollingMovementMethod()); ImageView detailWebLink = (ImageView) findViewById(R.id.detail_web_link); int i = MainActivity.currentItem; Random n = new Random(); int m = n.nextInt((600 - 20) + 1) + 20; setTitle(getString(R.string.app_name) + " - " + MainData.nameArray[i]); detailImage.setImageResource(MainData.detailImageArray[i]); detailName.setText(MainData.nameArray[i]); detailDistance.setText(String.valueOf(m) + " miles"); detailText.setText(MainData.detailTextArray[i]); detailWebLink.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.setData(Uri.parse(MainData.detailWebLink[MainActivity.currentItem])); startActivity(intent); } }); }
From source file:org.angellist.angellistmobile.UserRolesJSONAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) convertView = activity.getLayoutInflater().inflate(R.layout.row_userrole, null); TextView textView = (TextView) convertView.findViewById(R.id.label); textView.setMovementMethod(LinkMovementMethod.getInstance()); ImageView imageView = (ImageView) convertView.findViewById(R.id.logo); JSONObject jsonObject = getItem(position); try {/*from w ww . j a va2s. c o m*/ textView.setText("-"); imageView.setImageResource(R.drawable.ic_launcher); String image = jsonObject.getJSONObject("startup").getString("logo_url"); String startupId = jsonObject.getJSONObject("startup").getString("id"); imageLoader.DisplayImage(image, imageView); String role = jsonObject.getString("role"); String name = jsonObject.getJSONObject("startup").getString("name"); if ("referrer".equals(role)) { role = "Referrer"; } else if ("board_member".equals(role)) { role = "Board Member"; } else if ("employee".equals(role)) { role = "Employee"; } else if ("past_investor".equals(role)) { role = "Past Investor"; } else if ("founder".equals(role)) { role = "Founder"; } else if ("customer".equals(role)) { role = "Customer"; } else if ("mentor".equals(role)) { role = "Mentor"; } else if ("advisor".equals(role)) { role = "Advisor"; } String allText = ""; allText = "<a href=\"org.angellist.angellistmobile.startup://" + startupId + "\">" + name + "</a>" + " - " + role; textView.setText(Html.fromHtml(allText)); } catch (JSONException e) { e.printStackTrace(); } return convertView; }
From source file:com.btmura.android.reddit.app.MarkdownTableFragment.java
private void populateTable(final View view, final LayoutInflater inflater) { final TableLayout table = (TableLayout) view.findViewById(R.id.table); MarkdownTableScanner.scan(getTableDataExtra(), new OnTableScanListener<TableRow>() { @Override/*from w ww.j a v a 2 s.c om*/ public TableRow onRowStart() { return new TableRow(getActivity()); } @Override public void onCell(TableRow container, Cell cell) { int layout = cell.isHeader ? R.layout.markdown_table_cell_header : R.layout.markdown_table_cell; TextView tv = (TextView) inflater.inflate(layout, container, false); tv.setGravity(cell.gravity); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setText(formatter.formatAll(getActivity(), cell.contents)); container.addView(tv); table.setColumnShrinkable(cell.column, true); table.setColumnStretchable(cell.column, true); } @Override public void onRowEnd(TableRow row) { table.addView(row); } }); }
From source file:org.dkf.jmule.fragments.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_about, container, false); final TextView title = (TextView) view.findViewById(R.id.fragment_about_title); title.setText("Mule on Android " + " v" + Constants.JED2K_VERSION_STRING); final TextView buildNumber = (TextView) view.findViewById(R.id.fragment_about_build_number); buildNumber.setText(//ww w . ja v a2 s . c o m "\nBuild " + BuildConfig.VERSION_CODE + " - SDK level " + Build.VERSION.SDK_INT + " sources on: "); final TextView content = (TextView) view.findViewById(R.id.fragment_about_content); content.setText(Html.fromHtml(getAboutText())); content.setMovementMethod(LinkMovementMethod.getInstance()); final ImageButton githubButton = (ImageButton) view.findViewById(R.id.fragment_github_button); githubButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { UIUtils.openURL(v.getContext(), "http://github.com/a-pavlov/jed2k"); } }); return view; }
From source file:io.github.t3r1jj.pbmap.AboutActivity.java
private void setUpAuthor() { TextView authorText = (TextView) findViewById(R.id.about_author); authorText.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.tortel.syslog.dialog.FaqDialog.java
@NonNull @Override//from ww w . j a va 2s . co m public Dialog onCreateDialog(Bundle savedInstanceState) { MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.about, null); TextView text = (TextView) view.findViewById(R.id.text); text.setText(Html.fromHtml(readRawTextFile(R.raw.faq))); Linkify.addLinks(text, Linkify.ALL); text.setMovementMethod(LinkMovementMethod.getInstance()); builder.customView(view, false); builder.title(R.string.syslog_faq); builder.positiveText(R.string.close); return builder.build(); }
From source file:project.pamela.slambench.fragments.SLAMResultAdapter.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // LAYOUT - LAYOUT - LAYOUT - LAYOUT - LAYOUT - LAYOUT super.onCreate(savedInstanceState); llLayout = (LinearLayout) inflater.inflate(R.layout.fragment_result, container, false); TextView _messageView = (TextView) llLayout.findViewById(R.id.message); _messageView.setMovementMethod(new ScrollingMovementMethod()); MessageLog.setTextView(_messageView); if (SLAMBenchApplication.getResults() != null) { SLAMResultAdapter adapter = new SLAMResultAdapter(llLayout.getContext(), R.layout.list_row, SLAMBenchApplication.getResults()); ListView lv = (ListView) llLayout.findViewById(R.id.listView); lv.setAdapter(adapter);/*ww w . ja va2s .co m*/ lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View v, int position, long arg3) { Intent myIntent = new Intent(v.getContext(), PlotActivity.class); myIntent.putExtra(SELECTED_TEST_TAG, position); startActivity(myIntent); } }); } return llLayout; }
From source file:com.naman14.algovisualizer.AlgoDescriptionFragment.java
private void addDescData(String algorithmKey) { if (descJson == null || descObject == null || getActivity() == null) { return;// w w w . j a v a2 s.c o m } rootView.removeAllViews(); try { JSONObject dataObject = descObject.getJSONObject(algorithmKey); Iterator<?> keys = dataObject.keys(); while (keys.hasNext()) { View descView = LayoutInflater.from(getActivity()).inflate(R.layout.item_code_desc, rootView, false); TextView title = (TextView) descView.findViewById(R.id.title); TextView desc = (TextView) descView.findViewById(R.id.desc); desc.setMovementMethod(LinkMovementMethod.getInstance()); String key = (String) keys.next(); title.setText(key); if (dataObject.get(key) instanceof JSONObject) { JSONObject jsonObject = dataObject.getJSONObject(key); String descString = ""; Iterator<?> complexityKeys = jsonObject.keys(); while (complexityKeys.hasNext()) { String complexityKey = (String) complexityKeys.next(); descString += " - "; descString += complexityKey; descString += " : "; descString += jsonObject.getString(complexityKey); descString += "<br>"; } desc.setText(Html.fromHtml(descString)); } else if (dataObject.get(key) instanceof JSONArray) { JSONArray array = dataObject.getJSONArray(key); String descString = ""; for (int i = 0; i < array.length(); i++) { descString += " - "; descString += array.getString(i); descString += "<br>"; } desc.setText(Html.fromHtml(descString)); } else if (dataObject.get(key) instanceof String) { desc.setText(Html.fromHtml(dataObject.getString(key))); } rootView.addView(descView); } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.tortel.syslog.dialog.AboutDialog.java
@NonNull @Override//from ww w . j a va 2s. co m public Dialog onCreateDialog(Bundle savedInstanceState) { MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.about, null); TextView text = (TextView) view.findViewById(R.id.text); text.setText(Html.fromHtml(readRawTextFile(R.raw.about))); Linkify.addLinks(text, Linkify.ALL); text.setMovementMethod(LinkMovementMethod.getInstance()); builder.customView(view, false); builder.title(R.string.about); builder.positiveText(R.string.close); return builder.build(); }
From source file:com.tortel.syslog.dialog.AboutLogcatDialog.java
@NonNull @Override//from ww w . ja va2 s . com public Dialog onCreateDialog(Bundle savedInstanceState) { MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.about, null); TextView text = (TextView) view.findViewById(R.id.text); text.setText(Html.fromHtml(readRawTextFile(R.raw.logcat))); Linkify.addLinks(text, Linkify.ALL); text.setMovementMethod(LinkMovementMethod.getInstance()); builder.customView(view, false); builder.title(R.string.about_live); builder.positiveText(R.string.close); return builder.build(); }