@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; } }
@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 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = new Intent(); intent.setData(Sessions.buildSessionsAtDirUri(UIUtils.getCurrentTime(this))); setContentView(R.layout.activity_now_playing); mFragmentManager = getSupportFragmentManager(); mSessionsFragment = (SessionsFragment) mFragmentManager.findFragmentByTag("sessions"); if (mSessionsFragment == null) { mSessionsFragment = new SessionsFragment(); mSessionsFragment.setArguments(intentToFragmentArguments(intent)); mFragmentManager .beginTransaction() .add(R.id.fragment_container_sessions, mSessionsFragment, "sessions") .commit(); } }
public void clearCheckedPosition() { if (mCheckedPosition >= 0 && UIUtils.isHoneycomb()) { getGridView().setItemChecked(mCheckedPosition, false); mCheckedPosition = -1; } }
/** Handle "search" title-bar action. */ public void onSearchClick(View v) { UIUtils.goSearch(this); }
/** Handle "home" title-bar action. */ public void onHomeClick(View v) { UIUtils.goHome(this); }