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 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 / gist:8eb2da153cd207cd330b
Created Jul 6, 2014
run asynctask concurrently on targetSdkVersion 13+
View gist:8eb2da153cd207cd330b
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1) {
task.execute();
} else {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
View gist:5bafc99a65a0f4298db3
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
View proguard-rules.txt
-optimizationpasses 5
# 混淆时不会产生形形色色的类名
-dontusemixedcaseclassnames
# 指定不去忽略非公共的类库
-dontskipnonpubliclibraryclasses
# 不预校验
-dontpreverify
@kyze8439690
kyze8439690 / ListViewOnScrollListener.java
Created Dec 26, 2013
OnScrollListener to detect scrollup and scrolldown in ListView.
View ListViewOnScrollListener.java
public class ListViewOnScrollListener extends OnScrollListener{
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {}
private int lastVisibleItem = 0;
private int lastY = 0;
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
int top = 0;
@kyze8439690
kyze8439690 / SquareRelativeLayout.java
Created Nov 30, 2013
A custom RelativeLayout which will auto match its height to its width
View SquareRelativeLayout.java
public class SquareRelativeLayout extends RelativeLayout{
public SquareRelativeLayout(Context context) {
super(context);
}
public SquareRelativeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
@kyze8439690
kyze8439690 / build.gradle
Last active Jan 19, 2017
Use build.gradle to compile all jars in libs folder and ndk support
View build.gradle
//compile all jar in libs folder
dependencies {
compile fileTree(dir: 'libs' , include: '*.jar')
}
//pack all so file into a jar and compile it
task nativeLibsToJar(
type: Zip,
description: 'create a jar archive of the native libs') {
destinationDir file('./libs')
baseName 'native-libs'
View ExpandedGridView.java
public class ExpandedGridView extends GridView{
public ExpandedGridView(Context context) {
super(context);
}
public ExpandedGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ExpandedGridView(Context context, AttributeSet attrs, int defStyle) {
@kyze8439690
kyze8439690 / addHeaderView.java
Created Nov 22, 2013
ListView do not show header view until you add an adapter to it
View addHeaderView.java
listView.addHeaderView(headerView);
//add adapter and show the header
listView.setAdapter(myAdapter);
@kyze8439690
kyze8439690 / convertBitmap.java
Created Nov 11, 2013
fix android 2.3 can't decode bitmap in rgba8888 format
View convertBitmap.java
public static Bitmap convert(Bitmap bitmap, Bitmap.Config config) {
Bitmap convertedBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), config);
Canvas canvas = new Canvas(convertedBitmap);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
canvas.drawBitmap(bitmap, 0, 0, paint);
return convertedBitmap;
}
You can’t perform that action at this time.