Skip to content

Instantly share code, notes, and snippets.

View zawzaww's full-sized avatar

Zaw Zaw zawzaww

View GitHub Profile
@zawzaww
zawzaww / BoardConfig-shamu.mk
Last active July 25, 2018 14:32
Setup Inline kernel build for Motorola Nexus 6
# Inline Kernel Build
KERNEL_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/$(HOST_OS)-x86/aarch64/aarch64-linux-android-4.9/bin
KERNEL_TOOLCHAIN_PREFIX := aarch64-linux-android-
TARGET_KERNEL_SOURCE := kernel/moto/shamu
TARGET_KERNEL_CONFIG := shamu_defconfig
BOARD_KERNEL_IMAGE_NAME := Image.gz-dtb
@zawzaww
zawzaww / sample_selector.xml
Created July 13, 2018 14:08
Sample selector for using background color and button.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@android:color/white" />
<corners android:radius="3dp" />
<stroke android:width="2dp" android:color="@color/color_primary" />
</shape>
</item>
</selector>
@zawzaww
zawzaww / dimens.xml
Last active July 13, 2018 02:11
Dimensions for XML Layout.
<resources>
<dimen name="margin_small">4dp</dimen>
<dimen name="margin_medium">8dp</dimen>
<dimen name="margin_medium_2">16dp</dimen>
<dimen name="margin_medium_3">20dp</dimen>
<dimen name="margin_large">24dp</dimen>
<dimen name="margin_xlarge">32dp</dimen>
<dimen name="margin_xxlarge">48dp</dimen>
<dimen name="margin_card_medium">6dp</dimen>
@zawzaww
zawzaww / app_bar_sample.xml
Last active July 13, 2018 02:11
Setup app bar in XML Layout.
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/background_light"
@zawzaww
zawzaww / version_defaults.mk
Last active July 12, 2018 11:06
Android Make build system
#
# Handle various build version information.
#
# Guarantees that the following are defined:
# PLATFORM_VERSION
# PLATFORM_SDK_VERSION
# PLATFORM_VERSION_CODENAME
# DEFAULT_APP_TARGET_SDK
# BUILD_ID
# BUILD_NUMBER
@zawzaww
zawzaww / NewsAppModel.kt
Last active July 11, 2018 15:33
Setup sigleton pattern in Kotlin.
class NewsAppModel {
companion object {
private var INSTANCE: NewsAppModel? = null
fun getInstance(): NewsAppModel {
if (INSTANCE == null) {
INSTANCE = NewsAppModel()
}
val i = INSTANCE
return i!!