Upgrade several AndroidX libraries and Compose to latest stable versions.

This commit is contained in:
Alex Hart
2024-09-10 13:10:05 -03:00
committed by Cody Henthorne
parent 0fe9df3023
commit c3be92d365
10 changed files with 974 additions and 1618 deletions

View File

@@ -349,6 +349,7 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
@Override
protected void onUserLeaveHint() {
super.onUserLeaveHint();
enterPipModeIfPossible();
}

View File

@@ -107,7 +107,7 @@ class AppSettingsActivity : DSLSettingsActivity(), InAppPaymentComponent {
}
}
override fun onNewIntent(intent: Intent?) {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
finish()
startActivity(intent)

View File

@@ -181,11 +181,9 @@ class CallActivity : BaseActivity(), CallControlsCallback {
}
}
override fun onNewIntent(intent: Intent?) {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
if (intent != null) {
viewModel.processCallIntent(CallIntent(intent))
}
viewModel.processCallIntent(CallIntent(intent))
}
override fun onResume() {
@@ -265,7 +263,7 @@ class CallActivity : BaseActivity(), CallControlsCallback {
}
@SuppressLint("MissingSuperCall")
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String?>, grantResults: IntArray) {
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
Permissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults)
}

View File

@@ -27,6 +27,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
@@ -35,6 +36,7 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch
import org.signal.core.ui.DarkPreview
import org.signal.core.ui.Previews
import kotlin.math.pow
@@ -63,6 +65,7 @@ fun PictureInPicture(
val maxWidth = constraints.maxWidth
val contentWidth = with(density) { contentSize.width.toPx().roundToInt() }
val contentHeight = with(density) { contentSize.height.toPx().roundToInt() }
val coroutineScope = rememberCoroutineScope()
var isDragging by remember {
mutableStateOf(false)
@@ -114,6 +117,7 @@ fun PictureInPicture(
IntOffset(offsetX, offsetY)
}
.draggable2D(
enabled = !isAnimating,
state = rememberDraggable2DState { offset ->
offsetX += offset.x.roundToInt()
offsetY += offset.y.roundToInt()
@@ -122,8 +126,8 @@ fun PictureInPicture(
isDragging = true
},
onDragStopped = { velocity ->
isAnimating = true
isDragging = false
isAnimating = true
val x = offsetX + project(velocity.x)
val y = offsetY + project(velocity.y)
@@ -131,18 +135,20 @@ fun PictureInPicture(
val projectedCoordinate = IntOffset(x.roundToInt(), y.roundToInt())
val cornerCoordinate = getClosestCorner(projectedCoordinate, topLeft, topRight, bottomLeft, bottomRight)
animate(
typeConverter = IntOffsetConverter,
initialValue = IntOffset(offsetX, offsetY),
targetValue = cornerCoordinate,
initialVelocity = IntOffset(velocity.x.roundToInt(), velocity.y.roundToInt()),
animationSpec = tween()
) { value, _ ->
offsetX = value.x
offsetY = value.y
}
coroutineScope.launch {
animate(
typeConverter = IntOffsetConverter,
initialValue = IntOffset(offsetX, offsetY),
targetValue = cornerCoordinate,
initialVelocity = IntOffset(velocity.x.roundToInt(), velocity.y.roundToInt()),
animationSpec = tween()
) { value, _ ->
offsetX = value.x
offsetY = value.y
}
isAnimating = false
isAnimating = false
}
}
)
) {

View File

@@ -86,7 +86,7 @@ open class ConversationActivity : PassphraseRequiredActivity(), VoiceNoteMediaCo
transitionDebouncer.clear()
}
override fun onNewIntent(intent: Intent?) {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
// Note: We utilize this instead of 'replaceFragment' because there seems to be a bug

View File

@@ -148,7 +148,7 @@ private fun SafetyTipsContent(forGroup: Boolean = false, modifier: Modifier = Mo
HorizontalPager(
state = pagerState,
beyondBoundsPageCount = size,
beyondViewportPageCount = size,
modifier = Modifier.padding(top = 24.dp)
) {
SafetyTip(tips[it])

View File

@@ -113,7 +113,7 @@ class StoryViewerActivity : PassphraseRequiredActivity(), VoiceNoteMediaControll
}
}
override fun onNewIntent(intent: Intent?) {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
replaceStoryViewerFragment()