Add user feedback to setup action labels and icons
Bug: 8159728 Change-Id: I46c77c31973ae492c2a12291f2e0b154f64d26c9main
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2013, 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_focused="true"
|
||||||
|
android:drawable="@drawable/unbundled_key_01" />
|
||||||
|
<item
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/unbundled_key_01" />
|
||||||
|
<item
|
||||||
|
android:drawable="@drawable/unbundled_key_02" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2013, 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_focused="true"
|
||||||
|
android:drawable="@drawable/unbundled_select_01" />
|
||||||
|
<item
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/unbundled_select_01" />
|
||||||
|
<item
|
||||||
|
android:drawable="@drawable/unbundled_select_02" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2013, 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_focused="true"
|
||||||
|
android:drawable="@drawable/unbundled_earth_01" />
|
||||||
|
<item
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/unbundled_earth_01" />
|
||||||
|
<item
|
||||||
|
android:drawable="@drawable/unbundled_earth_02" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2013, 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_focused="true"
|
||||||
|
android:drawable="@drawable/unbundled_check_01" />
|
||||||
|
<item
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/unbundled_check_01" />
|
||||||
|
<item
|
||||||
|
android:drawable="@drawable/unbundled_check_02" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2013, 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_focused="true"
|
||||||
|
android:drawable="@color/setup_text_action" />
|
||||||
|
<item
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:drawable="@color/setup_text_action" />
|
||||||
|
<item
|
||||||
|
android:drawable="@color/setup_step_background" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2013, 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_focused="true"
|
||||||
|
android:color="@color/setup_step_background" />
|
||||||
|
<item
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:color="@color/setup_step_background" />
|
||||||
|
<item
|
||||||
|
android:color="@color/setup_text_action" />
|
||||||
|
</selector>
|
|
@ -42,7 +42,7 @@
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="2dp" />
|
android:layout_height="2dp" />
|
||||||
<TextView
|
<Button
|
||||||
android:id="@+id/setup_step_action_label"
|
android:id="@+id/setup_step_action_label"
|
||||||
style="@style/setupStepActionLabelStyle"
|
style="@style/setupStepActionLabelStyle"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
<item name="android:textSize">14sp</item>
|
<item name="android:textSize">14sp</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="setupStepActionLabelStyle">
|
<style name="setupStepActionLabelStyle">
|
||||||
<item name="android:background">@color/setup_step_background</item>
|
<item name="android:background">@drawable/setup_step_action_background</item>
|
||||||
<item name="android:textColor">@color/setup_text_action</item>
|
<item name="android:textColor">@drawable/setup_step_action_color</item>
|
||||||
<item name="android:textSize">18sp</item>
|
<item name="android:textSize">18sp</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -20,7 +20,6 @@ import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.PorterDuff;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
@ -119,7 +118,7 @@ public final class SetupActivity extends Activity {
|
||||||
|
|
||||||
final SetupStep step1 = new SetupStep(findViewById(R.id.setup_step1),
|
final SetupStep step1 = new SetupStep(findViewById(R.id.setup_step1),
|
||||||
appName, R.string.setup_step1_title, R.string.setup_step1_instruction,
|
appName, R.string.setup_step1_title, R.string.setup_step1_instruction,
|
||||||
R.drawable.ic_settings_language, R.string.setup_step1_action);
|
R.drawable.ic_setup_step1, R.string.setup_step1_action);
|
||||||
step1.setAction(new Runnable() {
|
step1.setAction(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -131,7 +130,7 @@ public final class SetupActivity extends Activity {
|
||||||
|
|
||||||
final SetupStep step2 = new SetupStep(findViewById(R.id.setup_step2),
|
final SetupStep step2 = new SetupStep(findViewById(R.id.setup_step2),
|
||||||
appName, R.string.setup_step2_title, R.string.setup_step2_instruction,
|
appName, R.string.setup_step2_title, R.string.setup_step2_instruction,
|
||||||
0 /* actionIcon */, R.string.setup_step2_action);
|
R.drawable.ic_setup_step2, R.string.setup_step2_action);
|
||||||
step2.setAction(new Runnable() {
|
step2.setAction(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -144,7 +143,7 @@ public final class SetupActivity extends Activity {
|
||||||
|
|
||||||
final SetupStep step3 = new SetupStep(findViewById(R.id.setup_step3),
|
final SetupStep step3 = new SetupStep(findViewById(R.id.setup_step3),
|
||||||
appName, R.string.setup_step3_title, R.string.setup_step3_instruction,
|
appName, R.string.setup_step3_title, R.string.setup_step3_instruction,
|
||||||
R.drawable.sym_keyboard_language_switch, R.string.setup_step3_action);
|
R.drawable.ic_setup_step3, R.string.setup_step3_action);
|
||||||
step3.setAction(new Runnable() {
|
step3.setAction(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -314,9 +313,7 @@ public final class SetupActivity extends Activity {
|
||||||
final int paddingEnd = ViewCompatUtils.getPaddingEnd(mActionLabel);
|
final int paddingEnd = ViewCompatUtils.getPaddingEnd(mActionLabel);
|
||||||
ViewCompatUtils.setPaddingRelative(mActionLabel, paddingEnd, 0, paddingEnd, 0);
|
ViewCompatUtils.setPaddingRelative(mActionLabel, paddingEnd, 0, paddingEnd, 0);
|
||||||
} else {
|
} else {
|
||||||
final int overrideColor = res.getColor(R.color.setup_text_action);
|
|
||||||
final Drawable icon = res.getDrawable(actionIcon);
|
final Drawable icon = res.getDrawable(actionIcon);
|
||||||
icon.setColorFilter(overrideColor, PorterDuff.Mode.MULTIPLY);
|
|
||||||
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
|
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
|
||||||
TextViewCompatUtils.setCompoundDrawablesRelative(
|
TextViewCompatUtils.setCompoundDrawablesRelative(
|
||||||
mActionLabel, icon, null, null, null);
|
mActionLabel, icon, null, null, null);
|
||||||
|
|