Conversation
Warning Message: "Use of LayoutInflater.from(getActivity()) detected. Consider using getLayoutInflater() instead" Explanation: "Using LayoutInflater.from(Context) can return a LayoutInflater that does not have the correct theme." ------------------------------------------------------------------------ The recommended use of 'getLayoutInflater()', instead of using the deprecated 'LayoutInflater.from(getActivity())' is causing a 'StackOverflowError' error. Thus, this error is suppress for 'NumberPickerDialog' (at least for the time being).
Warning Message: "Use of LayoutInflater.from(getActivity()) detected. Consider using getLayoutInflater() instead" Explanation: "Using LayoutInflater.from(Context) can return a LayoutInflater that does not have the correct theme." ------------------------------------------------------------------------ Using the recommended 'getLayoutInflater()', and on those specific cases via 'getActivity()', fix these warnings.
Warning Message: "WRITE_EXTERNAL_STORAGE no longer provides write access when targeting Android 11+, even when using 'requestLegacyExternalStorage'" Explanation: "Scoped storage is enforced on Android 10+ (or Android 11+ if using requestLegacyExternalStorage). In particular, WRITE_EXTERNAL_STORAGE will no longer provide write access to all files; it will provide the equivalent of READ_EXTERNAL_STORAGE instead." ------------------------------------------------------------------------ This warning is already addressed and will be fixed as part of the ongoing Android 13 media permissions work (see PR below): PR: #18183
Warning Message: "Calling `setType` after calling `setData` will clear the data: Call `setDataAndType` instead?" Explanation: "Intent provides the following APIs: setData(Uri) and setType(String). Unfortunately, setting one clears the other. If you want to set both, you should call setDataAndType(Uri, String) instead." ------------------------------------------------------------------------ This 78c2ea7 introduced this functionality. Testing without the 'calIntent.data = Events.CONTENT_URI' still works as expected. Thus, indeed it seems that the 'data' got cleared by setting the 'type' afterwards, thus the code, if kept as is, although still functioning, becomes misleading and worse, the 'data' related 'Events.CONTENT_URI' information ends-up being missing from the intent that starts the external calendar activity. From the looks of it, it seems that the author's intentions were to use both, 'data' and 'type'. As such, using the recommended 'setDataAndType(...)' fixes this warning. ------------------------------------------------------------------------ FOr more info see: - Calendar provider overview (Doc): https://developer.android.com/guide/topics/providers/calendar-provider - Use an intent to insert an event (Doc): https://developer.android.com/guide/topics/providers/calendar-provider #intent-insert
Warning Messages:
- "The locale folder "'he'" should be called "'iw'" instead; see the
'java.util.Locale' documentation"
- "The locale folder "'id'" should be called "'in'" instead; see the
'java.util.Locale' documentation"
Explanation: "From the java.util.Locale documentation:
"Note that Java uses several deprecated two-letter codes. The Hebrew
("he") language code is rewritten as "iw", Indonesian ("id") as "in",
and Yiddish ("yi") as "ji". This rewriting happens even if you construct
your own Locale object, not just for instances returned by the various
lookup methods.
Because of this, if you add your localized resources in for example
values-he they will not be used, since the system will look for
values-iw instead.
To work around this, place your resources in a values folder using the
deprecated language code instead."
------------------------------------------------------------------------
This Lint warning is moved within lint config and removed from Lint's
baseline because in order to resolve this warning a proper release
management localization solution should be set-up for both, the
WordPress and Jetpack apps. PS: The previous such Jetpack related
c272690 commit description was
misleading (describing this was already properly done on WordPress).
Related: Lint Warnings - Resolve 'LocaleFolder'
- #18226
Warning Message: "Redundant 'field' used for Dagger qualifier annotation." Explanation: "It's redundant to use 'field:' site-targets for qualifier annotations." ------------------------------------------------------------------------ This was probably an oversight while this efb4b8f commit was developed. Removing the redundant 'field' site-target fixes these warnings.
Instead of using an arbitrary 'IO_THREAD' string value, it is better to depend on using the 'IO_THREAD' constant from within the 'ThreadModule' file, which anyway points to that same 'IO_THREAD' string value.
Warning Message: "Replace the <fragment> tag with FragmentContainerView." Explanation: "FragmentContainerView replaces the <fragment> tag as the preferred way of adding fragments via XML. Unlike the <fragment> tag, FragmentContainerView uses a normal FragmentTransaction under the hood to add the initial fragment, allowing further FragmentTransaction operations on the FragmentContainerView and providing a consistent timing for lifecycle events." ------------------------------------------------------------------------ These warnings are suppressed on those files because the app crashes otherwise with a 'ClassCastException' exception (see an example crash on 'AccountSettingsFragment' below): ------------------------------------------------------------------------ Caused by: java.lang.ClassCastException: org.wordpress.android.ui.prefs.accountsettings.AccountSettingsFragment cannot be cast to androidx.fragment.app.Fragment ------------------------------------------------------------------------
Warning Message: "Replace the <fragment> tag with FragmentContainerView." Explanation: "FragmentContainerView replaces the <fragment> tag as the preferred way of adding fragments via XML. Unlike the <fragment> tag, FragmentContainerView uses a normal FragmentTransaction under the hood to add the initial fragment, allowing further FragmentTransaction operations on the FragmentContainerView and providing a consistent timing for lifecycle events." ------------------------------------------------------------------------ These warnings are suppressed on those files because the app crashes otherwise with a 'UninitializedPropertyAccessException' exception (see below): ------------------------------------------------------------------------ kotlin.UninitializedPropertyAccessException: lateinit property widgetType has not been initialized ------------------------------------------------------------------------
Warning Message: "Replace the <fragment> tag with FragmentContainerView." Explanation: "FragmentContainerView replaces the <fragment> tag as the preferred way of adding fragments via XML. Unlike the <fragment> tag, FragmentContainerView uses a normal FragmentTransaction under the hood to add the initial fragment, allowing further FragmentTransaction operations on the FragmentContainerView and providing a consistent timing for lifecycle events." ------------------------------------------------------------------------ Using the recommended '<androidx.fragment.app.FragmentContainerView>' fix these warnings.
|
| App Name | Jetpack |
|
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr18245-d7554d9 | |
| Commit | d7554d9 | |
| Direct Download | jetpack-prototype-build-pr18245-d7554d9.apk |
|
| App Name | WordPress |
|
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr18245-d7554d9 | |
| Commit | d7554d9 | |
| Direct Download | wordpress-prototype-build-pr18245-d7554d9.apk |
Warning Message: "Use of LayoutInflater.from(getActivity()) detected. Consider using getLayoutInflater() instead" Explanation: "Using LayoutInflater.from(Context) can return a LayoutInflater that does not have the correct theme." ------------------------------------------------------------------------ Using the recommended 'getLayoutInflater()', and in this specific case via 'getActivity()', fixes this warning too. FYI: I previously suppressed it because I incorrectly used 'getLayoutInflater()' directly and not using 'getActivity()' first, like: 'getActivity().getLayoutInflater()'
There was a problem hiding this comment.
There are well-explained changes. I have checked them all. LGTM! Great Job! 👍🏻
I have tested all your written test cases in both WP and JP, and they have all passed. 🟢
Although I have left a comment, I am not merging but approving it because the issue will be resolved after syncing with the trunk.
Maybe that needs to be corrected so the first one become a more generic Views title and much that of the views layout file.
It makes sense to me. We can open an issue for it.
Awesome, thank you so much for reviewing and testing these changes @irfano , you rock! 🙇 ❤️ 🚀
Yes, your comment is spot-on and I was waiting on it to happen, on way or another, depending on which PR would be merged first, this one or the targetSdkVersion-to-33 one, thanks for taking the time to call that off! 💯 |
Generated by 🚫 dangerJS |


