-
-
Notifications
You must be signed in to change notification settings - Fork 472
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
4159 migrate help fragment to compose #4217
base: main
Are you sure you want to change the base?
4159 migrate help fragment to compose #4217
Conversation
@MohitMaliFtechiz sir I would like to put a thing in notice that whenever i sync the gradel using sync now after sync some string.xml files are automatically changed or updated. I am not able to know why. The above image shows before sync and after sync status of the files. |
@SOUMEN-PAL This is due to our gradle task, which we have added to fix #3176. Please do not include this automate change in commit. kiwix-android/app/build.gradle.kts Line 144 in 687fbe0
|
@SOUMEN-PAL Any update? |
The ui is working I ensured the version and gradel dependencies the only problem is the strings that are getting updated in gradel sync and I am not able to fix the changes the jetpack compose code is working seemlesly. I am not able to figure out the Tarak file thing |
@SOUMEN-PAL Apart from the |
Yes The UI is ready for review. |
b81ad3c
to
6873bd5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SOUMEN-PAL Thanks for your changes. Please see the review comments.
val isDarkTheme = isSystemInDarkTheme() | ||
val itemColor = if (isDarkTheme) Color.White else Color.Black | ||
val arrowRotation by animateFloatAsState( | ||
targetValue = if (isOpen) 180f else 0f, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SOUMEN-PAL This is giving the MagicNumber
lint error. Please fix it.
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun HelpScreen( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here lint is giving the LongMethod
error, please fix it.
throw IllegalArgumentException("Invalid description resource type for title: $title") | ||
} | ||
} | ||
protected abstract val navHostFragmentId: Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is abstract
so why we are not implementing it in CustomHelpFragment
like we are doing it in KiwixHelpFragment
? It will not allow us to build the Custom
module without implementing this in CustomHelpFragment
.
implementation(Libs.androidx_compose_material3) | ||
implementation(Libs.androidx_activity_compose) | ||
|
||
implementation(Libs.androidx_compose_ui) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have added androidx.compose.ui:ui-android:1.7.7
in our project. Due to this, we are facing a PrivateResouce
lint issue for our close_drawer
string. Can you please fix that? IMO add this in in lintConfig file since our app can have the same resource name, and we are getting this name from our R
package so it will not conflict with compose internal string.
<issue id="PrivateResource" severity="warning" />
navigationIcon = { | ||
IconButton(onClick = navController::popBackStack) { | ||
Icon( | ||
imageVector = Icons.Filled.ArrowBack, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Icons.Filled.ArrowBack
is deprecated we should use Icons.AutoMirrored.Filled.ArrowBack
instead.
topBar = { | ||
TopAppBar( | ||
title = { | ||
Text( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) { | ||
Image( | ||
painter = painterResource(R.drawable.ic_feedback_orange_24dp), | ||
contentDescription = "Feedback", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contentDescription
should be Send diagnostic report
as it is for "Send diagnostic report" we have a string for this send_report
which we are using in the fragment_help.xml
so we should use that.
fragmentHelpBinding?.activityHelpRecyclerView?.addItemDecoration( | ||
DividerItemDecoration(activity, DividerItemDecoration.VERTICAL) | ||
) | ||
fragmentHelpBinding?.activityHelpRecyclerView?.adapter = HelpAdapter(titleDescriptionMap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After moving HelpScreen
to compose our HelpAdapter
is unused so we should remove the unused code.
.padding(start = 16.dp, end = 16.dp) | ||
) { | ||
Text( | ||
text = data.description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal text is showing bigger and looks different from the previous one. Also, the side image
for opening and closing the menu items is bigger which does not look good. See the difference:
Previous design | Current design |
---|---|
You can take the reference from xml design how we have used sizes, margins, paddings, etc, for text and images.
@SOUMEN-PAL I have rebased the PR and resolved the tarask file conflicts. Now only add the files in which you have made the changes.
I have reviewed your PR, please have a look at the review changes. |
I more question regarding the workflow I mean I was thinking for getting the upstream then updating my branch to the branch that is added after rebase from https://github.com/kiwix/kiwix-android/tree/4159-migrate-help-fragment-to-compose Other wise i wont be able to see the changes in my forked repository. I just want to confirm my workflow for the post rebase step |
@SOUMEN-PAL Your branch has the latest code, so you can directly get it via running
If your local branch does not have the origin, you can do it. |
Fixes #4159
📌 Summary
Migrated
HelpFragment
from XML-based UI to Jetpack Compose.🔄 Changes Made
Created new Composable components
HomeScreen.kt
andHomeScreenItem.kt
to handle the UI logic in Jetpack Compose.Updated
HelpFragment.kt
HelpFragment
to return a Composable UI instead of using View Binding.Updated dependencies
Libs.kt
andVersions.kt
inbuildSrc
.Handled Navigation
KiwixHelpFragment.kt
, as the host fragment ID is required for Composable-to-Fragment and vice versa navigation.🖼️ Screenshots / GIFs