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"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | |
<!-- Drop Shadow Stack --> | |
<item> | |
<shape> | |
<padding | |
android:bottom="1dp" | |
android:left="1dp" | |
android:right="1dp" |
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
/* | |
* Copyright (C) 2012 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 HexUtils{ | |
pulbic static String convertToHex(byte[] data) { | |
StringBuffer buf = new StringBuffer(); | |
for (int i = 0; i < data.length; i++) { | |
int halfbyte = (data[i] >>> 4) & 0x0F; | |
int two_halfs = 0; | |
do { | |
if ((0 <= halfbyte) && (halfbyte <= 9)) | |
buf.append((char) ('0' + halfbyte)); | |
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
public class ConnectDotsView extends View { | |
private Bitmap mBitmap; | |
private Canvas mCanvas; | |
private Path mPath; | |
private Paint mPaint; | |
private static final int TOUCH_TOLERANCE_DP = 24; | |
private static final int BACKGROUND = 0xFFDDDDDD; | |
private List<Point> mPoints = new ArrayList<Point>(); | |
private int mLastPointIndex = 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
import numpy | |
import matplotlib.pyplot as plt | |
def interpolateCatmulRomeSegment(P0, P1, P2, P3, nPoints=10): | |
""" | |
P0, P1, P2, and P3 should be (x,y) point pairs that define the Catmull-Rom spline. | |
nPoints is the number of points to include in this curve segment. | |
""" | |
# Convert the points to numpy so that we can do array multiplication | |
P0, P1, P2, P3 = map(numpy.array, [P0, P1, P2, P3]) |
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 TimePickerDialogFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener { | |
private static final String DIALOG_HOUR = "my.package:INITIAL_HOUR"; | |
private static final String DIALOG_MINUTE = "my.package:INITIAL_MINUTE"; | |
//My custom listener | |
private OnTimePickedListener mListener; | |
private int mDialogRequestCode; | |
//Use dialogRequestCode to discriminate dialogs in OnTimePickedListener#onTimePicked method. I think you could also use dialog tag string instead of integer variable. | |
public static TimePickerDialogFragment newInstance(int hour, int minute, int dialogRequestCode, OnTimePickedListener 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
package lecho.lib.hellocharts.renderer; | |
import lecho.lib.hellocharts.util.CasteljauComputator; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.PointF; | |
/** | |
* PathCompat uses Canvas.drawLines instead Canvas.drawPath. Supports normal lines and cubic Bezier's lines. | |
* Warning!: doesn't support breaks in line so line has to be continuous and doesn't support area chart. |
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
TextView textView = new TextView(this); | |
textView.setEllipsize(TruncateAt.MARQUEE); | |
textView.setFocusableInTouchMode(true); | |
textView.setFreezesText(true); | |
textView.setSingleLine(true); | |
textView.setMarqueeRepeatLimit(-1); | |
textView.setFocusable(true); | |
textView.setSelected(true); | |
textView.setText("Sooooooooooooooome Loooooooooooooooooooooooong Teeeeeeeeeeeeeeeeeeeeeeeeeeext"); |
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 void onPageSelected(int position) { | |
actionBar.setSelectedNavigationItem(position); | |
selectInSpinnerIfPresent(position, true); | |
} | |
/** |
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 android.content.Context; | |
import android.database.Cursor; | |
import android.support.v4.content.AsyncTaskLoader; | |
public abstract class SimpleCursorLoader extends AsyncTaskLoader<Cursor> { | |
private Cursor mCursor; | |
public SimpleCursorLoader(Context context) { | |
super(context); | |
} |
NewerOlder