diff options
Diffstat (limited to 'java/com/android/dialer/voicemail/listui')
-rw-r--r-- | java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java | 39 | ||||
-rw-r--r-- | java/com/android/dialer/voicemail/listui/res/drawable-hdpi/ic_handle.png | bin | 0 -> 218 bytes | |||
-rw-r--r-- | java/com/android/dialer/voicemail/listui/res/drawable-mdpi/ic_handle.png | bin | 0 -> 160 bytes | |||
-rw-r--r-- | java/com/android/dialer/voicemail/listui/res/drawable-xhdpi/ic_handle.png | bin | 0 -> 285 bytes | |||
-rw-r--r-- | java/com/android/dialer/voicemail/listui/res/drawable-xxhdpi/ic_handle.png | bin | 0 -> 311 bytes | |||
-rw-r--r-- | java/com/android/dialer/voicemail/listui/res/drawable-xxxhdpi/ic_handle.png | bin | 0 -> 467 bytes | |||
-rw-r--r-- | java/com/android/dialer/voicemail/listui/res/drawable/ic_voicemail_seek_handle_disabled.xml | 20 | ||||
-rw-r--r-- | java/com/android/dialer/voicemail/listui/res/values/colors.xml | 19 |
8 files changed, 74 insertions, 4 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java index 3becd271f..dd59712a4 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java @@ -20,6 +20,7 @@ import android.app.FragmentManager; import android.content.Context; import android.content.Intent; import android.database.Cursor; +import android.graphics.drawable.Drawable; import android.media.AudioManager; import android.net.Uri; import android.provider.VoicemailContract; @@ -61,6 +62,8 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { private ImageButton deleteButton; private TextView currentSeekBarPosition; private SeekBar seekBarView; + private Drawable voicemailSeekHandleDisabled; + private TextView totalDurationView; private TextView voicemailLoadingStatusView; private Uri voicemailUri; @@ -96,6 +99,11 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { deleteButton = findViewById(R.id.deleteButton); totalDurationView = findViewById(R.id.playback_seek_total_duration); voicemailLoadingStatusView = findViewById(R.id.playback_state_text); + + voicemailSeekHandleDisabled = + getContext() + .getResources() + .getDrawable(R.drawable.ic_voicemail_seek_handle_disabled, getContext().getTheme()); } private void setupListenersForMediaPlayerButtons() { @@ -142,7 +150,9 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { Assert.isNotNull(voicemailEntryFromAdapter); Uri uri = Uri.parse(voicemailEntryFromAdapter.voicemailUri()); + numberVoicemailFrom = voicemailEntryFromAdapter.number().getRawInput().getNumber(); + Assert.isNotNull(viewHolder); Assert.isNotNull(uri); Assert.isNotNull(listener); @@ -167,6 +177,12 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { initializeMediaPlayerButtonsAndViews(); setupListenersForMediaPlayerButtons(); + // TODO(uabdullah): Handle seekbar seeking properly (a bug) + seekBarView.setEnabled(false); + seekBarView.setThumb(voicemailSeekHandleDisabled); + + updatePhoneIcon(numberVoicemailFrom); + // During the binding we only send a request to the adapter to tell us what the // state of the media player should be and call that function. // This could be the paused state, or the playing state of the resume state. @@ -219,6 +235,23 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { } } + /** + * Updates the phone icon depending if we can dial it or not. + * + * <p>Note: This must be called after the onClickListeners have been set, otherwise isClickable() + * state is not maintained. + */ + private void updatePhoneIcon(@Nullable String numberVoicemailFrom) { + // TODO(uabdullah): Handle restricted/blocked numbers (a bug) + if (TextUtils.isEmpty(numberVoicemailFrom)) { + phoneButton.setEnabled(false); + phoneButton.setClickable(false); + } else { + phoneButton.setEnabled(true); + phoneButton.setClickable(true); + } + } + private final OnSeekBarChangeListener seekbarChangeListener = new OnSeekBarChangeListener() { @Override @@ -466,11 +499,11 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { audioManager.setMode(AudioManager.STREAM_MUSIC); if (audioManager.isSpeakerphoneOn()) { LogUtil.i( - "NewVoicemailMediaPlayer.phoneButtonListener", "speaker was on, turning it off"); + "NewVoicemailMediaPlayer.speakerButtonListener", "speaker was on, turning it off"); audioManager.setSpeakerphoneOn(false); } else { LogUtil.i( - "NewVoicemailMediaPlayer.phoneButtonListener", "speaker was off, turning it on"); + "NewVoicemailMediaPlayer.speakerButtonListener", "speaker was off, turning it on"); audioManager.setSpeakerphoneOn(true); } // TODO(uabdullah): Handle colors of speaker icon when speaker is on and off. @@ -478,8 +511,6 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { }; // TODO(uabdullah): Add phone account handle (a bug) - // TODO(uabdullah): If the call cannot be made then the phone icon should be greyed out - // (a bug) private final View.OnClickListener phoneButtonListener = new View.OnClickListener() { @Override diff --git a/java/com/android/dialer/voicemail/listui/res/drawable-hdpi/ic_handle.png b/java/com/android/dialer/voicemail/listui/res/drawable-hdpi/ic_handle.png Binary files differnew file mode 100644 index 000000000..315a0dd40 --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/drawable-hdpi/ic_handle.png diff --git a/java/com/android/dialer/voicemail/listui/res/drawable-mdpi/ic_handle.png b/java/com/android/dialer/voicemail/listui/res/drawable-mdpi/ic_handle.png Binary files differnew file mode 100644 index 000000000..8bcec11e0 --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/drawable-mdpi/ic_handle.png diff --git a/java/com/android/dialer/voicemail/listui/res/drawable-xhdpi/ic_handle.png b/java/com/android/dialer/voicemail/listui/res/drawable-xhdpi/ic_handle.png Binary files differnew file mode 100644 index 000000000..36f3466a6 --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/drawable-xhdpi/ic_handle.png diff --git a/java/com/android/dialer/voicemail/listui/res/drawable-xxhdpi/ic_handle.png b/java/com/android/dialer/voicemail/listui/res/drawable-xxhdpi/ic_handle.png Binary files differnew file mode 100644 index 000000000..9a1651cee --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/drawable-xxhdpi/ic_handle.png diff --git a/java/com/android/dialer/voicemail/listui/res/drawable-xxxhdpi/ic_handle.png b/java/com/android/dialer/voicemail/listui/res/drawable-xxxhdpi/ic_handle.png Binary files differnew file mode 100644 index 000000000..c6dbf3875 --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/drawable-xxxhdpi/ic_handle.png diff --git a/java/com/android/dialer/voicemail/listui/res/drawable/ic_voicemail_seek_handle_disabled.xml b/java/com/android/dialer/voicemail/listui/res/drawable/ic_voicemail_seek_handle_disabled.xml new file mode 100644 index 000000000..5e974c45a --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/drawable/ic_voicemail_seek_handle_disabled.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2015 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 + --> +<bitmap xmlns:android="http://schemas.android.com/apk/res/android" + android:src="@drawable/ic_handle" + android:tint="@color/voicemail_icon_disabled_tint"> +</bitmap>
\ No newline at end of file diff --git a/java/com/android/dialer/voicemail/listui/res/values/colors.xml b/java/com/android/dialer/voicemail/listui/res/values/colors.xml new file mode 100644 index 000000000..6ecf4c229 --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/values/colors.xml @@ -0,0 +1,19 @@ +<?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 + --> +<resources> + <color name="voicemail_icon_disabled_tint">#80000000</color> +</resources>
\ No newline at end of file |