From 8915c215e4d5c02a714c53a3808dea7b8718d052 Mon Sep 17 00:00:00 2001 From: Android Dialer Date: Mon, 18 Jun 2018 14:54:27 -0700 Subject: Added Change Voicemail Greeting Preference to Settings screen Added empty classes and necessary XML files Test: "No Tests" PiperOrigin-RevId: 201063930 Change-Id: I2c24428a91c5d2a706f0e90ce899e8faaf1a2df9 --- .../dialer/voicemail/settings/AndroidManifest.xml | 12 ++++++- .../settings/CurrentVoicemailGreetingActivity.java | 30 ++++++++++++++++++ .../dialer/voicemail/settings/RecordButton.java | 37 ++++++++++++++++++++++ .../settings/RecordVoicemailGreetingActivity.java | 30 ++++++++++++++++++ .../settings/VoicemailSettingsFragment.java | 23 ++++++++++++-- .../layout/activity_current_voicemail_greeting.xml | 24 ++++++++++++++ .../layout/activity_record_voicemail_greeting.xml | 24 ++++++++++++++ .../voicemail/settings/res/values/strings.xml | 16 ++++++++++ .../settings/res/xml/voicemail_settings.xml | 4 +++ 9 files changed, 197 insertions(+), 3 deletions(-) create mode 100644 java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java create mode 100644 java/com/android/dialer/voicemail/settings/RecordButton.java create mode 100644 java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java create mode 100644 java/com/android/dialer/voicemail/settings/res/layout/activity_current_voicemail_greeting.xml create mode 100644 java/com/android/dialer/voicemail/settings/res/layout/activity_record_voicemail_greeting.xml (limited to 'java/com') diff --git a/java/com/android/dialer/voicemail/settings/AndroidManifest.xml b/java/com/android/dialer/voicemail/settings/AndroidManifest.xml index 5b7f1f79e..71a70da7e 100644 --- a/java/com/android/dialer/voicemail/settings/AndroidManifest.xml +++ b/java/com/android/dialer/voicemail/settings/AndroidManifest.xml @@ -18,9 +18,10 @@ package="com.android.dialer.voicemail.settings"> + + settings --> + + + + diff --git a/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java new file mode 100644 index 000000000..2b6f27bc3 --- /dev/null +++ b/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2018 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 + */ + +package com.android.dialer.voicemail.settings; + +import android.app.Activity; +import android.os.Bundle; + +/** Activity to display current voicemail greeting and allow user to navigate to record a new one */ +public class CurrentVoicemailGreetingActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_current_voicemail_greeting); + } +} diff --git a/java/com/android/dialer/voicemail/settings/RecordButton.java b/java/com/android/dialer/voicemail/settings/RecordButton.java new file mode 100644 index 000000000..f144576d4 --- /dev/null +++ b/java/com/android/dialer/voicemail/settings/RecordButton.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2018 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 + */ + +package com.android.dialer.voicemail.settings; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.Button; + +/** Custom Button View for Dialer voicemail greeting recording */ +public class RecordButton extends Button { + + public RecordButton(Context context) { + super(context); + } + + public RecordButton(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public RecordButton(Context context, AttributeSet attrs, int defStyleAttrs) { + super(context, attrs, defStyleAttrs); + } +} diff --git a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java new file mode 100644 index 000000000..750636faa --- /dev/null +++ b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2018 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 + */ + +package com.android.dialer.voicemail.settings; + +import android.app.Activity; +import android.os.Bundle; + +/** Activity for recording a new voicemail greeting */ +public class RecordVoicemailGreetingActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_record_voicemail_greeting); + } +} diff --git a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java index 007ab202d..1eb831fdb 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java @@ -36,6 +36,7 @@ import android.telephony.TelephonyManager; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.preference.SwitchPreferenceWithClickableSummary; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.notification.NotificationChannelManager; @@ -71,6 +72,7 @@ public class VoicemailSettingsFragment extends PreferenceFragment private VoicemailClient voicemailClient; // Settings that are independent of the carrier configurations private Preference voicemailNotificationPreference; + private Preference changeGreetingPreference; private PreferenceScreen advancedSettingsPreference; // Settings that are supported by dialer only if the carrier configurations are valid. private SwitchPreference visualVoicemailPreference; @@ -105,6 +107,7 @@ public class VoicemailSettingsFragment extends PreferenceFragment setupVisualVoicemailPreferences(); setupNotificationsPreference(); + setupChangeGreetingPreference(); setupAdvancedSettingsPreference(); } @@ -229,6 +232,9 @@ public class VoicemailSettingsFragment extends PreferenceFragment findPreference(getString(R.string.voicemail_notifications_key)); voicemailNotificationPreference.setOrder(VMSettingOrdering.NOTIFICATIONS); + changeGreetingPreference = findPreference(getString(R.string.voicemail_change_greeting_key)); + changeGreetingPreference.setOrder(VMSettingOrdering.CHANGE_GREETING); + advancedSettingsPreference = (PreferenceScreen) findPreference(getString(R.string.voicemail_advanced_settings_key)); advancedSettingsPreference.setOrder(VMSettingOrdering.ADVANCED_SETTING); @@ -290,7 +296,6 @@ public class VoicemailSettingsFragment extends PreferenceFragment } private void setupNotificationsPreference() { - voicemailNotificationPreference.setIntent(getNotificationSettingsIntent()); voicemailNotificationPreference.setOnPreferenceClickListener( @@ -305,6 +310,18 @@ public class VoicemailSettingsFragment extends PreferenceFragment }); } + private void setupChangeGreetingPreference() { + if (!ConfigProviderComponent.get(getContext()) + .getConfigProvider() + .getBoolean("voicemail_change_greeting_enabled", false)) { + getPreferenceScreen().removePreference(changeGreetingPreference); + return; + } + + Intent changeGreetingIntent = new Intent(getContext(), CurrentVoicemailGreetingActivity.class); + changeGreetingPreference.setIntent(changeGreetingIntent); + } + private void setupAdvancedSettingsPreference() { Intent advancedSettingsIntent = new Intent(TelephonyManager.ACTION_CONFIGURE_VOICEMAIL); advancedSettingsIntent.putExtra(TelephonyManager.EXTRA_HIDE_PUBLIC_SETTINGS, true); @@ -508,7 +525,8 @@ public class VoicemailSettingsFragment extends PreferenceFragment VMSettingOrdering.VOICEMAIL_TRANSCRIPTION_DONATION, VMSettingOrdering.VOICEMAIL_CHANGE_PIN, VMSettingOrdering.VOICEMAIL_AUTO_ARCHIVE, - VMSettingOrdering.ADVANCED_SETTING + VMSettingOrdering.ADVANCED_SETTING, + VMSettingOrdering.CHANGE_GREETING }) private @interface VMSettingOrdering { int NOTIFICATIONS = 1; @@ -518,5 +536,6 @@ public class VoicemailSettingsFragment extends PreferenceFragment int VOICEMAIL_CHANGE_PIN = 5; int VOICEMAIL_AUTO_ARCHIVE = 6; int ADVANCED_SETTING = 7; + int CHANGE_GREETING = 8; } } diff --git a/java/com/android/dialer/voicemail/settings/res/layout/activity_current_voicemail_greeting.xml b/java/com/android/dialer/voicemail/settings/res/layout/activity_current_voicemail_greeting.xml new file mode 100644 index 000000000..81d175a4f --- /dev/null +++ b/java/com/android/dialer/voicemail/settings/res/layout/activity_current_voicemail_greeting.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/java/com/android/dialer/voicemail/settings/res/layout/activity_record_voicemail_greeting.xml b/java/com/android/dialer/voicemail/settings/res/layout/activity_record_voicemail_greeting.xml new file mode 100644 index 000000000..afaec5fdf --- /dev/null +++ b/java/com/android/dialer/voicemail/settings/res/layout/activity_record_voicemail_greeting.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/com/android/dialer/voicemail/settings/res/values/strings.xml b/java/com/android/dialer/voicemail/settings/res/values/strings.xml index ad245ee47..12cb83bf7 100644 --- a/java/com/android/dialer/voicemail/settings/res/values/strings.xml +++ b/java/com/android/dialer/voicemail/settings/res/values/strings.xml @@ -29,6 +29,22 @@ which sound to play and whether to vibrate when a voicemail notification is received. [CHAR LIMIT=30] --> Notifications + + + voicemail_change_greeting_key + + + Voicemail greeting + + + Tap to Record + + + Save + + + Try Again + voicemail_advanced_settings_key diff --git a/java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml b/java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml index fc839ee3e..9dff2cba4 100644 --- a/java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml +++ b/java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml @@ -22,6 +22,10 @@ android:key="@string/voicemail_notifications_key" android:title="@string/voicemail_notifications_preference_title"/> + + " -- cgit v1.2.3