使用Dribble提供的Api获取上面的设计分享

  • 使用了Material Design、SceneTransitionAnimation
  • 使用了Volley Gson

1. 申请Dribble开发者应用

https://dribbble.com/account/applications/new

申请成功之后,就会生成

  • Client ID
  • Client Secret
  • Client Access Token

2. 使用Dribble的Api

还可加page参数获取分页数据

构建类似这样的数据

public class DribbleShot{
@SerializedName("animated")
public Boolean mAnimated;
@SerializedName("attachments_count")
public Long mAttachmentsCount;
@SerializedName("attachments_url")
public String mAttachmentsUrl;
@SerializedName("buckets_count")
public Long mBucketsCount;
@SerializedName("buckets_url")
public String mBucketsUrl;
@SerializedName("comments_count")
public Long mCommentsCount;
@SerializedName("comments_url")
public String mCommentsUrl;
@SerializedName("created_at")
public String mCreatedAt;
@SerializedName("description")
public String mDescription;
@SerializedName("height")
public Long mHeight;
@SerializedName("html_url")
public String mHtmlUrl;
@SerializedName("id")
public Long mId;
@SerializedName("images")
public DribbleShotImages mDribbleShotImages;
@SerializedName("likes_count")
public Long mLikesCount;
@SerializedName("likes_url")
public String mLikesUrl;
@SerializedName("projects_url")
public String mProjectsUrl;
@SerializedName("rebounds_count")
public Long mReboundsCount;
@SerializedName("rebounds_url")
public String mReboundsUrl;
@SerializedName("tags")
public List<String> mTags;
@SerializedName("team")
public DribbleShotTeam mDribbleShotTeam;
@SerializedName("title")
public String mTitle;
@SerializedName("updated_at")
public String mUpdatedAt;
@SerializedName("user")
public DribbleShotUser mDribbleShotUser;
@SerializedName("views_count")
public Long mViewsCount;
@SerializedName("width")
public Long mWidth;
}

使用Volley获取数据,Gson解析

private void getData() {
final String shotUrl = "https://api.dribbble.com/v1/shots?access_token=" + DRIBBLE_Token;
StringRequest request = new StringRequest(Request.Method.GET, shotUrl, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Gson gson = new Gson();
Type type = new TypeToken<ArrayList<DribbleShot>>() {
}.getType();
dribbleShots = gson.fromJson(response, type);
//填充到list
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_SHORT).show();
}
});
RequestQueue queue = Volley.newRequestQueue(context);
queue.add(request);
}

3. Activity View转场动画

  1. 在跳转的Activity使用ActivityOptionsCompat.makeSceneTransitionAnimation()

    Intent intent = new Intent(context, ShotItemActivity.class);
    ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(context, view, "TRASATION_ANIMATION");
    ActivityCompat.startActivity(context, itent, optionsCompat.toBundle());
    • view 为发生转场动画的控件
  2. 在目标Activity使用ViewCompat.setTransitionName()设定转场动画的接收控件

    ViewCompat.setTransitionName(imageView, "TRASATION_ANIMATION");
    • 注意制定的TRANATION_ANIMATION需要保持一致。

最新文章

  1. jqueryAPI使用之选择器
  2. python面相对象进阶
  3. step by step 之餐饮管理系统四(日志模块实现)
  4. AJAX请求和跨域请求详解(原生JS、Jquery)
  5. 百度地图API的调用
  6. 【HDOJ】1180 诡异的楼梯
  7. java加载配置文件
  8. 用数据说话,外贸B2C产品选择(上篇)-热门搜索法
  9. javascript数字验证输入
  10. Java 使用AES/CBC/PKCS7Padding 加解密字符串
  11. Lichee (五岁以下儿童) sysconfig1.fex 配置系统
  12. 基于python的web应用开发-添加关注者
  13. mybatis常见错误
  14. .net core 多租户框架整理
  15. C#开启异步 线程的四种方式
  16. Selenium+Java自动化之如何优雅绕过验证码
  17. markdown 相关零碎知识
  18. 收藏的blog
  19. 三维dp
  20. 1126 Eulerian Path (25 分)

热门文章

  1. ObjecT4:On-line multiple instance learning (MIL)学习
  2. SDL2源代码分析
  3. python tips:文件读取——换行符的问题
  4. 路飞学城Python-Day52
  5. vue自己写了一个div菜单,点击按钮展开,点击其他地方关闭这个div菜单
  6. 将JavaBean对象/List或Set或Map对象转成JSON方式
  7. javascript的带操作符的赋值运算
  8. [洛谷 P2365] 任务安排 (线性dp)
  9. 《黑白团团队》第八次团队作业:Alpha冲刺 第二天
  10. linux_ubuntu 连接xftp