Skip to content

Instantly share code, notes, and snippets.

View kyze8439690's full-sized avatar
📱
Working

Yang Hui kyze8439690

📱
Working
View GitHub Profile
@kyze8439690
kyze8439690 / gist:5bafc99a65a0f4298db3
Created January 11, 2014 08:21
thing to do when release
1.debug false
2.sign true
3.test proguard
4.change version code
5.upload new apk to umeng and test update works
6.merge master to release branch
7.upload new apk to appstores
@kyze8439690
kyze8439690 / gist:8eb2da153cd207cd330b
Created July 6, 2014 13:28
run asynctask concurrently on targetSdkVersion 13+
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1) {
task.execute();
} else {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@kyze8439690
kyze8439690 / android.mk
Created August 14, 2014 01:59
Jni android.mk
#Start from here
LOCAL+PATH:= $(call my-dir)
#Module1 definition start
include $(CLEAR_VARS)
LOCAL_MODULE := modulename1
LOCAL_SRC_FILES := modulesource1.c
include $(BUILD_STATIC_LIBRARY)
@kyze8439690
kyze8439690 / CursorAdapter2
Created October 19, 2014 06:07
CursorAdapter used for RecyclerView
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;
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;
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;
@kyze8439690
kyze8439690 / .gitignore
Created March 4, 2015 03:01
android studio project .gitignore file
.gradle
.idea
*.iml
build
gradle*
local.properties
@kyze8439690
kyze8439690 / SelectorImageView.java
Created April 12, 2015 09:33
ImageView that will draw a selector on top of image, support normal drawable and the newest RippleDrawable.
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 / NestedAppBarLayout.java
Created June 24, 2015 03:23
NestedAppBarLayout, make AppBarLayout scrollable in CoordinatorLayout, merge code from NestedScrollView, lots of thing to improve...
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 / FilterIntentChooser.java
Created October 14, 2015 06:53
FilterIntentChooser
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);