- jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
- Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
- AngularJS - Conventions based MVC framework for HTML5 apps.
- Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
- lawnchair - Key/value store adapter for indexdb, localStorage
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
public class IconCounterUtils { | |
public static void setCounterValue(Context mContext, LayerDrawable icon, int count) { | |
CounterDrawable mCounterDrawable; | |
Drawable reuse = icon.findDrawableByLayerId(R.id.ic_counter); | |
if (reuse != null && reuse instanceof CounterDrawable) { | |
mCounterDrawable = (CounterDrawable) reuse; | |
} else { | |
mCounterDrawable = new CounterDrawable(mContext); | |
} |
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
public class AppTextView extends TextView { | |
public Paint paint; | |
public boolean addStrike = false; | |
public AppTextView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
if (!isInEditMode()) init(attrs); | |
} |
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
/** | |
* Tries to acquire a partial wake lock if not already acquired. Logs errors | |
* and gives up trying in case the wake lock cannot be acquired. | |
*/ | |
/** | |
* Acquire a wake lock if not already acquired. | |
* | |
* @param context the context | |
* @param wakeLock wake lock or 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
public class CustomViewPager extends ViewPager { | |
float mStartDragX; | |
OnSwipeOutListener mOnSwipeOutListener; | |
public CustomViewPager(Context context) { | |
super(context); | |
} | |
public CustomViewPager(Context context, AttributeSet attrs) { |
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
package com.hashlearn.common.utils; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.Rect; | |
import android.graphics.drawable.Drawable; | |
import android.text.style.DynamicDrawableSpan; | |
import java.lang.ref.WeakReference; |
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
/* | |
This method will create a spannable which is a displayable styled text. It | |
also has a custom ImageGetter based on Picasso for loading <img> tags inside the html. | |
We use this for rendering formulas in challenges | |
*/ | |
public static Spannable getSpannableHtmlWithImageGetter(AppTextView view, String value) { | |
PicassoImageGetter imageGetter = new PicassoImageGetter(view); | |
Spannable html; | |
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { |
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
public class PicassoImageGetter implements Html.ImageGetter { | |
private AppTextView textView = null; | |
public PicassoImageGetter() { | |
} | |
public PicassoImageGetter(AppTextView target) { | |
textView = target; |
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 |