Skip to content

Instantly share code, notes, and snippets.

View mistrydarshan99's full-sized avatar

Darshan Mistry mistrydarshan99

View GitHub Profile
@mistrydarshan99
mistrydarshan99 / README.md
Last active August 29, 2015 14:26 — forked from gabrielemariotti/README.md
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@mistrydarshan99
mistrydarshan99 / style.java
Created August 19, 2015 08:43
Style of Project
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@mistrydarshan99
mistrydarshan99 / OverFlowMenu.java
Last active August 29, 2015 14:27
Customize overflow menu
<!-- APP Theme which extends Theme App Compact -->
<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat">
<item name="android:actionOverflowButtonStyle">@style/OverflowButton</item>
<item name="actionOverflowButtonStyle">@style/OverflowButton</item>
<item name="android:dropDownListViewStyle">@style/PopupMenuListView</item>
<item name="dropDownListViewStyle">@style/PopupMenuListView</item>
<item name="actionBarDivider">@null</item>
@mistrydarshan99
mistrydarshan99 / TestAlert.java
Last active August 28, 2015 10:50 — forked from vaibhav-jani/TestAlert.java
Test Alert and mail sender
import java.io.IOException;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import java.io.ByteArrayOutputStream;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;
public class Base64ImageUtil {
public static Bitmap stringToBitmap(String encodedString) {
try {
public class SignatureView extends View {
private static final float STROKE_WIDTH = 5f;
/** Need to track this so the dirty region can accommodate the stroke. **/
private static final float HALF_STROKE_WIDTH = STROKE_WIDTH / 2;
private Paint paint = new Paint();
private Path path = new Path();
public class KeyboardUtils {
public static void setKeyboardVisibilityListener(Activity activity, final KeyboardVisibilityListener keyboardVisibilityListener) {
final View contentView = activity.findViewById(android.R.id.content);
contentView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
private int mPreviousHeight;
@mistrydarshan99
mistrydarshan99 / Hack.java
Last active August 28, 2015 10:50 — forked from vaibhav-jani/Hack.java
move with drawar
drawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
float moveFactor = (drawerView.getWidth() * slideOffset);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
{
flContent.setTranslationX(-moveFactor);
/**
* Created by vaibhav.jani on 15-Jul-15.
*/
public abstract class BaseFragment extends Fragment {
protected View rootView;
protected HomeActivity activity;
import android.content.Context;
import android.content.res.AssetManager;
import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;