Skip to content

Instantly share code, notes, and snippets.

@Jitesh1720
Jitesh1720 / ExpiryDateTextWatcher.java
Created December 8, 2022 13:15 — 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;
@Jitesh1720
Jitesh1720 / WeChatLogin.java
Created February 6, 2021 14:46 — forked from luhaiwork/WeChatLogin.java
Wechat Login
package net.sourceforge.simcpux.wxapi;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import net.sourceforge.simcpux.Constants;
@Jitesh1720
Jitesh1720 / FragFollow.java
Created December 29, 2020 13:46 — forked from deep15187/FragFollow.java
Direct intent to Facebook, Google plus, Linkedin, Twitter, Pinterest, Instagram, Snapchat and Youtube from a fragment after checking if app installed on device
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Build;
import android.text.Editable;
import android.util.AttributeSet;
import android.util.TypedValue;
@Jitesh1720
Jitesh1720 / VerticalViewPager.java
Created November 28, 2019 09:21
Vertical ViewPager (Also working for android pie and higher)
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import androidx.core.view.MotionEventCompat;
import androidx.viewpager.widget.ViewPager;
public class VerticalViewPager extends ViewPager {
@Jitesh1720
Jitesh1720 / FileUtils.java
Created April 9, 2019 13:02 — forked from HBiSoft/FileUtils.java
This fixes the issue when selecting a file from Downloads directory as well as the SD Card. This class can be called like this: String sourcePath = FileUtils.getRealPathFromURI_API19(this, data.getData());
import android.annotation.SuppressLint;
import android.content.ContentUris;
import android.content.Context;
import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@Jitesh1720
Jitesh1720 / EndlessRecyclerOnScrollListener.java
Created April 25, 2018 10:52 — forked from ssinss/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@Jitesh1720
Jitesh1720 / OnItemSelectedListener.java
Created April 3, 2018 11:07 — forked from andreynovikov/OnItemSelectedListener.java
Complete working solution for Android action bar tabs with fragments having separate back stack for each tab.
// Custom interface that enables communication between Fragment and its Activity
public interface OnItemSelectedListener
{
public void onItemSelected(String item);
}