View settings.json
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
// ============ vim ============ // | |
"vim.easymotion": true, | |
"vim.incsearch": true, | |
"vim.useSystemClipboard": true, | |
"vim.useCtrlKeys": true, | |
"vim.hlsearch": true, | |
"vim.otherModesKeyBindingsNonRecursive": [ | |
{ | |
"before": [ | |
"L" |
View ValidateConstantNew.kt
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
//common validate = 1 | |
const val VALIDATE = 0x000000000000101 | |
const val INVALIDATE = 0x000000000000102 | |
//common string = 2 | |
const val INVALIDATE_EMPTY = 0x000000000000201 or INVALIDATE | |
//email validate = 3 | |
const val INVALIDATE_EMAIL = 0x000000000000301 or INVALIDATE | |
const val INVALIDATE_EMAIL_FORMAT = 0x000000000000302 or INVALIDATE_EMAIL |
View ValidateConstant.kt
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 @receiver:ValidateString Int.isValidate(): Boolean = this and VALIDATE == VALIDATE | |
fun @receiver:ValidateString Int.isInvalidate(): Boolean = this and INVALIDATE == INVALIDATE | |
fun String?.validateCommon(): Int { | |
if (this.isNullOrEmpty()) return INVALIDATE_EMPTY | |
return VALIDATE | |
} | |
fun @receiver:ValidateString Int.isInvalidateEmail(): Boolean = this and INVALIDATE_EMAIL == INVALIDATE_EMAIL | |
fun String?.validateEmail(): Int { | |
if (this.validateCommon().isInvalidate()) return this.validateCommon() |
View ValidateConstant.kt
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
//common validate at index 0 | |
const val VALIDATE = 0x0001 | |
const val INVALIDATE = 0x0002 | |
//common string validate at index 1 | |
const val INVALIDATE_EMPTY = 0x0010 or INVALIDATE | |
//email validate at index 2 | |
const val INVALIDATE_EMAIL = 0x0100 or INVALIDATE | |
const val INVALIDATE_EMAIL_FORMAT = 0x0200 or INVALIDATE_EMAIL |
View Validate.kt
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 android.support.annotation.IntDef | |
import java.util.regex.Pattern | |
/** | |
* Created by「 The Khaeng 」on 27 Mar 2018 :) | |
*/ | |
//common validate at index 0 | |
const val VALIDATE = 0x0001 | |
const val INVALIDATE = 0x0002 |
View SystemUISpaceView.kt
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
package com.thekhaeng.systemui.view | |
import android.content.Context | |
import android.graphics.Rect | |
import android.os.Build | |
import android.support.annotation.RequiresApi | |
import android.util.AttributeSet | |
import android.view.View | |
import android.view.WindowInsets | |
import com.thekhaeng.systemui.R |
View get_statusbar_height.kt
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
var statusBarHeight: Int = 0 | |
ViewCompat.setOnApplyWindowInsetsListener(rootView) { view, windowInsets -> | |
statusBarHeight = windowInsets.systemWindowInsetTop | |
return windowInsets //pass insets down to child view | |
} |
View CustomLayout.kt
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 CustomLayout : LinearLayout { | |
... | |
@Suppress("OverridingDeprecatedMember") | |
override | |
fun fitSystemWindows(insets: Rect): Boolean { | |
// Pre API 20: do something with insets | |
return true //consume inset: not pass insets down |
View setOnApplyWindowInsetsListener.kt
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
ViewCompat.setOnApplyWindowInsetsListener(rootView) { view, windowInsets -> | |
// do something with insets | |
return windowInsets.consumeSystemWindowInsets() //consume inset: not pass insets down | |
//or | |
return windowInsets //pass insets down to child view | |
} |
View CoordinatorLayout.xml
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
<android.support.design.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true"> | |
<android.support.design.widget.AppBarLayout | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" |
NewerOlder