Skip to content

ui: Enhance download actions bottom sheet#15

Merged
syed-tp merged 5 commits intomainfrom
ui/change_dowloading_action_btm_sht
Jun 16, 2025
Merged

ui: Enhance download actions bottom sheet#15
syed-tp merged 5 commits intomainfrom
ui/change_dowloading_action_btm_sht

Conversation

@syed-tp
Copy link
Copy Markdown
Contributor

@syed-tp syed-tp commented Jun 13, 2025

Summary by CodeRabbit

  • New Features

    • Added new icons for delete, pause download, and resume download actions in the download management UI.
  • Refactor

    • Updated the download action bottom sheet layout to use custom buttons with icons and labels instead of standard button components, improving visual clarity and interaction.
    • Adjusted UI to display icons and text for pause/resume and delete/cancel actions.
  • Style

    • Changed related button texts from uppercase to capitalized case for improved readability.
  • Bug Fixes

    • Updated download status text to display "Downloading Paused" when a download is paused.

@codetortoiseai
Copy link
Copy Markdown

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 13, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update refactors the download action bottom sheet UI by replacing MaterialButtons with custom LinearLayouts containing ImageViews and TextViews for interactive actions. New vector drawable icons for pause, resume, and delete actions are introduced. Related strings are updated for capitalization, and the download status message is slightly revised.

Changes

File(s) Change Summary
.../DownloadActionBottomSheet.kt, .../layout_download_action_bottom_sheet.xml Replaces MaterialButtons with LinearLayouts containing ImageView and TextView for action buttons; updates click listeners and UI references accordingly.
.../ic_delete.xml, .../ic_pause_download.xml, .../ic_resume_download.xml Adds new vector drawable icons for delete, pause, and resume download actions.
.../strings.xml Changes download-related button strings from uppercase to capitalized case.
.../DownloadActions.kt Changes paused status string from "Paused" to "Downloading Paused".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BottomSheet
    participant DownloadManager

    User->>BottomSheet: Opens Download Action Bottom Sheet
    BottomSheet->>User: Shows actions (Pause/Resume, Delete, Cancel) with icon+label
    User->>BottomSheet: Taps Pause/Resume/Delete/Cancel (via LinearLayout)
    BottomSheet->>DownloadManager: Executes corresponding action
    DownloadManager-->>BottomSheet: Updates download state
    BottomSheet-->>User: Updates UI (icon and label) accordingly
Loading

Possibly related PRs

Poem

In the bottom sheet where buttons once lay,
Now icons and labels lead the way.
Pause, resume, or delete with style,
A tap on a layout—actions compile.
With shiny new icons and text so neat,
Download actions now feel complete!
🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 13, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (1)
tpstreams-android-player/src/main/java/com/tpstreams/player/DownloadActions.kt (1)

109-119: 🛠️ Refactor suggestion

Hard-coded status strings hinder localisation & introduce inconsistency

getCurrentDownloadStatus() now returns raw English strings (e.g. "Downloading Paused").
Problems:

  1. Breaks localisation – the rest of the UI uses string resources.
  2. Inconsistent wording: strings.xml has "Download Paused" (title) while code returns "Downloading Paused".
  3. Future edits require touching code instead of translations.
-import com.tpstreams.player.R   // already implied elsewhere
+import com.tpstreams.player.R-return when {
-    downloadTracker.isDownloaded(uri)   -> "Downloaded"
-    downloadTracker.isDownloading(uri)  -> "Downloading"
-    downloadTracker.isPaused(uri)       -> "Download Paused"
-    else                                -> "Download"
-}
+val res = view.context.resources
+return when {
+    downloadTracker.isDownloaded(uri)   -> res.getString(R.string.downloaded)         // add to strings.xml
+    downloadTracker.isDownloading(uri)  -> res.getString(R.string.downloading)
+    downloadTracker.isPaused(uri)       -> res.getString(R.string.download_paused)    // reuse existing
+    else                                -> res.getString(R.string.download)
+}

You’ll need to add the missing downloaded and downloading entries (lower-case) to strings.xml.

🧹 Nitpick comments (8)
tpstreams-android-player/src/main/res/drawable/ic_pause_download.xml (1)

1-5: Remove fixed tint to stay theme-aware

Same concern as for ic_delete.xml: the explicit android:tint="#000000" means the asset cannot automatically adopt accent / dark-mode colors. Consider removing the attribute and letting the hosting view tint it.

tpstreams-android-player/src/main/res/drawable/ic_resume_download.xml (1)

1-5: Follow consistent vector-drawable conventions

For consistency with other drawables (and future recoloring), drop the inline tint here too. Using one convention across all icons avoids surprises.

tpstreams-android-player/src/main/res/values/strings.xml (1)

31-40: Inconsistent casing & duplicate semantics

