コード例 #1
0
        @Override
        public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
          mAdapter.swapCursor(data);

          if (isResumed()) {
            setGridShown(true);
          } else {
            setGridShownNoAnimation(true);
          }

          if (mCheckedPosition >= 0 && getView() != null && UIUtils.isHoneycomb()) {
            getGridView().setItemChecked(mCheckedPosition, true);
          }
        }
コード例 #2
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    setEmptyText(getString(R.string.empty_speakers));

    if (UIUtils.isHoneycomb()) {
      getGridView().setChoiceMode(GridView.CHOICE_MODE_SINGLE);
    }

    reloadFromArguments(getArguments());

    setGridShown(false);

    if (savedInstanceState != null) {
      mCheckedPosition = savedInstanceState.getInt(STATE_CHECKED_POSITION, -1);
    }
  }
コード例 #3
0
 @Override
 public void onGridItemClick(GridView gv, View v, int position, long id) {
   final Cursor cursor = (Cursor) mAdapter.getItem(position);
   final String speakerId = cursor.getString(SpeakersAdapter.SpeakersQuery.SPEAKER_ID);
   final String firstName = cursor.getString(SpeakersAdapter.SpeakersQuery.SPEAKER_FIRSTNAME);
   final String lastName = cursor.getString(SpeakersAdapter.SpeakersQuery.SPEAKER_LASTNAME);
   final String speakerName = UIUtils.formatSpeakerName(firstName, lastName);
   final String title = getResources().getString(R.string.title_sessions_of, speakerName);
   AnalyticsUtils.getInstance(getActivity()).trackEvent("Speakers Grid", "Click", speakerName, 0);
   final Uri sessionsUri = CfpContract.Speakers.buildSessionsDirUri(speakerId);
   final Intent intent = new Intent(Intent.ACTION_VIEW, sessionsUri);
   intent.putExtra(Intent.EXTRA_TITLE, title);
   ((AbstractActivity) getActivity()).openActivityOrFragment(intent);
   if (UIUtils.isHoneycomb()) {
     getGridView().setItemChecked(position, true);
     mCheckedPosition = position;
   }
 }
コード例 #4
0
 public void clearCheckedPosition() {
   if (mCheckedPosition >= 0 && UIUtils.isHoneycomb()) {
     getGridView().setItemChecked(mCheckedPosition, false);
     mCheckedPosition = -1;
   }
 }