Skip to content

Commit 14124b4

Browse files
committed
change package name of app
1 parent af5e49d commit 14124b4

File tree

7 files changed

+24
-35
lines changed

7 files changed

+24
-35
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.github.compose.waveloading">
3+
package="com.github.compose.waveloading.sample">
44

55
<application
66
android:allowBackup="true"

app/src/main/java/com/github/compose/waveloading/MainActivity.kt renamed to app/src/main/java/com/github/compose/waveloading/sample/MainActivity.kt

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
package com.github.compose.waveloading
1+
package com.github.compose.waveloading.sample
22

33
import android.os.Bundle
44
import androidx.activity.ComponentActivity
55
import androidx.activity.compose.setContent
6-
import androidx.compose.animation.core.CubicBezierEasing
7-
import androidx.compose.animation.core.LinearEasing
8-
import androidx.compose.animation.core.RepeatMode
9-
import androidx.compose.animation.core.animateFloat
10-
import androidx.compose.animation.core.animateIntAsState
11-
import androidx.compose.animation.core.infiniteRepeatable
12-
import androidx.compose.animation.core.rememberInfiniteTransition
13-
import androidx.compose.animation.core.tween
146
import androidx.compose.foundation.Image
15-
import androidx.compose.foundation.background
167
import androidx.compose.foundation.layout.Box
178
import androidx.compose.foundation.layout.Column
189
import androidx.compose.foundation.layout.Row
@@ -22,7 +13,6 @@ import androidx.compose.foundation.layout.padding
2213
import androidx.compose.foundation.layout.width
2314
import androidx.compose.material.Checkbox
2415
import androidx.compose.material.MaterialTheme
25-
import androidx.compose.material.RadioButton
2616
import androidx.compose.material.Slider
2717
import androidx.compose.material.Surface
2818
import androidx.compose.material.Text
@@ -33,16 +23,16 @@ import androidx.compose.runtime.mutableStateOf
3323
import androidx.compose.runtime.remember
3424
import androidx.compose.ui.Alignment
3525
import androidx.compose.ui.Modifier
36-
import androidx.compose.ui.draw.rotate
37-
import androidx.compose.ui.graphics.Brush
3826
import androidx.compose.ui.graphics.Color
3927
import androidx.compose.ui.res.painterResource
40-
import androidx.compose.ui.text.font.FontStyle
4128
import androidx.compose.ui.text.font.FontWeight
4229
import androidx.compose.ui.text.style.TextAlign
4330
import androidx.compose.ui.tooling.preview.Preview
4431
import androidx.compose.ui.unit.dp
45-
import com.github.compose.waveloading.ui.theme.ComposewaveloadingTheme
32+
import com.github.compose.waveloading.DrawType
33+
import com.github.compose.waveloading.WaveLoading
34+
import com.github.compose.waveloading.rememberDrawColor
35+
import com.github.compose.waveloading.sample.ui.theme.ComposewaveloadingTheme
4636

