Skip to content

Instantly share code, notes, and snippets.

View ilhamsuaib's full-sized avatar
:octocat:
hello

ilham suaib ilhamsuaib

:octocat:
hello
View GitHub Profile
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
plugins {
`kotlin-dsl`
}
repositories {
jcenter()
}
/**
* Created by @ilhamsuaib on 2019-08-03.
* github.com/ilhamsuaib
*/
object Versions {
const val GRADLE_BUILD = "3.4.2"
const val KOTLIN = "1.3.41"
const val ANDROIDX = "1.0.2"
}
import org.gradle.kotlin.dsl.*
plugins {
id("com.android.application")
kotlin("android")
kotlin("android.extensions")
}
android {
compileSdkVersion(Config.SDK_VERSION)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath (BuildPlugins.GRADLE_PLUGIN)
include (":app")
@ilhamsuaib
ilhamsuaib / HttpInterceptor
Created March 26, 2019 13:32
Contoh hadle expired token otomatis
class HttpInterceptor(private val context: Context) : Interceptor {
lateinit var sp: PreferencesManager
companion object {
const val TAG = "HttpInterceptor"
}
override fun intercept(chain: Interceptor.Chain?): Response {
sp = PreferencesManager(context)
@ilhamsuaib
ilhamsuaib / ImageEncoder
Created September 25, 2018 06:01
encode image to bitmap black and transparent
import android.graphics.Bitmap
import com.google.zxing.BarcodeFormat
import com.google.zxing.MultiFormatWriter
import com.google.zxing.common.BitMatrix
/**
* Created by ilham on 9/19/17.
*/
@ilhamsuaib
ilhamsuaib / build.gradle
Created March 2, 2018 16:02
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
@ilhamsuaib
ilhamsuaib / CustomTextWatcher.java
Created September 5, 2017 04:43
set currency editText android
public class CustomTextWatcher implements TextWatcher{
private EditText edt;
private String current = "";
public CustomTextWatcher(EditText edt) {
this.edt = edt;
}
@Override