This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void collapse(final View v) { | |
final int initialHeight = v.getMeasuredHeight(); | |
Animation a = new Animation() { | |
@Override | |
protected void applyTransformation(float interpolatedTime, | |
Transformation t) { | |
if (interpolatedTime == 1) { | |
v.setVisibility(View.GONE); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.ref.WeakReference; | |
import java.lang.reflect.Field; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.net.Uri; | |
import android.util.AttributeSet; | |
import android.webkit.WebView; | |
import android.webkit.WebViewClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.zala.model; | |
import android.os.Parcel; | |
import android.os.Parcelable; | |
import android.util.SparseArray; | |
/** | |
* https://gist.github.com/kaushikgopal/9eea148a2188dc58fe37 | |
*/ | |
public class ParcelableSparseArray<T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import retrofit.RestAdapter; | |
/** | |
* Singleton class for Retrofit RestAdapter and API (Retrofit 1.9.0) | |
*/ | |
public class ApiManager { | |
// interface containing HTTP methods as given by Retrofit | |
private static RegionApi regionApi; | |
// static adapter to be used in entire app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# first argument pass the package name of the app | |
#echo $1 | |
# the phone must be rooted for this to work | |
# this will dump the files directly in the location where this script is run | |
# ./pull.sh com.yourpackagename | |
adb shell "su -c 'chmod -R +rwx /data/data/$1;cp -r /data/data/$1/files /sdcard/;exit;'" | |
adb pull /sdcard/files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DbManager { | |
static volatile DbManager singleton = null; | |
private DbManager() { | |
} | |
public static DbManager getInstance() { | |
if (singleton == null) { | |
synchronized (DbManager.class) { | |
if (singleton == null) | |
singleton = new DbManager(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isConnectedToInternet(Context context) { | |
if (isConnectingToInternet(context)) { | |
return isNetworkAvailable(); | |
} | |
return false; | |
} | |
public static boolean isConnectingToInternet(Context context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onPrepareOptionsMenu(Menu menu) { | |
// getMenuInflater().inflate(R.menu.text_menu, menu); | |
getMenuInflater().inflate(R.menu.actionview_menu, menu); | |
// menu.getItem(0).setVisible(false); | |
this.menu = menu; | |
MenuItem shareItem = menu.findItem(R.id.action_share); | |
ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int getStatusBarHeight(){ | |
int result=0;\ | |
int resourceId= getResources().getIdentifier("status_bar_height","dimen","android"); | |
if(resourceId >0) | |
result = getResources().getDimensionPixelSize(resourceId); | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WindowManager windowManager =(WindowManager)getSystemService(Context.WindowService); | |
DisplayMetrics displayMetrics = new DisplayMetrics(); | |
windowManager.getDefaultDisplay().getMetrics(displayMetrics); | |
int screenWidth = displayMetrics.widthPixels; | |
int screenHeight = displayMetrics.heightPixels; |