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
@AnirudhaAgashe
AnirudhaAgashe / EmptyRecyclerView.java
Last active June 25, 2017 03:00 — forked from meoyawn/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 {
@iChintanSoni
iChintanSoni / BaseRecyclerAdapter.java
Last active February 1, 2018 14:00
This implementation of generic recycler adapter is truely inspired from Firebase Database UI Adapter.
package com.chintansoni.android.mesamis.base;
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;
@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;
@berkkaraoglu
berkkaraoglu / BorderedCircleTransform.java
Created November 14, 2014 09:12
BorderedCircleTransform for Picasso (Based on https://gist.github.com/julianshen/5829333)
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
private final int BORDER_COLOR = Color.WHITE;
@furkantektas
furkantektas / DatePickerFragment.java
Last active February 11, 2020 20:52
Android DatePicker without year field.
public static class DatePickerFragment extends DialogFragment
implements DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
final int year = c.get(Calendar.YEAR);
final int month = c.get(Calendar.MONTH);
final int day = c.get(Calendar.DAY_OF_MONTH);
@pocmo
pocmo / gist:a47e93254ecac0d26695
Created July 16, 2015 12:57
Android M-Preview 2 - Permissions + Groups + Protection Level
(android.permission-group.CONTACTS) android.permission.READ_CONTACTS dangerous
(android.permission-group.CONTACTS) android.permission.WRITE_CONTACTS dangerous
(android.permission-group.CONTACTS) android.permission.READ_PROFILE dangerous
(android.permission-group.CONTACTS) android.permission.WRITE_PROFILE dangerous
(android.permission-group.CALENDAR) android.permission.READ_CALENDAR dangerous
(android.permission-group.CALENDAR) android.permission.WRITE_CALENDAR dangerous
(android.permission-group.SMS) android.permission.SEND_SMS dangerous
(android.permission-group.SMS) android.permission.RECEIVE_SMS dangerous
(android
@quanturium
quanturium / CursorRecyclerAdapter.java
Last active July 10, 2020 17:50
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
@HeyLookItsBrandon
HeyLookItsBrandon / gist:9693410
Last active November 12, 2020 05:33
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);
@riyazMuhammad
riyazMuhammad / CustomItemClickListener.java
Last active December 30, 2020 15:10
Easy Implementation of RecyclerView custom onItemClickListener
public interface CustomItemClickListener {
public void onItemClick(View v, int position);
}
@gunhansancar
gunhansancar / LocaleHelper.java
Last active April 8, 2021 12:34
While developing your awesome application, sometimes you are required to add a language change feature to your app on the fly. However, Android OS does not directly support this behaviour. And therefore, you need to solve this situation in some other ways. For more details see http://gunhansancar.com/change-language-programmatically-in-android/
package com.gunhansancar.changelanguageexample.helper;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.preference.PreferenceManager;