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 / 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) {
@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 / 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 / README.md
Last active March 30, 2023 18:22
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 February 19, 2023 19:38
Android Supported Language

Android Supported Language

Twitter

Folder extension name
Language / Country
@lopspower
lopspower / README.md
Last active March 10, 2024 05:33
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 March 28, 2024 10:37
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 May 11, 2022 02:47
Android Tools Attributes

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

Increase Android Studio memory

Twitter

Locate the configuration file

Run command:

touch ~/Library/Preferences/AndroidStudioX.X/studio.vmoptions
@lopspower
lopspower / KeyboardUtils.java
Last active July 6, 2023 13:35
Force Hide Keyboard Android
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);