This file contains hidden or 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
| //Credits Tomohiko Sakamoto's Algorithm : https://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week | |
| //to find the day of week from any given date. | |
| int dow(int y, int m, int d) { | |
| static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; | |
| y -= m < 3; | |
| return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7; | |
| } | |
This file contains hidden or 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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or 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
| RotateAnimation anim = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); | |
| //Setup anim with desired properties | |
| anim.setInterpolator(new LinearInterpolator()); | |
| anim.setRepeatCount(Animation.INFINITE); //Repeat animation indefinitely | |
| anim.setDuration(300); | |
| // imgView.setAnimation(anim); |
This file contains hidden or 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
| // Animate a text view | |
| TextView myText = (TextView) findViewById(R.id.textView1); | |
| myText = (TextView)Utils.makeMeBlink(myText,250,20); | |
| // Animate an image view | |
| ImageView imageView = (ImageView) findViewById(R.id.imageView); | |
| imageView = (ImageView)Utils.makeMeBlink(imageView,250,20); | |
This file contains hidden or 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 android.content.res.AssetManager; | |
| import android.graphics.Rect; | |
| import android.util.SparseArray; | |
| import com.google.android.gms.maps.model.Tile; | |
| import com.google.android.gms.maps.model.TileProvider; | |
| import java.io.ByteArrayOutputStream; |
This file contains hidden or 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 android.util.Log; | |
| import org.json.JSONArray; | |
| import org.json.JSONException; | |
| import org.json.JSONObject; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; |
This file contains hidden or 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
| private static final String TAG = "GateMe"; | |
| private static final int BUFFER_SIZE = 0x1000; | |
| public static String formatDateString(String dateString) { | |
| SimpleDateFormat inFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); //2011-08-08 20:00:00, 2013-10-20T19:00:00Z | |
| Date date = null; |
This file contains hidden or 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 android.app.AlarmManager; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.location.Criteria; | |
| import android.location.Location; | |
| import android.location.LocationListener; | |
| import android.location.LocationManager; | |
| import android.os.Bundle; |
This file contains hidden or 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
| private final static int SECONDS = 1; | |
| private final static int MINUTES = 60 * SECONDS; | |
| private final static int HOURS = 60 * MINUTES; | |
| private final static int DAYS = 24 * HOURS; | |
| private final static int WEEKS = 7 * DAYS; | |
| private final static int MONTHS = 4 * WEEKS; | |
| private final static int YEARS = 12 * MONTHS; | |
| /** |
This file contains hidden or 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 android.content.Context; | |
| import android.util.AttributeSet; | |
| import android.widget.Checkable; | |
| import android.widget.CompoundButton.OnCheckedChangeListener; | |
| import android.widget.RelativeLayout; | |
| /** | |
| * A special variation of RelativeLayout that can be used as a checkable object. | |
| * This allows it to be used as the top-level view of a list view item, which |
NewerOlder