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 com.leydoo.outsidpprison.utils; | |
import android.annotation.SuppressLint; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Spliterator; | |
public class Arrays{ | |
@SuppressLint("NewApi") public static void main(String[] args) { |
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 SerialManager() {} | |
public static SerialManager getInstance() { | |
if (null == singleTon) { | |
synchronized (SerialManager.class){ | |
if (singleTon == null) { | |
singleTon = new SerialManager(); | |
} | |
} | |
} | |
return singleTon; |
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 int getStatusBarHeight(Context context) { | |
int result = 24; | |
int resId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); | |
if (resId > 0) { | |
result = context.getResources().getDimensionPixelSize(resId); | |
} else { | |
result = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, | |
result, Resources.getSystem().getDisplayMetrics()); | |
} |
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
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
Window window = getWindow(); | |
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | |
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); | |
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); | |
window.setStatusBarColor(getColor(R.color.colorPrimaryDark_main)); | |
} |
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 <T> boolean saveDeviceData(Context context, String key, T device) { | |
if (mSharedPreferences == null) { | |
mSharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE); | |
} | |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
try { //Device为自定义类 | |
// 创建对象输出流,并封装字节流 | |
ObjectOutputStream oos = new ObjectOutputStream(baos); | |
// 将对象写入字节流 | |
oos.writeObject(device); |
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
//Return true if the fragment is currently added to its activity. | |
isAdd(); |
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
//android.support.v4.widget.SwipeRefreshLayout | |
setRefreshing(true),展开刷新动画。 | |
setRefreshing(false),取消刷新动画。 | |
setEnable(true)下拉刷新将不可用。 | |
isRefreshing(); | |
setColorSchemeResources(int... colorResIds);// 进度条颜色 | |
setOnRefreshListener // 设置监听 | |
setProgressBackgroundColorSchemeResource(int colorRes) //进度条背景 |
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
private void rxEditText() { | |
Observable.combineLatest(RxTextView.textChanges(mEditName).map(new Function<CharSequence, String>() { | |
@Override | |
public String apply(CharSequence charSequence) throws Exception { | |
return String.valueOf(charSequence); | |
} | |
}), RxTextView.textChanges(mEditPwd).map(new Function<CharSequence, String>() { | |
@Override | |
public String apply(CharSequence charSequence) throws Exception { | |
return String.valueOf(charSequence); |
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 ExecutorManager { | |
public static final int DEVICE_INFO_UNKNOWN = 0; | |
public static ExecutorService eventExecutor; | |
//private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors(); | |
private static final int CPU_COUNT = ExecutorManager.getCountOfCPU(); | |
private static final int CORE_POOL_SIZE = CPU_COUNT + 1; | |
private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1; | |
private static final int KEEP_ALIVE = 1; | |
private static final BlockingQueue<Runnable> eventPoolWaitQueue = new LinkedBlockingQueue<>(128); | |
private static final ThreadFactory eventThreadFactory = new ThreadFactory() { |
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
<li> <a title="把这个链接拖到你的Chrome收藏夹工具栏中" href='javascript:(function() { | |
function c() { | |
var e = document.createElement("link"); | |
e.setAttribute("type", "text/css"); | |
e.setAttribute("rel", "stylesheet"); | |
e.setAttribute("href", f); | |
e.setAttribute("class", l); | |
document.body.appendChild(e) | |
} |