This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val projectGroup: String by project | |
val projectVersion: String by project | |
val kotlinVersion: String by project | |
val ktlintVersion: String by project | |
plugins { | |
val kotlinVersion = "1.4.10" | |
kotlin("jvm") version kotlinVersion | |
kotlin("kapt") version kotlinVersion | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 앱이 설치 설치되었는지 판단하는 함수 | |
fun Context.isInstalledApp(packageName: String): Boolean { | |
val intent = packageManager.getLaunchIntentForPackage(packageName) | |
return intent != null | |
} | |
// 특정 앱을 실행하는 함수 | |
fun Context.openApp(packageName: String) { | |
val intent = packageManager.getLaunchIntentForPackage(packageName) | |
startActivity(intent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SortTest { | |
@Test | |
fun `sorting`() { | |
DUMMY.sortedWith( | |
compareByDescending<SortItem> { it.bool } | |
.thenBy { it.num } | |
.thenBy { it.date } | |
.thenBy { it.name } | |
).print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.commons.codec.binary.Hex | |
import java.nio.charset.Charset | |
import java.security.GeneralSecurityException | |
import java.text.SimpleDateFormat | |
import java.util.* | |
import javax.crypto.Mac | |
import javax.crypto.spec.SecretKeySpec | |
object HmacGenerator { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application ...> | |
... | |
<service android:name=".ClipboardService"/> | |
</application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application .. > | |
... | |
<service android:name=".StartAppService"/> | |
</application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage | |
* DLog.w("This is awesome!") | |
* | |
* print -> W/Dave: [xx.kt::methodName]This is awesome! | |
*/ | |
object DLog { | |
private const val TAG : String = "Dave" | |
fun e(message : String){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ApiInterface { | |
@GET("User") | |
fun getUser( | |
@Query("user_id") userId: String | |
): Deferred<User> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamicImageView: LinearLayout { | |
private var imagesPath = mutableListOf<String>() | |
private val horizontalLayoutParam by lazy { LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT) } | |
private val weightZeroLayoutParam by lazy { LinearLayout.LayoutParams(0, 380, 1F) } | |
constructor(context: Context) : super(context) | |
fun addImage(vararg path: String) : DynamicImageView { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun ViewManager.flexboxLayout(theme: Int = 0, init: FlexboxLayout.() -> Unit) = ankoView(::FlexboxLayout, theme, init) | |
inline fun ViewManager.swipeRefreshLayout(theme: Int = 0, init: SwipeRefreshLayout.() -> Unit) = ankoView(::SwipeRefreshLayout, theme, init) | |
inline fun ViewManager.zoomTextView(theme: Int = 0, init: ZoomTextView.() -> Unit) = ankoView(::ZoomTextView, theme, init) | |
inline fun ViewManager.textView(theme: Int = 0, init: TextView.() -> Unit) = ankoView(::TextView, theme, init) | |
inline fun ViewManager.imageView(theme: Int = 0, init: ImageView.() -> Unit) = ankoView(::ImageView, theme, init) | |
inline fun ViewManager.view(theme: Int = 0, init: View.() -> Unit) = ankoView(::View, theme, init) | |
inline fun ViewManager.button(theme: Int = 0, init: Button.() -> Unit) = ankoView(::Button, theme, init) |
NewerOlder