使用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需要保持一致。

Android使用Dribble Api的更多相关文章

  1. Android SDK之API Level

    Android SDK之API Level Android SDK API_LEVEL Platform Version API Level VERSION_CODE Android 4.2, 4.2 ...

  2. Android 使用Telephony API

    Android 使用Telephony API public class TelephonyDemo extends Activity { TextView textOut; TelephonyMan ...

  3. Android L Camera2 API 使用实例程序汇总

    在网上发现几个使用Camera API2开发的实例程序,总结一下方便后续参考: 1.Camera2 Basic : https://github.com/googlesamples/android-C ...

  4. 申请Android Map 的API Key(v2)的最新申请方式(SHA1密钥)

    申请Android Map 的API Key(v2)的最新申请方式(SHA1密钥)具体步骤如下:                                                     ...

  5. 翻译Android USB HOST API

    翻译Android USB HOST API 源代码地址:http://developer.android.com/guide/topics/connectivity/usb/host.html 译者 ...

  6. Android SDK与API版本的对应关系

    看教程.开发Android程序等很多地方,需要设置Android SDK的版本,而其要我们写的却是API版本的数字, 为了方便查看 Android SDK与API版本的对应关系 我在SDK Manag ...

  7. Android 用 camera2 API 自定义相机

    前言 笔者因为项目需要自定义相机,所以了解了一下 Android 关于 camera 这块的 API.Android SDK 21(LOLLIPOP) 开始已经弃用了之前的 Camera 类,提供了 ...

  8. Android BLE与终端通信(一)——Android Bluetooth基础API以及简单使用获取本地蓝牙名称地址

    Android BLE与终端通信(一)--Android Bluetooth基础API以及简单使用获取本地蓝牙名称地址 Hello,工作需要,也必须开始向BLE方向学习了,公司的核心技术就是BLE终端 ...

  9. React-Native 问题随记2: com.android.builder.testing.api.DeviceException

    错误详细: Execution failed for task ':app:installDebug'.> com.android.builder.testing.api.DeviceExcep ...

随机推荐

  1. trigger事件就是继承某一个类的事件.

    <html><head><script type="text/javascript" src="/jquery/jquery.js" ...

  2. MaterialDesign动画

    一.概述 MaterialDesign设计理念 MaterialDesign动画 二.实例讲解 (1)Touch Feedback (2)Reveal Effect (3)Activity Trans ...

  3. 如何安全使用公共Wifi,防止信息泄露?

    购物中心,机场,餐厅,咖啡馆,图书馆,公共交通,酒店客房均提供免费无线网络连接,这些网络每天被数百万人使用.然而,大多数人没有意识到的是,免费的公共Wi-Fi并不安全.即使需要密码才能登录,这并不一定 ...

  4. 常用shell备份脚本

    #!/bin/sh # File: /路径/mysql/backup_mydb.sh # Database info DB_NAME="szby" DB_USER="ro ...

  5. js中标签字符串的拼接

    //1.用单双引号拼接 var valueDemo = "111"; var htmlStrs1 = '<option selected="selected&quo ...

  6. google spanner

    REF 论文 google spanner spanner 介绍 http://blog.jobbole.com/110262/

  7. Codeforces Round #447 (Div. 2)E. Ralph and Mushrooms

    Ralph is going to collect mushrooms in the Mushroom Forest. There are m directed paths connecting n  ...

  8. spring实现定时任务的两种方式之spring @scheduled注解方式

    1.使用spring的 scheduled使用注解的方式 这种方法的好处是:使用方便,配置少,提高开发效率: 缺点是:如果使用服务器集群部署方式的时候,其自身无法解决定时任务重复执行的问题. 2.首先 ...

  9. VirtualBox安装kali linux过程及安装后无法全屏问题解决方法(2)

    ? 1   安装说完了,现在来看看怎么全屏吧,虚拟机无法全屏跟咸鱼有什么区别... 首先打开vbox,选择设备(Device)选项里面最下面安装增强工具那个选项(insert guest additi ...

  10. spring boot系列--spring security (基于数据库)登录和权限控制

    先说一下AuthConfig.java Spring Security的主要配置文件之一 AuthConfig 1 @Configuration 2 @EnableWebSecurity 3 publ ...