Skip to content

Instantly share code, notes, and snippets.

View vijaybheda's full-sized avatar
🖥️
Working from Office

Vijay Bheda vijaybheda

🖥️
Working from Office
View GitHub Profile
@vijaybheda
vijaybheda / app_build.gradle
Last active May 7, 2020 11:23
Add crashlytics to Android Project 2020
app/build.gradle
apply plugin: 'io.fabric'
check.dependsOn 'assembleDebugAndroidTest'
android {
}
@vijaybheda
vijaybheda / ImageSliderAdapter.java
Last active February 8, 2020 12:40
Image Slider Android
public class ImageSliderAdapter extends FragmentPagerAdapter {
private final List<Fragment> fragmentList = new ArrayList<>();
public ImageSliderAdapter(@NonNull FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
import android.content.Context;
import android.content.SharedPreferences;
/**
* Copyright (C) 2016 Mikhael LOPEZ
* Licensed under the Apache License Version 2.0
* Utility class for the SharedPreferences management
*/
public class SharedPreferencesUtils {
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardUtils {
public static void hideKeyboard(Activity activity) {
View view = activity.findViewById(android.R.id.content);
package com.vijay.backend;
import android.app.AlertDialog;
import android.app.Service;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
@vijaybheda
vijaybheda / MyApplication.java
Created February 13, 2020 17:07
extends Application
import android.app.Activity;
import android.app.Application;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@vijaybheda
vijaybheda / JsonParserClass.java
Created February 13, 2020 17:10
fromJson toJson JSON Parser
public static MapOrderDetail fromJson(String decoded) {
Gson gson = new Gson();
Type type = new TypeToken<MapOrderDetail>() {
}.getType();
return gson.fromJson(decoded, type);
}
public static String toJson(MapOrderDetail mapOrderDetail) {
Gson gson = new Gson();
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE);
integrator.setPrompt("Scan a QR Code");
integrator.setBeepEnabled(true);
integrator.setBarcodeImageEnabled(true);
integrator.setOrientationLocked(true);
integrator.initiateScan();
@Override
class UploadImageASYNC extends AsyncTask<String, String, String> {
private final ProgressDialog dialog = new ProgressDialog(UploadImageDashboard.this);
@Override
protected void onProgressUpdate(String... msg) {
if (msg.length > 0 && msg[0].length() > 0) {
this.dialog.setMessage(msg[0]);
}
}
public static boolean isInternetAvailable(Context context) {
ConnectivityManager conMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = null;
if (conMgr != null) {
netInfo = conMgr.getActiveNetworkInfo();
}
if (netInfo == null) {
new androidx.appcompat.app.AlertDialog.Builder(context)
.setTitle(context.getResources().getString(R.string.app_name))
.setMessage(context.getResources().getString(R.string.internet_error))