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 ...
随机推荐
- STL编程:C++的忠告!
Copy别人的,有少量修改,可以做为一下参考! C++之父Bjarne Stroustrup 写的 The C++ Programming Language (Special Edition) 中各章 ...
- 01--[转]C++强大背后
[转]C++强大背后 2014-01-22 分类:互联网 阅读(9295) 评论(6) 在31年前(1979年),一名刚获得博士学位的研究员,为了开发一个软件项目发明了一门新编程语言,该研究员名为Bj ...
- Dynamics CRM 使用 Profiler 来做debug
首先,我们需要install Profiler 我们选中一个plugin, 并且选择start Profilling 然后我们选择Persist to Entity 然后我们执行trigger这个pl ...
- Python笔记5----集合set
1.集合的概念:无序不重复 分为可变集合(set())和不可变集合(frozenset)两种 2.创建集合 aset=set('hello') >>aset={'h','e','l','o ...
- ios高效开发二--ARC跟block那点事
block是可以捕捉上下文的特殊代码块. block可以访问定义在block外的变量,当在block中使用时,它就会为其在作用域内的每个标量变量创建一个副本. 如果通过self拥有一个block,然后 ...
- Python学习笔记(3)for循环和while循环
2019-02-25 (1)break语句:终止当前循环,跳出循环体. (2)continue语句:终止本轮循环并开始下一轮循环(在下一轮循环开始前,会先测试循环条件). (3)for循环 ① ran ...
- Python-基础-day3
基础数据类型 1.什么是数据类型? 我们人类可以很容易的分清数字与字符的区别,但是计算机并不能呀,计算机虽然很强大,但从某种角度上看又很傻,除非你明确的告诉它,1是数字,“汉”是文字,否则它是分不清1 ...
- 2019-04-03 Anaconda+VSCode搭建python开发环境,并连接GIthub
1.最好的Python开发环境 :Anaconda+VSCode搭建python开发环境,conda提供了python开发环境和大量的你不用安装的库 conda的环境变量: 直接在conda 中下载启 ...
- JavaScript(DOM编程补充一)
HTML属性的直接调用: 还可以通过getAttribute方法获取属性的值: setAttribute方法: removeAttribute ---------------------------- ...
- https://stackoverflow.com/questions/16130292/java-lang-outofmemoryerror-permgen-space-java-reflection
https://stackoverflow.com/questions/16130292/java-lang-outofmemoryerror-permgen-space-java-reflectio ...