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
{ "activities": | |
[ | |
{ | |
"id": 1, | |
"stream_id": "a5141e80-d285-11e4-b78b-0a0469cc7060", | |
"verb": "rsvp", | |
"category": "friends", | |
"description": "is going to", | |
"is_liked": false, | |
"like_count": 0, |
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 final int NEW = 0; | |
public static final int REMOVED = 1; | |
public static final int CHANGED = 2; | |
public static HashMap<Integer, ArrayList<Integer>> calculateAdapterChanges(ArrayList<Object> oldData, ArrayList<Object> newData) { | |
HashMap<Integer, ArrayList<Integer>> map = new HashMap<>(); | |
ArrayList<Integer> newItems = new ArrayList<>(); | |
ArrayList<Integer> removedItems = new ArrayList<>(); | |
ArrayList<Integer> changedItems = new ArrayList<>(); |
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 BitVolleyRequester<T extends ApiResponse> extends AbsVolleyRequester { | |
private static final String AUTHORIZATION_KEY = "Authorization"; | |
private static final String AUTHORIZATION_VALUE_FORMAT = "Token token=%s, auth_method=%s, auth_login=%s"; | |
protected Class<T> mClass; | |
public BitVolleyRequester(Context context, Class<T> theClass) { | |
super(context); | |
mClass = theClass; |
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 abstract class AbsVolleyRequester<T> { | |
protected Context mContext; | |
public AbsVolleyRequester(Context context) { | |
mContext = context.getApplicationContext(); //To avoid leaks | |
// HttpsTrustManager.allowAllSSL(); //TODO implement for https? | |
} | |
public void makeGetRequest(BaseActivity activity, String url, final VolleyRequestListener<T> listener) { |
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 abstract class AbsClass<T> { | |
protected abstract void doSomething(X<T> special); | |
} | |
public class MyClass<T extends Y> extends AbsClass { | |
@Override | |
protected void doSomething(X<T> special) { |
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
{ | |
"artists": { | |
"tracked": [ … ], | |
"untracked": [ … ], | |
"blocked": [ ] | |
}, | |
"events": { | |
"going": [ … ], | |
"maybe": [ … ], | |
"declined": [ ] |
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
//If the origin is behind the popup, | |
if(popupBounds.contains(origin.x, origin.y)) { | |
pivotX = origin.x - popupBounds.left; | |
pivotY = origin.y - popupBounds.top; | |
} | |
else { | |
//If X is not the problem, treat it normally, else either make the pivot point negative or bigger than the view | |
if(popupBounds.left <= origin.x && origin.x <= popupBounds.right) | |
pivotX = origin.x - popupBounds.left; | |
else if(origin.x < popupBounds.left) |
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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<include | |
android:id="@+id/activity_toolbar" | |
layout="@layout/widget_toolbar"/> | |
<android.support.v7.widget.RecyclerView |
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 Bitmap getCloudPopupImage(Context context, Bitmap bitmap) { | |
// float cornerRadius = context.getResources().getDimension(R.dimen.cloud_popup_corner_radius); //this value was 4dp | |
int smallerDimen = Math.min(bitmap.getWidth(), bitmap.getHeight()); | |
int xDiff = Math.max((bitmap.getWidth() - smallerDimen) / 2, 0); | |
int cornerRadius = 90;//Math.max(90, smallerDimen / 2); | |
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); | |
Canvas canvas = new Canvas(output); | |
int color = 0xff424242; |
NewerOlder