コード例 #1
0
 /* (non-Javadoc)
  * @see android.support.v4.app.Fragment#onResume()
  */
 @Override
 public void onResume() {
   super.onResume();
   if (!UIUtils.isTablet(getSherlockActivity())) {
     clearSelection();
   }
 }
コード例 #2
0
 /*
  * (non-Javadoc)
  *
  * @see
  * com.actionbarsherlock.app.SherlockListFragment#onAttach(android.app.Activity
  * )
  */
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   if (activity instanceof OnChannelSelectedListener) {
     mCHannelSelectedListener = (OnChannelSelectedListener) activity;
   }
 }
コード例 #3
0
  /*
   * (non-Javadoc)
   *
   * @see android.support.v4.app.Fragment#onCreate(android.os.Bundle)
   */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = getActivity().getApplicationContext();

    ConnectivityManager connManager =
        (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
    mNetworkInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

    prefs = new DVBViewerPreferences(getActivity());
    showFavs = prefs.getPrefs().getBoolean(DVBViewerPreferences.KEY_CHANNELS_USE_FAVS, false);
    showNowPlaying =
        prefs.getPrefs().getBoolean(DVBViewerPreferences.KEY_CHANNELS_SHOW_NOW_PLAYING, true);
    showNowPlayingWifi =
        prefs
            .getPrefs()
            .getBoolean(DVBViewerPreferences.KEY_CHANNELS_SHOW_NOW_PLAYING_WIFI_ONLY, true);
    mAdapter = new ChannelAdapter(getActivity());
    if (getArguments() != null) {
      if (getArguments().containsKey(ChannelList.KEY_HAS_OPTIONMENU)) {
        hasOptionsMenu = getArguments().getBoolean(KEY_HAS_OPTIONMENU);
      }
    }
    if (savedInstanceState != null) {
      if (savedInstanceState.containsKey(KEY_SELECTED_POSITION)) {
        selectedPosition = savedInstanceState.getInt(KEY_SELECTED_POSITION);
      }
    } else {
      selectedPosition =
          getActivity().getIntent().getIntExtra(KEY_SELECTED_POSITION, selectedPosition);
    }
    setHasOptionsMenu(hasOptionsMenu);
  }
コード例 #4
0
 /* (non-Javadoc)
  * @see org.dvbviewer.controller.ui.base.BaseListFragment#setSelection(int)
  */
 @Override
 public void setSelection(int position) {
   clearSelection();
   getListView().setItemChecked(position, true);
   setSelectedPosition(position);
   super.setSelection(position);
 }
コード例 #5
0
 /*
  * (non-Javadoc)
  *
  * @see
  * com.actionbarsherlock.app.SherlockListFragment#onCreateOptionsMenu(android
  * .view.Menu, android.view.MenuInflater)
  */
 @Override
 public void onCreateOptionsMenu(
     com.actionbarsherlock.view.Menu menu, com.actionbarsherlock.view.MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.channel_list, menu);
   for (int i = 0; i < menu.size(); i++) {
     if (menu.getItem(i).getItemId() == R.id.menuChannelList) {
       menu.getItem(i).setVisible(showFavs);
     } else if (menu.getItem(i).getItemId() == R.id.menuFavourties) {
       menu.getItem(i).setVisible(!showFavs);
     }
   }
   menu.findItem(R.id.menuChannelList).setVisible(showFavs);
   menu.findItem(R.id.menuFavourties).setVisible(!showFavs);
   if (getSherlockActivity() instanceof ChannelListMultiActivity) {
     menu.findItem(R.id.menu_refresh_now_playing).setVisible(false);
     menu.findItem(R.id.menuRefreshChannels).setVisible(false);
   }
 }
コード例 #6
0
 /*
  * (non-Javadoc)
  *
  * @see android.support.v4.app.Fragment#onActivityCreated(android.os.Bundle)
  */
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   setListAdapter(mAdapter);
   getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
   registerForContextMenu(getListView());
   int loaderId = LOADER_CHANNELLIST;
   /** Prüfung ob das EPG in der Senderliste angezeigt werden soll. */
   if (!Config.CHANNELS_SYNCED) {
     loaderId = LOADER_REFRESH_CHANNELLIST;
   } else if ((showNowPlaying && !showNowPlayingWifi)
       || (showNowPlaying && showNowPlayingWifi && mNetworkInfo.isConnected())) {
     loaderId = LOADER_EPG;
   }
   setEmptyText(
       showFavs
           ? getResources().getString(R.string.no_favourites)
           : getResources().getString(R.string.no_channels));
   Loader<Cursor> loader = getLoaderManager().initLoader(loaderId, savedInstanceState, this);
   setListShown(!(!isResumed() || loader.isStarted()));
   setSelection(selectedPosition);
 }
コード例 #7
0
 /*
  * (non-Javadoc)
  *
  * @see
  * android.support.v4.app.Fragment#onSaveInstanceState(android.os.Bundle)
  */
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putInt(KEY_SELECTED_POSITION, selectedPosition);
 }
コード例 #8
0
 /**
  * Persist channel config config.
  *
  * @author RayBa
  * @date 05.07.2012
  */
 public void persistChannelConfigConfig() {
   Editor editor = prefs.getPrefs().edit();
   editor.putBoolean(DVBViewerPreferences.KEY_CHANNELS_USE_FAVS, showFavs);
   editor.commit();
   super.onPause();
 }
コード例 #9
0
 /*
  * (non-Javadoc)
  *
  * @see
  * android.support.v4.app.Fragment#onCreateContextMenu(android.view.ContextMenu
  * , android.view.View, android.view.ContextMenu.ContextMenuInfo)
  */
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   getActivity().getMenuInflater().inflate(R.menu.context_menu_channellist, menu);
   menu.findItem(R.id.menuSwitch).setVisible(URLUtil.isValidUrl(ServerConsts.DVBVIEWER_URL));
 }