diff options
author | Chung-yih Wang <cywang@google.com> | 2011-09-13 16:00:20 +0800 |
---|---|---|
committer | Chung-yih Wang <cywang@google.com> | 2011-09-13 16:54:40 +0800 |
commit | 6176dfc23f5a092ca1b2ee3d07d7076821ec6095 (patch) | |
tree | 1e4c4cd27d116329ae597abd9a3f2f1dd419c0ac /src | |
parent | ed2ea4de7489f4e27d47227da6ad1bb08d2d15e7 (diff) | |
download | LegacyCamera-6176dfc23f5a092ca1b2ee3d07d7076821ec6095.zip LegacyCamera-6176dfc23f5a092ca1b2ee3d07d7076821ec6095.tar.gz LegacyCamera-6176dfc23f5a092ca1b2ee3d07d7076821ec6095.tar.bz2 |
Fix the NPE in IndicatorControlBarContainer.
bug:5299759
move the view inits to onFinishInflate().
Change-Id: I3a3adb01805fbfb5e22d58f86c9d5da3ce3585a6
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/ui/IndicatorControlBar.java | 11 | ||||
-rw-r--r-- | src/com/android/camera/ui/IndicatorControlBarContainer.java | 36 |
2 files changed, 27 insertions, 20 deletions
diff --git a/src/com/android/camera/ui/IndicatorControlBar.java b/src/com/android/camera/ui/IndicatorControlBar.java index ff986ee..3838508 100644 --- a/src/com/android/camera/ui/IndicatorControlBar.java +++ b/src/com/android/camera/ui/IndicatorControlBar.java @@ -39,6 +39,14 @@ public class IndicatorControlBar extends IndicatorControl implements super(context, attrs); } + @Override + protected void onFinishInflate() { + mZoomIcon = (ImageView) findViewById(R.id.zoom_control_icon); + mSecondLevelIcon = (ImageView) + findViewById(R.id.second_level_indicator_bar_icon); + mSecondLevelIcon.setOnClickListener(this); + } + public void initialize(Context context, PreferenceGroup group, String flashSetting, boolean zoomSupported) { // From UI spec, we have camera_flash setting on the first level. @@ -50,13 +58,10 @@ public class IndicatorControlBar extends IndicatorControl implements // add Zoom Icon. if (zoomSupported) { - mZoomIcon = (ImageView) findViewById(R.id.zoom_control_icon); mZoomIcon.setOnTouchListener(this); mZoomIcon.setVisibility(View.VISIBLE); } - mSecondLevelIcon = (ImageView) findViewById(R.id.second_level_indicator_bar_icon); - mSecondLevelIcon.setOnClickListener(this); requestLayout(); } diff --git a/src/com/android/camera/ui/IndicatorControlBarContainer.java b/src/com/android/camera/ui/IndicatorControlBarContainer.java index b06c63f..d425c59 100644 --- a/src/com/android/camera/ui/IndicatorControlBarContainer.java +++ b/src/com/android/camera/ui/IndicatorControlBarContainer.java @@ -43,36 +43,38 @@ public class IndicatorControlBarContainer extends IndicatorControlContainer public IndicatorControlBarContainer(Context context, AttributeSet attrs) { super(context, attrs); + mFadeIn = AnimationUtils.loadAnimation( + context, R.anim.grow_fade_in_from_bottom); + mFadeOut = AnimationUtils.loadAnimation( + context, R.anim.shrink_fade_out_from_top); } @Override - public void initialize(Context context, PreferenceGroup group, - String flashSetting, boolean isZoomSupported, - String[] secondLevelKeys, String[] secondLevelOtherSettingKeys) { - mZoomControlBar = (ZoomControlBar) - findViewById(R.id.zoom_control); + protected void onFinishInflate() { + mZoomControlBar = (ZoomControlBar) findViewById(R.id.zoom_control); mZoomControlBar.setOnIndicatorEventListener(this); mZoomIndexBar = (ZoomIndexBar) findViewById(R.id.zoom_index_bar); mZoomControlBar.setOnZoomIndexChangeListener(mZoomIndexBar); - - // We need to show/hide the zoom slider icon accordingly. - // From UI spec, we have camera_flash setting on the first level. mIndicatorControlBar = (IndicatorControlBar) findViewById(R.id.indicator_bar); - mIndicatorControlBar.initialize(context, group, flashSetting, - isZoomSupported); mIndicatorControlBar.setOnIndicatorEventListener(this); - mSecondLevelIndicatorControlBar = (SecondLevelIndicatorControlBar) findViewById(R.id.second_level_indicator_bar); - mSecondLevelIndicatorControlBar.initialize(context, group, secondLevelKeys, - secondLevelOtherSettingKeys); mSecondLevelIndicatorControlBar.setOnIndicatorEventListener(this); + } - mFadeIn = AnimationUtils.loadAnimation( - context, R.anim.grow_fade_in_from_bottom); - mFadeOut = AnimationUtils.loadAnimation( - context, R.anim.shrink_fade_out_from_top); + @Override + public void initialize(Context context, PreferenceGroup group, + String flashSetting, boolean isZoomSupported, + String[] secondLevelKeys, String[] secondLevelOtherSettingKeys) { + + // We need to show/hide the zoom slider icon accordingly. + // From UI spec, we have camera_flash setting on the first level. + mIndicatorControlBar.initialize(context, group, flashSetting, + isZoomSupported); + + mSecondLevelIndicatorControlBar.initialize(context, group, + secondLevelKeys, secondLevelOtherSettingKeys); } public void setDegree(int degree) { |