这几天学习到的开源项目

fragmentargs
介绍文章
解决fragment横竖屏切换可能带来的crash,用注解生成Bundle代码,支持继承

IntentBuilder

AutoBundle
fragmentargs 和 AutoBundle 的结合

icepick
一个使用注解就可以完成savedInstanceState的库,支持custom Views

这几天看的文章

深入理解Android(一):Gradle详解

深入理解Android(二):Java虚拟机Dalvik

深入理解Android(三):Xposed详解

从案例学RxAndroid开发(上)

Retrofit中的一些注解总结

注解 描述
@Path 替换URL中的变量
@Query 指定注解参数中的查询变量的键名
@Body POST请求的请求体
@Multipart/@Part 提交多参数表单数据
@FormUrlEncode/@FieldMap 编码的URL键值对
@Streaming 大文件下载避免将整个文件加入内存
1
2
@GET("/users/{username}") 
Call<User> getUser(@Path("username") String username);
1
2
@GET("/group/{id}/users") 
Call<List<User>> groupList(@Path("id") int groupId, @Query("sort") String sort);
1
2
@POST("/users/new") 
Call<User> createUser(@Body User user);
1
2
3
@Multipart 
@POST("/some/endpoint")
Call<SomeResponse> someEndpoint(@Part("name1") String name1, @Part("name2") String name2)
1
2
3
@FormUrlEncoded
@POST("/some/endpoint")
Call<SomeResponse> someEndpoint(@FieldMap Map<String, String> names);
1
2
@POST("/test/rest1.php")
Call<SomeResponse> updatePerson(@Field("name") String name,@Field("age") int age, Callback<Person> callback);
1
2
3
@Streaming
@GET
Call<ResponseBody> downloadFileWithDynamicUrlAsync(@Url String fileUrl);

一系列Retrofit文章
如何从服务器下载文件
链接

position参数指明了给定页面相对于屏幕中心的位置。它是一个动态的属性,会根据用户滑动页面时变化。当一个页面充满屏幕时,它的position值为0。当一个页面被绘制在屏幕的右侧,它的position值为1。如果用户滑到一半,在页面1和页面2之间是,页面1的position值为-0.5,页面2的position值为0.5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public class DepthPageTransformer implements PageTransformer {
private static float MIN_SCALE = 0.75f;

@SuppressLint("NewApi")
@Override
public void transformPage(View view, float position) { //这里的position参数不好理解
int pageWidth = view.getWidth();
if (position < -1) { //[-8,-1]
view.setAlpha(0);
} else if (position <= 0) { //[-1.0]
view.setAlpha(1);
view.setTranslationX(0);
view.setScaleX(1);
view.setScaleY(1);
} else if (position <= 1) { //[0,1]
view.setAlpha(1 - position);
view.setTranslationX(pageWidth * -position);
float scaleFactor = MIN_SCALE + (1 - MIN_SCALE)* (1 - Math.abs(position));
view.setScaleX(scaleFactor);
view.setScaleY(scaleFactor);
} else { //[1,+8]
view.setAlpha(0);

}
}

}

http://android.jobbole.com/80668/