Skip to content

Instantly share code, notes, and snippets.

View mhrpatel12's full-sized avatar
🇮🇳

Mihir Patel mhrpatel12

🇮🇳
View GitHub Profile
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DBHelper extends SQLiteOpenHelper {
public DBHelper(Context context) {
@mhrpatel12
mhrpatel12 / ListAdapter.java
Last active April 2, 2017 19:20
Functional adapter class with no issues.
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.LayoutInflater;
@mhrpatel12
mhrpatel12 / ParseAndStoreAsyncTask.java
Last active April 2, 2017 20:08
parse json resoibse and store in database
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.design.widget.Snackbar;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@mhrpatel12
mhrpatel12 / DatabaseBLL.java
Last active April 2, 2017 20:31
BLL with insert/update/delete/fetch operations.
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
@mhrpatel12
mhrpatel12 / ServiceCallHelper_NetworkUtil.java
Last active April 3, 2017 06:07
Helper files for web service call using volley
/**
* Created by Mihir on 25-04-2016.
*/
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class NetworkUtil {
public static int TYPE_WIFI = 1;
import android.content.Context;
import java.util.ArrayList;
import io.realm.Realm;
import io.realm.RealmResults;
import io.realm.Sort;
import io.realm.exceptions.RealmException;
package com.mihir.bottomsheet
import android.app.Activity
import android.os.Bundle
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
(view?.parent as View).setBackgroundColor(Color.TRANSPARENT)
val resources = resources
if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
assert(view != null)
val parent = view?.parent as View
val layoutParams = parent.layoutParams as CoordinatorLayout.LayoutParams
layoutParams.setMargins(
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val bottomSheetDialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
bottomSheetDialog.setOnShowListener {
val dialog = it as BottomSheetDialog
val bottomSheet = dialog.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
BottomSheetBehavior.from(bottomSheet).state = BottomSheetBehavior.STATE_EXPANDED
}
return bottomSheetDialog
}
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',