Skip to content

Instantly share code, notes, and snippets.

Avatar
💚
Android Lover

Lopez Mikhael lopspower

💚
Android Lover
View GitHub Profile
@lopspower
lopspower / ViewModel.kt
Last active February 14, 2018 09:00
ViewModel Kotlin Android Studio Template
View ViewModel.kt
#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) {
@lopspower
lopspower / RecyclerViewAdapter.kt
Last active December 6, 2019 11:34
RecyclerView Adapter Kotlin Android Studio Template
View RecyclerViewAdapter.kt
#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 / README.md
Last active September 16, 2019 13:06
Custom Logcat Color
View README.md

Custom Logcat Color

Twitter

  • ASSERT -> #FF6B68
  • DEBUG -> #3D9D2A
  • ERROR -> #D80D15
  • INFO -> #B7AB4C
@lopspower
lopspower / README.md
Last active April 7, 2022 05:05
Android studio format code auto break line
View README.md

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 February 19, 2023 19:38
Android Supported Language
View README.md

Android Supported Language

Twitter

Folder extension name
Language / Country
@lopspower
lopspower / README.md
Last active February 9, 2023 08:46
All InputType for EditText
View README.md

All InputType for EditText

Twitter

Constant Description
none There is no content type. The text is not editable.
@lopspower
lopspower / README.md
Last active March 29, 2023 06:44
Hexadecimal color code for transparency
View README.md

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 May 11, 2022 02:47
Android Tools Attributes
View README.md

Android Tools Attributes

Twitter

Android has a dedicated XML namespace intended for tools to be able to record information in XML files, and have that information stripped when the application is packaged such that there is no runtime or download size penalty. The namespace URI is http://schemas.android.com/tools and is usually bound to the tools: prefix:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
@lopspower
lopspower / REAMDE.md
Last active August 16, 2021 04:19
Increase Android Studio memory
View REAMDE.md

Increase Android Studio memory

Twitter

Locate the configuration file

Run command:

touch ~/Library/Preferences/AndroidStudioX.X/studio.vmoptions
@lopspower
lopspower / KeyboardUtils.java
Last active December 9, 2022 05:20
Force Hide Keyboard Android
View KeyboardUtils.java
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardUtils {
public static void hideKeyboard(Activity activity) {
View view = activity.findViewById(android.R.id.content);