@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); } }
@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); } }
@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; } }
public void clearCheckedPosition() { if (mCheckedPosition >= 0 && UIUtils.isHoneycomb()) { getGridView().setItemChecked(mCheckedPosition, false); mCheckedPosition = -1; } }