List of usage examples for android.widget TextView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.liangxun.yuejiula.huanxin.chat.activity.GroupsActivity.java
private void showMsgFenghao() { final Dialog picAddDialog = new Dialog(GroupsActivity.this, R.style.dialog); View picAddInflate = View.inflate(this, R.layout.msg_mine_dialog, null); TextView jubao_sure = (TextView) picAddInflate.findViewById(R.id.jubao_sure); final TextView content = (TextView) picAddInflate.findViewById(R.id.content); content.setText("????"); //??//w w w.j a v a 2 s. c om jubao_sure.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getManagerBySchoolId(); picAddDialog.dismiss(); } }); //? TextView jubao_cancle = (TextView) picAddInflate.findViewById(R.id.jubao_cancle); jubao_cancle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { picAddDialog.dismiss(); } }); picAddDialog.setContentView(picAddInflate); picAddDialog.show(); }
From source file:com.ehret.mixit.fragment.PeopleDetailFragment.java
private void addPeopleLink(Member membre) { //On vide les lments linkLayout.removeAllViews();/*from ww w . ja va 2 s . c o m*/ //On affiche les liens que si on a recuperer des choses if (membre != null && membre.getSharedLinks() != null && !membre.getSharedLinks().isEmpty()) { //On ajoute un table layout TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams( TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); TableLayout tableLayout = new TableLayout(getActivity().getBaseContext()); tableLayout.setLayoutParams(tableParams); if (mInflater != null && membre.getSharedLinks().size() > 0) { for (final Link link : membre.getSharedLinks()) { RelativeLayout row = (RelativeLayout) mInflater.inflate(R.layout.item_link, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView link_text = (TextView) row.findViewById(R.id.link_text); link_text.setText(Html.fromHtml(String.format("%s : <a href=\"%s\">%s</a>", link.getRel(), link.getHref(), link.getHref()))); link_text.setBackgroundColor(Color.TRANSPARENT); link_text.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(link.getHref())); getActivity().startActivity(in); } }); tableLayout.addView(row); } } else { RelativeLayout row = (RelativeLayout) mInflater.inflate(R.layout.item_link, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView link_text = (TextView) row.findViewById(R.id.link_text); link_text.setText("Aucun lien"); link_text.setBackgroundColor(Color.TRANSPARENT); tableLayout.addView(row); } linkLayout.addView(tableLayout); } else { titleLinks.getLayoutParams().height = 0; } }
From source file:com.amaze.filemanager.fragments.RarViewer.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.main_frag, container, false); mainActivity = (MainActivity) getActivity(); listView = (RecyclerView) rootView.findViewById(R.id.listView); mainActivity = (MainActivity) getActivity(); mainActivity.supportInvalidateOptionsMenu(); swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.activity_main_swipe_refresh_layout); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override/* w ww.j a va 2s. c o m*/ public void onRefresh() { refresh(); } }); TextView textView = (TextView) mainActivity.pathbar.findViewById(R.id.fullpath); mainActivity.pathbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); return rootView; }
From source file:com.theultimatelabs.scale.ScaleActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.scale);//ww w. j ava 2s . c om Log.v(TAG, "onCreate"); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); mSettings = getSharedPreferences(PREFS, 0); mUnitsText = mSettings.getString("unitsText", "grams"); mUnitsRatio = mSettings.getFloat("unitsRatio", (float) 1.0); mTts = new TextToSpeech(this, this); mUnitsView = (TextView) findViewById(R.id.text_unit); mUnitsView.setText(mUnitsText); findViewById(R.id.text_unit).setOnClickListener(new OnClickListener() { public void onClick(View v) { while (mTts.isSpeaking()) ; Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Say Units"); startActivityForResult(intent, 0); if (adView != null) { adView.loadAd(new AdRequest()); } } }); mWeightTextView = (TextView) findViewById(R.id.text_weight); mWeightTextView.setText("00.00"); /* * TextPaint weightTextPaint = mWeightTextView.getPaint(); CharSequence * weightText = mWeightTextView.getText(); while (weightText != * TextUtils.ellipsize(weightText, weightTextPaint, * getWindowManager().getDefaultDisplay * ().getWidth()*2/3,TextUtils.TruncateAt.END)) { * weightTextPaint.setTextSize(weightTextPaint.getTextSize() - 1); } */ mWeightTextView.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(getApplicationContext(), "Zero'd", Toast.LENGTH_LONG).show(); mZeroGrams = mWeightGrams; if (adView != null) { adView.loadAd(new AdRequest()); } } }); mWeightTextView.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(View v) { mZeroGrams = 0; Toast.makeText(getApplicationContext(), "Reset", Toast.LENGTH_LONG).show(); if (adView != null) { adView.loadAd(new AdRequest()); } return true; } }); disableAdsText = (TextView) findViewById((R.id.text_disableAds)); disableAdsText.setOnClickListener(new OnClickListener() { public void onClick(View v) { new AlertDialog.Builder(ScaleActivity.this).setTitle("Keep Software Free and Open Source") .setMessage("Ads help support further development, but they are OPTIONAL." + " If you choose to disable ads, please consider donating. All dontations" + " go towards purchasing hardware for open source development. " + "Disabling ads or donating will not change the features availble in this app." + " Thank you. rob@theultimatelabs.com") .setPositiveButton("Disable Ads", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { adLayout.removeAllViews(); adView.removeAllViews(); disableAdsText.setVisibility(View.INVISIBLE); mSettings.edit().putBoolean("ads", false).commit(); adView = null; } }).setCancelable(true).setNegativeButton("Keep Ads", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).setNeutralButton("Disable Ads + Donate", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { adLayout.removeAllViews(); adView.removeAllViews(); disableAdsText.setVisibility(View.INVISIBLE); mSettings.edit().putBoolean("ads", false).commit(); adView = null; startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://blog.theultimatelabs.com/p/donate.html"))); } }).show(); } }); TextView aboutText = (TextView) findViewById((R.id.text_about)); aboutText.setOnClickListener(new OnClickListener() { public void onClick(View v) { startActivity(new Intent(getApplicationContext(), AboutActivity.class)); } }); /* * .setMessage() new AlertDialog.Builder(this) .setMessage(mymessage) * .setTitle(title) .setCancelable(true) * .setNeutralButton(android.R.string.cancel, new * DialogInterface.OnClickListener() { public void * onClick(DialogInterface dialog, int whichButton){} }) .show(); }} */ // / mDensitiesJson = loadJsonResource(R.raw.densities); mVolumesJson = loadJsonResource(R.raw.volumes); mWeightsJson = loadJsonResource(R.raw.weights); // Initiate a generic request to load it with an ad if (mSettings.getBoolean("ads", true)) { // Create the adViewj adView = new AdView(this, AdSize.SMART_BANNER, "a15089dfb39c5a8"); // Log.w(TAG, new Integer(R.id.layout_ads).toString()); adLayout = (LinearLayout) findViewById(R.id.layout_ads); // Add the adView to it adLayout.addView(adView, 0); disableAdsText.setVisibility(View.VISIBLE); } else { disableAdsText.setVisibility(View.INVISIBLE); adView = null; } Intent intent = getIntent(); mDevice = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); findScale(); }
From source file:com.jiandanbaoxian.fragment.DialogFragmentCreater.java
private Dialog signOutDialog() { View.OnClickListener listener = new View.OnClickListener() { @Override//from w w w.ja v a 2 s .c om public void onClick(View view) { switch (view.getId()) { case R.id.close_app: if (onDialogClickLisenter != null) onDialogClickLisenter.viewClick(StringConstant.tv_confirm); dismiss(); break; case R.id.stay_here: if (onDialogClickLisenter != null) onDialogClickLisenter.viewClick(StringConstant.tv_cancel); dismiss(); break; default: break; } } }; View convertView = LayoutInflater.from(mContext).inflate(R.layout.view_sign_out_dialog, null); TextView signOutButton = (TextView) convertView.findViewById(R.id.stay_here); TextView closeAppButton = (TextView) convertView.findViewById(R.id.close_app); signOutButton.setOnClickListener(listener); closeAppButton.setOnClickListener(listener); Dialog dialog = new Dialog(mContext, R.style.CustomDialog); dialog.setContentView(convertView); dialog.getWindow().setWindowAnimations(R.style.dialog_right_control_style); return dialog; }
From source file:com.muzima.view.custom.PagerSlidingTabStrip.java
private void addTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setText(title);/*from w w w . j a va 2 s . c om*/ tab.setFocusable(true); tab.setGravity(Gravity.CENTER); tab.setSingleLine(); tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); tabsContainer.addView(tab); }
From source file:com.alexcruz.papuhwalls.Credits.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.credits, null); this.Preferences = new Preferences(getContext()); context = getActivity();//from ww w .j a v a 2s .c o m ActionBar toolbar = ((ActionBarActivity) context).getSupportActionBar(); toolbar.setTitle(R.string.section_aboutapp); //Credits TextView credit_title = (TextView) root.findViewById(R.id.credit_title); credit_title.setTextColor(Preferences.PrimaryText()); TextView credit_desc = (TextView) root.findViewById(R.id.credit_desc); credit_desc.setText(Html.fromHtml(getString(R.string.credit_desc))); credit_desc.setTextColor(Preferences.SecondaryText()); //Free and open source text TextView freeandopensource_text = (TextView) root.findViewById(R.id.freeandopensource_text); freeandopensource_text.setTextColor(Preferences.PrimaryText()); //Library number two TextView libtwo_title = (TextView) root.findViewById(R.id.libtwo_title); libtwo_title.setTextColor(Preferences.PrimaryText()); TextView libtwo_content = (TextView) root.findViewById(R.id.libtwo_content); libtwo_content.setText(Html.fromHtml(getString(R.string.fab_desc))); libtwo_content.setTextColor(Preferences.SecondaryText()); TextView libtwo_license = (TextView) root.findViewById(R.id.libtwo_license); libtwo_license.setTextColor(Preferences.PrimaryText()); TextView libtwo_author = (TextView) root.findViewById(R.id.libtwo_author); libtwo_author.setTextColor(Preferences.SecondaryText()); //Library number three TextView libthree_title = (TextView) root.findViewById(R.id.libthree_title); libthree_title.setTextColor(Preferences.PrimaryText()); TextView libthree_content = (TextView) root.findViewById(R.id.libthree_content); libthree_content.setText(Html.fromHtml(getString(R.string.materialdialogs_desc))); libthree_content.setTextColor(Preferences.SecondaryText()); TextView libthree_license = (TextView) root.findViewById(R.id.libthree_license); libthree_license.setTextColor(Preferences.PrimaryText()); TextView libthree_author = (TextView) root.findViewById(R.id.libthree_author); libthree_author.setTextColor(Preferences.SecondaryText()); //Library number four TextView libfour_title = (TextView) root.findViewById(R.id.libfour_title); libfour_title.setTextColor(Preferences.PrimaryText()); TextView libfour_content = (TextView) root.findViewById(R.id.libfour_content); libfour_content.setText(Html.fromHtml(getString(R.string.materialdrawer_desc))); libfour_content.setTextColor(Preferences.SecondaryText()); TextView libfour_license = (TextView) root.findViewById(R.id.libfour_license); libfour_license.setTextColor(Preferences.PrimaryText()); TextView libfour_author = (TextView) root.findViewById(R.id.libfour_author); libfour_author.setTextColor(Preferences.SecondaryText()); //Library number five TextView libfive_title = (TextView) root.findViewById(R.id.libfive_title); libfive_title.setTextColor(Preferences.PrimaryText()); TextView libfive_content = (TextView) root.findViewById(R.id.libfive_content); libfive_content.setText(Html.fromHtml(getString(R.string.picasso_desc))); libfive_content.setTextColor(Preferences.SecondaryText()); TextView libfive_license = (TextView) root.findViewById(R.id.libfive_license); libfive_license.setTextColor(Preferences.PrimaryText()); TextView libfive_author = (TextView) root.findViewById(R.id.libfive_author); libfive_author.setTextColor(Preferences.SecondaryText()); //Library number six TextView libsix_title = (TextView) root.findViewById(R.id.libsix_title); libsix_title.setTextColor(Preferences.PrimaryText()); TextView libsix_content = (TextView) root.findViewById(R.id.libsix_content); libsix_content.setText(Html.fromHtml(getString(R.string.okhttp_desc))); libsix_content.setTextColor(Preferences.SecondaryText()); TextView libsix_license = (TextView) root.findViewById(R.id.libsix_license); libsix_license.setTextColor(Preferences.PrimaryText()); TextView libsix_author = (TextView) root.findViewById(R.id.libsix_author); libsix_author.setTextColor(Preferences.SecondaryText()); //Library number seven TextView libseven_title = (TextView) root.findViewById(R.id.libseven_title); libseven_title.setTextColor(Preferences.PrimaryText()); TextView libseven_content = (TextView) root.findViewById(R.id.libseven_content); libseven_content.setText(Html.fromHtml(getString(R.string.snackbar_desc))); libseven_content.setTextColor(Preferences.SecondaryText()); TextView libseven_license = (TextView) root.findViewById(R.id.libseven_license); libseven_license.setTextColor(Preferences.PrimaryText()); TextView libseven_author = (TextView) root.findViewById(R.id.libseven_author); libseven_author.setTextColor(Preferences.SecondaryText()); //Library number eight TextView libeight_title = (TextView) root.findViewById(R.id.libeight_title); libeight_title.setTextColor(Preferences.PrimaryText()); TextView libeight_content = (TextView) root.findViewById(R.id.libeight_content); libeight_content.setText(Html.fromHtml(getString(R.string.crash_desc))); libeight_content.setTextColor(Preferences.SecondaryText()); TextView libeight_license = (TextView) root.findViewById(R.id.libeight_license); libeight_license.setTextColor(Preferences.PrimaryText()); TextView libeight_author = (TextView) root.findViewById(R.id.libeight_author); libeight_author.setTextColor(Preferences.SecondaryText()); //Library number nine TextView libnine_title = (TextView) root.findViewById(R.id.libnine_title); libnine_title.setTextColor(Preferences.PrimaryText()); TextView libnine_content = (TextView) root.findViewById(R.id.libnine_content); libnine_content.setText(Html.fromHtml(getString(R.string.appintro_desc))); libnine_content.setTextColor(Preferences.SecondaryText()); TextView libnine_license = (TextView) root.findViewById(R.id.libnine_license); libnine_license.setTextColor(Preferences.PrimaryText()); TextView libnine_author = (TextView) root.findViewById(R.id.libnine_author); libnine_author.setTextColor(Preferences.SecondaryText()); //Library number ten TextView libten_title = (TextView) root.findViewById(R.id.libten_title); libten_title.setTextColor(Preferences.PrimaryText()); TextView libten_content = (TextView) root.findViewById(R.id.libten_content); libten_content.setText(Html.fromHtml(getString(R.string.materialripple_desc))); libten_content.setTextColor(Preferences.SecondaryText()); TextView libten_license = (TextView) root.findViewById(R.id.libten_license); libten_license.setTextColor(Preferences.PrimaryText()); TextView libten_author = (TextView) root.findViewById(R.id.libten_author); libten_author.setTextColor(Preferences.SecondaryText()); //Library number eleven TextView libeleven_title = (TextView) root.findViewById(R.id.libeleven_title); libeleven_title.setTextColor(Preferences.PrimaryText()); TextView libeleven_content = (TextView) root.findViewById(R.id.libeleven_content); libeleven_content.setText(Html.fromHtml(getString(R.string.materialpreference_desc))); libeleven_content.setTextColor(Preferences.SecondaryText()); TextView libeleven_license = (TextView) root.findViewById(R.id.libeleven_license); libeleven_license.setTextColor(Preferences.PrimaryText()); TextView libeleven_author = (TextView) root.findViewById(R.id.libeleven_author); libeleven_author.setTextColor(Preferences.SecondaryText()); //Library number twelve TextView libtwelve_title = (TextView) root.findViewById(R.id.libtwelve_title); libtwelve_title.setTextColor(Preferences.PrimaryText()); TextView libtwelve_content = (TextView) root.findViewById(R.id.libtwelve_content); libtwelve_content.setText(Html.fromHtml(getString(R.string.licensesdialog_desc))); libtwelve_content.setTextColor(Preferences.SecondaryText()); TextView libtwelve_license = (TextView) root.findViewById(R.id.libtwelve_license); libtwelve_license.setTextColor(Preferences.PrimaryText()); TextView libtwelve_author = (TextView) root.findViewById(R.id.libtwelve_author); libtwelve_author.setTextColor(Preferences.SecondaryText()); //Library source buttons TextView credit = (TextView) root.findViewById(R.id.github_button); credit.setTextColor(Preferences.Accent()); credit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent credit = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.jahir_link))); startActivity(credit); } }); TextView fab_web = (TextView) root.findViewById(R.id.floating_github_button); fab_web.setTextColor(Preferences.Accent()); fab_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent fab_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.fab_web))); startActivity(fab_web); } }); TextView materialdialogs_web = (TextView) root.findViewById(R.id.dialogs_github_button); materialdialogs_web.setTextColor(Preferences.Accent()); materialdialogs_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent materialdialogs_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.materialdialogs_web))); startActivity(materialdialogs_web); } }); TextView materialdrawer_web = (TextView) root.findViewById(R.id.materialdrawer_github_button); materialdrawer_web.setTextColor(Preferences.Accent()); materialdrawer_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent materialdrawer_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.materialdrawer_web))); startActivity(materialdrawer_web); } }); TextView picasso_web = (TextView) root.findViewById(R.id.picasso_github_button); picasso_web.setTextColor(Preferences.Accent()); picasso_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent picasso_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.picasso_web))); startActivity(picasso_web); } }); TextView okhttp_web = (TextView) root.findViewById(R.id.okhttp_github_button); okhttp_web.setTextColor(Preferences.Accent()); okhttp_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent okhttp_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.okhttp_web))); startActivity(okhttp_web); } }); TextView snackbar_web = (TextView) root.findViewById(R.id.snackbar_github_button); snackbar_web.setTextColor(Preferences.Accent()); snackbar_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent snackbar_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.snackbar_web))); startActivity(snackbar_web); } }); TextView crash_web = (TextView) root.findViewById(R.id.crash_github_button); crash_web.setTextColor(Preferences.Accent()); crash_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent crash_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.crash_web))); startActivity(crash_web); } }); TextView appintro_web = (TextView) root.findViewById(R.id.appintro_github_button); appintro_web.setTextColor(Preferences.Accent()); appintro_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent appintro_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.appintro_web))); startActivity(appintro_web); } }); TextView materialripple_web = (TextView) root.findViewById(R.id.materialripple_github_button); materialripple_web.setTextColor(Preferences.Accent()); materialripple_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent materialripple_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.materialripple_web))); startActivity(materialripple_web); } }); TextView materialpreference_web = (TextView) root.findViewById(R.id.materialpreference_github_button); materialpreference_web.setTextColor(Preferences.Accent()); materialpreference_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent materialpreference_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.materialpreference_web))); startActivity(materialpreference_web); } }); TextView licensesdialog_web = (TextView) root.findViewById(R.id.licensesdialog_github_button); licensesdialog_web.setTextColor(Preferences.Accent()); licensesdialog_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent licensesdialog_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.licensesdialog_web))); startActivity(licensesdialog_web); } }); return root; }
From source file:com.frostwire.android.gui.adapters.SearchResultListAdapter.java
private void populateFilePart(View view, FileSearchResult sr) { ImageView fileTypeIcon = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon); fileTypeIcon.setImageResource(getFileTypeIconId()); TextView adIndicator = findView(view, R.id.view_bittorrent_search_result_list_item_ad_indicator); adIndicator.setVisibility(View.GONE); TextView title = findView(view, R.id.view_bittorrent_search_result_list_item_title); title.setText(sr.getDisplayName());/*from w w w.java 2 s.c om*/ TextView fileSize = findView(view, R.id.view_bittorrent_search_result_list_item_file_size); if (sr.getSize() > 0) { fileSize.setText(UIUtils.getBytesInHuman(sr.getSize())); } else { fileSize.setText("..."); } TextView extra = findView(view, R.id.view_bittorrent_search_result_list_item_text_extra); extra.setText(FilenameUtils.getExtension(sr.getFilename())); TextView seeds = findView(view, R.id.view_bittorrent_search_result_list_item_text_seeds); seeds.setText(""); String license = sr.getLicense().equals(Licenses.UNKNOWN) ? "" : " - " + sr.getLicense(); TextView sourceLink = findView(view, R.id.view_bittorrent_search_result_list_item_text_source); sourceLink.setText(sr.getSource() + license); // TODO: ask for design sourceLink.setTag(sr.getDetailsUrl()); sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); sourceLink.setOnClickListener(linkListener); }
From source file:com.brodev.socialapp.view.BlogPostNew.java
private void initView() { TextView moduleName = (TextView) this.findViewById(R.id.moduleName); moduleName.setText(phraseManage.getPhrase(getApplicationContext(), "blog.add_a_new_blog")); TextView title = (TextView) this.findViewById(R.id.textTitle); title.setHint(phraseManage.getPhrase(getApplicationContext(), "blog.title")); TextView post = (TextView) this.findViewById(R.id.textCotent); post.setHint(phraseManage.getPhrase(getApplicationContext(), "blog.post")); ImageView privacyImg = (ImageView) this.findViewById(R.id.post_stt_privacy_img); colorView.changeColorPrivacy(privacyImg, user.getColor()); // category/*from w w w. j a v a2 s . co m*/ TextView categories = (TextView) this.findViewById(R.id.categoryView); categories.setText(phraseManage.getPhrase(getApplicationContext(), "blog.categories")); getCategory = (LinearLayout) this.findViewById(R.id.listCategories); BlogCategoryTask showBlogCategory = new BlogCategoryTask(); progressBlog = (ProgressBar) this.findViewById(R.id.progress_blog); showBlogCategory.execute(); // show privacy TextView postPrivacy = (TextView) this.findViewById(R.id.postPrivacy); postPrivacy.setText(phraseManage.getPhrase(getApplicationContext(), "blog.privacy")); final TextView privacy_status = (TextView) this.findViewById(R.id.status_privacy); privacy_status.setText(phraseManage.getPhrase(getApplicationContext(), "privacy.everyone")); privacy = new Privacy(this); privacy.setTextView(privacy_status); privacy_status.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { privacy.showMessage(); } catch (Exception e) { } } }); }
From source file:com.gh4a.IssueCreateActivity.java
public void fillLabels() { final Typeface boldCondensed = getApplicationContext().boldCondensed; final Typeface condensed = getApplicationContext().condensed; for (final Label label : mAllLabel) { final View rowView = getLayoutInflater().inflate(R.layout.row_issue_create_label, null); View viewColor = (View) rowView.findViewById(R.id.view_color); viewColor.setBackgroundColor(Color.parseColor("#" + label.getColor())); //viewColor.setPadding(10, 10, 10, 10); final TextView tvLabel = (TextView) rowView.findViewById(R.id.tv_title); tvLabel.setTypeface(condensed);/*from w w w . ja v a 2s . co m*/ tvLabel.setText(label.getName()); tvLabel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mSelectedLabels.contains(label)) { mSelectedLabels.remove(label); tvLabel.setTypeface(condensed); tvLabel.setBackgroundColor(0); if (Gh4Application.THEME == R.style.LightTheme) { tvLabel.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_light)); } else { tvLabel.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_dark)); } } else { mSelectedLabels.add(label); tvLabel.setTypeface(boldCondensed); tvLabel.setBackgroundColor(Color.parseColor("#" + label.getColor())); int r = Color.red(Color.parseColor("#" + label.getColor())); int g = Color.green(Color.parseColor("#" + label.getColor())); int b = Color.blue(Color.parseColor("#" + label.getColor())); if (r + g + b < 383) { tvLabel.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_dark)); } else { tvLabel.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_light)); } } } }); if (mEditMode) { if (mSelectedLabels.contains(label)) { tvLabel.setTypeface(boldCondensed); tvLabel.setBackgroundColor(Color.parseColor("#" + label.getColor())); int r = Color.red(Color.parseColor("#" + label.getColor())); int g = Color.green(Color.parseColor("#" + label.getColor())); int b = Color.blue(Color.parseColor("#" + label.getColor())); if (r + g + b < 383) { tvLabel.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_dark)); } else { tvLabel.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_light)); } } else { tvLabel.setTypeface(condensed); tvLabel.setBackgroundColor(0); if (Gh4Application.THEME == R.style.LightTheme) { tvLabel.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_light)); } else { tvLabel.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_dark)); } } } mLinearLayoutLabels.addView(rowView); } }