diff options
author | Hung-ying Tyan <tyanh@google.com> | 2010-12-07 11:40:46 +0800 |
---|---|---|
committer | Hung-ying Tyan <tyanh@google.com> | 2010-12-07 20:42:12 +0800 |
commit | b03fe27d8392d190ea0dcc6d3661c117fe5e07d6 (patch) | |
tree | 2514e5b4eca676bb7bb8ffe34af005dfea16e0a0 | |
parent | 95b65b1c84ad44b43bd3defbdba5d881c0881d35 (diff) | |
download | LegacyCamera-b03fe27d8392d190ea0dcc6d3661c117fe5e07d6.zip LegacyCamera-b03fe27d8392d190ea0dcc6d3661c117fe5e07d6.tar.gz LegacyCamera-b03fe27d8392d190ea0dcc6d3661c117fe5e07d6.tar.bz2 |
Implement new visual design for Camera zoom control.
And overlay zoom control readout on top of preview area.
Bug: 3252827
Bug: 3252839
Change-Id: I2220a0784b94a7b80807bf7f4e29d039cb6e6f0f
30 files changed, 62 insertions, 44 deletions
diff --git a/res/drawable-hdpi/button_zoom_in_focused_holo.png b/res/drawable-hdpi/button_zoom_in_focused_holo.png Binary files differnew file mode 100644 index 0000000..5787024 --- /dev/null +++ b/res/drawable-hdpi/button_zoom_in_focused_holo.png diff --git a/res/drawable-hdpi/button_zoom_in_holo.png b/res/drawable-hdpi/button_zoom_in_holo.png Binary files differnew file mode 100644 index 0000000..ef385e0 --- /dev/null +++ b/res/drawable-hdpi/button_zoom_in_holo.png diff --git a/res/drawable-hdpi/button_zoom_in_longpressed_holo.png b/res/drawable-hdpi/button_zoom_in_longpressed_holo.png Binary files differnew file mode 100644 index 0000000..d9f9f12 --- /dev/null +++ b/res/drawable-hdpi/button_zoom_in_longpressed_holo.png diff --git a/res/drawable-hdpi/button_zoom_in_pressed_holo.png b/res/drawable-hdpi/button_zoom_in_pressed_holo.png Binary files differnew file mode 100644 index 0000000..e75cb4a --- /dev/null +++ b/res/drawable-hdpi/button_zoom_in_pressed_holo.png diff --git a/res/drawable-hdpi/button_zoom_out_focused_holo.png b/res/drawable-hdpi/button_zoom_out_focused_holo.png Binary files differnew file mode 100644 index 0000000..b4659aa --- /dev/null +++ b/res/drawable-hdpi/button_zoom_out_focused_holo.png diff --git a/res/drawable-hdpi/button_zoom_out_holo.png b/res/drawable-hdpi/button_zoom_out_holo.png Binary files differnew file mode 100644 index 0000000..01f5615 --- /dev/null +++ b/res/drawable-hdpi/button_zoom_out_holo.png diff --git a/res/drawable-hdpi/button_zoom_out_longpressed_holo.png b/res/drawable-hdpi/button_zoom_out_longpressed_holo.png Binary files differnew file mode 100644 index 0000000..d2a3e59 --- /dev/null +++ b/res/drawable-hdpi/button_zoom_out_longpressed_holo.png diff --git a/res/drawable-hdpi/button_zoom_out_pressed_holo.png b/res/drawable-hdpi/button_zoom_out_pressed_holo.png Binary files differnew file mode 100644 index 0000000..4a032a6 --- /dev/null +++ b/res/drawable-hdpi/button_zoom_out_pressed_holo.png diff --git a/res/drawable-hdpi/zoompicker_down_normal.png b/res/drawable-hdpi/zoompicker_down_normal.png Binary files differdeleted file mode 100644 index d1d5ce0..0000000 --- a/res/drawable-hdpi/zoompicker_down_normal.png +++ /dev/null diff --git a/res/drawable-hdpi/zoompicker_down_pressed.png b/res/drawable-hdpi/zoompicker_down_pressed.png Binary files differdeleted file mode 100644 index 088d287..0000000 --- a/res/drawable-hdpi/zoompicker_down_pressed.png +++ /dev/null diff --git a/res/drawable-hdpi/zoompicker_up_normal.png b/res/drawable-hdpi/zoompicker_up_normal.png Binary files differdeleted file mode 100644 index 9cded59..0000000 --- a/res/drawable-hdpi/zoompicker_up_normal.png +++ /dev/null diff --git a/res/drawable-hdpi/zoompicker_up_pressed.png b/res/drawable-hdpi/zoompicker_up_pressed.png Binary files differdeleted file mode 100644 index 320bcaf..0000000 --- a/res/drawable-hdpi/zoompicker_up_pressed.png +++ /dev/null diff --git a/res/drawable-mdpi/button_zoom_in_holo.png b/res/drawable-mdpi/button_zoom_in_holo.png Binary files differnew file mode 100644 index 0000000..ef385e0 --- /dev/null +++ b/res/drawable-mdpi/button_zoom_in_holo.png diff --git a/res/drawable-mdpi/button_zoom_in_longpressed_holo.png b/res/drawable-mdpi/button_zoom_in_longpressed_holo.png Binary files differnew file mode 100644 index 0000000..d9f9f12 --- /dev/null +++ b/res/drawable-mdpi/button_zoom_in_longpressed_holo.png diff --git a/res/drawable-mdpi/button_zoom_in_pressed_holo.png b/res/drawable-mdpi/button_zoom_in_pressed_holo.png Binary files differnew file mode 100644 index 0000000..e75cb4a --- /dev/null +++ b/res/drawable-mdpi/button_zoom_in_pressed_holo.png diff --git a/res/drawable-mdpi/button_zoom_out_holo.png b/res/drawable-mdpi/button_zoom_out_holo.png Binary files differnew file mode 100644 index 0000000..01f5615 --- /dev/null +++ b/res/drawable-mdpi/button_zoom_out_holo.png diff --git a/res/drawable-mdpi/button_zoom_out_longpressed_holo.png b/res/drawable-mdpi/button_zoom_out_longpressed_holo.png Binary files differnew file mode 100644 index 0000000..d2a3e59 --- /dev/null +++ b/res/drawable-mdpi/button_zoom_out_longpressed_holo.png diff --git a/res/drawable-mdpi/button_zoom_out_pressed_holo.png b/res/drawable-mdpi/button_zoom_out_pressed_holo.png Binary files differnew file mode 100644 index 0000000..4a032a6 --- /dev/null +++ b/res/drawable-mdpi/button_zoom_out_pressed_holo.png diff --git a/res/drawable-mdpi/zoompicker_down_normal.png b/res/drawable-mdpi/zoompicker_down_normal.png Binary files differdeleted file mode 100644 index d1d5ce0..0000000 --- a/res/drawable-mdpi/zoompicker_down_normal.png +++ /dev/null diff --git a/res/drawable-mdpi/zoompicker_down_pressed.png b/res/drawable-mdpi/zoompicker_down_pressed.png Binary files differdeleted file mode 100644 index 088d287..0000000 --- a/res/drawable-mdpi/zoompicker_down_pressed.png +++ /dev/null diff --git a/res/drawable-mdpi/zoompicker_up_normal.png b/res/drawable-mdpi/zoompicker_up_normal.png Binary files differdeleted file mode 100644 index 9cded59..0000000 --- a/res/drawable-mdpi/zoompicker_up_normal.png +++ /dev/null diff --git a/res/drawable-mdpi/zoompicker_up_pressed.png b/res/drawable-mdpi/zoompicker_up_pressed.png Binary files differdeleted file mode 100644 index 320bcaf..0000000 --- a/res/drawable-mdpi/zoompicker_up_pressed.png +++ /dev/null diff --git a/res/drawable/btn_zoom_picker_down.xml b/res/drawable-xlarge/btn_zoom_in.xml index 38f1270..1ae7aeb 100644 --- a/res/drawable/btn_zoom_picker_down.xml +++ b/res/drawable-xlarge/btn_zoom_in.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2008 The Android Open Source Project +<!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,6 +15,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="true" android:drawable="@drawable/zoompicker_down_pressed" /> - <item android:drawable="@drawable/zoompicker_down_normal" /> + <item android:state_pressed="true" android:drawable="@drawable/button_zoom_in_pressed_holo" /> + <item android:drawable="@drawable/button_zoom_in_holo" /> </selector> diff --git a/res/drawable/btn_zoom_picker_up.xml b/res/drawable-xlarge/btn_zoom_out.xml index 0a2249b..92370c1 100644 --- a/res/drawable/btn_zoom_picker_up.xml +++ b/res/drawable-xlarge/btn_zoom_out.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2008 The Android Open Source Project +<!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,6 +15,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="true" android:drawable="@drawable/zoompicker_up_pressed" /> - <item android:drawable="@drawable/zoompicker_up_normal" /> + <item android:state_pressed="true" android:drawable="@drawable/button_zoom_out_pressed_holo" /> + <item android:drawable="@drawable/button_zoom_out_holo" /> </selector> diff --git a/res/layout-xlarge/camera_control.xml b/res/layout-xlarge/camera_control.xml index 82757c6..4507fc4 100644 --- a/res/layout-xlarge/camera_control.xml +++ b/res/layout-xlarge/camera_control.xml @@ -30,10 +30,10 @@ android:layout="@layout/zoom_picker" android:layout_alignParentTop="true" android:layout_alignParentRight="true" - android:layout_width="45dp" - android:layout_height="150dp" - android:layout_marginTop="40dp" - android:layout_marginRight="160dp"/> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:layout_marginRight="20dp"/> <TextView android:id="@+id/time_lapse_recording_time" style="@style/RecordingTime" diff --git a/res/layout-xlarge/preview_frame.xml b/res/layout-xlarge/preview_frame.xml index 16be7e9..66c9117 100644 --- a/res/layout-xlarge/preview_frame.xml +++ b/res/layout-xlarge/preview_frame.xml @@ -34,6 +34,21 @@ android:id="@+id/focus_rectangle" android:layout_width="match_parent" android:layout_height="match_parent"/> + <TextView android:id="@+id/zoom_ratio" + android:gravity="center" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_alignParentRight="true" + android:singleLine="true" + android:layout_margin="20dp" + android:paddingLeft="15dp" + android:paddingRight="15dp" + android:paddingTop="3dp" + android:paddingBottom="3dp" + android:textColor="@android:color/white" + android:textSize="16dp" + android:background="@color/zoom_text_background_color"/> <ImageView style="@style/OnScreenGpsIndicator" android:id="@+id/onscreen_gps_indicator_no_signal" android:src="@drawable/ic_viewfinder_gps_no_signal" diff --git a/res/layout-xlarge/zoom_picker.xml b/res/layout-xlarge/zoom_picker.xml index a5ef7ad..68431ba 100644 --- a/res/layout-xlarge/zoom_picker.xml +++ b/res/layout-xlarge/zoom_picker.xml @@ -18,35 +18,21 @@ --> <com.android.camera.ui.ZoomPicker xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" + android:orientation="horizontal" android:gravity="center" - android:layout_width="45dp" - android:layout_height="150dp" - android:layout_alignParentTop="true" - android:layout_alignParentLeft="true" - android:background="@drawable/mode_switch_bg_v2"> - - <TextView android:id="@+id/zoom_ratio" - android:gravity="center" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="10dp" - android:layout_marginBottom="20dp" - android:singleLine="true" - android:textColor="@android:color/white" - android:textSize="16dp" /> - - <Button android:id="@+id/increment" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="10dp" - android:layout_marginBottom="10dp" - android:background="@drawable/btn_zoom_picker_up" /> + android:layout_alignParentTop="true" + android:layout_alignParentRight="true"> <Button android:id="@+id/decrement" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="10dp" - android:layout_marginBottom="10dp" - android:background="@drawable/btn_zoom_picker_down" /> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/btn_zoom_out" /> + + <Button android:id="@+id/increment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="25dp" + android:background="@drawable/btn_zoom_in" /> </com.android.camera.ui.ZoomPicker> diff --git a/res/values/colors.xml b/res/values/colors.xml index c5572ca..2d5286b 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -21,4 +21,5 @@ <color name="recording_time_elapsed_text">#FFFFFFFF</color> <color name="recording_time_remaining_text">#FFFF0033</color> <color name="zoom_picker_btn_pressed">#FFFFAD00</color> + <color name="zoom_text_background_color">#77333333</color> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 66e84ff..3616c27 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -365,6 +365,8 @@ <string name="zoom_control_title">Zoom</string> <string name="zoom_increment" translatable="false">+</string> <string name="zoom_decrement" translatable="false">-</string> + <!-- The text to show the current zoom factor. [CHAR LIMIT=NONE] --> + <string name="zoom_text">Zoom <xliff:g id="zoom_text" example="1.1x">%s</xliff:g></string> <string name="switch_to_camera_lable">Switch to camera</string> <string name="switch_to_video_lable">Switch to video</string> diff --git a/src/com/android/camera/ui/ZoomPicker.java b/src/com/android/camera/ui/ZoomPicker.java index 63c9f10..4d85db9 100644 --- a/src/com/android/camera/ui/ZoomPicker.java +++ b/src/com/android/camera/ui/ZoomPicker.java @@ -16,6 +16,8 @@ package com.android.camera.ui; +import com.android.camera.R; + import android.content.Context; import android.os.Handler; import android.util.AttributeSet; @@ -28,8 +30,6 @@ import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; -import com.android.camera.R; - import java.util.Formatter; /** @@ -37,7 +37,7 @@ import java.util.Formatter; */ public class ZoomPicker extends LinearLayout { private final String TAG = "ZoomPicker"; - private TextView mText; + private TextView mZoomTextView; private int mZoomMax, mZoomIndex; private float[] mZoomRatios; private OnZoomChangedListener mListener; @@ -45,15 +45,20 @@ public class ZoomPicker extends LinearLayout { private final StringBuilder mBuilder = new StringBuilder(); private final Formatter mFormatter = new Formatter(mBuilder); private final Object[] mFormatterArgs = new Object[1]; + private String mZoomText; + private Button mIncrementButton; + private Button mDecrementButton; private Handler mHandler; private final Runnable mRunnable = new Runnable() { public void run() { if (mIncrement) { + mIncrementButton.setBackgroundResource(R.drawable.button_zoom_in_longpressed_holo); if (changeZoomIndex(mZoomIndex + 1)) { mHandler.postDelayed(this, 65); } } else if (mDecrement) { + mDecrementButton.setBackgroundResource(R.drawable.button_zoom_out_longpressed_holo); if (changeZoomIndex(mZoomIndex - 1)) { mHandler.postDelayed(this, 65); } @@ -63,6 +68,7 @@ public class ZoomPicker extends LinearLayout { public ZoomPicker(Context context, AttributeSet attrs) { super(context, attrs); + mZoomText = context.getString(R.string.zoom_text); } @Override @@ -80,6 +86,7 @@ public class ZoomPicker extends LinearLayout { mHandler.postDelayed(mRunnable, 200); } } else if (event.getAction() == MotionEvent.ACTION_UP) { + mIncrementButton.setBackgroundResource(R.drawable.button_zoom_in_holo); mIncrement = false; } return false; @@ -96,18 +103,17 @@ public class ZoomPicker extends LinearLayout { mHandler.postDelayed(mRunnable, 200); } } else if (event.getAction() == MotionEvent.ACTION_UP) { + mDecrementButton.setBackgroundResource(R.drawable.button_zoom_out_holo); mDecrement = false; } return false; } }; - Button incrementButton = (Button) findViewById(R.id.increment); + Button incrementButton = mIncrementButton = (Button) findViewById(R.id.increment); incrementButton.setOnTouchListener(incrementTouchListener); - Button decrementButton = (Button) findViewById(R.id.decrement); + Button decrementButton = mDecrementButton = (Button) findViewById(R.id.decrement); decrementButton.setOnTouchListener(decrementTouchListener); - mText = (TextView) findViewById(R.id.zoom_ratio); - mText.setText(formatZoomRatio(1.0f)); } public void setOnZoomChangeListener(OnZoomChangedListener listener) { @@ -143,7 +149,15 @@ public class ZoomPicker extends LinearLayout { } private void updateView() { - mText.setText(formatZoomRatio(mZoomRatios[mZoomIndex])); + if (mZoomTextView == null) { + mZoomTextView = (TextView) getRootView().findViewById(R.id.zoom_ratio); + } + if (mZoomIndex == 0) { + mZoomTextView.setVisibility(View.INVISIBLE); + } else { + mZoomTextView.setText(String.format(mZoomText, formatZoomRatio(mZoomRatios[mZoomIndex]))); + mZoomTextView.setVisibility(View.VISIBLE); + } } private String formatZoomRatio(float value) { |