@Override protected void onResume() { // Be sure to call the super class. super.onResume(); // Update our list of displays on resume. mDisplayListAdapter.updateContents(); // Restore presentations from before the activity was paused. final int numDisplays = mDisplayListAdapter.getCount(); for (int i = 0; i < numDisplays; i++) { final Display display = mDisplayListAdapter.getItem(i); final PresentationContents contents = mSavedPresentationContents.get(display.getDisplayId()); if (contents != null) { showPresentation(display, contents); } } mSavedPresentationContents.clear(); // Register to receive events from the display manager. mDisplayManager.registerDisplayListener(mDisplayListener, null); }
@Override protected void onResume() { // Be sure to call the super class. super.onResume(); // Update our list of displays on resume. mDisplayListAdapter.updateContents(); // Restore presentations from before the activity was paused. final int numDisplays = mDisplayListAdapter.getCount(); for (int i = 0; i < numDisplays; i++) { final Display display = mDisplayListAdapter.getItem(i); final DemoPresentationContents contents = mSavedPresentationContents.get(display.getDisplayId()); if (contents != null) { showPresentation(display, contents); } } mSavedPresentationContents.clear(); // Register to receive events from the display manager. mDisplayManager.registerDisplayListener(mDisplayListener, null); }
/** * Called when the show all displays checkbox is toggled or when * an item in the list of displays is checked or unchecked. */ @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (buttonView == mShowAllDisplaysCheckbox) { // Show all displays checkbox was toggled. mDisplayListAdapter.updateContents(); } else { // Display item checkbox was toggled. final Display display = (Display)buttonView.getTag(); if (isChecked) { PresentationContents contents = new PresentationContents(getNextPhoto()); showPresentation(display, contents); } else { hidePresentation(display); } } }
/** * Called when the show all displays checkbox is toggled or when * an item in the list of displays is checked or unchecked. */ @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (buttonView == mShowAllDisplaysCheckbox) { // Show all displays checkbox was toggled. mDisplayListAdapter.updateContents(); } else { // Display item checkbox was toggled. final Display display = (Display)buttonView.getTag(); if (isChecked) { DemoPresentationContents contents = new DemoPresentationContents(getNextPhoto()); showPresentation(display, contents); } else { hidePresentation(display); } mDisplayListAdapter.updateContents(); } }