Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33780141 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Added Change Voicemail Greeting Preference to Settings screen Added...

Merge "Added Change Voicemail Greeting Preference to Settings screen Added empty classes and necessary XML files"
parents 559ec9f1 8915c215
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
    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 -->
@@ -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>
+30 −0
Original line number Diff line number Diff line
/*
 * 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);
  }
}
+37 −0
Original line number Diff line number Diff line
/*
 * 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);
  }
}
+30 −0
Original line number Diff line number Diff line
/*
 * 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);
  }
}
+21 −2
Original line number Diff line number Diff line
@@ -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;
  }
}
Loading