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

Commit 633172ec authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implement base job progress item" into main

parents 7ad8ff21 671681d8
Loading
Loading
Loading
Loading
+124 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2025 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.
-->
<com.google.android.material.card.MaterialCardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    style="@style/JobProgressItemCardStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/job_progress_item_title"
            style="@style/JobProgressItemTitleStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/job_progress_item_padding"
            android:layout_marginStart="@dimen/job_progress_item_padding"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toStartOf="@id/job_progress_item_expand"
            app:layout_constraintTop_toTopOf="parent" />
        <com.google.android.material.button.MaterialButton
            android:id="@+id/job_progress_item_expand"
            style="@style/JobProgressItemExpandButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/job_progress_item_expand_margin_start"
            android:layout_marginEnd="@dimen/job_progress_item_padding"
            app:layout_constraintStart_toEndOf="@id/job_progress_item_title"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/job_progress_item_title" />
        <androidx.constraintlayout.widget.Barrier
            android:id="@+id/job_progress_item_header_barrier"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:barrierDirection="bottom"
            app:constraint_referenced_ids="job_progress_item_title,job_progress_item_expand" />

        <com.google.android.material.progressindicator.LinearProgressIndicator
            android:id="@+id/job_progress_item_progress"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/job_progress_item_progress_margin_top"
            app:layout_constraintStart_toStartOf="@id/job_progress_item_title"
            app:layout_constraintEnd_toEndOf="@id/job_progress_item_expand"
            app:layout_constraintTop_toBottomOf="@id/job_progress_item_header_barrier" />
        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/job_progress_item_primary_status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="@style/JobProgressItemStatusText"
            app:layout_constraintStart_toStartOf="@id/job_progress_item_progress"
            app:layout_constraintTop_toBottomOf="@id/job_progress_item_progress" />
        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/job_progress_item_status_separator"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/job_progress_item_status_separator_margin"
            android:text="@string/bullet"
            android:textAppearance="?attr/textAppearanceBodySmall"
            app:layout_constraintStart_toEndOf="@id/job_progress_item_primary_status"
            app:layout_constraintTop_toBottomOf="@id/job_progress_item_progress" />
        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/job_progress_item_secondary_status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/job_progress_item_status_separator_margin"
            android:textAppearance="@style/JobProgressItemStatusText"
            app:layout_constraintStart_toEndOf="@+id/job_progress_item_status_separator"
            app:layout_constraintTop_toBottomOf="@+id/job_progress_item_progress" />

        <!-- Used to provide a bottom margin when all buttons are hidden. -->
        <Space
            android:layout_width="wrap_content"
            android:layout_height="@dimen/job_progress_item_padding"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/job_progress_item_secondary_status" />
        <!-- Used to provide a consistent margin regardless of which button is displayed. -->
        <Space
            android:id="@+id/job_progress_item_button_margin"
            android:layout_width="@dimen/job_progress_item_buttons_margin_start"
            android:layout_height="@dimen/job_progress_item_buttons_margin_top"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/job_progress_item_secondary_status" />
        <com.google.android.material.button.MaterialButton
            android:id="@+id/job_progress_item_cancel"
            style="@style/JobProgressItemActionButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@android:string/cancel"
            app:layout_constraintStart_toEndOf="@id/job_progress_item_button_margin"
            app:layout_constraintTop_toBottomOf="@id/job_progress_item_button_margin" />
        <com.google.android.material.button.MaterialButton
            android:id="@+id/job_progress_item_show_in_folder"
            style="@style/JobProgressItemActionButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/button_show_in_folder"
            app:layout_constraintStart_toEndOf="@id/job_progress_item_cancel"
            app:layout_constraintTop_toTopOf="@id/job_progress_item_cancel" />
        <com.google.android.material.button.MaterialButton
            android:id="@+id/job_progress_item_dismiss"
            style="@style/JobProgressItemActionButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/button_dismiss"
            app:layout_constraintStart_toEndOf="@id/job_progress_item_show_in_folder"
            app:layout_constraintTop_toTopOf="@id/job_progress_item_show_in_folder" />
    </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
