OSDN Git Service

Change gear icon background and implement pressed state
authorDoris Liu <tianliu@google.com>
Fri, 14 Feb 2014 23:42:57 +0000 (15:42 -0800)
committerDoris Liu <tianliu@google.com>
Tue, 18 Feb 2014 21:55:17 +0000 (13:55 -0800)
Bug: 13004843
Bug: 13005562
Change-Id: I18b44283bb337ca0bb3eb4aae923398a8ac4bfbb

res/drawable/settings_gear_background.xml [new file with mode: 0644]
res/drawable/settings_gear_background_normal.xml [new file with mode: 0644]
res/drawable/settings_gear_background_pressed.xml [new file with mode: 0644]
res/layout/mode_list_layout.xml
res/values/colors.xml
src/com/android/camera/ui/ModeListView.java

diff --git a/res/drawable/settings_gear_background.xml b/res/drawable/settings_gear_background.xml
new file mode 100644 (file)
index 0000000..f82684e
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true"
+        android:drawable="@drawable/settings_gear_background_pressed" />
+    <item android:drawable="@drawable/settings_gear_background_normal" />
+</selector>
\ No newline at end of file
diff --git a/res/drawable/settings_gear_background_normal.xml b/res/drawable/settings_gear_background_normal.xml
new file mode 100644 (file)
index 0000000..ca22e6a
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+
+    <solid
+        android:color="@color/mode_list_settings_icon_background"/>
+
+    <size
+        android:width="@dimen/mode_list_settings_icon_size"
+        android:height="@dimen/mode_list_settings_icon_size"/>
+</shape>
\ No newline at end of file
diff --git a/res/drawable/settings_gear_background_pressed.xml b/res/drawable/settings_gear_background_pressed.xml
new file mode 100644 (file)
index 0000000..f0c7abf
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+
+    <solid
+        android:color="@color/mode_list_settings_icon_pressed_background"/>
+
+    <size
+        android:width="@dimen/mode_list_settings_icon_size"
+        android:height="@dimen/mode_list_settings_icon_size"/>
+</shape>
\ No newline at end of file
index 2da4a35..1920e23 100644 (file)
@@ -35,6 +35,6 @@
         android:layout_height="@dimen/mode_list_settings_icon_size"
         android:scaleType="center"
         android:layout_gravity="top|left"
-        android:background="@drawable/mode_icon_background"
+        android:background="@drawable/settings_gear_background"
         android:src="@drawable/ic_settings_normal" />
 </com.android.camera.ui.ModeListView>
\ No newline at end of file
index 2e61e95..5c87344 100644 (file)
@@ -77,6 +77,8 @@
     <color name="mode_selector_text_highlight_color">#ffffffff</color>
     <color name="mode_selector_icon_background">#4c000000</color>
     <color name="mode_list_background">#00000000</color>
+    <color name="mode_list_settings_icon_background">#26000000</color>
+    <color name="mode_list_settings_icon_pressed_background">#99000000</color>
 
     <color name="camera_mode_color">#76a7fa</color>
     <color name="video_mode_color">#e57368</color>
index 992f70d..4718fc0 100644 (file)
@@ -444,7 +444,17 @@ public class ModeListView extends FrameLayout
         mSettingsButton.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
-                mModeSwitchListener.onSettingsSelected();
+                // Post this callback to make sure current user interaction has
+                // been reflected in the UI. Specifically, the pressed state gets
+                // unset after click happens. In order to ensure the pressed state
+                // gets unset in UI before getting in the low frame rate settings
+                // activity launch stage, the settings selected callback is posted.
+                post(new Runnable() {
+                    @Override
+                    public void run() {
+                        mModeSwitchListener.onSettingsSelected();
+                    }
+                });
             }
         });
     }