Skip to content

Conversation

@Fandroid745
Copy link
Contributor

@Fandroid745 Fandroid745 commented Jan 18, 2026

Purpose / Description

Add help icon to the sync dialog in order to avoid confusion for users.

Fixes

This fixes #17544

Approach

1.SyncErrorDialog.kt :Refactored the DIALOG_SYNC_CONFLICT_RESOLUTION block to use the titleWithHelpIcon extension from AlertDialogFacade.kt

2.AlertDialogFacade.kt: Updated the extension function to use optional icon parameter.

3.alert_dialog_with_xml :Added the title_icon ImageView to alert_dialog_title_with_help.xml and added adjustment so that the title aligns when no icon is present.

4.Constants.xml: added the link_sync_conflict_help string pointing to the url: https://docs.ankiweb.net/syncing.html#conflicts

How Has This Been Tested?

Ran the app on the phone
and verified that the sync dialog shows both the dialog icon on the left and the help_icon on the right.
Verified that the icons are visible on both light and dark theme.

Checklist

Please, go through these checks before submitting the PR.

screen-20260118-164024.mp4

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Thanks!!!

There's lots of changes which don't seem relevant to the PR (maxLines), and lots of line noise

I would expect in the layout:

  • Add the icon to the left of the screen
  • add a constraint on the icon
  • add 'end' padding on the icon

}.setNegativeButton(R.string.sync_conflict_keep_remote_new) { _, _ ->
requireSyncErrorDialogListener().showSyncErrorDialog(DIALOG_SYNC_CONFLICT_CONFIRM_KEEP_REMOTE)
}.setNeutralButton(R.string.dialog_cancel) { _, _ ->
AlertDialog.Builder(requireContext()).create {
Copy link
Member

Choose a reason for hiding this comment

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

In this case, continue to use dialog: have titleWithHelpIcon return this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have reverted the unecessary changes and added the changes you requested in the layout.
but the dialog looks like this now
is this fine?
Screenshot_20260118-213009

Copy link
Member

Choose a reason for hiding this comment

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

Here's a before and after with my changes:

Index: AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml b/AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml
--- a/AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml	(revision 0c3c88c1659c1eec012fcc20f8e498497eed03e0)
+++ b/AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml	(revision 6a54c83ee785b0a6062742c669274b953f80c9d4)
@@ -14,7 +14,6 @@
         android:id="@+id/title_icon"
         android:layout_width="24dp"
         android:layout_height="24dp"
-        android:layout_marginEnd="12dp"
         android:visibility="gone"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="@android:id/title"
@@ -29,6 +28,8 @@
         android:layout_height="wrap_content"
         android:textAppearance="?attr/textAppearanceHeadlineSmall"
         android:textColor="?attr/colorOnSurface"
+        android:layout_marginStart="12dp"
+        app:layout_goneMarginStart="0dp"
         app:layout_constraintEnd_toStartOf="@+id/help_icon"
         app:layout_constraintStart_toEndOf="@+id/title_icon"
         app:layout_constraintTop_toTopOf="parent"
Screenshot 2026-01-19 at 10 21 28 Screenshot 2026-01-19 at 10 20 28

This is almost there.

  • Check to see what's going on with the title, I may have made a mistake with the size, or it may be dynamic based on content to fit a line
  • Maintain the 'old' color, we'll handle these in:
  • The margin is wrong, there should be more space between the icon and the title

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if you're still working on this, or the push was a nudge for me to re-review.

Still pending on an investigation of the title

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jan 18, 2026
@Fandroid745 Fandroid745 force-pushed the feat/help-icon-sync branch 2 times, most recently from 8908f5a to 0c3c88c Compare January 18, 2026 15:40
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Thanks!!

}.setNegativeButton(R.string.sync_conflict_keep_remote_new) { _, _ ->
requireSyncErrorDialogListener().showSyncErrorDialog(DIALOG_SYNC_CONFLICT_CONFIRM_KEEP_REMOTE)
}.setNeutralButton(R.string.dialog_cancel) { _, _ ->
AlertDialog.Builder(requireContext()).create {
Copy link
Member

Choose a reason for hiding this comment

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

Here's a before and after with my changes:

Index: AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml b/AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml
--- a/AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml	(revision 0c3c88c1659c1eec012fcc20f8e498497eed03e0)
+++ b/AnkiDroid/src/main/res/layout/alert_dialog_title_with_help.xml	(revision 6a54c83ee785b0a6062742c669274b953f80c9d4)
@@ -14,7 +14,6 @@
         android:id="@+id/title_icon"
         android:layout_width="24dp"
         android:layout_height="24dp"
-        android:layout_marginEnd="12dp"
         android:visibility="gone"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="@android:id/title"
@@ -29,6 +28,8 @@
         android:layout_height="wrap_content"
         android:textAppearance="?attr/textAppearanceHeadlineSmall"
         android:textColor="?attr/colorOnSurface"
+        android:layout_marginStart="12dp"
+        app:layout_goneMarginStart="0dp"
         app:layout_constraintEnd_toStartOf="@+id/help_icon"
         app:layout_constraintStart_toEndOf="@+id/title_icon"
         app:layout_constraintTop_toTopOf="parent"
Screenshot 2026-01-19 at 10 21 28 Screenshot 2026-01-19 at 10 20 28

This is almost there.

  • Check to see what's going on with the title, I may have made a mistake with the size, or it may be dynamic based on content to fit a line
  • Maintain the 'old' color, we'll handle these in:
  • The margin is wrong, there should be more space between the icon and the title

@Fandroid745
Copy link
Contributor Author

Fandroid745 commented Jan 19, 2026

I have made the changes you asked.
I renamed the resource string to link_sync_conflict_help from sync_conflict_url, and I ran the app on my phone the dialog now matches what you have shared in your comment.
Screenshot_20260119-194957

@Fandroid745 Fandroid745 force-pushed the feat/help-icon-sync branch 2 times, most recently from b52744c to 6aa12b6 Compare January 19, 2026 14:39
@david-allison
Copy link
Member

The title height has changed from the original dialog (also in my screenshot)

Check to see what's going on with the title, I may have made a mistake with the size, or it may be dynamic based on content to fit a line

@david-allison
Copy link
Member

@Fandroid745 is this pending a review, the title issue still looks to be pending

@Fandroid745
Copy link
Contributor Author

I checked the title height using layout inspector it says 65 dp after removing the bottom constraint from the dialog view
Screenshot from 2026-01-20 19-44-58

the original has a title height of 26 dp,
Screenshot from 2026-01-20 20-15-03

I am unclear about what to change to match the original

@david-allison
Copy link
Member

david-allison commented Jan 20, 2026

Check what happened before/after this commit (b0e6996). That will clarify:

  • Was the original size a bug
  • Is the text auto-sized, in which case this PR is incorrect

It would also be useful to check with the material dialog specs: https://m3.material.io/components/dialogs/specs

@Fandroid745
Copy link
Contributor Author

Check what happened before/after this commit (b0e6996). That will clarify:

  • Was the original size a bug
  • Is the text auto-sized, in which case this PR is incorrect

It would also be useful to check with the material dialog specs: https://m3.material.io/components/dialogs/specs

I checked the previous commit d33b340 and it uses onMeasure which results in the text being autosized and it allows up to two lines. The 26dp is not a bug as it is the height of the title for single line and the height of the top panel is 60dp.

@david-allison
Copy link
Member

david-allison commented Jan 22, 2026

But the behaviour appears incorrect now we're extending it with this new dialog?

Let's reuse the material dialog logic to provide a standardized experience between the two title bars?

@Fandroid745
Copy link
Contributor Author

But the behaviour appears incorrect now we're extending it with this new dialog?

Let's reuse the material dialog logic to provide a standardized experience between the two title bars?

Yes, I will update the implementation to reuse the material dialog logic.

@Fandroid745
Copy link
Contributor Author

Fandroid745 commented Jan 23, 2026

I have updated the implementation to use linear layout and reuse material 3 logic.
The dialog title now matches the original dialog in title height.
Screenshot_20260123-213900~2

@david-allison
Copy link
Member

david-allison commented Jan 23, 2026

Hey... it's nearly been a week. I need to ask: what's going on here. This is starting to feel LLM generated.

If I check out 37f12c5, I see:

Screenshot 2026-01-23 at 16 34 42 Screenshot 2026-01-23 at 16 33 58

on b0e6996

Screenshot 2026-01-23 at 16 42 17

on f644067 (this PR)

Screenshot 2026-01-23 at 16 38 07 Screenshot 2026-01-23 at 16 37 54

@Fandroid745
Copy link
Contributor Author

I am sorry for the delay, I tried a lot of random changes hoping that I will stumble upon the correct layout for the dialog. I am closing the pr for now, I will reopen it once I am certain the dialog matches the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Author Reply Waiting for a reply from the original author Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'Help' icon for sync conflict

2 participants