4737
class MainActivity : ComponentActivity() {
4838
override fun onCreate(savedInstanceState: Bundle?) {
@@ -147,7 +137,7 @@ class MainActivity : ComponentActivity() {
147137

148138
WaveLoading(
149139
Modifier.weight(1f),
150-
drawType = DrawType.DrawColor(Color.Cyan),
140+
foreDrawType = DrawType.DrawColor(Color.Cyan),
151141
backDrawType = if (_backImage) rememberDrawColor() else DrawType.None,
152142
progress = _progress,
153143
velocity = _velocity,

app/src/main/java/com/github/compose/waveloading/ui/theme/Color.kt renamed to app/src/main/java/com/github/compose/waveloading/sample/ui/theme/Color.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.compose.waveloading.ui.theme
1+
package com.github.compose.waveloading.sample.ui.theme
22

33
import androidx.compose.ui.graphics.Color
44

app/src/main/java/com/github/compose/waveloading/ui/theme/Shape.kt renamed to app/src/main/java/com/github/compose/waveloading/sample/ui/theme/Shape.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.compose.waveloading.ui.theme
1+
package com.github.compose.waveloading.sample.ui.theme
22

33
import androidx.compose.foundation.shape.RoundedCornerShape
44
import androidx.compose.material.Shapes

app/src/main/java/com/github/compose/waveloading/ui/theme/Theme.kt renamed to app/src/main/java/com/github/compose/waveloading/sample/ui/theme/Theme.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.compose.waveloading.ui.theme
1+
package com.github.compose.waveloading.sample.ui.theme
22

33
import androidx.compose.foundation.isSystemInDarkTheme
44
import androidx.compose.material.MaterialTheme

app/src/main/java/com/github/compose/waveloading/ui/theme/Type.kt renamed to app/src/main/java/com/github/compose/waveloading/sample/ui/theme/Type.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.compose.waveloading.ui.theme
1+
package com.github.compose.waveloading.sample.ui.theme
22

33
import androidx.compose.material.Typography
44
import androidx.compose.ui.text.TextStyle

lib/src/main/java/com/github/compose/waveloading/WaveLoading.kt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import kotlin.math.roundToInt
4848
private const val defaultAmlitude = 0.2f
4949
private const val defaultVelocity = 1.0f
5050
private const val waveDuration = 2000
51-
private const val frontDrawAlpha = 0.5f
51+
private const val foreDrawAlpha = 0.5f
5252
private const val scaleX = 1f
5353
private const val scaleY = 1f
5454

@@ -57,9 +57,9 @@ private val alphaBitmap by lazy {
5757
}
5858

5959
data class WaveConfig(
60-
val progress: Float,
61-
val frontDrawType: DrawType,
60+
val foreDrawType: DrawType,
6261
val backDrawType: DrawType,
62+
@FloatRange(from = 0.0, to = 1.0) val progress: Float,
6363
@FloatRange(from = 0.0, to = 1.0) val amplitude: Float,
6464
@FloatRange(from = 0.0, to = 1.0) val velocity: Float
6565
)
@@ -71,9 +71,9 @@ val LocalWave = compositionLocalOf<WaveConfig> {
7171
@Composable
7272
fun WaveLoading(
7373
modifier: Modifier = Modifier,
74-
progress: Float = 0f,
75-
drawType: DrawType = DrawType.DrawImage,
74+
foreDrawType: DrawType = DrawType.DrawImage,
7675
backDrawType: DrawType = rememberDrawColor(color = Color.LightGray),
76+
@FloatRange(from = 0.0, to = 1.0) progress: Float = 0f,
7777
@FloatRange(from = 0.0, to = 1.0) amplitude: Float = defaultAmlitude,
7878
@FloatRange(from = 0.0, to = 1.0) velocity: Float = defaultVelocity,
7979
content: @Composable BoxScope.() -> Unit
@@ -130,7 +130,7 @@ fun WaveLoading(
130130

131131

132132
CompositionLocalProvider(
133-
LocalWave provides WaveConfig(progress, drawType, backDrawType, amplitude, velocity)
133+
LocalWave provides WaveConfig(foreDrawType, backDrawType, progress, amplitude, velocity)
134134
) {
135135
with(LocalDensity.current) {
136136
Box(
@@ -159,14 +159,14 @@ private fun WaveLoadingInternal(bitmap: Bitmap) {
159159

160160
val transition = rememberInfiniteTransition()
161161

162-
val (progress, frontDrawType, backDrawType, amplitude, velocity) = LocalWave.current
162+
val (foreDrawType, backDrawType, progress, amplitude, velocity) = LocalWave.current
163163

164-
val frontPaint = remember(frontDrawType, bitmap) {
164+
val forePaint = remember(foreDrawType, bitmap) {
165165
Paint().apply {
166-
alpha = frontDrawAlpha
166+
alpha = foreDrawAlpha
167167
shader = BitmapShader(
168-
when (frontDrawType) {
169-
is DrawType.DrawColor -> bitmap.toColor(frontDrawType.color)
168+
when (foreDrawType) {
169+
is DrawType.DrawColor -> bitmap.toColor(foreDrawType.color)
170170
is DrawType.DrawImage -> bitmap
171171
else -> alphaBitmap
172172
},
@@ -224,7 +224,7 @@ private fun WaveLoadingInternal(bitmap: Bitmap) {
224224
-offsetY
225225
)
226226

227-
frontPaint.shader?.transform {
227+
forePaint.shader?.transform {
228228
setTranslate(offsetX, 0f)
229229
}
230230

@@ -235,7 +235,7 @@ private fun WaveLoadingInternal(bitmap: Bitmap) {
235235
height = maxHeight,
236236
amplitude = size.height * amplitude,
237237
progress = progress
238-
), frontPaint
238+
), forePaint
239239
)
240240
}
241241

@@ -246,7 +246,6 @@ private fun WaveLoadingInternal(bitmap: Bitmap) {
246246
}
247247

248248

249-
250249
@Composable
251250
private fun InfiniteTransition.animateOf(duration: Int) = animateFloat(
252251
initialValue = 0f, targetValue = 1f, animationSpec = infiniteRepeatable(

0 commit comments

Comments
 (0)