summaryrefslogtreecommitdiff
path: root/java/com
diff options
context:
space:
mode:
authorAndroid Dialer <noreply@google.com>2018-06-18 14:54:27 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-18 14:55:53 -0700
commit8915c215e4d5c02a714c53a3808dea7b8718d052 (patch)
treef680238fd0028a12a5a7ac30ee455034e99e638e /java/com
parent4a22adba986be3b76b7607f320906729a511b6b4 (diff)
Added Change Voicemail Greeting Preference to Settings screen
Added empty classes and necessary XML files Test: "No Tests" PiperOrigin-RevId: 201063930 Change-Id: I2c24428a91c5d2a706f0e90ce899e8faaf1a2df9
Diffstat (limited to 'java/com')
-rw-r--r--java/com/android/dialer/voicemail/settings/AndroidManifest.xml12
-rw-r--r--java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java30
-rw-r--r--java/com/android/dialer/voicemail/settings/RecordButton.java37
-rw-r--r--java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java30
-rw-r--r--java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java23
-rw-r--r--java/com/android/dialer/voicemail/settings/res/layout/activity_current_voicemail_greeting.xml24
-rw-r--r--java/com/android/dialer/voicemail/settings/res/layout/activity_record_voicemail_greeting.xml24
-rw-r--r--java/com/android/dialer/voicemail/settings/res/values/strings.xml16
-rw-r--r--java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml4
9 files changed, 197 insertions, 3 deletions
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">
<application>
+
<!-- Causes the "Voicemail" item under "Calls" setting to be hidden. The voicemail module will
be handling the settings. Has no effect before OC where dialer cannot provide voicemail
- settings-->
+ settings -->
<meta-data android:name="android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU" android:value="true"/>
<activity
@@ -35,5 +36,14 @@
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
+ <activity
+ android:name=".RecordVoicemailGreetingActivity"
+ android:configChanges="orientation|screenSize|keyboardHidden"
+ android:label="@string/voicemail_change_greeting_preference_title"
+ android:parentActivityName="com.android.dialer.app.settings.DialerSettingsActivity"
+ android:theme="@style/SettingsStyle">
+ </activity>
+ <activity android:name=".CurrentVoicemailGreetingActivity">
+ </activity>
</application>
</manifest>
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.android.dialer.voicemail.settings.CurrentVoicemailGreetingActivity">
+</RelativeLayout>
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.android.dialer.voicemail.settings.RecordVoicemailGreetingActivity">
+</RelativeLayout> \ 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] -->
<string name="voicemail_notifications_preference_title">Notifications</string>
+
+ <!-- Internal key for a preference to change greeting -->
+ <string name="voicemail_change_greeting_key" translatable="false">voicemail_change_greeting_key</string>
+
+ <!-- Title for changing voicemail greeting activity [CHAR LIMIT=40] -->
+ <string name="voicemail_change_greeting_preference_title">Voicemail greeting</string>
+
+ <!-- Text shown on the record voicemail activity [CHAR LIMIT=20] -->
+ <string name="change_greeting_text">Tap to Record</string>
+
+ <!-- Text shown on save button in record voicemail activity [CHAR LIMIT=10] -->
+ <string name="save_button_text">Save</string>
+
+ <!-- Text shown on redo button in record voicemail activity [CHAR LIMIT=10] -->
+ <string name="redo_button_text">Try Again</string>
+
<string name="voicemail_advanced_settings_key" translatable="false">voicemail_advanced_settings_key</string>
<!-- Title for advanced settings in the voicemail settings -->
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"/>
+ <Preference
+ android:key="@string/voicemail_change_greeting_key"
+ android:title = "@string/voicemail_change_greeting_preference_title"/>
+
<SwitchPreference
android:key="@string/voicemail_visual_voicemail_key"
android:title="@string/voicemail_visual_voicemail_switch_title"/>"