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
比喻很形象 | |
Please note that the methods in Listing 1-10 are internal methods and are not part of the | |
public API, so they may change with newer releases. However, the underlying protocol would remain | |
the same. | |
In Listing 1-10, it is easier to first tell what forceLayout( ) is. It is like a touch command in build | |
environments. Usually when a file hasn’t changed, the build dependencies will ignore it. So, you | |
force that file to be compiled by “touch”ing, and thereby updating its time stamp. Just like touch, | |
the forceLayout( ) will not invoke any build commands by itself (unless your build environment is too |
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
*.iml | |
# generated files | |
bin/ | |
gen/ | |
# Ignore gradle files | |
.gradle | |
build/ |
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
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. | |
To use the support version of these attributes, remove the android namespace. | |
For instance, "android:colorControlNormal" becomes "colorControlNormal". | |
These attributes will be propagated to their corresponding attributes within the android namespace | |
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix. | |
All Clickable Views: | |
----------- |
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 abstract class BaseFragment extends Fragment { | |
static final String STATE = "saved_state"; | |
Bundle mSavedState; | |
public BaseFragment() {} | |
public abstract void refreshData(); | |
protected void showSoftKeyboard(View editText) { |
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 Bitmap blendRenderScript(RenderScript rs, Bitmap originalBitmap) { | |
// Creates a matching Renderscript allocation object and | |
// copies the contents of the bitmap into the allocation | |
Allocation input = Allocation.createFromBitmap(rs, originalBitmap, | |
Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); | |
// Generates an Allocation identical in structure to the first | |
Allocation output = Allocation.createTyped(rs, input.getType()); |
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 abstract class CursorPagerAdapter extends PagerAdapter { | |
public static final String TAG = CursorPagerAdapter.class.getSimpleName(); | |
protected WeakReference<Context> ctxRef; | |
protected boolean mDataValid; | |
protected boolean mAutoRequery; | |
protected Cursor mCursor; | |
protected int mRowIDColumn; |
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 abstract class AbstractCursorRecyclerAdapter<VH extends RecyclerView.ViewHolder> | |
extends RecyclerView.Adapter<VH> { | |
protected Context mContext; | |
protected Cursor mCursor; | |
protected boolean mDataValid; | |
protected int mRowIDColumn; | |
protected ChangeObserver mChangeObserver; |
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 setupView() { | |
mViewStateIndicator.setImageResource(mIsRevealed | |
? R.drawable.revealed | |
: R.drawable.not_revealed); | |
int hideTranslateY = -mToBeRevealedViewContainer.getHeight() / 4; // last 25% of animation | |
if (mIsRevealed && mToBeRevealedViewContainer.getTranslationY() == 0) { | |
// initial setup | |
mToBeRevealedViewContainer.setAlpha(0); | |
mToBeRevealedViewContainer.setTranslationY(hideTranslateY); | |
} |