Skip to content

Instantly share code, notes, and snippets.

Avatar

Piyush Malaviya piyush-malaviya

  • Ahmedabad, Gujarat, India
View GitHub Profile
@piyush-malaviya
piyush-malaviya / GridSpacingItemDecoration.md
Last active Feb 17, 2020 — forked from liangzhitao/GridSpacingItemDecoration.md
Add column spacing in RecyclerView with GridLayoutManager
View GridSpacingItemDecoration.md

Android Recyclerview GridLayoutManager column spacing Here is the question, the first answer does not work well in my project,and it makes the spacing bigger between item and item. the second answer is quite perfect.But if RecyclerView has headers,it does not work well. Then I fixed it.

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
@piyush-malaviya
piyush-malaviya / PDFUtil.java
Created Mar 19, 2019 — forked from tejpratap46/PDFUtil.java
Android Generate PDF from view
View PDFUtil.java
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.pdf.PdfDocument;
import android.graphics.pdf.PdfRenderer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@piyush-malaviya
piyush-malaviya / EditTextDateValidation.java
Created Apr 19, 2019 — forked from devrath/EditTextDateValidation.java
Validation date in EditText for android while user is clicking
View EditTextDateValidation.java
//SOURCE: http://stackoverflow.com/questions/16889502/how-to-mask-an-edittext-to-show-the-dd-mm-yyyy-date-format
EditText date;
date = (EditText)findViewById(R.id.whichdate);
date.addTextChangedListener(tw);
TextWatcher tw = new TextWatcher() {
private String current = "";
@piyush-malaviya
piyush-malaviya / DeCryptor.java
Created Jun 21, 2019 — forked from JosiasSena/DeCryptor.java
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
View DeCryptor.java
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@piyush-malaviya
piyush-malaviya / MultiPartUtility.java
Created Nov 27, 2019 — forked from Antarix/MultiPartUtility.java
Uploading Multiple files at once with Post and Header parameter in Android
View MultiPartUtility.java
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;