Skip to content

Commit c3be92d

Browse files
alex-signalcody-signal
authored andcommitted
Upgrade several AndroidX libraries and Compose to latest stable versions.
1 parent 0fe9df3 commit c3be92d

File tree

10 files changed

+1101
-1745
lines changed

10 files changed

+1101
-1745
lines changed

app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
349349

350350
@Override
351351
protected void onUserLeaveHint() {
352+
super.onUserLeaveHint();
352353
enterPipModeIfPossible();
353354
}
354355

app/src/main/java/org/thoughtcrime/securesms/components/settings/app/AppSettingsActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class AppSettingsActivity : DSLSettingsActivity(), InAppPaymentComponent {
107107
}
108108
}
109109

110-
override fun onNewIntent(intent: Intent?) {
110+
override fun onNewIntent(intent: Intent) {
111111
super.onNewIntent(intent)
112112
finish()
113113
startActivity(intent)

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallActivity.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,9 @@ class CallActivity : BaseActivity(), CallControlsCallback {
181181
}
182182
}
183183

184-
override fun onNewIntent(intent: Intent?) {
184+
override fun onNewIntent(intent: Intent) {
185185
super.onNewIntent(intent)
186-
if (intent != null) {
187-
viewModel.processCallIntent(CallIntent(intent))
188-
}
186+
viewModel.processCallIntent(CallIntent(intent))
189187
}
190188

191189
override fun onResume() {
@@ -265,7 +263,7 @@ class CallActivity : BaseActivity(), CallControlsCallback {
265263
}
266264

267265
@SuppressLint("MissingSuperCall")
268-
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String?>, grantResults: IntArray) {
266+
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
269267
Permissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults)
270268
}
271269

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/PictureInPicture.kt

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import androidx.compose.runtime.getValue
2727
import androidx.compose.runtime.mutableIntStateOf
2828
import androidx.compose.runtime.mutableStateOf
2929
import androidx.compose.runtime.remember
30+
import androidx.compose.runtime.rememberCoroutineScope
3031
import androidx.compose.runtime.setValue
3132
import androidx.compose.ui.Modifier
3233
import androidx.compose.ui.draw.clip
@@ -35,6 +36,7 @@ import androidx.compose.ui.platform.LocalDensity
3536
import androidx.compose.ui.unit.DpSize
3637
import androidx.compose.ui.unit.IntOffset
3738
import androidx.compose.ui.unit.dp
39+
import kotlinx.coroutines.launch
3840
import org.signal.core.ui.DarkPreview
3941
import org.signal.core.ui.Previews
4042
import kotlin.math.pow
@@ -63,6 +65,7 @@ fun PictureInPicture(
6365
val maxWidth = constraints.maxWidth
6466
val contentWidth = with(density) { contentSize.width.toPx().roundToInt() }
6567
val contentHeight = with(density) { contentSize.height.toPx().roundToInt() }
68+
val coroutineScope = rememberCoroutineScope()
6669

6770
var isDragging by remember {
6871
mutableStateOf(false)
@@ -114,6 +117,7 @@ fun PictureInPicture(
114117
IntOffset(offsetX, offsetY)
115118
}
116119
.draggable2D(
120+
enabled = !isAnimating,
117121
state = rememberDraggable2DState { offset ->
118122
offsetX += offset.x.roundToInt()
119123
offsetY += offset.y.roundToInt()
@@ -122,27 +126,29 @@ fun PictureInPicture(
122126
isDragging = true
123127
},
124128
onDragStopped = { velocity ->
125-
isAnimating = true
126129
isDragging = false
130+
isAnimating = true
127131

128132
val x = offsetX + project(velocity.x)
129133
val y = offsetY + project(velocity.y)
130134

131135
val projectedCoordinate = IntOffset(x.roundToInt(), y.roundToInt())
132136
val cornerCoordinate = getClosestCorner(projectedCoordinate, topLeft, topRight, bottomLeft, bottomRight)
133137

134-
animate(
135-
typeConverter = IntOffsetConverter,
136-
initialValue = IntOffset(offsetX, offsetY),
137-
targetValue = cornerCoordinate,
138-
initialVelocity = IntOffset(velocity.x.roundToInt(), velocity.y.roundToInt()),
139-
animationSpec = tween()
140-
) { value, _ ->
141-
offsetX = value.x
142-
offsetY = value.y
138+
coroutineScope.launch {
139+
animate(
140+
typeConverter = IntOffsetConverter,
141+
initialValue = IntOffset(offsetX, offsetY),
142+
targetValue = cornerCoordinate,
143+
initialVelocity = IntOffset(velocity.x.roundToInt(), velocity.y.roundToInt()),
144+
animationSpec = tween()
145+
) { value, _ ->
146+
offsetX = value.x
147+
offsetY = value.y
148+
}
149+
150+
isAnimating = false
143151
}
144-
145-
isAnimating = false
146152
}
147153
)
148154
) {

app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ open class ConversationActivity : PassphraseRequiredActivity(), VoiceNoteMediaCo
8686
transitionDebouncer.clear()
8787
}
8888

89-
override fun onNewIntent(intent: Intent?) {
89+
override fun onNewIntent(intent: Intent) {
9090
super.onNewIntent(intent)
9191

9292
// Note: We utilize this instead of 'replaceFragment' because there seems to be a bug

app/src/main/java/org/thoughtcrime/securesms/conversation/v2/SafetyTipsBottomSheetDialog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private fun SafetyTipsContent(forGroup: Boolean = false, modifier: Modifier = Mo
148148

149149
HorizontalPager(
150150
state = pagerState,
151-
beyondBoundsPageCount = size,
151+
beyondViewportPageCount = size,
152152
modifier = Modifier.padding(top = 24.dp)
153153
) {
154154
SafetyTip(tips[it])

app/src/main/java/org/thoughtcrime/securesms/stories/viewer/StoryViewerActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class StoryViewerActivity : PassphraseRequiredActivity(), VoiceNoteMediaControll
113113
}
114114
}
115115

116-
override fun onNewIntent(intent: Intent?) {
116+
override fun onNewIntent(intent: Intent) {
117117
super.onNewIntent(intent)
118118
setIntent(intent)
119119
replaceStoryViewerFragment()

core-ui/src/main/java/org/signal/core/ui/IconButtons.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import androidx.compose.foundation.layout.Box
1212
import androidx.compose.foundation.layout.size
1313
import androidx.compose.foundation.selection.toggleable
1414
import androidx.compose.foundation.shape.CircleShape
15-
import androidx.compose.material.ripple.rememberRipple
1615
import androidx.compose.material3.LocalContentColor
1716
import androidx.compose.material3.MaterialTheme
1817
import androidx.compose.material3.minimumInteractiveComponentSize
18+
import androidx.compose.material3.ripple
1919
import androidx.compose.runtime.Composable
2020
import androidx.compose.runtime.CompositionLocalProvider
2121
import androidx.compose.runtime.remember
@@ -88,7 +88,7 @@ object IconButtons {
8888
enabled = enabled,
8989
role = Role.Button,
9090
interactionSource = interactionSource,
91-
indication = rememberRipple(
91+
indication = ripple(
9292
bounded = false,
9393
radius = size / 2
9494
)
@@ -126,7 +126,7 @@ object IconButtons {
126126
enabled = enabled,
127127
role = Role.Checkbox,
128128
interactionSource = interactionSource,
129-
indication = androidx.compose.material.ripple.rememberRipple(
129+
indication = ripple(
130130
bounded = false,
131131
radius = size / 2
132132
)

dependencies.gradle.kts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ dependencyResolutionManagement {
55
versionCatalogs {
66
create("libs") {
77
version("androidx-appcompat", "1.6.1")
8-
version("androidx-activity", "1.8.2")
8+
version("androidx-activity", "1.9.2")
99
version("androidx-camera", "1.3.4")
10-
version("androidx-fragment", "1.6.2")
11-
version("androidx-lifecycle", "2.8.4")
10+
version("androidx-fragment", "1.8.3")
11+
version("androidx-lifecycle", "2.8.5")
1212
version("androidx-media3", "1.3.1")
13-
version("androidx-navigation", "2.7.6")
14-
version("androidx-window", "1.2.0")
13+
version("androidx-navigation", "2.8.0")
14+
version("androidx-window", "1.3.0")
1515
version("exoplayer", "2.19.0")
1616
version("glide", "4.15.1")
1717
version("kotlin", "1.9.20")
@@ -26,8 +26,9 @@ dependencyResolutionManagement {
2626
library("android-application", "com.android.application", "com.android.application.gradle.plugin").versionRef("android-gradle-plugin")
2727

2828
// Compose
29-
library("androidx-compose-bom", "androidx.compose:compose-bom:2024.06.00")
29+
library("androidx-compose-bom", "androidx.compose:compose-bom:2024.09.00")
3030
library("androidx-compose-material3", "androidx.compose.material3", "material3").withoutVersion()
31+
library("androidx-compose-material-navigation", "androidx.compose.material", "material-navigation").withoutVersion()
3132
library("androidx-compose-ui-tooling-preview", "androidx.compose.ui", "ui-tooling-preview").withoutVersion()
3233
library("androidx-compose-ui-tooling-core", "androidx.compose.ui", "ui-tooling").withoutVersion()
3334
library("androidx-compose-ui-test-manifest", "androidx.compose.ui", "ui-test-manifest").withoutVersion()

0 commit comments

Comments
 (0)