Lines Matching refs:button

91     /** A listener for button enabled and visibility
119 * to prevent stale references button views.
126 * ButtonStatusListener provides callbacks for when button's
131 * A button's visibility has changed.
136 * A button's enabled state has changed.
184 MultiToggleImageButton button = null;
190 button = getButtonOrError(BUTTON_FLASH);
194 button = getButtonOrError(BUTTON_TORCH);
198 button = getButtonOrError(BUTTON_HDR_PLUS_FLASH);
202 button = getButtonOrError(BUTTON_CAMERA);
206 button = getButtonOrError(BUTTON_HDR_PLUS);
210 button = getButtonOrError(BUTTON_HDR);
214 button = getButtonOrError(BUTTON_GRID_LINES);
222 button = getButtonOrError(BUTTON_COUNTDOWN);
225 if (button != null && button.getState() != index) {
226 button.setState(Math.max(index, 0), false);
231 * A callback executed in the state listener of a button.
233 * Used by a module to set specific behavior when a button's
242 * based on button id. An IllegalStateException will be throw if the
243 * button could not be found in the view hierarchy.
249 throw new IllegalStateException("Flash button could not be found.");
254 throw new IllegalStateException("Torch button could not be found.");
259 throw new IllegalStateException("Hdr plus torch button could not be found.");
264 throw new IllegalStateException("Camera button could not be found.");
269 throw new IllegalStateException("Hdr plus button could not be found.");
274 throw new IllegalStateException("Hdr button could not be found.");
279 throw new IllegalStateException("Grid lines button could not be found.");
284 throw new IllegalStateException("Countdown button could not be found.");
288 throw new IllegalArgumentException("button not known by id=" + buttonId);
294 * based on button id. An IllegalStateException will be throw if the
295 * button could not be found in the view hierarchy.
301 throw new IllegalStateException("Cancel button could not be found.");
306 throw new IllegalStateException("Done button could not be found.");
311 throw new IllegalStateException("Retake button could not be found.");
316 throw new IllegalStateException("Review button could not be found.");
321 throw new IllegalStateException("Exposure Compensation button could not be found.");
325 throw new IllegalArgumentException("button not known by id=" + buttonId);
330 * Initialize a known button by id with a state change callback, and then
331 * enable the button.
333 * @param buttonId The id if the button to be initialized.
334 * @param cb The callback to be executed after the button state change.
341 * Initialize a known button by id, with a state change callback and a state
342 * pre-change callback, and then enable the button.
344 * @param buttonId The id if the button to be initialized.
345 * @param cb The callback to be executed after the button state change.
346 * @param preCb The callback to be executed before the button state change.
349 MultiToggleImageButton button = getButtonOrError(buttonId);
352 initializeFlashButton(button, cb, preCb, R.array.camera_flashmode_icons);
355 initializeTorchButton(button, cb, preCb, R.array.video_flashmode_icons);
358 initializeHdrPlusFlashButton(button, cb, preCb, R.array.camera_flashmode_icons);
361 initializeCameraButton(button, cb, preCb, R.array.camera_id_icons);
364 initializeHdrPlusButton(button, cb, preCb, R.array.pref_camera_hdr_plus_icons);
367 initializeHdrButton(button, cb, preCb, R.array.pref_camera_hdr_icons);
370 initializeGridLinesButton(button, cb, preCb, R.array.grid_lines_icons);
373 initializeCountdownButton(button, cb, preCb, R.array.countdown_duration_icons);
376 throw new IllegalArgumentException("button not known by id=" + buttonId);
384 * Initialize a known button with a click listener and a drawable resource id,
386 * Sets the button visible.
390 ImageButton button = getImageButtonOrError(buttonId);
391 button.setOnClickListener(cb);
393 button.setImageResource(imageId);
396 button.setContentDescription(mAppController
400 if (!button.isEnabled()) {
401 button.setEnabled(true);
406 button.setTag(R.string.tag_enabled_id, buttonId);
408 if (button.getVisibility() != View.VISIBLE) {
409 button.setVisibility(View.VISIBLE);
417 * Initialize a known button with a click listener and a resource id.
418 * Sets the button visible.
426 * Initialize a known button with a click listener. Sets the button visible.
433 * Sets the camera button in its disabled (greyed out) state and blocks it
443 * Sets a button in its disabled (greyed out) state.
446 View button;
448 button = getImageButtonOrError(buttonId);
450 button = getButtonOrError(buttonId);
452 // HDR and HDR+ buttons share the same button object,
455 // in the case of the HDR[+] button being disabled at startup,
459 initializeHdrPlusButtonIcons((MultiToggleImageButton) button, R.array.pref_camera_hdr_plus_icons);
461 initializeHdrButtonIcons((MultiToggleImageButton) button, R.array.pref_camera_hdr_icons);
464 if (button.isEnabled()) {
465 button.setEnabled(false);
470 button.setTag(R.string.tag_enabled_id, null);
474 * Enables the camera button and removes the block that was set by
483 * Enables a button that has already been initialized.
490 ImageButton button;
491 // Manual exposure uses a regular image button instead of a
493 // TODO: Redesign ButtonManager's button getter methods into one method.
495 button = getImageButtonOrError(buttonId);
497 button = getButtonOrError(buttonId);
499 if (!button.isEnabled()) {
500 button.setEnabled(true);
505 button.setTag(R.string.tag_enabled_id, buttonId);
509 * Disable click reactions for a button without affecting visual state.
511 * @param buttonId The id of the button.
514 ImageButton button = getButtonOrError(buttonId);
515 if (button instanceof MultiToggleImageButton) {
516 ((MultiToggleImageButton) button).setClickEnabled(false);
521 * Enable click reactions for a button without affecting visual state.
523 * @param buttonId The id of the button.
526 ImageButton button = getButtonOrError(buttonId);
527 if (button instanceof MultiToggleImageButton) {
528 ((MultiToggleImageButton) button).setClickEnabled(true);
533 * Hide a button by id.
536 View button;
538 button = getButtonOrError(buttonId);
540 button = getImageButtonOrError(buttonId);
542 if (button.getVisibility() == View.VISIBLE) {
543 button.setVisibility(View.GONE);
551 * Show a button by id.
554 View button;
556 button = getButtonOrError(buttonId);
558 button = getImageButtonOrError(buttonId);
560 if (button.getVisibility() != View.VISIBLE) {
561 button.setVisibility(View.VISIBLE);
630 * Check if a button is enabled with the given button id..
633 View button;
635 button = getButtonOrError(buttonId);
637 button = getImageButtonOrError(buttonId);
640 Integer enabledId = (Integer) button.getTag(R.string.tag_enabled_id);
642 return (enabledId.intValue() == buttonId) && button.isEnabled();
649 * Check if a button is visible.
652 View button;
654 button = getButtonOrError(buttonId);
656 button = getImageButtonOrError(buttonId);
658 return (button.getVisibility() == View.VISIBLE);
662 * Initialize a flash button.
664 private void initializeFlashButton(MultiToggleImageButton button,
668 button.overrideImageIds(resIdImages);
670 button.overrideContentDescriptions(R.array.camera_flash_descriptions);
674 button.setState(index >= 0 ? index : 0, false);
676 setPreChangeCallback(button, preCb);
678 button.setOnStateChangeListener(new MultiToggleImageButton.OnStateChangeListener() {
691 * Initialize video torch button
693 private void initializeTorchButton(MultiToggleImageButton button,
697 button.overrideImageIds(resIdImages);
699 button.overrideContentDescriptions(R.array.video_flash_descriptions);
703 button.setState(index >= 0 ? index : 0, false);
705 setPreChangeCallback(button, preCb);
707 button.setOnStateChangeListener(new MultiToggleImageButton.OnStateChangeListener() {
720 * Initialize hdr plus flash button
722 private void initializeHdrPlusFlashButton(MultiToggleImageButton button,
726 button.overrideImageIds(resIdImages);
728 button.overrideContentDescriptions(R.array.hdr_plus_flash_descriptions);
732 button.setState(index >= 0 ? index : 0, false);
734 setPreChangeCallback(button, preCb);
736 button.setOnStateChangeListener(new MultiToggleImageButton.OnStateChangeListener() {
749 * Initialize a camera button.
751 private void initializeCameraButton(final MultiToggleImageButton button,
755 button.overrideImageIds(resIdImages);
760 button.setState(index >= 0 ? index : 0, false);
762 setPreChangeCallback(button, preCb);
764 button.setOnStateChangeListener(new MultiToggleImageButton.OnStateChangeListener() {
772 // found by rapid pressing camera switch button. The assumption
773 // here is that each time this button is clicked, the listener
774 // will do something and then enable this button again.
775 button.setEnabled(false);
785 * Initialize an hdr plus button.
787 private void initializeHdrPlusButton(MultiToggleImageButton button,
790 initializeHdrPlusButtonIcons(button, resIdImages);
794 button.setState(index >= 0 ? index : 0, false);
796 setPreChangeCallback(button, preCb);
798 button.setOnStateChangeListener(new MultiToggleImageButton.OnStateChangeListener() {
810 private void initializeHdrPlusButtonIcons(MultiToggleImageButton button, int resIdImages) {
812 button.overrideImageIds(resIdImages);
814 button.overrideContentDescriptions(R.array.hdr_plus_descriptions);
818 * Initialize an hdr button.
820 private void initializeHdrButton(MultiToggleImageButton button,
823 initializeHdrButtonIcons(button, resIdImages);
827 button.setState(index >= 0 ? index : 0, false);
829 setPreChangeCallback(button, preCb);
831 button.setOnStateChangeListener(new MultiToggleImageButton.OnStateChangeListener() {
843 private void initializeHdrButtonIcons(MultiToggleImageButton button, int resIdImages) {
845 button.overrideImageIds(resIdImages);
847 button.overrideContentDescriptions(R.array.hdr_descriptions);
851 * Initialize a countdown timer button.
853 private void initializeCountdownButton(MultiToggleImageButton button,
856 button.overrideImageIds(resIdImages);
861 button.setState(index >= 0 ? index : 0, false);
863 setPreChangeCallback(button, preCb);
865 button.setOnStateChangeListener(new MultiToggleImageButton.OnStateChangeListener() {
890 * Initialize a grid lines button.
892 private void initializeGridLinesButton(MultiToggleImageButton button,
896 button.overrideImageIds(resIdImages);
898 button.overrideContentDescriptions(R.array.grid_lines_descriptions);
900 setPreChangeCallback(button, preCb);
902 button.setOnStateChangeListener(new MultiToggleImageButton.OnStateChangeListener() {
915 button.setState(index >= 0 ? index : 0, true);
944 // if in landscape orientation (pano bar vertical), reverse button order
1000 private void setPreChangeCallback(MultiToggleImageButton button, final ButtonCallback preCb) {
1001 button.setOnPreChangeListener(new MultiToggleImageButton.OnStateChangeListener() {