-
Notifications
You must be signed in to change notification settings - Fork 0
MediaSend update 1 : Moved fragment UI to compose #4
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: improvements/mediasend-compose
Are you sure you want to change the base?
Conversation
| ) { | ||
|
|
||
| // span logic: screenWidth / media_picker_folder_width | ||
| val folderWidth = dimensionResource(R.dimen.media_picker_folder_width) |
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.
You probably want to port this into our compose Dimension.kt instead. You can remove media_picker_folder_width and other related xml dimensions if they are not needed or moved to the kt file instead.
| modifier = Modifier | ||
| .align(Alignment.BottomCenter) | ||
| .fillMaxWidth() | ||
| .height(50.dp) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| @Deprecated |
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.
One thing to be mindful of if you decide to keep all the old stuff, is to not forget to clean it out later.
With git history you can easily access old files you should be ok deleting and cleaning everything you don't need anymore.
Don't forget to clean out the layout.xml files, and possibly unused views.xml, dimensions, etc...
| .clickable(onClick = onClick) | ||
| ) { | ||
| Box(modifier = Modifier.aspectRatio(1f)) { | ||
| GlideImage( |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| modifier = Modifier.fillMaxSize(), | ||
| contentScale = ContentScale.Crop | ||
| ) | ||
| // Bottom shade overlay |
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.
Do you think it could be achieved more easily with the innerShadow modifier?
| selected.indexOfFirst { it.uri == media.uri } | ||
| } | ||
|
|
||
| // Matches adapter rules: |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| .padding(end = 2.dp, bottom = 2.dp) | ||
| .aspectRatio(1f) | ||
| .combinedClickable( | ||
| onClick = { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
|
||
| Box( | ||
| modifier = modifier | ||
| .padding(end = 2.dp, bottom = 2.dp) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| ) | ||
|
|
||
| // Border overlay (replaces @drawable/mediapicker_item_border_dark View) | ||
| Box( |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| painter = painterResource(R.drawable.triangle_right), | ||
| contentDescription = null, | ||
| modifier = Modifier | ||
| .size(width = 15.dp, height = 18.dp) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
|
||
| val context = LocalContext.current | ||
| val activity = context as? FragmentActivity | ||
| val showManage = remember(activity) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
I moved a few functions into the VM and added the flag to the UiState as an initial change. Maybe we can separate permission checking from the AttachmentManager. I copied some of the permission checks into the VM for now but I can do the separate file if we find that suitable for the modern structure.
| .fillMaxSize() | ||
| .background(LocalColors.current.background) | ||
| ) { | ||
| items(folders) { folder -> |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| val mediaItemGridSpacing : Dp = 2.dp, | ||
| val mediaPlayOverlay : Dp = 36.dp, | ||
|
|
||
| val smallRadius : Dp = 26.dp |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| .padding(LocalDimensions.current.xxsSpacing), | ||
| contentAlignment = Alignment.Center | ||
| ) { | ||
| IndicatorOn(size = LocalDimensions.current.smallRadius) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.Dp | ||
| import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi | ||
| import com.bumptech.glide.integration.compose.GlideImage |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| .aspectRatio(1f) | ||
| .border( | ||
| width = LocalDimensions.current.borderStroke, | ||
| color = Color.White.copy(alpha = 0.20f) |
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.
A new color is suspicious here. Shouldn't it be our LocalColors.current.borders color instead?
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.
@jbsession You added the new color but you left the alpha. Is that needed? The border colour alone should be enough?
Moved the old Fragment XMLs to Compose.
New ComposeFragments are created to replace the old fragments for the MediaSendActivity.
Part 2 in progress : MediaSendFragment UI to compose.