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
<resources> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
<item name="android:scrollbarSize">10.0dip</item><!--very important, in order to show scrollbar properly in android 2.3 and before--> | |
<item name="android:scrollbarThumbVertical">@drawable/scrollbar</item> | |
<item name="android:scrollbarThumbHorizontal">@drawable/scrollbar</item> | |
<item name="android:scrollbarTrackVertical">@null</item> | |
<item name="android:scrollbarTrackHorizontal">@null</item> | |
</style> | |
</resources> |
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
getListView().setDivider(getResources().getDrawable(R.color.list_background)); //must be called first | |
getListView().setDividerHeight(FuncInt.dp(10)); |
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 Singleton { | |
private static Object obj = new Object(); | |
private static Singleton instance = null; | |
private Singleton(){ | |
} | |
public static Singleton getInstance() { | |
// if already inited, no need to get lock everytime |
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 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; | |
} |
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
listView.addHeaderView(headerView); | |
//add adapter and show the header | |
listView.setAdapter(myAdapter); |
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 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) { |
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
//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' |
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 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) { |
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 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; |
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
-optimizationpasses 5 | |
# 混淆时不会产生形形色色的类名 | |
-dontusemixedcaseclassnames | |
# 指定不去忽略非公共的类库 | |
-dontskipnonpubliclibraryclasses | |
# 不预校验 | |
-dontpreverify |
OlderNewer