Parent #18162
Partially Closes #18193
This PR resolves the 1st part of
correctnessLint related warnings for theMainsource set:Reconfigure Lint (Ignore):
Warnings Resolution List:
Warnings Suppression List:
Refactor List:
PS: @irfano I added you as the main reviewer, randomly, since I just wanted someone from the WordPress team to be aware of and sign-off on that change for WPAndroid. I also added the @wordpress-mobile/apps-infrastructure team, but this in done only for monitoring purposes, as such, I am not expecting any active review from that team. Thus, feel free to merge this PR if you deem so.
To test:
Warnings Resolution List (✅):
[
UseGetLayoutInflater]1. Number Picker Dialog [NumberPickerDialog.java]
My Sitetab ->MENUsub-tab ->Side Settingsscreen.Post per pageoption and click on it.2. Post Settings Input Dialog [PostSettingsInputDialogFragment.java]
Postsscreen -> Find a post and click on it ->Post settingsscreen.Passwordoption and click on it.3. Text Input Dialog [TextInputDialogFragment.java]
Mescreen ->My Profilescreen.First nameoption and click on it.[
IntentReset]1. Publish Settings Bottom Sheet [PublishSettingsFragment.kt]
Postsscreen -> Create a new post -> Click onPUBLISHbutton.Publish Dateoption and click on it.Date and Timeoption and click on it.NotificationandAdd to calendaroptions will appear.Add to calendaroption and click on it.Calendarapp and an draft calendar event is being createdon your behalf. Verify that the calendar title, description and dates are correct. Click on
Saveto create the calendar event. Verify that the calendar event has been created and is as expected.
[
FragmentTagUsage]1. Edit Image Screen [activity_edit_image.xml]
Blogsand add a newblogpost.imageblock.imageblock.media optionsof this image (top right) and then clickedit.Edit Imagescreen is shown and functioning as expected.2. My Profile Settings Screen [app_settings_activity.xml]
Mescreen ->My Profilesettings screen.My Profilesettings screen is shown and functioning as expected.3. Debug Settings Screen [debug_settings_activity.xml]
Mescreen ->App Settingsscreen ->Debug Settingsscreen.Debug Settingsscreen is shown and functioning as expected.4. Categories Setting Screen [site_settings_categories_list_activity.xml]
My Sitetab ->MENUsub-tab ->Site Settingsscreen.Writingsection in the middle and click on itsCategoriesoption.Categoriessetting screen is shown and functioning as expected.5. Insights Management Screen [insights_management_activity.xml]
My Sitetab ->MENUsub-tab ->Statsscreen.Add new stats cardoption and click on it.Add New Cardstats setting screen is shown and functioning as expected.6. Plans Screen [plans_activity.xml]
ℹ️ This my site menu option is only shown conditionally.
My Sitetab ->MENUsub-tab ->Plansscreen.Plansscreen is shown and functioning as expected.7. Activity Log Screen [activity_log_list_activity.xml]
My Sitetab ->MENUsub-tab ->Activity Logscreen.Activity Logscreen is shown and functioning as expected.8. Backup Download Screen [backup_download_activity.xml]
My Sitetab ->MENUsub-tab ->Backupscreen.Download Backupscreen is shown and functioning as expected.9. Restore Screen [restore_activity.xml]
My Sitetab ->MENUsub-tab ->Backupscreen.Restorescreen is shown and functioning as expected.10. Scan Screen [scan_activity.xml]
ℹ️ This my site menu option is only shown conditionally.
My Sitetab ->MENUsub-tab ->Scanscreen.Scanscreen is shown and functioning as expected.11. Scan History Screen [scan_history_activity.xml]
ℹ️ This my site menu option is only shown conditionally.
My Sitetab ->MENUsub-tab ->Scanscreen.Scan Historyscreen is shown and functioning as expected.12. Threat Details Screen [scan_history_activity.xml]
ℹ️ You would need to add a threat to your side so that after you trigger 'Scan now' on your side,
then let it complete, it will finally show some threats on your site.
My Sitetab ->MENUsub-tab ->Scanscreen.Thread foundlist and click on it.Threat Detailsscreen is shown and functioning as expected.13. Set Parent Screen [pages_parent_activity.xml]
Pagesscreen and set a parent page for a page (page options).Set Parentscreen is shown and functioning as expected.14. Follow Topics Screen [reader_interests_activity.xml]
Readertab ->DISCOVERsub-tab.Follow topicsscreen is shown and functioning as expected.15. At A Glance Widget Screen [stats_minified_widget_configure_activity.xml]
At a glancewidget to your home screen.At a glancewidget screen is shown and functioning as expected.Warnings Suppression List (❌):
[
FragmentTagUsage]1. Account Settings Screen [account_settings_activity.xml]
❌ Exception:
ClassCastExceptionMescreen ->My Profilescreen.Account Settingsscreen is shown and functioning as expected.2. App Settings Screen [app_settings_activity.xml]
❌ Exception:
ClassCastExceptionMescreen ->App Settingsscreen.App Settingsscreen is shown and functioning as expected.3. Jetpack Security Settings Screen [fragment_jetpack_security_settings.xml]
❌ Exception:
ClassCastExceptionℹ️ It seems that this flow has been migrated into the
Site Settingsscreen and itsJetpack Settingssection at the bottom. Thus, it is hard to be tested and most importantly maybe worth removing at some point due to it ending-up becoming dead code.My Sitetab ->MENUsub-tab ->Jetpack Settingsscreen.App Settingsscreen is shown and functioning as expected.4. All Time + Today + Views + Views This Week Widget Screens [stats_xyz_widget_configure_activity.xml]
❌ Exception:
UninitializedPropertyAccessExceptionℹ️ The 'xyz' part of the file name is either
all_time,today,viewsorweek_views.❓️ The widget title for
viewsorweek_viewsis always the same, theViews this weekone. Maybe that needs to be corrected so the first one become a more genericViewstitle and much that of theviewslayout file.All-time,Today,Views this weekorViews this weekwidget to your home screen.All-time,Today,Views this weekorViews this weekwidget screen areshown and functioning as expected.
Regression Notes
Potential unintended areas of impact
PublishSettingsFragmentand itsAddToCalendarfunctionality.LayoutInflater.from(getActivity())tag got replaced with theactivity().getLayoutInflater()tag.<fragment>tag got replaced with the<androidx.fragment.app.FragmentContainerView>tag.What I did to test those areas of impact (or what existing automated tests I relied on)
To testsection above.What automated tests I added (or what prevented me from doing so)
PR submission checklist:
RELEASE-NOTES.txtif necessary.