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 Bitmap getScreenshotFromRecyclerView(RecyclerView view) { | |
RecyclerView.Adapter adapter = view.getAdapter(); | |
Bitmap bigBitmap = null; | |
if (adapter != null) { | |
int size = adapter.getItemCount(); | |
int height = 0; | |
Paint paint = new Paint(); | |
int iHeight = 0; | |
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); |
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
/** | |
* Created: chiemy | |
* Date: 16/11/22 | |
* Description: 可控制显示时长, 可点击的Toast | |
*/ | |
public class ExtendToast { | |
public static final int LENGTH_ALWAYS = 0; | |
public static final int LENGTH_SHORT = 2; | |
private Toast toast; |
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
import android.support.v4.app.Fragment; | |
import android.support.v4.view.ViewPager; | |
/** | |
* Created: chiemy | |
* Date: 17/1/4 | |
* Description: 为解决 ViewPager 内 Fragment 嵌套 ViewPager, setUserVisibleHint 方法不准确的问题的帮助类 | |
*/ | |
public class NestedFragmentHelper implements ViewPager.OnPageChangeListener { |
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 CustomTypefaceSpan extends MetricAffectingSpan { | |
private final Typeface mTypeface; | |
public CustomTypefaceSpan(final Typeface typeface) { | |
this.mTypeface = typeface; | |
} | |
@Override | |
public void updateDrawState(final TextPaint drawState) { | |
apply(drawState); |
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 CustomSpan { | |
private Context mContext; | |
private SpannableStringBuilder mSpannableString; | |
private int mStart; | |
private int mEnd; | |
public CustomSpan(Context context) { | |
mContext = context; | |
mSpannableString = new SpannableStringBuilder(""); | |
} |
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 SnappingLinearLayoutManager extends LinearLayoutManager { | |
private RecyclerView.SmoothScroller smoothScroller; | |
public SnappingLinearLayoutManager(Context context) { | |
super(context, VERTICAL, false); | |
} | |
@Override | |
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, | |
int position) { |
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 boolean dispatchTouchEvent(MotionEvent ev) { | |
final int action = ev.getAction(); | |
final float xf = ev.getX(); | |
final float yf = ev.getY(); | |
final float scrolledXFloat = xf + mScrollX; | |
final float scrolledYFloat = yf + mScrollY; | |
final Rect frame = mTempRect; | |
boolean disallowIntercept = (mGroupFlags & FLAG_DISALLOW_INTERCEPT) != 0; | |
if (action == MotionEvent.ACTION_DOWN) { | |
if (mMotionTarget != null) { |
OlderNewer