Skip to content

Instantly share code, notes, and snippets.


Muyangmin Muyangmin

View GitHub Profile
Muyangmin / AndroidManifest.xml
Created Mar 14, 2017 — forked from romannurik/AndroidManifest.xml
Android example of how to programmatically instantiate a View with a custom style.
View AndroidManifest.xml
<manifest ...>
<!-- Make sure your app (or individual activity) uses the
theme with the custom attribute defined. -->
<application android:theme="@style/AppTheme" ...>
Muyangmin /
Created Sep 7, 2016
A sample wrapper class for usage of log libray.
package org.mym.prettylog.wrapper;
import android.content.Context;
import org.mym.plog.PLog;
import org.mym.plog.config.EasyLogController;
import org.mym.plog.config.PLogConfig;
* <p>
Muyangmin /
Created Jul 6, 2016
detect android device info, MIUI version, etc.
public static boolean isMiUi() {
return !TextUtils.isEmpty(getSystemProperty(""));
public static String getSystemProperty(String propName) {
String line;
BufferedReader input = null;
try {
java.lang.Process p = Runtime.getRuntime().exec("getprop " + propName);
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
Muyangmin /
Last active May 27, 2016
Git log alias
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Now just executegit lg, it looks like this :

Enjoy it!

Muyangmin /
Created May 25, 2016
Android Network Speed Detection
private static boolean isFastMobileNetwork(Context context) {
TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
switch (telephonyManager.getNetworkType()) {
case TelephonyManager.NETWORK_TYPE_1xRTT:
return false; // ~ 50-100 kbps
case TelephonyManager.NETWORK_TYPE_CDMA:
return false; // ~ 14-64 kbps
case TelephonyManager.NETWORK_TYPE_EDGE:
return false; // ~ 50-100 kbps
case TelephonyManager.NETWORK_TYPE_EVDO_0:
You can’t perform that action at this time.