-
기존 UI 개발의 문제점
왜 컴포즈를 써야 할까?
- RoundImageView 만들기 위한 과정
- 리사이클러뷰를 만들기 위한 과정
- 상태 관리
-
결론: UI 를 만들기 위한 모든 과정을 명시해야 해서 생산성이 저하된다.
@file:OptIn(ExperimentalComposeUiApi::class) | |
@file:Suppress("unused") | |
@file:NoLiveLiterals | |
package land.sungbin.androidplayground.extension | |
import androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.AnimationSpec | |
import androidx.compose.animation.core.AnimationVector2D | |
import androidx.compose.animation.core.Spring |
@file:OptIn( | |
ExperimentalComposeUiApi::class, | |
ExperimentalMaterialApi::class | |
) | |
package land.sungbin.androidplayground.snippet.animation | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.navigationBarsPadding |
# Coroutines: | |
How do Kotlin coroutines work internally? | |
- https://medium.com/@elizarov/blocking-threads-suspending-coroutines-d33e11bf4761, | |
- https://medium.com/androiddevelopers/coroutines-on-android-part-i-getting-the-background-3e0e54d20bb, | |
- https://medium.com/androiddevelopers/coroutines-on-android-part-ii-getting-started-3bff117176dd, | |
- https://medium.com/androiddevelopers/coroutines-on-android-part-iii-real-work-2ba8a2ec2f45, | |
- https://medium.com/@patson.luk/learning-kotlin-coroutines-as-a-java-dev-part-i-a04029b6214b, | |
- https://medium.com/@patson.luk/learning-kotlin-coroutines-as-a-java-dev-part-ii-dfe0d468b65e, | |
- https://medium.com/@esocogmbh/coroutines-in-pure-java-65661a379c85. |
import android.graphics.drawable.GradientDrawable | |
import android.view.View | |
import android.view.ViewGroup.LayoutParams | |
import androidx.annotation.Size | |
import androidx.compose.foundation.gestures.FlingBehavior | |
import androidx.compose.foundation.gestures.ScrollableDefaults | |
import androidx.compose.foundation.layout.Arrangement | |
import androidx.compose.foundation.layout.PaddingValues | |
import androidx.compose.foundation.lazy.LazyColumn | |
import androidx.compose.foundation.lazy.LazyListScope |
Android Studio doesn't automatically include dynamic feature modules when building signed release APKs. But universal APKs can be created via the bundletool and signed later.
The gradle wrapper has a task for this already. This makes creating universal APKs easier since APK creation and signing are executed with one command and no separate download of bundletool
is required.
You can use packageReleaseUniversalApk
with the name of your base application module (e.g.: app
) to create a universal APK:
./gradlew :app:packageReleaseUniversalApk
This will however only create an unsigned APK unless you specify the signing informations in your gradle file or pass the information through the command line as shown below.
import androidx.compose.foundation.ScrollState | |
import androidx.compose.material.MaterialTheme | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.composed | |
import androidx.compose.ui.draw.drawWithContent | |
import androidx.compose.ui.geometry.Offset | |
import androidx.compose.ui.geometry.Size | |
import androidx.compose.ui.graphics.Brush | |
import androidx.compose.ui.graphics.Color | |
import androidx.compose.ui.platform.debugInspectorInfo |
The Material Components Library introduced with the 1.2.0-alpha03
the new ShapeableImageView
.
In your layout you can use:
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/image_view"
app:srcCompat="@drawable/..." />
Then in your code apply the ShapeAppearanceModel
to define your custom corners:
import androidx.compose.animation.* | |
import androidx.compose.animation.core.tween | |
import androidx.compose.material.* | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.onCommit | |
import androidx.compose.ui.Modifier | |
@OptIn(ExperimentalAnimationApi::class, ExperimentalMaterialApi::class) | |
@Composable | |
fun <T> AnimatedSwipeDismiss( |
Android Recyclerview GridLayoutManager column spacing Here is the question, the first answer does not work well in my project,and it makes the spacing bigger between item and item. the second answer is quite perfect.But if RecyclerView has headers,it does not work well. Then I fixed it.
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**