Package tvbrowser.ui.settings.channel

Examples of tvbrowser.ui.settings.channel.FilterItem


   */
  private void updateFilterPanel() {
    Channel[] allChannels = ChannelList.getAvailableChannels();

    mCategoryCB.removeAllItems();
    mCategoryCB.addItem(new FilterItem(mLocalizer.msg("allCategories",
        "All Categories"), null));

    mCategoryCB.addItem(new FilterItem(mLocalizer.msg("allExceptEventCinema",
        "All except Event/Cinema"), new Integer[] { Channel.CATEGORY_TV,
        Channel.CATEGORY_RADIO, Channel.CATEGORY_NONE }));

    if (channelListContains(allChannels, Channel.CATEGORY_TV)) {
      addCategoryFilter(Channel.CATEGORY_TV);

      if (channelListContains(allChannels, Channel.CATEGORY_TV)) {
        mCategoryCB.addItem(new FilterItem(mLocalizer.msg("categoryNotSpecial",
            "TV"), Channel.CATEGORY_TV * -1));
      }
      if (channelListContains(allChannels, Channel.CATEGORY_DIGITAL)) {
        addCategoryFilter(Channel.CATEGORY_DIGITAL);
      }
      if (channelListContains(allChannels, Channel.CATEGORY_SPECIAL_MUSIC)) {
        addCategoryFilter(Channel.CATEGORY_SPECIAL_MUSIC);
      }
      if (channelListContains(allChannels, Channel.CATEGORY_SPECIAL_SPORT)) {
        addCategoryFilter(Channel.CATEGORY_SPECIAL_SPORT);
      }
      if (channelListContains(allChannels, Channel.CATEGORY_SPECIAL_NEWS)) {
        addCategoryFilter(Channel.CATEGORY_SPECIAL_NEWS);
      }
      if (channelListContains(allChannels, Channel.CATEGORY_SPECIAL_OTHER)) {
        addCategoryFilter(Channel.CATEGORY_SPECIAL_OTHER);
      }
      if (channelListContains(allChannels, Channel.CATEGORY_PAY_TV)) {
        addCategoryFilter(Channel.CATEGORY_PAY_TV);
      }
      if (channelListContains(allChannels, Channel.CATEGORY_RADIO)) {
        addCategoryFilter(Channel.CATEGORY_RADIO);
      }
    }
    if (channelListContains(allChannels, Channel.CATEGORY_CINEMA)) {
      addCategoryFilter(Channel.CATEGORY_CINEMA);
    }
    if (channelListContains(allChannels, Channel.CATEGORY_EVENTS)) {
      addCategoryFilter(Channel.CATEGORY_EVENTS);
    }
    if (channelListContains(allChannels, Channel.CATEGORY_PAYED_DATA_TV)) {
      addCategoryFilter(Channel.CATEGORY_PAYED_DATA_TV);
    }
    if (channelListContains(allChannels, Channel.CATEGORY_NONE)) {
      addCategoryFilter(Channel.CATEGORY_NONE);
    }

    if(mCategoryCB.getItemCount() > Settings.propSelectedChannelCategoryIndex.getByte()) {
      mCategoryCB.setSelectedIndex(Settings.propSelectedChannelCategoryIndex.getByte());
    }

    HashSet<String> countries = new HashSet<String>();

    for (Channel allChannel : allChannels) {
      String country = allChannel.getCountry();
      if (country != null) {
        countries.add(country.toLowerCase());
      }
    }

    mCountryCB.removeAllItems();
    mCountryCB.addItem(new FilterItem(mLocalizer.msg("allCountries",
        "All Countries"), null));
    ArrayList<FilterItem> items = new ArrayList<FilterItem>(countries.size());
    for (String country : countries) {
      Locale locale = new Locale(Locale.getDefault().getLanguage(), country);
      items.add(new FilterItem(locale.getDisplayCountry(), country));
    }
    Collections.sort(items);

    String defaultCountry = Settings.propSelectedChannelCountry.getString();
    for (FilterItem item : items) {
View Full Code Here


      mCountryCB.setSelectedIndex(0);
    }
  }

  private void addCategoryFilter(final int category) {
    mCategoryCB.addItem(new FilterItem(Channel.getLocalizedCategory(category),
        category));
  }
View Full Code Here

  /**
   * Fills the List with the available Channels
   */
  private void fillAvailableChannelsListBox() {
    Object oldSelectedChannel = mAllChannels.getSelectedValue();
    FilterItem selectedCountry = (FilterItem) mCountryCB.getSelectedItem();
    FilterItem selectedCategory = (FilterItem) mCategoryCB.getSelectedItem();
    if (selectedCountry == null || selectedCategory == null) {
      return;
    }

    String country = (String) (selectedCountry).getValue();
View Full Code Here

TOP

Related Classes of tvbrowser.ui.settings.channel.FilterItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.