Skip to content

Instantly share code, notes, and snippets.

View ParryPatel021's full-sized avatar
🛠️
Working

Parth Patel ParryPatel021

🛠️
Working
View GitHub Profile
@ParryPatel021
ParryPatel021 / build.gradle (Module : app)
Created April 4, 2018 07:34 — forked from jaisonfdo/build.gradle (Module : app)
It helps you to Automatically Sign Your APK using build.gradle in Android Studio. For more information, check out my detailed guide here : http://droidmentor.com/sign-apk-automatically/
apply plugin: 'com.android.application'
ext.majorVersion = 1
ext.minorVersion = 0
ext.patchVersion = 1
ext.preRelease = "Alpha"
ext.minSdkVersion = 16
android {
@ParryPatel021
ParryPatel021 / hideShowFloatingbutton.java
Last active July 20, 2018 09:28
Hide and show Floating button based on scrolling of RecyclerView.
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.RecyclerView;
// View Declaration and initialization.
private FloatingActionButton floatingAddButton = view.findViewById(R.id.floatingAddButton);
private RecyclerView recyclerBookSeats = view.findViewById(R.id.recyclerBookSeats);
// Implementation of scrolling with Floating button hide & show.
recyclerBookSeats.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
@ParryPatel021
ParryPatel021 / getDateRange.php
Last active July 20, 2018 13:28
Retrieve Date range from start date to end date in an Array format.
<?php
//Function calling
$dateRange=getDatesFromRange("2018-07-20", "2018-08-05", $format = 'Y-m-d')
//Function body
private function getDatesFromRange($start, $end, $format = 'Y-m-d')
{
$array = array();
$interval = new DateInterval('P1D');
@ParryPatel021
ParryPatel021 / checkInternetConnectionInAndroid.java
Created July 20, 2018 13:40
Check internet connection in android.
//This method will return true if internet available else return false.
public static boolean checkInternetConnection(Context mContext) {
ConnectivityManager connection = (ConnectivityManager) mContext.getSystemService(CONNECTIVITY_SERVICE);
if (connection != null) {
if (connection.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED ||
connection.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTING ||
connection.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED ||
connection.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTING) {
return true;
} else if (connection.getNetworkInfo(0).getState() == NetworkInfo.State.DISCONNECTED ||
//Calling decodePoly
String polyline = (String)((JSONObject)((JSONObject)jSteps.get(k)).get("polyline")).get("points");
List<LatLng> list = decodePoly(polyline);
/*
where "polyline" & "points" are JSON key return from GoogleMap URl.
*/
// deocdePoly implementation
private List<LatLng> decodePoly(String encoded) {
@ParryPatel021
ParryPatel021 / AppHelper.java
Created September 26, 2018 12:50 — forked from anggadarkprince/AppHelper.java
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
/**
* Get Image Uri from Image Bitmap
* @param inContext
* @param inImage
* @return Uri
*/
public Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "NewsImage", null);