Skip to content

Instantly share code, notes, and snippets.

View milaptank's full-sized avatar
💭
a lazy android developer

milap tank milaptank

💭
a lazy android developer
View GitHub Profile
@milaptank
milaptank / gist:8e1b624468858124ea350df3a2710699
Created June 28, 2020 08:41 — forked from HeyLookItsBrandon/gist:9693410
Toggleable Android RadioButton
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RadioButton;
import android.widget.RadioGroup;
/** Extension of Android's RadioButton that restores CompoundButton's check toggling
* behavior, allowing a checked RadioButton to be unchecked by tapping on it again. */
public class ToggleableRadioButton extends RadioButton {
public ToggleableRadioButton(Context context) {
super(context);
@milaptank
milaptank / ExpiryDateTextWatcher.java
Created May 30, 2019 11:42 — forked from orcchg/ExpiryDateTextWatcher.java
TextWatcher for expiry date MM/YY automatically adding slash. For Android
import android.graphics.Canvas;
import android.graphics.Paint;
import android.support.annotation.NonNull;
import android.text.Editable;
import android.text.Spannable;
import android.text.TextWatcher;
import android.text.style.ReplacementSpan;
public class ExpiryDateTextWatcher implements TextWatcher {
private int maxLength = 5;
@milaptank
milaptank / AbstractRecyclerAdapter.java
Created August 11, 2016 16:43 — forked from iChintanSoni/BaseRecyclerAdapter.java
This implementation of generic recycler adapter is truely inspired from Firebase Database UI Adapter.
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
package api;
import android.os.Handler;
import android.os.Looper;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
@milaptank
milaptank / CursorRecyclerAdapter.java
Created June 10, 2016 09:03 — forked from quanturium/CursorRecyclerAdapter.java
A simple implementation of CursorAdapter for the new RecyclerView. It is designed to work with CursorLoaders and do not register any content observer (which can cause leaks if not handled properly)
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 ARNAUD FRUGIER
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@milaptank
milaptank / 0_reuse_code.js
Created April 27, 2016 10:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@milaptank
milaptank / build.gradle
Created April 15, 2016 13:26 — forked from ok3141/build.gradle
Gradle obfuscate string
apply from: "$rootDir/utils.gradle"
android {
defaultConfig {
buildConfigField 'String', 'SECRET_KEY', toJavaCodeString(SECRET_KEY)
}
}
@milaptank
milaptank / EmptyRecyclerView.java
Created February 26, 2016 13:59 — forked from AnirudhaAgashe/EmptyRecyclerView.java
RecyclerView with provosion to add empty view like list view. Displayed when the data set is empty
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
public class EmptyRecyclerView extends RecyclerView {