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
#! /bin/zsh | |
# Buttery powered state | |
adb shell dumpsys battery | grep powered | |
# Unplug battery | |
adb shell dumpsys battery unplug | |
# Reset battery | |
adb shell dumpsys battery reset |
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 SpinnerCommon<T> { | |
public Spinner mSpinner; | |
public SpinnerAdapter<T> mAdapter; | |
public SpinnerCommon(Spinner spinner) { | |
this(spinner, new ArrayList<T>(), new SpinnerAdapter<T>() { | |
}, false, android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_dropdown_item); | |
} | |
public SpinnerCommon(Spinner spinner, List<T> objects) { |
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
final int bgColor = getResources().getColor(R.color.colorPrimary); | |
ImageLoader.getInstance().displayImage(user.getImageUrl(), header, new SimpleImageLoadingListener() { | |
@Override | |
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { | |
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { | |
Palette.from(loadedImage).generate(new PaletteAsyncListener() { | |
@SuppressLint("NewApi") | |
@Override |
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
buildscript { | |
dependencies { | |
classpath "io.realm:realm-gradle-plugin:0.88.3" | |
} | |
} | |
apply plugin: 'realm-android' | |
compile 'com.jakewharton:butterknife:7.0.1' | |
compile 'com.squareup.retrofit2:retrofit:2.0.1' |
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
@Parcel(implementations = { CountryRealmProxy.class }, | |
value = Parcel.Serialization.FIELD, | |
analyze = { Country.class }) | |
public class Country extends RealmObject { | |
@ParcelPropertyConverter(RealmListParcelConverter.class) | |
public RealmList<RealmString> languages; | |
} | |
public class RealmListParcelConverter | |
implements TypeRangeParcelConverter<RealmList<? extends RealmObject>, |
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 S { | |
public static final String TAG = "DBG"; | |
public static void L(Context c, Object o) { | |
String txt = o.toString(); | |
Toast.makeText(c, txt, Toast.LENGTH_LONG).show(); | |
Log.d(TAG, txt); | |
} | |
public static void L(String s, Object... args) { |
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 Recycler<T, VH extends RecyclerViewHolder> { | |
public RecyclerView mRecyclerView; | |
public RecyclerAdapter<T, VH> mAdapter; | |
public LinearLayoutManager mLinearLayoutManager; | |
public Recycler(RecyclerView recyclerView, int layoutItemResId, RecyclerAdapter<T, VH> adapter, boolean divider, boolean vertical) { | |
mRecyclerView = recyclerView; | |
Context context = mRecyclerView.getContext(); | |
if (vertical) { | |
mLinearLayoutManager = new LinearLayoutManager(context); |
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
String[] texts = {"sometext 1", "sometext 2", "sometext 3"}; | |
ArrayList<Map<String, Object>> data = new ArrayList<Map<String, Object>>(texts.length); | |
Map<String, Object> m; | |
for (int i = 0; i < texts.length; i++) { | |
m = new HashMap<String, Object>(); | |
m.put("TEXT", texts[i]); | |
data.add(m); | |
} |
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 RankedMostPlayedAdapter extends BaseAdapter { | |
private LayoutInflater mInflater; | |
private List<StatsRanked> mStatsRanked; | |
private AQuery aq; | |
public RankedMostPlayedAdapter(Context context, List<StatsRanked> mStatsRanked) { | |
this.mStatsRanked = mStatsRanked; | |
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
aq = new AQuery(context); |