Skip to content

Instantly share code, notes, and snippets.

📱
Working

Yang Hui kyze8439690

📱
Working
Block or report user

Report or block kyze8439690

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:ed3792203b81e201380aae4e70386222
GetObjectClass -> DeleteLocalRef
FindClass -> DeleteLocalRef
NewString -> DeleteLocalRef
NewStringUTF -> DeleteLocalRef
NewObject -> DeleteLocalRef
NewBooleanArray -> DeleteLocalRef
NewByteArray -> DeleteLocalRef
NewCharArray -> DeleteLocalRef
NewShortArray -> DeleteLocalRef
NewIntArray -> DeleteLocalRef
@kyze8439690
kyze8439690 / PermissionUtils
Created Feb 3, 2016
android 6.0 request permission callback pattern
View PermissionUtils
import android.app.Activity;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.app.ActivityCompat;
import java.util.Map;
@kyze8439690
kyze8439690 / ActivityLifecycleLogger.java
Last active Jan 12, 2016
Activity Lifecycle Logger, not support onActivityResult()
View ActivityLifecycleLogger.java
//call if(BuildConfig.DEBUG) registerActivityLifecycleCallbacks(new ActivityLifecycleLogger()) in your own Application class.
public class ActivityLifecycleLogger implements Application.ActivityLifecycleCallbacks {
private static final String TAG = "LifeCycleLogger";
private static final Class[] LOG_CYCLE_ACTIVITIES = new Class[] {
//add activities you want to log here
MainActivity.class
};
View FilterIntentChooser.java
Intent[] targetedShareIntents = new Intent[infos.size()];
for (int i = 0; i < infos.size(); i++) {
String packageName = infos.get(i).activityInfo.packageName;
Intent targetedShareIntent = new Intent(Intent.ACTION_VIEW, uri);
targetedShareIntent.setPackage(packageName);
targetedShareIntents[i] = targetedShareIntent;
}
Intent chooserIntent = Intent.createChooser(new Intent(), "打开网页");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents);
@kyze8439690
kyze8439690 / NestedAppBarLayout.java
Created Jun 24, 2015
NestedAppBarLayout, make AppBarLayout scrollable in CoordinatorLayout, merge code from NestedScrollView, lots of thing to improve...
View NestedAppBarLayout.java
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.design.widget.AppBarLayout;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.support.v4.view.VelocityTrackerCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ScrollerCompat;
import android.util.AttributeSet;
@kyze8439690
kyze8439690 / SelectorImageView.java
Created Apr 12, 2015
ImageView that will draw a selector on top of image, support normal drawable and the newest RippleDrawable.
View SelectorImageView.java
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.widget.ImageView;
import me.yugy.app.timeline.R;
@kyze8439690
kyze8439690 / .gitignore
Created Mar 4, 2015
android studio project .gitignore file
View .gitignore
.gradle
.idea
*.iml
build
gradle*
local.properties
View StackPageTransformer.java
import android.support.v4.view.ViewPager;
import android.view.View;
public class StackPageTransformer implements ViewPager.PageTransformer {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void transformPage(View page, float position) {
final float alpha;
final float translationX;
View GridFragment.java
package android.support.v4.app;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
@kyze8439690
kyze8439690 / CursorAdapter2
Created Oct 19, 2014
CursorAdapter used for RecyclerView
View CursorAdapter2
package me.yugy.cnbeta.widget;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DataSetObservable;
import android.database.DataSetObserver;
import android.os.Handler;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
You can’t perform that action at this time.