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

Commit cb395358 authored by Beth Thibodeau's avatar Beth Thibodeau
Browse files

Adding seekbar to media notifications

Test: manually tested, screenshots at https://drive.google.com/open?id=1rbiNM_2PG_Kyd4MWnDFUdQy-K3dAVKz3
Bug: 123698590

Change-Id: Ieb7bc6b379f78d1611f7a97615a13a3c0a993f9e
parent 22f25a92
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public class MediaNotificationView extends FrameLayout {
    private View mActions;
    private View mHeader;
    private View mMainColumn;
    private View mMediaContent;
    private int mImagePushIn;

    public MediaNotificationView(Context context) {
@@ -70,7 +71,7 @@ public class MediaNotificationView extends FrameLayout {
                    (MarginLayoutParams) mRightIcon.getLayoutParams();
            int imageEndMargin = layoutParams.getMarginEnd();
            size -= imageEndMargin;
            int fullHeight = getMeasuredHeight();
            int fullHeight = mMediaContent.getMeasuredHeight();
            if (size > fullHeight) {
                size = fullHeight;
            } else if (size < fullHeight) {
@@ -154,5 +155,6 @@ public class MediaNotificationView extends FrameLayout {
        mActions = findViewById(com.android.internal.R.id.media_actions);
        mHeader = findViewById(com.android.internal.R.id.notification_header);
        mMainColumn = findViewById(com.android.internal.R.id.notification_main_column);
        mMediaContent = findViewById(com.android.internal.R.id.notification_media_content);
    }
}
+64 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/notification_media_progress"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_alignParentBottom="true"
    >
    <SeekBar android:id="@+id/notification_media_progress_bar"
        style="@style/Widget.ProgressBar.Horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:maxHeight="3dp"
        android:paddingTop="24dp"
        android:paddingBottom="24dp"
        android:layout_marginBottom="-24dp"
        android:layout_marginTop="-12dp"
        android:splitTrack="false"
    />
    <FrameLayout
        android:id="@+id/notification_media_progress_time"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="11dp"
        >

        <!-- width is set to "match_parent" to avoid extra layout calls -->
        <TextView android:id="@+id/notification_media_elapsed_time"
            style="@style/Widget.DeviceDefault.Notification.Text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_marginStart="@dimen/notification_content_margin_start"
            android:gravity="left"
        />

        <TextView android:id="@+id/notification_media_total_time"
            style="@style/Widget.DeviceDefault.Notification.Text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:gravity="right"
        />
    </FrameLayout>
</LinearLayout>
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/notification_media_content"
        >
        <LinearLayout
            android:id="@+id/notification_main_column"
@@ -84,5 +85,9 @@
                android:id="@+id/media_seamless"
            />
        </LinearLayout>
        <ViewStub android:id="@+id/notification_media_seekbar_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
        />
    </LinearLayout>
</com.android.internal.widget.MediaNotificationView>
+47 −35
Original line number Diff line number Diff line
@@ -33,6 +33,12 @@
    <include layout="@layout/notification_template_header"
        android:layout_width="match_parent"
        android:layout_height="@dimen/media_notification_header_height" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/notification_media_content"
        >
        <LinearLayout
            android:id="@+id/notification_main_column"
            android:layout_width="match_parent"
@@ -40,6 +46,7 @@
            android:orientation="horizontal"
            android:layout_marginStart="@dimen/notification_content_margin_start"
            android:layout_marginTop="@dimen/notification_content_margin_top"
            android:layout_alignParentTop="true"
            android:tag="media"
            >
            <LinearLayout
@@ -61,7 +68,6 @@
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|end"
                android:layout_marginStart="10dp"
            android:layout_marginBottom="@dimen/media_notification_actions_padding_bottom"
                android:layoutDirection="ltr"
                android:orientation="horizontal"
                >
@@ -79,4 +85,10 @@
                />
            </LinearLayout>
        </LinearLayout>
        <ViewStub android:id="@+id/notification_media_seekbar_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
        />
    </LinearLayout>
</FrameLayout>
+7 −0
Original line number Diff line number Diff line
@@ -195,6 +195,12 @@
  <java-symbol type="id" name="action3" />
  <java-symbol type="id" name="action4" />
  <java-symbol type="id" name="media_seamless" />
  <java-symbol type="id" name="notification_media_seekbar_container" />
  <java-symbol type="id" name="notification_media_content" />
  <java-symbol type="id" name="notification_media_progress" />
  <java-symbol type="id" name="notification_media_progress_bar" />
  <java-symbol type="id" name="notification_media_elapsed_time" />
  <java-symbol type="id" name="notification_media_total_time" />
  <java-symbol type="id" name="big_picture" />
  <java-symbol type="id" name="big_text" />
  <java-symbol type="id" name="chronometer" />
@@ -1573,6 +1579,7 @@
  <java-symbol type="layout" name="immersive_mode_cling" />
  <java-symbol type="layout" name="user_switching_dialog" />
  <java-symbol type="layout" name="common_tab_settings" />
  <java-symbol type="layout" name="notification_material_media_seekbar" />

  <java-symbol type="anim" name="slide_in_child_bottom" />
  <java-symbol type="anim" name="slide_in_right" />
Loading