+7 −0
Original line number Diff line number Diff line
@@ -262,4 +262,11 @@
    <!-- 360dp - 2 * header margin (16dp) - header line height (24dp) -->
    <dimen name="job_progress_list_max_height">304dp</dimen>
    <dimen name="job_progress_list_margin">@dimen/space_extra_small_6</dimen>

    <dimen name="job_progress_item_padding">@dimen/space_small_1</dimen>
    <dimen name="job_progress_item_expand_margin_start">@dimen/space_small_4</dimen>
    <dimen name="job_progress_item_progress_margin_top">@dimen/space_extra_small_4</dimen>
    <dimen name="job_progress_item_status_separator_margin">@dimen/space_extra_small_2</dimen>
    <dimen name="job_progress_item_buttons_margin_start">@dimen/space_extra_small_2</dimen>
    <dimen name="job_progress_item_buttons_margin_top">@dimen/space_extra_small_1</dimen>
</resources>
+34 −0
Original line number Diff line number Diff line
@@ -189,4 +189,38 @@
        <item name="cardElevation">1dp</item>
        <item name="cardBackgroundColor">?attr/colorSurfaceDim</item>
    </style>

    <style name="JobProgressItemCardStyle" parent="@style/Widget.Material3.CardView.Filled">
        <item name="cardBackgroundColor">?attr/colorSurfaceContainer</item>
        <item name="shapeAppearance">@style/ShapeAppearance.Material3.Corner.ExtraSmall</item>
    </style>

    <style name="JobProgressItemTitleStyle" parent="">
        <item name="android:textAppearance">@style/JobProgressItemTitleText</item>
    </style>

    <style name="JobProgressItemTitleStyle.Collapsed">
        <item name="android:ellipsize">end</item>
        <item name="android:maxLines">1</item>
    </style>

    <style name="JobProgressItemExpandButtonStyle" parent="@style/Widget.Material3.Button.IconButton.Filled">
        <item name="android:insetBottom">0dp</item>
        <item name="android:insetLeft">0dp</item>
        <item name="android:insetRight">0dp</item>
        <item name="android:insetTop">0dp</item>
        <item name="android:minHeight">0dp</item>
        <item name="android:paddingHorizontal">6dp</item>
        <item name="android:paddingVertical">1dp</item>
        <item name="backgroundTint">?attr/colorSurfaceBright</item>
        <item name="iconSize">16dp</item>
        <item name="iconTint">?attr/colorOnSurface</item>
        <item name="shapeAppearance">@style/ShapeAppearance.Material3.Corner.Full</item>
    </style>

    <style name="JobProgressItemActionButtonStyle" parent="@style/Widget.Material3.Button.TextButton">
        <item name="android:minWidth">0dp</item>
        <item name="android:textAppearance">@style/JobProgressItemActionButtonText</item>
    </style>

</resources>
+12 −0
Original line number Diff line number Diff line
@@ -156,6 +156,18 @@
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="JobProgressItemTitleText" parent="@style/TextAppearance.Material3.TitleSmall">
        <item name="fontFamily">@string/config_fontFamily</item>
    </style>

    <style name="JobProgressItemStatusText" parent="@style/TextAppearance.Material3.LabelMedium">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="JobProgressItemActionButtonText" parent="@style/TextAppearance.Material3.LabelLarge">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="MaterialAlertDialogTitleStyle" parent="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>
+7 −0
Original line number Diff line number Diff line
@@ -133,6 +133,8 @@
    <string name="button_show_provider">Show in provider</string>
    <!-- Button label that do back action [CHAR LIMIT=24] -->
    <string name="button_back">Back</string>
    <!-- Button label that navigates to the destination folder of a copy/move. -->
    <string name="button_show_in_folder">Show in folder</string>

    <!-- A string used to show user that currently documents are not sorted in any given order. [CHAR_LIMIT=30] -->
    <string name="not_sorted">Not sorted</string>
@@ -430,6 +432,11 @@
        other {Zipping # files}
    }</string>
    <string name="job_progress_panel_title" translatable="false">File Progress</string>
    <string name="job_progress_item_completed" translatable="false">Completed</string>
    <string name="job_progress_item_failed" translatable="false">Failed</string>
    <string name="job_progress_item_byte_progress" translatable="false">
        <xliff:g id="currentBytes" example="2.4 MB">%1$s</xliff:g> of <xliff:g id="totalBytes" example="50 MB">%2$s</xliff:g>
    </string>

    <!-- Text in an alert dialog asking user to grant app access to a given directory in an external storage volume -->
    <string name="open_external_dialog_request">Grant <xliff:g id="appName" example="System Settings"><b>^1</b></xliff:g>
Loading