Disable seekbar user seeking
By default the seekbar should be disabled unless being played or the voicemails have downloaded. This first part of the seekbar update ensures that a user is not able to seek, and the seekbar will only be updated automatically when the voicemail is being played.
Bug: 7252855
Test: N/A
PiperOrigin-RevId: 183419966
Change-Id: I4e492279402d76d3e1ece03dded9b402c88138c8
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java
index 3becd27..0234f64 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.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 @@
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 @@
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() {
@@ -167,6 +175,10 @@
initializeMediaPlayerButtonsAndViews();
setupListenersForMediaPlayerButtons();
+ // TODO(uabdullah): Handle seekbar seeking properly (a bug)
+ seekBarView.setEnabled(false);
+ seekBarView.setThumb(voicemailSeekHandleDisabled);
+
// 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.
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
new file mode 100644
index 0000000..315a0dd
--- /dev/null
+++ b/java/com/android/dialer/voicemail/listui/res/drawable-hdpi/ic_handle.png
Binary files differ
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
new file mode 100644
index 0000000..8bcec11
--- /dev/null
+++ b/java/com/android/dialer/voicemail/listui/res/drawable-mdpi/ic_handle.png
Binary files differ
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
new file mode 100644
index 0000000..36f3466
--- /dev/null
+++ b/java/com/android/dialer/voicemail/listui/res/drawable-xhdpi/ic_handle.png
Binary files differ
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
new file mode 100644
index 0000000..9a1651c
--- /dev/null
+++ b/java/com/android/dialer/voicemail/listui/res/drawable-xxhdpi/ic_handle.png
Binary files differ
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
new file mode 100644
index 0000000..c6dbf38
--- /dev/null
+++ b/java/com/android/dialer/voicemail/listui/res/drawable-xxxhdpi/ic_handle.png
Binary files differ
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 0000000..5e974c4
--- /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 0000000..6ecf4c2
--- /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