Skip to content

Instantly share code, notes, and snippets.

View jisungbin's full-sized avatar
🌴
언어의 정원사

Ji Sungbin jisungbin

🌴
언어의 정원사
  • 여의도 (South Korea)
  • South Korea, Seoul
  • 17:41 (UTC +09:00)
View GitHub Profile
@jisungbin
jisungbin / Data+PrettyPrint.swift
Created September 22, 2020 02:15 — forked from cprovatas/Data+PrettyPrint.swift
Pretty print JSON string from Data in Swift 4.1 (especially useful printing to Xcode console)
import Foundation
extension Data {
var prettyPrintedJSONString: NSString? { /// NSString gives us a nice sanitized debugDescription
guard let object = try? JSONSerialization.jsonObject(with: self, options: []),
let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]),
let prettyPrintedString = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else { return nil }
return prettyPrintedString
}
fun Date.toCalendar(): Calendar {
val calendar = Calendar.getInstance()
calendar.time = this
return calendar
}
@jisungbin
jisungbin / GridSpacingItemDecoration.md
Created October 16, 2020 02:16 — forked from cxyxlxdm/GridSpacingItemDecoration.md
Add column spacing in RecyclerView with GridLayoutManager

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;

/**
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(
@jisungbin
jisungbin / FadingEdge.kt
Created January 17, 2022 14:21 — forked from dovahkiin98/FadingEdge.kt
A Jetpack Compose implementation of the `fadingEdge` effect.
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
@jisungbin
jisungbin / README.md
Created February 6, 2022 12:27 — forked from Farbklex/README.md
Android: Create a signed universal APK with all dynamic feature modules included with gradle wrapper via commandline

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.

@jisungbin
jisungbin / Jetpack-Compose-Fading-Edge.kt
Last active March 26, 2022 15:18
A very simple Fading Edge implementation in Jetpack Compose.
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
@jisungbin
jisungbin / coroutines
Created April 12, 2022 19:21 — forked from ryszardmakuch/coroutines
Coroutines
# 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.
@jisungbin
jisungbin / README.MD
Created January 5, 2022 15:28 — forked from gabrielemariotti/README.MD
How to use the ShapeableImageView.

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:

1. Compose 소개

  • 기존 UI 개발의 문제점

    왜 컴포즈를 써야 할까?

    • RoundImageView 만들기 위한 과정
    • 리사이클러뷰를 만들기 위한 과정
    • 상태 관리
  • 결론: UI 를 만들기 위한 모든 과정을 명시해야 해서 생산성이 저하된다.