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 TextViewWithImages extends TextView { | |
private static final String DRAWABLE = "drawable"; | |
/** | |
* Regex pattern that looks for embedded images of the format: [img src=imageName/] | |
*/ | |
public static final String PATTERN = "\\Q[img src=\\E([a-zA-Z0-9_]+?)\\Q/]\\E"; | |
public TextViewWithImages(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); |
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
// 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 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 toGrayScale(Bitmap bmpOriginal) { | |
int width, height; | |
height = bmpOriginal.getHeight(); | |
width = bmpOriginal.getWidth(); | |
Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); | |
Canvas c = new Canvas(bmpGrayscale); | |
Paint paint = new Paint(); | |
ColorMatrix cm = new ColorMatrix(); |
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"?> | |
<resources> | |
<color name="red_50">#fde0dc</color> | |
<color name="red_100">#f9bdbb</color> | |
<color name="red_200">#f69988</color> | |
<color name="red_300">#f36c60</color> | |
<color name="red_400">#e84e40</color> | |
<color name="red_500">#e51c23</color> |
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 MyApplication extends Application { | |
private static MyApplication singleton; | |
// Returns the application instance | |
public static MyApplication getInstance() { | |
return singleton; | |
} | |
//Called when the application is created. Override this method to initialize your |
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 MyStateChangeActivity extends Activity { | |
// Called at the start of the full lifetime. | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
// Initialize Activity and inflate the UI. | |
} | |
// Called after onCreate has finished, use to restore UI state |
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 MySkeletonFragment extends Fragment { | |
// Called when the Fragment is attached to its parent Activity. | |
@Override | |
public void onAttach(Activity activity) { | |
super.onAttach(activity); | |
// Get a reference to the parent Activity. | |
} | |
// Called to do the initial creation of the Fragment. |
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
// Create the Array List of to do items | |
final ArrayList<String> todoItems = new ArrayList<String>(); | |
// Create the Array Adapter to bind the array to the List View | |
// ArrayAdapter(Context context, int textViewResourceId, List<T> objects) | |
final ArrayAdapter<String> aa; | |
aa = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, todoItems); | |
// Bind the Array Adapter to the List View | |
myListView.setAdapter(aa); |