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

Commit 563fb819 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 13488884 from 29ffa81b to 25Q3-release

Change-Id: Iea2f8fa60deab36b0eb4265af5609e923350c8a2
parents 3467775e 29ffa81b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -9,8 +9,7 @@
    }
  ],
  "desktop-postsubmit": [    {
      "name": "DocumentsUIGoogleTests",
      "keywords": ["primary-device"]
      "name": "DocumentsUIGoogleTests"
    },
    {
      "name": "DocumentsUIUnitTests"
+9 −7
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@
    <style name="TextAppearance.DocumentsUI.TitleSmall" parent="TextAppearance.Material3.TitleSmall">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>
    <style name="TextAppearance.DocumentsUI.TitleSmall.Emphasized" parent="TextAppearance.Material3.TitleSmall.Emphasized">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>
    <style name="TextAppearance.DocumentsUI.BodyLarge" parent="TextAppearance.Material3.BodyLarge">
        <item name="fontFamily">@string/config_fontFamily</item>
    </style>
@@ -53,6 +56,9 @@
    <style name="TextAppearance.DocumentsUI.LabelLarge" parent="TextAppearance.Material3.LabelLarge">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>
    <style name="TextAppearance.DocumentsUI.LabelLarge.Emphasized" parent="TextAppearance.Material3.LabelLarge.Emphasized">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>
    <style name="TextAppearance.DocumentsUI.LabelMedium" parent="TextAppearance.Material3.LabelMedium">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>
@@ -99,9 +105,8 @@
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="DrawerMenuHeaderM3" parent="@style/TextAppearance.Material3.TitleSmall.Emphasized">
    <style name="DrawerMenuHeaderM3" parent="@style/TextAppearance.DocumentsUI.TitleSmall.Emphasized">
        <item name="android:textColor">?attr/colorOnSurfaceVariant</item>
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="DrawerMenuPrimaryM3" parent="@style/TextAppearance.DocumentsUI.LabelLarge">
@@ -156,9 +161,7 @@

    <style name="NavRailItemTextAppearance" parent="@style/TextAppearance.DocumentsUI.LabelMedium" />

    <style name="ListTableHeaderText" parent="@style/TextAppearance.Material3.TitleSmall.Emphasized">
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>
    <style name="ListTableHeaderText" parent="@style/TextAppearance.DocumentsUI.TitleSmall.Emphasized" />

    <style name="DragBadgeText" parent="@style/TextAppearance.DocumentsUI.TitleSmall">
        <item name="android:textColor">@color/drag_content_text_color</item>
@@ -210,9 +213,8 @@
        <item name="android:textColor">@android:color/white</item>
    </style>

    <style name="PeekNoPreviewLabelText" parent="@style/TextAppearance.Material3.LabelLarge.Emphasized">
    <style name="PeekNoPreviewLabelText" parent="@style/TextAppearance.DocumentsUI.LabelLarge.Emphasized">
        <item name="android:textColor">?attr/colorOnSurfaceVariant</item>
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

</resources>
+25 −2
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import android.widget.ProgressBar
import android.widget.TextView
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.ListAdapter
@@ -78,7 +80,8 @@ private class VerticalMarginItemDecoration(
class JobPanelController(
    private val activityContext: Context,
    private val viewModel: JobPanelViewModel,
) : BroadcastReceiver() {
) : BroadcastReceiver(),
    DefaultLifecycleObserver {
    companion object {
        private const val TAG = "JobPanelController"
        private const val MAX_PROGRESS = 100
@@ -324,6 +327,10 @@ class JobPanelController(
                ))
                itemAnimator = null
                adapter = listAdapter
                if (viewModel.listState != null) {
                    layoutManager?.onRestoreInstanceState(viewModel.listState)
                    viewModel.listState = null
                }
            }
            progressListAdapter = listAdapter
            val popupWidth =
@@ -338,7 +345,10 @@ class JobPanelController(
                /* height= */ ViewGroup.LayoutParams.WRAP_CONTENT,
                /* focusable= */ true
            ).apply {
                setOnDismissListener { progressListAdapter = null }
                setOnDismissListener {
                    progressListAdapter = null
                    popup = null
                }
                showAsDropDown(
                    /* anchor= */ view,
                    /* xoff= */ 0,
@@ -347,11 +357,24 @@ class JobPanelController(
                )
            }
        }
        // Restore the popup if we had saved state.
        if (viewModel.listState != null) {
            progressIcon.callOnClick()
        }
        menuItem = newMenuItem
        // Don't animate for the initial state update.
        updateMenuItem(viewModel.getMenuState(), animate = false)
    }

    override fun onDestroy(owner: LifecycleOwner) {
        // We need to save the popup's UI state and manually dismiss the popup, as it somehow
        // stays alive even if the activity is destroyed due to a configuration change.
        viewModel.listState = popup?.contentView
            ?.findViewById<RecyclerView>(R.id.job_progress_list)?.layoutManager
            ?.onSaveInstanceState()
        popup?.dismiss()
    }

    override fun onReceive(context: Context?, intent: Intent) {
        val progresses = intent.getParcelableArrayListExtra(
            FileOperationService.EXTRA_PROGRESS,
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.documentsui

import android.os.Parcelable
import android.util.Log
import androidx.lifecycle.ViewModel
import com.android.documentsui.base.SharedMinimal.DEBUG
@@ -49,6 +50,7 @@ class JobPanelViewModel : ViewModel() {
    /** List of jobs currently tracked. */
    private val _currentJobs = LinkedHashMap<String, ProgressViewModel>()
    val currentJobs: Map<String, ProgressViewModel> get() = _currentJobs
    var listState: Parcelable? = null

    /**
     * Gets the state of the toolbar progress icon based off the current jobs tracked.
+4 −2
Original line number Diff line number Diff line
@@ -148,8 +148,10 @@ public class FilesActivity extends BaseActivity implements AbstractActionHandler
                mInjector.getModel()::getItemUri,
                mInjector.getModel()::getItemCount);
        if (isVisualSignalsFlagEnabled()) {
            menuManager.setJobPanelController(new JobPanelController(this,
                    new ViewModelProvider(this).get(JobPanelViewModel.class)));
            JobPanelController jobPanelController = new JobPanelController(this,
                    new ViewModelProvider(this).get(JobPanelViewModel.class));
            getLifecycle().addObserver(jobPanelController);
            menuManager.setJobPanelController(jobPanelController);
        }
        mInjector.menuManager = menuManager;