List of usage examples for android.text.style RelativeSizeSpan RelativeSizeSpan
public RelativeSizeSpan(@NonNull Parcel src)
From source file:com.android.deskclock.Utils.java
/** * @param context - context used to get time format string resource * @param showAmPm - include the am/pm string if true * @return format string for 12 hours mode time *//* w w w .ja va 2s . c o m*/ public static CharSequence get12ModeFormat(Context context, boolean showAmPm) { String pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), "hma"); if (!showAmPm) { pattern = pattern.replaceAll("a", "").trim(); } // Replace spaces with "Hair Space" pattern = pattern.replaceAll(" ", "\u200A"); // Build a spannable so that the am/pm will be formatted int amPmPos = pattern.indexOf('a'); if (amPmPos == -1) { return pattern; } final Resources resources = context.getResources(); final float amPmProportion = resources.getFraction(R.fraction.ampm_font_size_scale, 1, 1); final Spannable sp = new SpannableString(pattern); sp.setSpan(new RelativeSizeSpan(amPmProportion), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); sp.setSpan(new StyleSpan(Typeface.NORMAL), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); sp.setSpan(new TypefaceSpan("sans-serif"), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Make the font smaller for locales with long am/pm strings. if (Utils.isAmPmStringLong()) { final float proportion = resources.getFraction(R.fraction.reduced_clock_font_size_scale, 1, 1); sp.setSpan(new RelativeSizeSpan(proportion), 0, pattern.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } return sp; }
From source file:at.jclehner.rxdroid.DrugListActivity.java
@TargetApi(11) private void updateDateString() { if (mCurrentDate == null) return;//from w w w. ja va 2s.c o m final SpannableString dateString = new SpannableString( DateFormat.getDateFormat(this).format(mCurrentDate.getTime())); if (isShowingCurrentDate()) Util.applyStyle(dateString, new UnderlineSpan()); Util.applyStyle(dateString, new RelativeSizeSpan(0.75f)); getSupportActionBar().setSubtitle(dateString); }
From source file:info.guardianproject.otr.app.im.app.MessageView.java
private CharSequence formatPresenceUpdates(String contact, int type, boolean isGroupChat, boolean scrolling) { String body;//www. ja v a2s . c o m Resources resources = getResources(); switch (type) { case Imps.MessageType.PRESENCE_AVAILABLE: body = resources.getString(isGroupChat ? R.string.contact_joined : R.string.contact_online, contact); break; case Imps.MessageType.PRESENCE_AWAY: body = resources.getString(R.string.contact_away, contact); break; case Imps.MessageType.PRESENCE_DND: body = resources.getString(R.string.contact_busy, contact); break; case Imps.MessageType.PRESENCE_UNAVAILABLE: body = resources.getString(isGroupChat ? R.string.contact_left : R.string.contact_offline, contact); break; default: return null; } if (scrolling) { return body; } else { SpannableString spanText = new SpannableString(body); int len = spanText.length(); spanText.setSpan(new StyleSpan(Typeface.ITALIC), 0, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); spanText.setSpan(new RelativeSizeSpan((float) 0.8), 0, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return spanText; } }
From source file:com.nttec.everychan.ui.presentation.HtmlParser.java
private static void endHeader(SpannableStringBuilder text) { int len = text.length(); Object obj = getLast(text, Header.class); int where = text.getSpanStart(obj); text.removeSpan(obj);/*from ww w . ja v a2 s. c om*/ // Back off not to change only the text, not the blank line. while (len > where && text.charAt(len - 1) == '\n') { len--; } if (where != len) { Header h = (Header) obj; text.setSpan(new RelativeSizeSpan(HEADER_SIZES[h.mLevel]), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); text.setSpan(new StyleSpan(Typeface.BOLD), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } }
From source file:com.msopentech.applicationgateway.EnterpriseBrowserActivity.java
public void showSettingsPopup(View v) { try {//from ww w .java 2 s .c o m PopupMenu popup = new PopupMenu(this, v); MenuInflater inflater = popup.getMenuInflater(); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.menu_connection: { showAgentsList(); return true; } case R.id.menu_sign_in_or_out: { if (mIsSigninRequired) { // Menu item in sign in mode. //TODO: showSignIn(null, true); return true; } // Clean up the session. mTraits.sessionID = null; mTraits.token = null; mTraits.agent = null; // Indicate the condition. mIsSigninRequired = true; //Remove all tabs except one. mCustomTabHost.resetTabs(); mUrlEditTextView.setText(""); mProgressBarView.setProgress(0); // Disable the reload button and set the right image for it. mReloadButtonView.setEnabled(false); mReloadButtonView.setImageResource(R.drawable.reload_button); mStatusButtonView.setImageResource(R.drawable.connection_red); // Since it's the user's intention to sign out, his // history must be dropped. PersistenceManager.dropContent(PersistenceManager.ContentType.HISTORY); return true; } // Removed from RELEASE version. Should be active for development ONLY. // case R.id.menu_advanced_router_settings: { // showAdvancedRouterSettings(null); // } default: { return false; } } } }); inflater.inflate(R.menu.settings_menu, popup.getMenu()); if (mIsSigninRequired) { MenuItem signItem = popup.getMenu().findItem(R.id.menu_sign_in_or_out); signItem.setTitle(getResources().getString(R.string.browser_menu_item_sign_in)); } // Assumes that agent always has a display name. If display name is not present agent is considered to be not connected. MenuItem agentItem = popup.getMenu().findItem(R.id.menu_connection); String status = getResources().getString(R.string.browser_menu_item_choose_connection_not_connected); if (mTraits != null && mTraits.agent != null && !TextUtils.isEmpty(mTraits.agent.getDisplayName())) { status = mTraits.agent.getDisplayName(); } Spannable span = new SpannableString( getResources().getString(R.string.browser_menu_item_choose_connection, status)); span.setSpan(new RelativeSizeSpan(0.8f), 18, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); span.setSpan(new ForegroundColorSpan(Color.GRAY), 18, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); agentItem.setTitle(span); popup.show(); } catch (final Exception e) { Utility.showAlertDialog(EnterpriseBrowserActivity.class.getSimpleName() + ".showSettingsPopup(): Failed. " + e.toString(), EnterpriseBrowserActivity.this); } }
From source file:org.miaowo.miaowo.util.Html.java
private void handleEndTag(String tag) { if (tag.equalsIgnoreCase("br")) { handleBr(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("p")) { endCssStyle(mSpannableStringBuilder); endBlockElement(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("ul")) { endBlockElement(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("li")) { endLi(mSpannableStringBuilder);/*from w w w . j av a 2 s . co m*/ } else if (tag.equalsIgnoreCase("div")) { endBlockElement(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("span")) { endCssStyle(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("strong")) { end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD)); } else if (tag.equalsIgnoreCase("b")) { end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD)); } else if (tag.equalsIgnoreCase("em")) { end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC)); } else if (tag.equalsIgnoreCase("cite")) { end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC)); } else if (tag.equalsIgnoreCase("dfn")) { end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC)); } else if (tag.equalsIgnoreCase("i")) { end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC)); } else if (tag.equalsIgnoreCase("big")) { end(mSpannableStringBuilder, Big.class, new RelativeSizeSpan(1.25f)); } else if (tag.equalsIgnoreCase("small")) { end(mSpannableStringBuilder, Small.class, new RelativeSizeSpan(0.8f)); } else if (tag.equalsIgnoreCase("font")) { endFont(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("blockquote")) { endBlockquote(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("tt")) { end(mSpannableStringBuilder, Monospace.class, new TypefaceSpan("monospace")); } else if (tag.equalsIgnoreCase("a")) { endA(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("u")) { end(mSpannableStringBuilder, Underline.class, new UnderlineSpan()); } else if (tag.equalsIgnoreCase("del")) { end(mSpannableStringBuilder, Strikethrough.class, new StrikethroughSpan()); } else if (tag.equalsIgnoreCase("s")) { end(mSpannableStringBuilder, Strikethrough.class, new StrikethroughSpan()); } else if (tag.equalsIgnoreCase("strike")) { end(mSpannableStringBuilder, Strikethrough.class, new StrikethroughSpan()); } else if (tag.equalsIgnoreCase("sup")) { end(mSpannableStringBuilder, Super.class, new SuperscriptSpan()); } else if (tag.equalsIgnoreCase("sub")) { end(mSpannableStringBuilder, Sub.class, new SubscriptSpan()); } else if (tag.length() == 2 && Character.toLowerCase(tag.charAt(0)) == 'h' && tag.charAt(1) >= '1' && tag.charAt(1) <= '6') { endHeading(mSpannableStringBuilder); } else if (mTagHandler != null) { mTagHandler.handleTag(false, tag, mSpannableStringBuilder, mReader); } }
From source file:org.awesomeapp.messenger.ui.MessageListItem.java
private CharSequence formatPresenceUpdates(String contact, int type, Date date, boolean isGroupChat, boolean scrolling) { String body;// ww w. j a v a2 s . c om Resources resources = getResources(); switch (type) { case Imps.MessageType.PRESENCE_AVAILABLE: body = resources.getString(isGroupChat ? R.string.contact_joined : R.string.contact_online, contact); break; case Imps.MessageType.PRESENCE_AWAY: body = resources.getString(R.string.contact_away, contact); break; case Imps.MessageType.PRESENCE_DND: body = resources.getString(R.string.contact_busy, contact); break; case Imps.MessageType.PRESENCE_UNAVAILABLE: body = resources.getString(isGroupChat ? R.string.contact_left : R.string.contact_offline, contact); break; default: return null; } body += " - "; body += formatTimeStamp(date, type, null, EncryptionState.NONE, null); if (scrolling) { return body; } else { SpannableString spanText = new SpannableString(body); int len = spanText.length(); spanText.setSpan(new StyleSpan(Typeface.ITALIC), 0, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); spanText.setSpan(new RelativeSizeSpan((float) 0.8), 0, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return spanText; } }
From source file:org.miaowo.miaowo.util.Html.java
private static void endHeading(Editable text) { // RelativeSizeSpan and StyleSpan are CharacterStyles // Their ranges should not include the newlines at the end Heading h = getLast(text, Heading.class); if (h != null) { setSpanFromMark(text, h, new RelativeSizeSpan(HEADING_SIZES[h.mLevel]), new StyleSpan(Typeface.BOLD)); }/*from w ww .jav a 2 s . co m*/ endBlockElement(text); }
From source file:org.tvbrowser.tvbrowser.TvBrowser.java
private void showChannelSelectionInternal(final String selection, final String title, final String help, final boolean delete) { String[] projection = {/* w w w . ja v a 2 s . com*/ TvBrowserContentProvider.CHANNEL_TABLE + "." + TvBrowserContentProvider.KEY_ID + " AS " + TvBrowserContentProvider.KEY_ID, TvBrowserContentProvider.GROUP_KEY_DATA_SERVICE_ID, TvBrowserContentProvider.CHANNEL_KEY_NAME, TvBrowserContentProvider.CHANNEL_KEY_SELECTION, TvBrowserContentProvider.CHANNEL_KEY_CATEGORY, TvBrowserContentProvider.CHANNEL_KEY_LOGO, TvBrowserContentProvider.CHANNEL_KEY_ALL_COUNTRIES }; ContentResolver cr = getContentResolver(); Cursor channels = cr.query(TvBrowserContentProvider.CONTENT_URI_CHANNELS_WITH_GROUP, projection, selection, null, TvBrowserContentProvider.CHANNEL_KEY_NAME); channels.moveToPosition(-1); // populate array list with all available channels final ArrayListWrapper channelSelectionList = new ArrayListWrapper(); ArrayList<Country> countryList = new ArrayList<Country>(); int channelIdColumn = channels.getColumnIndex(TvBrowserContentProvider.KEY_ID); int categoryColumn = channels.getColumnIndex(TvBrowserContentProvider.CHANNEL_KEY_CATEGORY); int logoColumn = channels.getColumnIndex(TvBrowserContentProvider.CHANNEL_KEY_LOGO); int dataServiceColumn = channels.getColumnIndex(TvBrowserContentProvider.GROUP_KEY_DATA_SERVICE_ID); int nameColumn = channels.getColumnIndex(TvBrowserContentProvider.CHANNEL_KEY_NAME); int countyColumn = channels.getColumnIndex(TvBrowserContentProvider.CHANNEL_KEY_ALL_COUNTRIES); int selectionColumn = channels.getColumnIndex(TvBrowserContentProvider.CHANNEL_KEY_SELECTION); ; while (channels.moveToNext()) { int channelID = channels.getInt(channelIdColumn); int category = channels.getInt(categoryColumn); byte[] logo = channels.getBlob(logoColumn); String dataService = channels.getString(dataServiceColumn); String name = channels.getString(nameColumn); String countries = channels.getString(countyColumn); boolean isSelected = channels.getInt(selectionColumn) == 1 && !delete; if (countries.contains("$")) { String[] values = countries.split("\\$"); for (String country : values) { Country test = new Country(new Locale(country, country)); if (!countryList.contains(test) && test.mLocale.getDisplayCountry().trim().length() > 0) { countryList.add(test); } } } else { Country test = new Country(new Locale(countries, countries)); if (!countryList.contains(test) && test.mLocale.getDisplayCountry().trim().length() > 0) { countryList.add(test); } } Bitmap channelLogo = UiUtils.createBitmapFromByteArray(logo); if (channelLogo != null) { BitmapDrawable l = new BitmapDrawable(getResources(), channelLogo); ColorDrawable background = new ColorDrawable(SettingConstants.LOGO_BACKGROUND_COLOR); background.setBounds(0, 0, channelLogo.getWidth() + 2, channelLogo.getHeight() + 2); LayerDrawable logoDrawable = new LayerDrawable(new Drawable[] { background, l }); logoDrawable.setBounds(background.getBounds()); l.setBounds(2, 2, channelLogo.getWidth(), channelLogo.getHeight()); channelLogo = UiUtils.drawableToBitmap(logoDrawable); } channelSelectionList.add(new ChannelSelection(channelID, name, category, countries, channelLogo, isSelected, SettingConstants.EPG_DONATE_KEY.equals(dataService))); } // sort countries for filtering Collections.sort(countryList, new Comparator<Country>() { @Override public int compare(Country lhs, Country rhs) { return lhs.toString().compareToIgnoreCase(rhs.toString()); } }); countryList.add(0, new Country(null)); channels.close(); // create filter for filtering of category and country final ChannelFilter filter = new ChannelFilter(SettingConstants.TV_CATEGORY, null); // create default logo for channels without logo final Bitmap defaultLogo = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); final Set<String> firstDeletedChannels = PrefUtils.getStringSetValue(R.string.PREF_FIRST_DELETED_CHANNELS, new HashSet<String>()); final Set<String> keptDeletedChannels = PrefUtils.getStringSetValue(R.string.PREF_KEPT_DELETED_CHANNELS, new HashSet<String>()); final int firstDeletedColor = getResources().getColor(R.color.pref_first_deleted_channels); final int keptDeletedColor = getResources().getColor(R.color.pref_kept_deleted_channels); // Custom array adapter for channel selection final ArrayAdapter<ChannelSelection> channelSelectionAdapter = new ArrayAdapter<ChannelSelection>( TvBrowser.this, R.layout.channel_row, channelSelectionList) { public View getView(int position, View convertView, ViewGroup parent) { ChannelSelection value = getItem(position); ViewHolder holder = null; if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) getContext() .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.channel_row, getParentViewGroup(), false); holder.mTextView = (TextView) convertView.findViewById(R.id.row_of_channel_text); holder.mCheckBox = (CheckBox) convertView.findViewById(R.id.row_of_channel_selection); holder.mLogo = (ImageView) convertView.findViewById(R.id.row_of_channel_icon); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } SpannableStringBuilder nameBuilder = new SpannableStringBuilder(value.toString()); String channelID = String.valueOf(value.getChannelID()); if (keptDeletedChannels.contains(channelID)) { nameBuilder.setSpan(new ForegroundColorSpan(keptDeletedColor), 0, value.toString().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } else if (firstDeletedChannels.contains(channelID)) { nameBuilder.setSpan(new ForegroundColorSpan(firstDeletedColor), 0, value.toString().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } if (value.isEpgDonateChannel()) { nameBuilder.append("\n(EPGdonate)"); nameBuilder.setSpan(new RelativeSizeSpan(0.65f), value.toString().length(), nameBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } holder.mTextView.setText(nameBuilder); holder.mCheckBox.setChecked(value.isSelected()); Bitmap logo = value.getLogo(); if (logo != null) { holder.mLogo.setImageBitmap(logo); } else { holder.mLogo.setImageBitmap(defaultLogo); } return convertView; } }; // inflate channel selection view View channelSelectionView = getLayoutInflater().inflate(R.layout.dialog_channel_selection_list, getParentViewGroup(), false); channelSelectionView.findViewById(R.id.channel_selection_selection_buttons).setVisibility(View.GONE); channelSelectionView.findViewById(R.id.channel_selection_input_id_name).setVisibility(View.GONE); TextView infoView = (TextView) channelSelectionView.findViewById(R.id.channel_selection_label_id_name); if (help != null) { infoView.setText(help); infoView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.epg_donate_info_font_size)); } else { infoView.setVisibility(View.GONE); } // get spinner for country filtering and create array adapter with all available countries Spinner country = (Spinner) channelSelectionView.findViewById(R.id.channel_country_value); final ArrayAdapter<Country> countryListAdapter = new ArrayAdapter<Country>(this, android.R.layout.simple_spinner_item, countryList); countryListAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); country.setAdapter(countryListAdapter); // add item selection listener to react of user setting filter for country country.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Country country = countryListAdapter.getItem(position); filter.mCountry = country.getCountry(); channelSelectionList.setFilter(filter); channelSelectionAdapter.notifyDataSetChanged(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); // get spinner for category selection and add listener to react to user category selection Spinner category = (Spinner) channelSelectionView.findViewById(R.id.channel_category_value); category.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 1: filter.mCategory = SettingConstants.TV_CATEGORY; break; case 2: filter.mCategory = SettingConstants.RADIO_CATEGORY; break; case 3: filter.mCategory = SettingConstants.CINEMA_CATEGORY; break; default: filter.mCategory = SettingConstants.NO_CATEGORY; break; } channelSelectionList.setFilter(filter); channelSelectionAdapter.notifyDataSetChanged(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); if (delete) { channelSelectionView.findViewById(R.id.channel_country_label).setVisibility(View.GONE); channelSelectionView.findViewById(R.id.channel_category_label).setVisibility(View.GONE); country.setVisibility(View.GONE); category.setVisibility(View.GONE); } // get the list view of the layout and add adapter with available channels ListView list = (ListView) channelSelectionView.findViewById(R.id.channel_selection_list); list.setAdapter(channelSelectionAdapter); // add listener to react to user selection of channels list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { CheckBox check = (CheckBox) view.findViewById(R.id.row_of_channel_selection); if (check != null) { check.setChecked(!check.isChecked()); channelSelectionAdapter.getItem(position).setSelected(check.isChecked()); } } }); // show dialog only if channels are available if (!channelSelectionList.isEmpty()) { AlertDialog.Builder builder = new AlertDialog.Builder(TvBrowser.this); if (title == null) { builder.setTitle(R.string.select_channels); } else { builder.setTitle(title); } builder.setView(channelSelectionView); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { boolean somethingSelected = false; boolean somethingChanged = false; Iterator<ChannelSelection> it = channelSelectionList.superIterator(); StringBuilder deleteWhere = new StringBuilder(); HashSet<String> keep = new HashSet<String>(); while (it.hasNext()) { ChannelSelection sel = it.next(); if (sel.isSelected() && !sel.wasSelected()) { somethingChanged = somethingSelected = true; if (delete) { if (deleteWhere.length() > 0) { deleteWhere.append(", "); } deleteWhere.append(sel.getChannelID()); } else { ContentValues values = new ContentValues(); values.put(TvBrowserContentProvider.CHANNEL_KEY_SELECTION, 1); getContentResolver().update( ContentUris.withAppendedId(TvBrowserContentProvider.CONTENT_URI_CHANNELS, sel.getChannelID()), values, null, null); } } else if (!sel.isSelected() && sel.wasSelected()) { somethingChanged = true; ContentValues values = new ContentValues(); values.put(TvBrowserContentProvider.CHANNEL_KEY_SELECTION, 0); getContentResolver().update( ContentUris.withAppendedId(TvBrowserContentProvider.CONTENT_URI_CHANNELS, sel.getChannelID()), values, null, null); getContentResolver().delete(TvBrowserContentProvider.CONTENT_URI_DATA_VERSION, TvBrowserContentProvider.CHANNEL_KEY_CHANNEL_ID + "=" + sel.getChannelID(), null); getContentResolver().delete(TvBrowserContentProvider.CONTENT_URI_DATA, TvBrowserContentProvider.CHANNEL_KEY_CHANNEL_ID + "=" + sel.getChannelID(), null); } else if (delete && !sel.isSelected()) { keep.add(String.valueOf(sel.getChannelID())); } } if (delete) { if (deleteWhere.length() > 0) { deleteWhere.insert(0, TvBrowserContentProvider.KEY_ID + " IN ( "); deleteWhere.append(" ) "); Log.d("info2", "DELETE WHERE FOR REMOVED CHANNELS " + deleteWhere.toString()); int count = getContentResolver().delete(TvBrowserContentProvider.CONTENT_URI_CHANNELS, deleteWhere.toString(), null); Log.d("info2", "REMOVED CHANNELS COUNT " + count); } Editor edit = PreferenceManager.getDefaultSharedPreferences(TvBrowser.this).edit(); edit.putStringSet(getString(R.string.PREF_KEPT_DELETED_CHANNELS), keep); edit.commit(); } // if something was changed we need to update channel list bar in program list and the complete program table if (somethingChanged) { SettingConstants.initializeLogoMap(TvBrowser.this, true); updateProgramListChannelBar(); } // if something was selected we need to download new data if (somethingSelected && !delete) { checkTermsAccepted(); } } }); builder.setNegativeButton(android.R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (delete) { HashSet<String> keep = new HashSet<String>(); Iterator<ChannelSelection> it = channelSelectionList.superIterator(); while (it.hasNext()) { ChannelSelection sel = it.next(); keep.add(String.valueOf(sel.getChannelID())); } Editor edit = PreferenceManager.getDefaultSharedPreferences(TvBrowser.this).edit(); edit.putStringSet(getString(R.string.PREF_KEPT_DELETED_CHANNELS), keep); edit.commit(); } } }); builder.show(); } selectingChannels = false; }