Skip to content

Instantly share code, notes, and snippets.

class MyCircularQueue {
int size;
int data[];
int start;
int end;
/**
* Initialize your data structure here. Set the size of the queue to be k.
*/
@krishnasajja
krishnasajja / DeviceLocation.java
Created June 11, 2018 19:33
Location manager which can give location and disconnect. Not usable to continuously receive updates
public class DeviceLocation implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient
.OnConnectionFailedListener {
//TODO Resolve the memory leak
private static final DeviceLocation currentLocation = new DeviceLocation();
private static final int PERMISSION_ACCESS_FINE_LOCATION = 1;
public static DeviceLocation getInstance() {
return currentLocation;
}
@krishnasajja
krishnasajja / SomeFragment.java
Created March 26, 2018 15:07
Android Animation cheatsheet
mHeader.setAlpha(1);
Animation animation = AnimationUtils.loadAnimation(getContext(), com.syw.commons.R.anim.left_in);
mAddPhoto.animate().alpha(1).setDuration(500).setInterpolator(new AccelerateInterpolator(2)).start();
mPopularSelectionParent.animate().alpha(1).setDuration(500).setInterpolator(new AccelerateInterpolator(2)).start();
mHeader.startAnimation(animation);
@krishnasajja
krishnasajja / layout_fragment.xml
Created January 31, 2018 22:55
Prevent the Soft Keyboard from Auto showing/focussing to an edit text in a Fragment
Add the below lines to the Parent layout which contains the EditText
android:focusableInTouchMode="true"