-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixes Issue 6461: Welcome screen works only from left to right #6461 #6545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Before this change, the page indicator library that was used was incompatible with ViewPager2. This change adds a page indicator library under the Apache 2.0 license that works with ViewPager2. Now the project can take advantage of ViewPager2 features, such as support for RTL languages/orientations.
…L orientations Before this commit, the Welcome activity Kotlin code only supported LTR orientations. This commit uses ViewPager2 and a new page indicator to support both LTR and RTL orientations. The orientation is derived from the user's app language setting.
Before this commit, the xml files did not support RTL orientation. This commit adds support for RTL orientation by using ViewPager2 and a new pager indicator. Other small changes also made to support RTL orientation.
WalkthroughThe welcome screen is migrated from ViewPager to ViewPager2 with RTL-aware indicator support. The adapter transitions from PagerAdapter to RecyclerView.Adapter, orientation detection logic is added to respect UI language preferences for bidirectional layouts, and XML layouts are updated for proper alignment direction. Changes
Sequence Diagram(s)sequenceDiagram
participant WelcomeActivity as WelcomeActivity
participant Prefs as Prefs<br/>(defaultKvStore)
participant Locale as Locale
participant TextUtils as TextUtilsCompat
participant IndicatorView as IndicatorView
WelcomeActivity->>Prefs: Read APP_UI_LANGUAGE preference
Prefs-->>WelcomeActivity: Return language code
WelcomeActivity->>Locale: Create Locale from language
WelcomeActivity->>TextUtils: getLayoutDirectionFromLocale(locale)
TextUtils-->>WelcomeActivity: Return layout direction
alt Layout Direction is RTL
WelcomeActivity->>IndicatorView: Set orientation = INDICATOR_RTL
else Layout Direction is LTR
WelcomeActivity->>IndicatorView: Set orientation = INDICATOR_HORIZONTAL
end
WelcomeActivity->>IndicatorView: setupWithViewPager(binding.welcomePager)
IndicatorView-->>WelcomeActivity: Indicator ready with RTL/LTR support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes Areas requiring extra attention:
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🧰 Additional context used🧬 Code graph analysis (1)app/src/main/java/fr/free/nrw/commons/WelcomePagerAdapter.kt (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (11)
Comment |
|
Also, I tried to make the new page indicator look like the old one. There are a few XML options listed at the library repo to change the appearance. I can make more changes, if needed. |
|
@amire80 Are you able to test this, by any chance? If you need help with checking out this branch or with building, I can help. :-) |
|
✅ Generated APK variants! |
Description (required)
Fixes #6461
What changes did you make and why?
There are two primary sets of changes made.
First,
ViewPager2replacesViewPagerfor the Welcome activity. This allows the swiping direction to match the language orientation.Second, a new view pager indicator replaces the old view pager indicator in the welcome activity. This is because the old indicator was incompatible with
ViewPager2and did not support the RTL orientation. The new indicator is under the Apache 2.0 license.The "More Information" button's XML has also been modified to match the language orientation (see screenshots).
Tests performed (required)
Tested ProdDebug on Android Studio emulator with API level 36.
To test:
Test can then be repeated with an LTR language (like English).
Screenshots (for UI changes only)
Both screenshots show last page in the welcome activity. Note the page indicator.


Summary by CodeRabbit
New Features
UI Improvements