Android使用Dribble Api
使用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转场动画
在跳转的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 为发生转场动画的控件
在目标Activity使用
ViewCompat.setTransitionName()设定转场动画的接收控件ViewCompat.setTransitionName(imageView, "TRASATION_ANIMATION");
- 注意制定的
TRANATION_ANIMATION需要保持一致。
- 注意制定的
Android使用Dribble Api的更多相关文章
- Android SDK之API Level
Android SDK之API Level Android SDK API_LEVEL Platform Version API Level VERSION_CODE Android 4.2, 4.2 ...
- Android 使用Telephony API
Android 使用Telephony API public class TelephonyDemo extends Activity { TextView textOut; TelephonyMan ...
- Android L Camera2 API 使用实例程序汇总
在网上发现几个使用Camera API2开发的实例程序,总结一下方便后续参考: 1.Camera2 Basic : https://github.com/googlesamples/android-C ...
- 申请Android Map 的API Key(v2)的最新申请方式(SHA1密钥)
申请Android Map 的API Key(v2)的最新申请方式(SHA1密钥)具体步骤如下: ...
- 翻译Android USB HOST API
翻译Android USB HOST API 源代码地址:http://developer.android.com/guide/topics/connectivity/usb/host.html 译者 ...
- Android SDK与API版本的对应关系
看教程.开发Android程序等很多地方,需要设置Android SDK的版本,而其要我们写的却是API版本的数字, 为了方便查看 Android SDK与API版本的对应关系 我在SDK Manag ...
- Android 用 camera2 API 自定义相机
前言 笔者因为项目需要自定义相机,所以了解了一下 Android 关于 camera 这块的 API.Android SDK 21(LOLLIPOP) 开始已经弃用了之前的 Camera 类,提供了 ...
- Android BLE与终端通信(一)——Android Bluetooth基础API以及简单使用获取本地蓝牙名称地址
Android BLE与终端通信(一)--Android Bluetooth基础API以及简单使用获取本地蓝牙名称地址 Hello,工作需要,也必须开始向BLE方向学习了,公司的核心技术就是BLE终端 ...
- React-Native 问题随记2: com.android.builder.testing.api.DeviceException
错误详细: Execution failed for task ':app:installDebug'.> com.android.builder.testing.api.DeviceExcep ...
随机推荐
- Computer Vision的尴尬
原文: Computer Vision是AI的一个非常活跃的领域,每年大会小会不断,发表的文章数以千计(单是CVPR每年就录取300多,各种二流会议每年的文章更可谓不计其数),新模型新算法新应用层出不 ...
- 实验6 Bezier曲线生成
1.实验目的: 了解曲线的生成原理,掌握几种常见的曲线生成算法,利用VC+OpenGL实现Bezier曲线生成算法. 2.实验内容: (1) 结合示范代码了解曲线生成原理与算法实现,尤其是Bezier ...
- 超酷消息警告框插件(SweetAlert)
今天给大家推荐一款不错的超酷消息警告框–SweetAlert:SweetAlert是一款不需要jQuery支持的原生js提示框,风格类似bootstrap.它的提示框不仅美丽动人,并且允许自定义,支持 ...
- C#模拟按键
try { System.Threading.Thread.Sleep(); ; i < ; i++) { SendKeys.SendWait("{ENTER}"); Sen ...
- C# 分割URL地址
public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_C ...
- java 常用API 包装
package com.oracel.demo01; public class Baozhuang { //将字符串转成基本数据类型 public static void main(String[] ...
- 理解Faster-RCNN 中的Anchor
先上图看一下Faster R-CNN操作流程: 图片说明:Faster R-CNN=Fast R-CNN+RPN,其中Fast R-CNN结构不变:RPN负责生成proposals,配合最后一层的f ...
- 序列模型(5)-----双向神经网络(BRNN)和深层循环神经网络(Deep RNN)
一.双向循环神经网络BRNN 采用BRNN原因: 双向RNN,即可以从过去的时间点获取记忆,又可以从未来的时间点获取信息.为什么要获取未来的信息呢? 判断下面句子中Teddy是否是人名,如果只从前面两 ...
- 1520dc更新与NUll语句用法
update dbo.dc_出租信息set 出租类型 = 1where 出租类型='普通楼上房' update dbo.dc_出租信息set 朝向 = 5where 朝向 is NULL
- jquery bind 传参数
方法一. ? 1 2 3 4 function GetCode(event) { alert(event.data.foo); } ? 1 2 3 4 $(document).ready(functi ...