Loading res/flag(com.android.documentsui.flags.use_material3)/values-night/colors.xml +2 −0 Original line number Diff line number Diff line Loading @@ -35,4 +35,6 @@ <!-- TODO(b/379776735): remove this after use_material3 flag is launched. --> <color name="search_chip_text_selected_color">@android:color/black</color> <color name="job_progress_success">#3CBA5A</color> </resources> res/flag(com.android.documentsui.flags.use_material3)/values/colors.xml +3 −0 Original line number Diff line number Diff line Loading @@ -101,4 +101,7 @@ <!-- Scrim for the Top bar. Static color, 32% opacity in black. The same scrim is used in some parts of Android SysUI, it can't be used directly here. --> <color name="peek_topbar_scrim">#52000000</color> <!-- Custom green color indicating success not available in the base theme palette. --> <color name="job_progress_success">#187231</color> </resources> res/flag(com.android.documentsui.flags.use_material3)/values/styles_text.xml +8 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,14 @@ <item name="fontFamily">@string/config_fontFamilyMedium</item> </style> <style name="JobProgressItemStatusText.Success"> <item name="android:textColor">@color/job_progress_success</item> </style> <style name="JobProgressItemStatusText.Failure"> <item name="android:textColor">?attr/colorError</item> </style> <style name="JobProgressItemActionButtonText" parent="@style/TextAppearance.Material3.LabelLarge"> <item name="fontFamily">@string/config_fontFamilyMedium</item> </style> Loading res/values/strings.xml +12 −0 Original line number Diff line number Diff line Loading @@ -434,9 +434,21 @@ <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> <!-- Label prompting the user to interact to view more details about errors/warnings encountered during a file operation. --> <string name="job_progress_item_see_details">See details</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> <!-- Status message shown when a copy is completed. --> <string name="copy_completed">Copied</string> <!-- Status message shown when a move is completed. --> <string name="move_completed">Moved</string> <!-- Status message shown when a delete is completed. --> <string name="delete_completed">Deleted</string> <!-- Status message shown when a compress file operation is completed. --> <string name="compress_completed">Compressed</string> <!-- Status message shown when an extract file operation is completed. --> <string name="extract_completed">Extracted</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 src/com/android/documentsui/JobPanelController.kt +41 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.graphics.Canvas import android.graphics.Path import android.graphics.Rect import android.graphics.RectF import android.text.format.Formatter import android.util.Log import android.view.LayoutInflater import android.view.MenuItem Loading @@ -42,6 +43,7 @@ import com.android.documentsui.services.FileOperationService import com.android.documentsui.services.FileOperationService.EXTRA_PROGRESS import com.android.documentsui.services.Job import com.android.documentsui.services.JobProgress import com.android.documentsui.util.FormatUtils import com.google.android.material.progressindicator.LinearProgressIndicator /** Loading Loading @@ -103,6 +105,9 @@ class JobPanelController(private val mContext: Context) : BroadcastReceiver() { val mTitleView = view.findViewById<TextView>(R.id.job_progress_item_title) val mProgressView = view.findViewById<LinearProgressIndicator>(R.id.job_progress_item_progress) val mPrimaryStatusView = view.findViewById<TextView>(R.id.job_progress_item_primary_status) val mSecondaryStatusView = view.findViewById<TextView>(R.id.job_progress_item_secondary_status) val mDismissButton = view.findViewById<Button>(R.id.job_progress_item_dismiss) Loading @@ -112,8 +117,44 @@ class JobPanelController(private val mContext: Context) : BroadcastReceiver() { if (!mProgressView.isIndeterminate) { mProgressView.setProgress(jobProgress.toPercent().toInt()) } if (jobProgress.state == Job.STATE_COMPLETED) { if (jobProgress.hasFailures) { mPrimaryStatusView.setTextAppearance(R.style.JobProgressItemStatusText_Failure) mPrimaryStatusView.text = mContext.getString(R.string.job_progress_item_failed) mSecondaryStatusView.text = mContext.getString(R.string.job_progress_item_see_details) } else { mPrimaryStatusView.setTextAppearance(R.style.JobProgressItemStatusText_Success) mPrimaryStatusView.text = mContext.getString(R.string.job_progress_item_completed) mSecondaryStatusView.text = getCompletionStatusString(jobProgress.operationType) } } else { mPrimaryStatusView.setTextAppearance(R.style.JobProgressItemStatusText) mPrimaryStatusView.text = mContext.getString( R.string.job_progress_item_byte_progress, Formatter.formatFileSize(mContext, jobProgress.currentBytes), Formatter.formatFileSize(mContext, jobProgress.requiredBytes), ) mSecondaryStatusView.text = mContext.getString(R.string.copy_remaining, FormatUtils.formatDuration(jobProgress.msRemaining)) } mDismissButton.setOnClickListener { mController.dismissProgress(jobProgress.id) } } private fun getCompletionStatusString(@FileOperationService.OpType opType: Int): String { return when (opType) { FileOperationService.OPERATION_COPY -> mContext.getString(R.string.copy_completed) FileOperationService.OPERATION_MOVE -> mContext.getString(R.string.move_completed) FileOperationService.OPERATION_DELETE -> mContext.getString(R.string.delete_completed) FileOperationService.OPERATION_COMPRESS -> mContext.getString(R.string.compress_completed) FileOperationService.OPERATION_EXTRACT -> mContext.getString(R.string.extract_completed) else -> "" } } } class ProgressListAdapter(val mController: JobPanelController) : Loading Loading
res/flag(com.android.documentsui.flags.use_material3)/values-night/colors.xml +2 −0 Original line number Diff line number Diff line Loading @@ -35,4 +35,6 @@ <!-- TODO(b/379776735): remove this after use_material3 flag is launched. --> <color name="search_chip_text_selected_color">@android:color/black</color> <color name="job_progress_success">#3CBA5A</color> </resources>
res/flag(com.android.documentsui.flags.use_material3)/values/colors.xml +3 −0 Original line number Diff line number Diff line Loading @@ -101,4 +101,7 @@ <!-- Scrim for the Top bar. Static color, 32% opacity in black. The same scrim is used in some parts of Android SysUI, it can't be used directly here. --> <color name="peek_topbar_scrim">#52000000</color> <!-- Custom green color indicating success not available in the base theme palette. --> <color name="job_progress_success">#187231</color> </resources>
res/flag(com.android.documentsui.flags.use_material3)/values/styles_text.xml +8 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,14 @@ <item name="fontFamily">@string/config_fontFamilyMedium</item> </style> <style name="JobProgressItemStatusText.Success"> <item name="android:textColor">@color/job_progress_success</item> </style> <style name="JobProgressItemStatusText.Failure"> <item name="android:textColor">?attr/colorError</item> </style> <style name="JobProgressItemActionButtonText" parent="@style/TextAppearance.Material3.LabelLarge"> <item name="fontFamily">@string/config_fontFamilyMedium</item> </style> Loading
res/values/strings.xml +12 −0 Original line number Diff line number Diff line Loading @@ -434,9 +434,21 @@ <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> <!-- Label prompting the user to interact to view more details about errors/warnings encountered during a file operation. --> <string name="job_progress_item_see_details">See details</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> <!-- Status message shown when a copy is completed. --> <string name="copy_completed">Copied</string> <!-- Status message shown when a move is completed. --> <string name="move_completed">Moved</string> <!-- Status message shown when a delete is completed. --> <string name="delete_completed">Deleted</string> <!-- Status message shown when a compress file operation is completed. --> <string name="compress_completed">Compressed</string> <!-- Status message shown when an extract file operation is completed. --> <string name="extract_completed">Extracted</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
src/com/android/documentsui/JobPanelController.kt +41 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.graphics.Canvas import android.graphics.Path import android.graphics.Rect import android.graphics.RectF import android.text.format.Formatter import android.util.Log import android.view.LayoutInflater import android.view.MenuItem Loading @@ -42,6 +43,7 @@ import com.android.documentsui.services.FileOperationService import com.android.documentsui.services.FileOperationService.EXTRA_PROGRESS import com.android.documentsui.services.Job import com.android.documentsui.services.JobProgress import com.android.documentsui.util.FormatUtils import com.google.android.material.progressindicator.LinearProgressIndicator /** Loading Loading @@ -103,6 +105,9 @@ class JobPanelController(private val mContext: Context) : BroadcastReceiver() { val mTitleView = view.findViewById<TextView>(R.id.job_progress_item_title) val mProgressView = view.findViewById<LinearProgressIndicator>(R.id.job_progress_item_progress) val mPrimaryStatusView = view.findViewById<TextView>(R.id.job_progress_item_primary_status) val mSecondaryStatusView = view.findViewById<TextView>(R.id.job_progress_item_secondary_status) val mDismissButton = view.findViewById<Button>(R.id.job_progress_item_dismiss) Loading @@ -112,8 +117,44 @@ class JobPanelController(private val mContext: Context) : BroadcastReceiver() { if (!mProgressView.isIndeterminate) { mProgressView.setProgress(jobProgress.toPercent().toInt()) } if (jobProgress.state == Job.STATE_COMPLETED) { if (jobProgress.hasFailures) { mPrimaryStatusView.setTextAppearance(R.style.JobProgressItemStatusText_Failure) mPrimaryStatusView.text = mContext.getString(R.string.job_progress_item_failed) mSecondaryStatusView.text = mContext.getString(R.string.job_progress_item_see_details) } else { mPrimaryStatusView.setTextAppearance(R.style.JobProgressItemStatusText_Success) mPrimaryStatusView.text = mContext.getString(R.string.job_progress_item_completed) mSecondaryStatusView.text = getCompletionStatusString(jobProgress.operationType) } } else { mPrimaryStatusView.setTextAppearance(R.style.JobProgressItemStatusText) mPrimaryStatusView.text = mContext.getString( R.string.job_progress_item_byte_progress, Formatter.formatFileSize(mContext, jobProgress.currentBytes), Formatter.formatFileSize(mContext, jobProgress.requiredBytes), ) mSecondaryStatusView.text = mContext.getString(R.string.copy_remaining, FormatUtils.formatDuration(jobProgress.msRemaining)) } mDismissButton.setOnClickListener { mController.dismissProgress(jobProgress.id) } } private fun getCompletionStatusString(@FileOperationService.OpType opType: Int): String { return when (opType) { FileOperationService.OPERATION_COPY -> mContext.getString(R.string.copy_completed) FileOperationService.OPERATION_MOVE -> mContext.getString(R.string.move_completed) FileOperationService.OPERATION_DELETE -> mContext.getString(R.string.delete_completed) FileOperationService.OPERATION_COMPRESS -> mContext.getString(R.string.compress_completed) FileOperationService.OPERATION_EXTRACT -> mContext.getString(R.string.extract_completed) else -> "" } } } class ProgressListAdapter(val mController: JobPanelController) : Loading