Home | History | Annotate | Download | only in ui
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.camera.ui;
     18 
     19 import android.content.Context;
     20 
     21 import com.android.camera.CameraSettings;
     22 import com.android.camera.IconListPreference;
     23 import com.android.camera.ListPreference;
     24 import com.android.camera.PreferenceGroup;
     25 
     26 public class CameraHeadUpDisplay extends HeadUpDisplay {
     27 
     28     protected static final String TAG = "CamcoderHeadUpDisplay";
     29 
     30     private OtherSettingsIndicator mOtherSettings;
     31     private GpsIndicator mGpsIndicator;
     32     private ZoomIndicator mZoomIndicator;
     33 
     34     public CameraHeadUpDisplay(Context context) {
     35         super(context);
     36     }
     37 
     38     @Override
     39     protected void initializeIndicatorBar(
     40             Context context, PreferenceGroup group) {
     41         super.initializeIndicatorBar(context, group);
     42 
     43         ListPreference prefs[] = getListPreferences(group,
     44                 CameraSettings.KEY_FOCUS_MODE,
     45                 CameraSettings.KEY_EXPOSURE,
     46                 CameraSettings.KEY_SCENE_MODE,
     47                 CameraSettings.KEY_PICTURE_SIZE,
     48                 CameraSettings.KEY_JPEG_QUALITY,
     49                 CameraSettings.KEY_COLOR_EFFECT);
     50 
     51         mOtherSettings = new OtherSettingsIndicator(context, prefs);
     52         mOtherSettings.setOnRestorePreferencesClickedRunner(new Runnable() {
     53             public void run() {
     54                 if (mListener != null) {
     55                     mListener.onRestorePreferencesClicked();
     56                 }
     57             }
     58         });
     59         mIndicatorBar.addComponent(mOtherSettings);
     60 
     61         mGpsIndicator = new GpsIndicator(
     62                 context, group, (IconListPreference)
     63                 group.findPreference(CameraSettings.KEY_RECORD_LOCATION));
     64         mIndicatorBar.addComponent(mGpsIndicator);
     65 
     66         addIndicator(context, group, CameraSettings.KEY_WHITE_BALANCE);
     67         addIndicator(context, group, CameraSettings.KEY_FLASH_MODE);
     68 
     69         mZoomIndicator = new ZoomIndicator(context);
     70         mIndicatorBar.addComponent(mZoomIndicator);
     71     }
     72 
     73     public void setZoomListener(ZoomController.ZoomListener listener) {
     74         mZoomIndicator.setZoomListener(listener);
     75     }
     76 
     77     public void setZoomIndex(int index) {
     78         mZoomIndicator.setZoomIndex(index);
     79     }
     80 
     81     public void setGpsHasSignal(final boolean hasSignal) {
     82         GLRootView root = getGLRootView();
     83         if (root != null) {
     84             root.queueEvent(new Runnable() {
     85                 public void run() {
     86                     mGpsIndicator.setHasSignal(hasSignal);
     87                 }
     88             });
     89         } else {
     90             mGpsIndicator.setHasSignal(hasSignal);
     91         }
     92     }
     93 
     94     public void setZoomRatios(float[] zoomRatios) {
     95         mZoomIndicator.setZoomRatios(zoomRatios);
     96     }
     97 }
     98