Skip to content

Instantly share code, notes, and snippets.

View huuphuoc1396's full-sized avatar
🤪

Phuoc Bui huuphuoc1396

🤪
View GitHub Profile
import android.content.Context
import android.graphics.BlurMaskFilter
import android.util.AttributeSet
import com.google.android.material.textview.MaterialTextView
import com.gooo_group.gooo.R
class BlurTextView(context: Context, attrs: AttributeSet) : MaterialTextView(context, attrs) {
init {
val typedArray = context.theme.obtainStyledAttributes(
@huuphuoc1396
huuphuoc1396 / gradle.properties
Created April 11, 2022 04:43
Android Optimize Build Time
### https://medium.com/proandroiddev/how-we-reduced-our-gradle-build-times-by-over-80-51f2b6d6b05b
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
kotlin.incremental=true
org.gradle.vfs.watch=true
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.caching=true
@huuphuoc1396
huuphuoc1396 / jacoco.gradle
Last active May 4, 2022 18:53
Compiling with language version 1.5 breaks JaCoCo: "Unexpected SMAP line: *S KotlinDebug"
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jacocoFullReport'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$3(ExecuteActionsTaskExecuter.java:186)
Caused by: : Error while creating report
at org.jacoco.ant.ReportTask.execute(ReportTask.java:502)
Caused by: java.io.IOException: Error while analyzing PersonalRequestHelper.class.
at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:162)
Caused by: java.lang.IllegalStateException: Unexpected SMAP line: *S KotlinDebug
at org.jacoco.core.internal.analysis.filter.KotlinInlineFilter.getFirstGeneratedLineNumber(KotlinInlineFilter.java:98)
@huuphuoc1396
huuphuoc1396 / getBuildNumber.kt
Last active April 28, 2021 01:57
Get build number in Gradle Kotlin DSL
fun getBuildNumber(): String {
val buildNumber = System.getenv()["BUILD_NUMBER"]
return buildNumber ?: ""
}
@huuphuoc1396
huuphuoc1396 / InAppReview.kt
Created April 2, 2021 09:54
Google Play In-App Review API
package com.example.androidinappreviews
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.example.androidinappreviews.databinding.ActivityMainBinding
import com.google.android.play.core.review.ReviewManagerFactory
class MainActivity : AppCompatActivity() {
@huuphuoc1396
huuphuoc1396 / fixing_gradlew_persmission_denied.sh
Last active March 26, 2021 07:50
Fixing `./gradlew` "Permission Denied" GitHub Actions
git update-index --chmod=+x gradlew
@huuphuoc1396
huuphuoc1396 / build.gradle.kts
Last active March 26, 2021 07:51
Fixing "Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option Adding support for Java 8 language features could solve this issue."
// Android App or Android Lib Module
plugins {
id(GradlePlugins.androidLib)
id(GradlePlugins.kotlinAndroid)
}
android {
kotlinOptions {
jvmTarget = "1.8"
}
@huuphuoc1396
huuphuoc1396 / HeaderItemDecoration.kt
Created November 17, 2020 08:04 — forked from filipkowicz/HeaderItemDecoration.kt
Item Decorator for sticky headers in Kotlin
package com.filipkowicz.headeritemdecorator
/*
solution based on - based on Sevastyan answer on StackOverflow
changes:
- take to account views offsets
- transformed to Kotlin
- now works on viewHolders
@huuphuoc1396
huuphuoc1396 / build.gradle
Last active July 30, 2024 20:46
Config your output file name in Gradle Kotlin DSL
import com.android.build.gradle.api.ApplicationVariant
import com.android.build.gradle.api.BaseVariantOutput
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
android {
//...
applicationVariants.all(ApplicationVariantAction())
}
apply plugin: 'jacoco'
// Filter out modules
def jacocoCoveredProject = subprojects.findAll { project ->
project.name == "app" || project.name == "data" || project.name == "domain"
}
def coveredProject = subprojects
println("All subprojects:")
println(subprojects.name)