Great move to sentence-case the action labels, but a few follow-ups:

  1. download_button remains all-caps (DOWNLOAD) while related actions switched to title-case – consider aligning.
  2. download vs new delete, pause_download etc. mix verb and noun forms; prefer consistent prefixes (download_* or action_*).
  3. Added "resume_download" yet code returns "Downloading" and "Download Paused" – make sure every label has a matching status string to avoid confusion.
tpstreams-android-player/src/main/java/com/tpstreams/player/DownloadActionBottomSheet.kt (4)

16-16: Remove stale MaterialButton import

MaterialButton is no longer referenced after migrating to LinearLayout-based controls. Keeping the import will produce an “unused import” warning and may fail a strict lint build.

-import com.google.android.material.button.MaterialButton

68-74: Duplicate “pause / resume” wiring – extract into a helper

The two branches that configure the pause/resume control are almost identical, differing only in drawable, text, and callback. Duplicated findViewById calls inside updateUI():

  • increase method length / cognitive load,
  • allocate view look-ups every time state changes,
  • invite accidental divergence between the two blocks.

A small private helper keeps the intent clear and prevents drift:

private fun setupPauseResume(icon: Int, textRes: Int, onClick: () -> Unit) {
    val container = view!!.findViewById<LinearLayout>(R.id.pause_resume_container)
    val iconView = view!!.findViewById<ImageView>(R.id.pause_resume_icon)
    val textView = view!!.findViewById<TextView>(R.id.pause_resume_text)

    iconView.setImageResource(icon)
    textView.text = getString(textRes)
    container.setOnClickListener { onClick(); dismiss() }
}

Then, inside updateUI():

Download.STATE_DOWNLOADING -> {
    setupPauseResume(
        R.drawable.ic_pause_download,
        R.string.pause_download
    ) { listener?.onPauseDownloadConfirmed() }
}

Download.STATE_STOPPED -> {
    setupPauseResume(
        R.drawable.ic_resume_download,
        R.string.resume_download
    ) { listener?.onResumeDownloadConfirmed() }
}

Also applies to: 86-92


68-74: Cache view references or use ViewBinding

findViewById on every updateUI() invocation is cheap but unnecessary. Holding the three pause/resume views as lateinit vals (or switching to ViewBinding) removes repeated look-ups and enforces non-nullability at compile-time.


135-147: User-visible controls lack accessibility role

LinearLayout containers are now acting as buttons. Consider adding

ViewCompat.setAccessibilityDelegate(container, object : AccessibilityDelegateCompat() {
    override fun onInitializeAccessibilityNodeInfo(v: View, info: AccessibilityNodeInfoCompat) {
        super.onInitializeAccessibilityNodeInfo(v, info)
        info.roleDescription = context.getString(R.string.role_button)
    }
})

or, in XML, android:roleDescription="button" to ensure TalkBack users recognise these views as actionable elements.

tpstreams-android-player/src/main/res/layout/layout_download_action_bottom_sheet.xml (1)

55-81: Clickable LinearLayout buttons need semantic hints

The containers are declared clickable/focusable but have no:

  • android:contentDescription for the ImageView (screen-reader announces only the icon’s resource name otherwise).
  • android:roleDescription="button" or android:accessibilityHeading.

At minimum, set the icon’s android:contentDescription="@string/delete" (etc.) or call android:importantForAccessibility="no" on the icon so that TalkBack reads the accompanying label only once.

Also applies to: 96-123, 126-152

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d29ae9 and 9a137b4.

📒 Files selected for processing (7)
  • tpstreams-android-player/src/main/java/com/tpstreams/player/DownloadActionBottomSheet.kt (4 hunks)
  • tpstreams-android-player/src/main/java/com/tpstreams/player/DownloadActions.kt (1 hunks)
  • tpstreams-android-player/src/main/res/drawable/ic_delete.xml (1 hunks)
  • tpstreams-android-player/src/main/res/drawable/ic_pause_download.xml (1 hunks)
  • tpstreams-android-player/src/main/res/drawable/ic_resume_download.xml (1 hunks)
  • tpstreams-android-player/src/main/res/layout/layout_download_action_bottom_sheet.xml (2 hunks)
  • tpstreams-android-player/src/main/res/values/strings.xml (1 hunks)

@syed-tp syed-tp changed the title ui: Enhance download actions bottom sheet ui ui: Enhance download actions bottom sheet Jun 13, 2025
@syed-tp syed-tp force-pushed the ui/change_dowloading_action_btm_sht branch from 8713c4d to 8754dba Compare June 16, 2025 12:05
@syed-tp syed-tp merged commit 0608c76 into main Jun 16, 2025
1 check passed
@syed-tp syed-tp deleted the ui/change_dowloading_action_btm_sht branch June 16, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant