List of usage examples for android.widget TextView getPaintFlags
public int getPaintFlags()
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());//w w w .j a v a 2 s. co m 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.cicada.yuanxiaobao.common.BaseAdapterHelper.java
/** Apply the typeface to the given viewId, and enable subpixel rendering. */ public BaseAdapterHelper setTypeface(int viewId, Typeface typeface) { TextView view = retrieveView(viewId); view.setTypeface(typeface);/*from w w w . j av a2 s.co m*/ view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); return this; }
From source file:com.cicada.yuanxiaobao.common.BaseAdapterHelper.java
/** * Apply the typeface to all the given viewIds, and enable subpixel * rendering./*from w w w.java 2s .c om*/ */ public BaseAdapterHelper setTypeface(Typeface typeface, int... viewIds) { for (int viewId : viewIds) { TextView view = retrieveView(viewId); view.setTypeface(typeface); view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); } return this; }
From source file:com.aniruddhc.acemusic.player.Dialogs.BlacklistedElementsDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mApp = (Common) getActivity().getApplicationContext(); final BlacklistedElementsDialog dialog = this; MANAGER_TYPE = getArguments().getString("MANAGER_TYPE"); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Get a cursor with a list of blacklisted elements. if (MANAGER_TYPE.equals("ARTISTS")) { builder.setTitle(R.string.blacklisted_artists); cursor = mApp.getDBAccessHelper().getBlacklistedArtists(); } else if (MANAGER_TYPE.equals("ALBUMS")) { builder.setTitle(R.string.blacklisted_albums); cursor = mApp.getDBAccessHelper().getBlacklistedAlbums(); } else if (MANAGER_TYPE.equals("SONGS")) { builder.setTitle(R.string.blacklisted_songs); cursor = mApp.getDBAccessHelper().getAllBlacklistedSongs(); } else if (MANAGER_TYPE.equals("PLAYLISTS")) { builder.setTitle(R.string.blacklisted_playlists); /*DBAccessHelper playlistsDBHelper = new DBAccessHelper(getActivity()); cursor = playlistsDBHelper.getAllBlacklistedPlaylists();*/ } else {/*from w w w . j a v a2s .co m*/ Toast.makeText(getActivity(), R.string.error_occurred, Toast.LENGTH_LONG).show(); return builder.create(); } //Dismiss the dialog if there are no blacklisted elements. if (cursor.getCount() == 0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); return builder.create(); } //Loop through checkboxStatuses and insert "TRUE" at every position by default. for (int i = 0; i < cursor.getCount(); i++) { checkboxStatuses.add(true); } View rootView = this.getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_blacklist_manager, null); TextView blacklistManagerInfoText = (TextView) rootView.findViewById(R.id.blacklist_manager_info_text); ListView blacklistManagerListView = (ListView) rootView.findViewById(R.id.blacklist_manager_list); blacklistManagerInfoText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light")); blacklistManagerInfoText.setPaintFlags( blacklistManagerInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); blacklistManagerListView.setFastScrollEnabled(true); BlacklistedElementsAdapter adapter = new BlacklistedElementsAdapter(getActivity(), cursor); blacklistManagerListView.setAdapter(adapter); builder.setView(rootView); builder.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { dialog.dismiss(); } }); builder.setPositiveButton(R.string.done, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //Loop through checkboxStatuses and unblacklist the elements that have been unchecked. for (int i = 0; i < checkboxStatuses.size(); i++) { cursor.moveToPosition(i); if (checkboxStatuses.get(i) == true) { //The item is still blacklisted. continue; } else { //The item has been unblacklisted. if (MANAGER_TYPE.equals("ARTISTS")) { mApp.getDBAccessHelper().setBlacklistForArtist( cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST)), false); } else if (MANAGER_TYPE.equals("ALBUMS")) { mApp.getDBAccessHelper().setBlacklistForAlbum( cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ALBUM)), cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST)), false); } else if (MANAGER_TYPE.equals("SONGS")) { mApp.getDBAccessHelper().setBlacklistForSong( cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_FILE_PATH)), false); } else if (MANAGER_TYPE.equals("PLAYLISTS")) { /*DBAccessHelper playlistsDBHelper = new DBAccessHelper(getActivity()); playlistsDBHelper.unBlacklistPlaylist(cursor.getString(cursor.getColumnIndex(DBAccessHelper.PLAYLIST_BLACKLIST_STATUS)));*/ } } } dialog.dismiss(); } }); return builder.create(); }
From source file:se.frikod.payday.DailyBudgetFragment.java
private void updateBudgetItems() { TableLayout itemsTable = (TableLayout) V.findViewById(R.id.budgetItems); itemsTable.removeAllViews();//from ww w . j a va 2 s . c o m for (int i = 0; i < budget.budgetItems.size(); i++) { BudgetItem bi = budget.budgetItems.get(i); final int currentIndex = i; LayoutInflater inflater = activity.getLayoutInflater(); TableRow budgetItemView = (TableRow) inflater.inflate(R.layout.daily_budget_budget_item, itemsTable, false); TextView amount = (TextView) budgetItemView.findViewById(R.id.budgetItemAmount); TextView title = (TextView) budgetItemView.findViewById(R.id.budgetItemLabel); amount.setText(budget.formatter.format(bi.amount)); title.setText(bi.title); if (bi.exclude) { amount.setTextColor(0xffCCCCCC); amount.setPaintFlags(amount.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); title.setTextColor(0xffCCCCCC); title.setPaintFlags(title.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } budgetItemView.setClickable(true); budgetItemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(10); BudgetItem bi = budget.budgetItems.get(currentIndex); bi.exclude = !bi.exclude; budget.saveBudgetItems(); updateBudgetItems(); } }); budgetItemView.setLongClickable(true); budgetItemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { editBudgetItem(v, currentIndex); return true; } }); itemsTable.addView(budgetItemView); } FontUtils.setRobotoFont(activity, itemsTable); updateBudget(); }
From source file:com.todoroo.astrid.adapter.TaskAdapter.java
/** Helper method to adjust a tasks' appearance if the task is completed or * uncompleted./*from ww w. j av a2 s. c o m*/ */ private void setTaskAppearance(ViewHolder viewHolder, Task task) { boolean completed = task.isCompleted(); TextView name = viewHolder.nameView; if (completed) { name.setEnabled(false); name.setPaintFlags(name.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { name.setEnabled(true); name.setPaintFlags(name.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); } name.setTextSize(fontSize); setupDueDateAndTags(viewHolder, task); float detailTextSize = Math.max(10, fontSize * 14 / 20); if (viewHolder.dueDate != null) { viewHolder.dueDate.setTextSize(detailTextSize); viewHolder.dueDate.setTypeface(null, 0); } setupCompleteBox(viewHolder); }
From source file:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistManagerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mApp = (Common) getActivity().getApplicationContext(); View rootView = (ViewGroup) inflater.inflate(R.layout.fragment_blacklist_manager, container, false); mContext = getActivity().getApplicationContext(); ImageView blacklistImage = (ImageView) rootView.findViewById(R.id.blacklist_image); blacklistImage.setImageResource(UIElementsHelper.getIcon(mContext, "manage_blacklists")); MANAGER_TYPE = getArguments().getString("MANAGER_TYPE"); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Get a cursor with a list of blacklisted elements. if (MANAGER_TYPE.equals("ARTISTS")) { builder.setTitle(R.string.blacklisted_artists); cursor = mApp.getDBAccessHelper().getBlacklistedArtists(); //Finish the activity if there are no blacklisted elements. if (cursor.getCount() == 0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); getActivity().finish();//from w w w . ja va2s.c o m } else { //Load the cursor data into temporary ArrayLists. for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); elementNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST))); } } } else if (MANAGER_TYPE.equals("ALBUMS")) { builder.setTitle(R.string.blacklisted_albums); cursor = mApp.getDBAccessHelper().getBlacklistedAlbums(); //Finish the activity if there are no blacklisted elements. if (cursor.getCount() == 0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); getActivity().finish(); } else { //Load the cursor data into temporary ArrayLists. for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); elementNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ALBUM))); artistNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST))); } } } else if (MANAGER_TYPE.equals("SONGS")) { builder.setTitle(R.string.blacklisted_songs); cursor = mApp.getDBAccessHelper().getAllBlacklistedSongs(); //Finish the activity if there are no blacklisted elements. if (cursor.getCount() == 0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); getActivity().finish(); } else { //Load the cursor data into temporary ArrayLists. for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); elementNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_TITLE))); artistNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST))); filePathList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_FILE_PATH))); songIdsList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ID))); } } } else if (MANAGER_TYPE.equals("PLAYLISTS")) { /*builder.setTitle(R.string.blacklisted_playlists); DBAccessHelper playlistsDBHelper = new DBAccessHelper(getActivity()); cursor = playlistsDBHelper.getAllBlacklistedPlaylists(); //Finish the activity if there are no blacklisted elements. if (cursor.getCount()==0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); getActivity().finish(); } else { //Load the cursor data into temporary ArrayLists. for (int i=0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); elementNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.PLAYLIST_NAME))); artistNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.NUMBER_OF_SONGS))); filePathList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.PLAYLIST_FILE_PATH))); } }*/ } else { Toast.makeText(getActivity(), R.string.error_occurred, Toast.LENGTH_LONG).show(); getActivity().finish(); } TextView blacklistManagerInfoText = (TextView) rootView.findViewById(R.id.blacklist_manager_info_text); DragSortListView blacklistManagerListView = (DragSortListView) rootView .findViewById(R.id.blacklist_manager_list); blacklistManagerListView.setRemoveListener(onRemove); blacklistManagerInfoText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light")); blacklistManagerInfoText.setPaintFlags( blacklistManagerInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); blacklistManagerListView.setFastScrollEnabled(true); adapter = new BlacklistedElementsAdapter(getActivity(), elementNameList, artistNameList, MANAGER_TYPE); blacklistManagerListView.setAdapter(adapter); return rootView; }
From source file:com.evandroid.musica.fragment.LyricsViewFragment.java
public void update(Lyrics lyrics, View layout, boolean animation) { TextSwitcher textSwitcher = ((TextSwitcher) layout.findViewById(R.id.switcher)); LrcView lrcView = (LrcView) layout.findViewById(R.id.lrc_view); View v = getActivity().findViewById(R.id.tracks_msg); if (v != null) ((ViewGroup) v.getParent()).removeView(v); TextView id3TV = (TextView) layout.findViewById(R.id.id3_tv); RelativeLayout bugLayout = (RelativeLayout) layout.findViewById(R.id.error_msg); this.mLyrics = lyrics; if (SDK_INT >= ICE_CREAM_SANDWICH) beamLyrics(lyrics, this.getActivity()); new PresenceChecker().execute(this, new String[] { lyrics.getArtist(), lyrics.getTrack(), lyrics.getOriginalArtist(), lyrics.getOriginalTrack() }); if (isActiveFragment) ((RefreshIcon) getActivity().findViewById(R.id.refresh_fab)).show(); EditText newLyrics = (EditText) getActivity().findViewById(R.id.edit_lyrics); if (newLyrics != null) newLyrics.setText(""); if (lyrics.getFlag() == Lyrics.POSITIVE_RESULT) { if (!lyrics.isLRC()) { textSwitcher.setVisibility(View.VISIBLE); lrcView.setVisibility(View.GONE); if (animation) textSwitcher.setText(Html.fromHtml(lyrics.getText())); else//from w w w . j a v a 2 s.c o m textSwitcher.setCurrentText(Html.fromHtml(lyrics.getText())); } else { textSwitcher.setVisibility(View.GONE); lrcView.setVisibility(View.VISIBLE); lrcView.setOriginalLyrics(lyrics); lrcView.setSourceLrc(lyrics.getText()); updateLRC(); } bugLayout.setVisibility(View.INVISIBLE); if ("Storage".equals(lyrics.getSource())) id3TV.setVisibility(View.VISIBLE); else id3TV.setVisibility(View.GONE); mScrollView.post(new Runnable() { @Override public void run() { mScrollView.scrollTo(0, 0); //only useful when coming from localLyricsFragment mScrollView.smoothScrollTo(0, 0); } }); } else { textSwitcher.setText(""); textSwitcher.setVisibility(View.INVISIBLE); lrcView.setVisibility(View.INVISIBLE); bugLayout.setVisibility(View.VISIBLE); int message; int whyVisibility; if (lyrics.getFlag() == Lyrics.ERROR || !OnlineAccessVerifier.check(getActivity())) { message = R.string.connection_error; whyVisibility = TextView.GONE; } else { message = R.string.no_results; whyVisibility = TextView.VISIBLE; updateSearchView(false, lyrics.getTrack(), false); } TextView whyTextView = ((TextView) bugLayout.findViewById(R.id.bugtext_why)); ((TextView) bugLayout.findViewById(R.id.bugtext)).setText(message); whyTextView.setVisibility(whyVisibility); whyTextView.setPaintFlags(whyTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); id3TV.setVisibility(View.GONE); } stopRefreshAnimation(); getActivity().getIntent().setAction(""); getActivity().invalidateOptionsMenu(); }
From source file:com.aniruddhc.acemusic.player.LauncherActivity.LauncherActivity.java
public void showTrialDialog(final boolean expired, int numDaysRemaining) { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(R.string.app_name); builder.setCancelable(false);//from w w w .jav a 2 s .c o m View view = this.getLayoutInflater().inflate(R.layout.trial_expiry_dialog, null); TextView trialExpiredText = (TextView) view.findViewById(R.id.trial_message); TextView trialDaysRemaining = (TextView) view.findViewById(R.id.trial_days_remaining); TextView trialDaysCaps = (TextView) view.findViewById(R.id.days_caps); trialExpiredText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); trialExpiredText .setPaintFlags(trialExpiredText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); trialDaysRemaining.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); trialDaysCaps.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); trialDaysCaps .setPaintFlags(trialDaysCaps.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); if (expired) { trialDaysRemaining.setText(R.string.expired); trialExpiredText.setText(R.string.trial_expired); trialDaysRemaining.setTextColor(0xFFFF8800); trialDaysCaps.setVisibility(View.GONE); trialDaysRemaining.setTextSize(36); trialDaysRemaining.setPaintFlags( trialDaysRemaining.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); } else { trialExpiredText.setText(R.string.trial_running); trialDaysRemaining.setText("" + numDaysRemaining); trialDaysCaps.setVisibility(View.VISIBLE); trialDaysRemaining.setTextColor(0xFF0099CC); trialDaysRemaining.setPaintFlags(trialDaysRemaining.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); } builder.setView(view); builder.setPositiveButton(R.string.upgrade, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { showUpgradeFragmentWithPromo(); } }); builder.setNegativeButton(R.string.later, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (expired) { finish(); } else { launchMainActivity(); } } }); builder.create().show(); }
From source file:com.hypodiabetic.happ.MainActivity.java
public void displayCurrentInfo() { final TextView currentBgValueText = (TextView) findViewById(R.id.currentBgValueRealTime); final TextView notificationText = (TextView) findViewById(R.id.notices); final TextView deltaText = (TextView) findViewById(R.id.bgDelta); if ((currentBgValueText.getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) > 0) { currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); }//from w w w . j a va2 s . com Bg lastBgreading = Bg.last(); if (lastBgreading != null) { notificationText.setText(lastBgreading.readingAge()); String bgDelta = tools.unitizedBG(lastBgreading.bgdelta, MainApp.instance().getApplicationContext()); if (lastBgreading.bgdelta >= 0) bgDelta = "+" + bgDelta; deltaText.setText(bgDelta); currentBgValueText.setText(extendedGraphBuilder.unitized_string(lastBgreading.sgv_double()) + " " + lastBgreading.slopeArrow()); if ((new Date().getTime()) - (60000 * 16) - lastBgreading.datetime > 0) { notificationText.setTextColor(Color.parseColor("#C30909")); currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { notificationText.setTextColor(Color.WHITE); } double estimate = lastBgreading.sgv_double(); if (extendedGraphBuilder.unitized(estimate) <= extendedGraphBuilder.lowMark) { currentBgValueText.setTextColor(Color.parseColor("#C30909")); } else if (extendedGraphBuilder.unitized(estimate) >= extendedGraphBuilder.highMark) { currentBgValueText.setTextColor(Color.parseColor("#FFBB33")); } else { currentBgValueText.setTextColor(Color.WHITE); } } //Stats UI update updateStats(null); //OpenAPS UI update updateOpenAPSDetails(null); //Temp Basal running update updateRunningTemp(); }