diff --git a/AndroidManifest.xml b/AndroidManifest.xml index fddc22c906e..f47ef0d95c7 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1022,7 +1022,7 @@ + android:label="@string/zen_mode_interruptions_voice_title"> diff --git a/res/drawable/bg_circle_blue.xml b/res/drawable/bg_voice_position.xml similarity index 88% rename from res/drawable/bg_circle_blue.xml rename to res/drawable/bg_voice_position.xml index 7f2cb1d26cd..2fb29c260a4 100644 --- a/res/drawable/bg_circle_blue.xml +++ b/res/drawable/bg_voice_position.xml @@ -16,6 +16,6 @@ --> - + android:shape="rectangle"> + diff --git a/res/layout/voice_interaction.xml b/res/layout/voice_interaction.xml index 13c4341636c..ed0cd1acf46 100644 --- a/res/layout/voice_interaction.xml +++ b/res/layout/voice_interaction.xml @@ -14,10 +14,20 @@ limitations under the License. --> - - + + + diff --git a/res/layout/voice_item_row.xml b/res/layout/voice_item_row.xml index 8576a57b436..eca5ac9033c 100644 --- a/res/layout/voice_item_row.xml +++ b/res/layout/voice_item_row.xml @@ -23,8 +23,8 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentStart="true" - android:layout_marginTop="20dp" - android:layout_marginBottom="20dp"> + android:layout_marginTop="15dp" + android:layout_marginBottom="15dp"> diff --git a/res/values/colors.xml b/res/values/colors.xml index 6f0352ce2cb..88cd3cbc87e 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -83,4 +83,5 @@ #263238 #1fffffff #ff009688 + #33b5e5 diff --git a/res/values/strings.xml b/res/values/strings.xml index 4c9ce79d113..7c75120028e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -6113,26 +6113,41 @@ %s next day + + Interruptions + + + When calls and notifications arrive + When would you like to be interrupted? For how long? + + Always interrupt + + + off,all,everything + + + Allow only priority interruptions + - important,priority,priority notifications + important,priority,priority notifications + + + Allow only alarms - alarms + alarms - - Off - - - off,all,everything + + Don\'t interrupt - none,nothing,no interruptions + none,nothing,no interruptions Indefinitely diff --git a/src/com/android/settings/notification/ZenModeVoiceActivity.java b/src/com/android/settings/notification/ZenModeVoiceActivity.java index c7c1151b1cf..2994ed10eb5 100644 --- a/src/com/android/settings/notification/ZenModeVoiceActivity.java +++ b/src/com/android/settings/notification/ZenModeVoiceActivity.java @@ -65,22 +65,24 @@ public class ZenModeVoiceActivity extends VoiceSettingsActivity { boolean enabled = intent.getBooleanExtra(EXTRA_DO_NOT_DISTURB_MODE_ENABLED, false); boolean specified = intent.hasExtra(EXTRA_DO_NOT_DISTURB_MODE_ENABLED); + setHeader(getString(R.string.zen_mode_interruptions_voice_header)); + List states = new ArrayList(); if (!specified || enabled) { states.add(new ModeSelection(this, Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS, - R.string.zen_mode_option_important_interruptions, - R.string.zen_mode_option_important_voice_synonyms)); + R.string.zen_mode_option_voice_important_interruptions, + R.string.zen_mode_option_voice_important_synonyms)); states.add(new ModeSelection(this, Global.ZEN_MODE_ALARMS, - R.string.zen_mode_option_alarms, - R.string.zen_mode_option_alarms_voice_synonyms)); + R.string.zen_mode_option_voice_alarms, + R.string.zen_mode_option_voice_alarms_synonyms)); states.add(new ModeSelection(this, Global.ZEN_MODE_NO_INTERRUPTIONS, - R.string.zen_mode_option_no_interruptions, - R.string.zen_mode_option_no_interruptions_voice_synonyms)); + R.string.zen_mode_option_voice_no_interruptions, + R.string.zen_mode_option_voice_no_interruptions_synonyms)); } if (!specified || !enabled) { states.add(new ModeSelection(this, Global.ZEN_MODE_OFF, - R.string.zen_mode_option_off, - R.string.zen_mode_option_off_voice_synonyms)); + R.string.zen_mode_option_voice_all_interruptions, + R.string.zen_mode_option_voice_all_interruptions_synonyms)); } VoiceSelectionFragment fragment = new VoiceSelectionFragment(); fragment.setArguments(VoiceSelectionFragment.createArguments( @@ -98,8 +100,10 @@ public class ZenModeVoiceActivity extends VoiceSettingsActivity { pickDuration(selection.getLabel(), mode); return; } + setZenModeConfig(mode, conditionSelection.mCondition); + } else { + setZenModeConfig(Global.ZEN_MODE_OFF, null); } - setZenModeConfig(mode, conditionSelection.mCondition); notifySuccess(getChangeSummary(mode, conditionSelection)); finish(); } @@ -112,6 +116,8 @@ public class ZenModeVoiceActivity extends VoiceSettingsActivity { */ private void pickDuration(CharSequence label, final int mode) { setTitle(label.toString()); + setHeader(null); + List states = new ArrayList(); states.add(new ConditionSelection(null, -1, getString(R.string.zen_mode_duration_indefinte_voice_label), @@ -137,13 +143,6 @@ public class ZenModeVoiceActivity extends VoiceSettingsActivity { showFragment(fragment, "pick_duration_fragment"); } - private void showFragment(Fragment fragment, String tag) { - getFragmentManager() - .beginTransaction() - .replace(R.id.fragment_root, fragment, tag) - .commit(); - } - private void setZenModeConfig(int mode, Condition condition) { if (condition != null) { NotificationManager.from(this).setZenMode(mode, condition.id, TAG); diff --git a/src/com/android/settings/utils/VoiceSelectionFragment.java b/src/com/android/settings/utils/VoiceSelectionFragment.java index c2e80d3aaa7..1e4e7e407bd 100644 --- a/src/com/android/settings/utils/VoiceSelectionFragment.java +++ b/src/com/android/settings/utils/VoiceSelectionFragment.java @@ -111,7 +111,7 @@ public class VoiceSelectionFragment extends ListFragment { } if (mOnItemSelectedListener != null) { - mOnItemSelectedListener.onItemSelected(position, getSelectionAt(position)); + mOnItemSelectedListener.onItemSelected(position, getSelectionAt(position)); } } diff --git a/src/com/android/settings/utils/VoiceSettingsActivity.java b/src/com/android/settings/utils/VoiceSettingsActivity.java index ac5b8becb17..21849a44eb3 100644 --- a/src/com/android/settings/utils/VoiceSettingsActivity.java +++ b/src/com/android/settings/utils/VoiceSettingsActivity.java @@ -16,11 +16,16 @@ package com.android.settings.utils; +import com.android.settings.R; + import android.app.Activity; +import android.app.Fragment; import android.app.VoiceInteractor; import android.app.VoiceInteractor.CompleteVoiceRequest; import android.content.Intent; import android.os.Bundle; +import android.view.View; +import android.widget.TextView; import android.util.Log; /** @@ -65,10 +70,30 @@ abstract public class VoiceSettingsActivity extends Activity { } } + protected void setHeader(String label) { + TextView header = (TextView) findViewById(R.id.voice_fragment_header); + if (header != null) { + if (label != null) { + header.setText(label); + header.setVisibility(View.VISIBLE); + } else { + header.setVisibility(View.GONE); + } + } + } + /** * Indicates when the setting could not be changed. */ protected void notifyFailure(String reason) { getVoiceInteractor().submitRequest(new VoiceInteractor.AbortVoiceRequest(reason, null)); } + + protected void showFragment(Fragment fragment, String tag) { + getFragmentManager() + .beginTransaction() + .replace(R.id.voice_fragment_root, fragment, tag) + .commit(); + } + }