Skip to content

Instantly share code, notes, and snippets.

View Krishan14sharma's full-sized avatar

krishan sharma Krishan14sharma

View GitHub Profile
@Krishan14sharma
Krishan14sharma / proguard-rules.pro
Created September 29, 2015 10:23
Common proguard rules
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/zapbuild/adt-bundle-linux-x86_64-20140702/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
@Krishan14sharma
Krishan14sharma / LocationFinder.java
Created September 7, 2015 12:59
reverse geocode
package com.zapbuild.myi.interactors;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import com.zapbuild.myi.base.BaseApp;
import java.util.List;
import java.util.Locale;
package com.zapbuild.myi.interactors;
import android.location.Location;
import android.os.Bundle;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationServices;
import static com.zapbuild.myi.base.BaseApp.getContext;
public class DetectHomeScreen {
private static List<String> homePackageNamesCache;
public static List<String> homePackageName(Context context){
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
List<ResolveInfo> info = context.getPackageManager().queryIntentActivities(intent, 0);
List<String> homes = new ArrayList<String>(info.size());
for(int i=0; i<info.size(); i++){
homes.add(info.get(i).activityInfo.packageName);
@Krishan14sharma
Krishan14sharma / MyLayout.java
Created July 30, 2015 07:32
softkeyboard listner layout
package com.zapbuild.myi.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
public class MyLayout extends LinearLayout {
public MyLayout(Context context, AttributeSet attrs) {
super(context, attrs);
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="400"
android:fromXDelta="100%p"
android:toXDelta="0"
android:interpolator="@android:anim/accelerate_interpolator"
/>
</set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator"
android:zAdjustment="bottom">
<scale
android:duration="@android:integer/config_mediumAnimTime"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%p"
android:pivotY="50%p"
@Krishan14sharma
Krishan14sharma / NotifyingScrollView.java
Created July 3, 2015 05:36
For scrollview listener
package zapbuild.kr.myexperimentwithview.fancytoolbar;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* Created by Krishan on 23/4/15.
@Krishan14sharma
Krishan14sharma / build.gradle
Created April 29, 2015 11:39
common dependencies
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "mvp.dagger.yify.yify"
minSdkVersion 15
@Krishan14sharma
Krishan14sharma / MainActivity2.java
Created April 24, 2015 05:28
Expandable Toolbar
package zapbuild.kr.myexperimentwithview;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import butterknife.ButterKnife;