Skip to content

Instantly share code, notes, and snippets.

View lopspower's full-sized avatar
💚
Android Lover

Lopez Mikhael lopspower

💚
Android Lover
View GitHub Profile
@lopspower
lopspower / README.md
Last active April 26, 2024 07:55
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@lopspower
lopspower / README.md
Last active April 22, 2024 07:02
Android studio format code auto break line

Android studio format code auto break line

Twitter

To do this in Android Studio go to Preferences > Editor > Code Style

and set Right margin (columns) to 150 (or the line width you want)

Now go to File -> Settings > Editor > Code Style > Java > Wrapping and Braces

@lopspower
lopspower / README.md
Last active April 17, 2024 23:43
All InputType for EditText

All InputType for EditText

Twitter

Constant Description
none There is no content type. The text is not editable.
@lopspower
lopspower / README.md
Last active April 12, 2024 13:55
All Android Directory Path

All Android Directory Path

Twitter

1) System directories

⚠️ We can't write to these folers

Method Result
@lopspower
lopspower / README.md
Last active January 20, 2024 09:18
Publish AAR to jCenter and Maven Central

Publish AAR to jCenter and Maven Central

Twitter

EDIT: You can find this same updated tutorial here -> Medium

Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:

  1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView
@lopspower
lopspower / README.md
Last active January 19, 2024 10:54
What's difference between -nodpi and -anydpi?

Difference between -nodpi and -anydpi

Android Studio exposes developers to -nodpi and -anydpi in various places. For example, if you use the New Resource Directory wizard thing, and you choose to add a density qualifier to the directory, you will see "No Density" (-nodpi) and "Any Density" (-anydpi) options.

Some of you might expect these to be well-documented.

In a word, no.

However, courtesy of a fair amount of experimentation (largely done as part of work on this Stack Overflow question and this answer), their use becomes at least a bit clearer. Many thanks to Stack Overflow user rds for the help!

@lopspower
lopspower / README.md
Last active December 24, 2023 13:01
Material Animations

Material Animations

Android Arsenal

[Android Transition Framework][transition-framework] can be used for three main things:

  1. Animate activity layout content when transitioning from one activity to another.
  2. Animate shared elements (Hero views) in transitions between activities.
  3. Animate view changes within same activity.
@lopspower
lopspower / README.md
Last active September 30, 2023 10:51
Custom Logcat Color

Custom Logcat Color

Twitter

  • ASSERT -> #FF6B68
  • DEBUG -> #3D9D2A
  • ERROR -> #D80D15
  • INFO -> #B7AB4C
@lopspower
lopspower / RecyclerViewAdapter.kt
Last active September 30, 2023 10:50
RecyclerView Adapter Kotlin Android Studio Template
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import java.util.*
class ${NAME} : RecyclerView.Adapter<${Model}Adapter.ViewHolder>() {
@lopspower
lopspower / ViewModel.kt
Last active September 30, 2023 10:50
ViewModel Kotlin Android Studio Template
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import com.mstv.presentation.scenes.base.view.ContentState
import com.mstv.presentation.scenes.base.view.LoadingState
data class ${NAME}(val loadingState: LoadingState = LoadingState.NONE,
val contentState: ContentState = ContentState.NONE,
val data: ${DataType}? = null,
val errorMessage: String? = null,
val snackMessage: String? = null) {