Skip to content

Instantly share code, notes, and snippets.

import { StackNavigator } from 'react-navigation'
import CardStackStyleInterpolator from 'react-navigation/src/views/CardStackStyleInterpolator'
import Home from './scenes/Home'
import Page from './scenes/Page'
const Navigator = StackNavigator({
Home: { screen: Home },
Page: { screen: Page },
}, {
LayoutInflaterCompat.setFactory(LayoutInflater.from(this), new LayoutInflaterFactory() {
@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
AppCompatDelegate delegate = getDelegate();
View view = delegate.createView(parent, name, context, attrs);
if (view != null && (view instanceof TextView)) {
((TextView) view).setTextColor(getResources().getColor(R.color.primary));
}
return view;
@bxbxbai
bxbxbai / QueuedWork.java
Created March 4, 2015 05:33
QueuedWork
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Internal utility class to keep track of process-global work that's
* outstanding and hasn't been finished yet.
*
* This was created for writing SharedPreference edits out
* asynchronously so we'd have a mechanism to wait for the writes in
@bxbxbai
bxbxbai / .gitconfig
Last active August 29, 2015 14:14
gitconfig
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = auto
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ld = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
@bxbxbai
bxbxbai / LayoutInflator.infalte.java
Last active August 29, 2015 14:11
Android sorce code
/**
* Inflate a new view hierarchy from the specified XML node. Throws
* {@link InflateException} if there is an error.
* <p>
* <em><strong>Important</strong></em>&nbsp;&nbsp;&nbsp;For performance
* reasons, view inflation relies heavily on pre-processing of XML files
* that is done at build time. Therefore, it is not currently possible to
* use LayoutInflater with an XmlPullParser over a plain XML file at runtime.
*
* @param parser XML dom node containing the description of the view
@bxbxbai
bxbxbai / StopWatch.java
Last active April 15, 2019 05:57
一个测试代码耗费时间的工具类
package io.bxbxbai.android.examples.utils;
import android.os.SystemClock;
import android.util.Log;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Android应用中的秒表工具,跟踪某段代码的执行时间<br/>