Skip to content

Instantly share code, notes, and snippets.

View Krishan14sharma's full-sized avatar

krishan sharma Krishan14sharma

View GitHub Profile
@Krishan14sharma
Krishan14sharma / GcmMockServer.java
Created November 21, 2014 10:28
GCM Mock server code
package com.dnn.zapbuild.dnn.helper;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
/**
@Krishan14sharma
Krishan14sharma / ApiClient.java
Created November 26, 2014 12:21
Quick way to create RetrofitApiClient
package krishan.dhancha.api;
import com.squareup.okhttp.Cache;
import com.squareup.okhttp.OkHttpClient;
import java.io.File;
import java.io.IOException;
import java.util.List;
import krishan.dhancha.BaseApp;
import krishan.dhancha.model.Movie;
import retrofit.Callback;
@Krishan14sharma
Krishan14sharma / CancelableCallback.java
Created November 26, 2014 12:22
Helper class for retrofit callback
package krishan.dhancha.api.helper;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;
public class CancelableCallback<T> implements Callback<T> {
private final Callback callback;
@Krishan14sharma
Krishan14sharma / NetworkActivity.java
Created November 26, 2014 12:43
General Base activity handle network evnts. uses event bus
package krishan.dhancha.controller.base;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Toast;
import com.devspark.appmsg.AppMsg;
package com.dnn.zapbuild.commons.util;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Build;
import android.util.Log;
public class AndroidUtils {
@Krishan14sharma
Krishan14sharma / layout_activity_main.xml
Created December 5, 2014 04:17
Contains standard List item layout
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
package com.dnn.zapbuild.commons.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.dnn.zapbuild.commons.R;
@Krishan14sharma
Krishan14sharma / BaseApp
Created December 10, 2014 06:38
Provides Global Context and Crashlytics config with timber
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import krishan.dhancha.controller.receiver.NetworkStateReceiver;
import timber.log.Timber;
/**
* Created by Krishan on 16-Aug-14.
*/
@Krishan14sharma
Krishan14sharma / SplashActivity.java
Created December 12, 2014 07:41
Splash Template
package com.dnn.zapbuild.sports.controller.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.ActionBarActivity;
import com.dnn.zapbuild.sports.R;
@Krishan14sharma
Krishan14sharma / BaseToolBarActivity.java
Created December 17, 2014 07:27
Contains optional Toolbar
package com.dnn.zapbuild.sports.controller.activity;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import com.dnn.zapbuild.sports.R;
import butterknife.ButterKnife;
import butterknife.InjectView;