使用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. C# 1.将整个文件夹复制到目标文件夹中 2.将指定文件复制到指定目标文件夹中

    ].Items.Clear(); string filePath = Application.StartupPath; string sourcePath = Path.Combine(filePat ...

  2. [Intermediate Algorithm] - Spinal Tap Case

    题目 将字符串转换为 spinal case.Spinal case 是 all-lowercase-words-joined-by-dashes 这种形式的,也就是以连字符连接所有小写单词. 提示 ...

  3. SourceInsight使用入门与技巧(转)

    1 sourceinsight screen font 的默认字体是Verdana的,它是一直变宽字体.在Document style中可以将字体改为定宽的Courier 2   document o ...

  4. Day 10 函数

    函数 1.什么是函数? 函数就是具备某一功能的工具,事先将工具准备好就是函数的定义,遇到应用场景拿来就用就是函数的调用 2.为何用函数? 如果不使用函数,写程序会遇到这三个问题 1.程序冗长 2.程序 ...

  5. Java 习惯用法总结

    转自:http://www.importnew.com/15605.html 首页 所有文章 资讯 Web 架构 基础技术 书籍 教程 我要投稿 更多频道 » Java 习惯用法总结 2015/04/ ...

  6. python第四周:装饰器、迭代器、内置方法、数据序列化

    1.装饰器 定义:本质是一个函数,(装饰其他函数)就是为其他函数添加附加功能 原则:不能修改被装饰函数的源代码,不能修改被装饰函数的调用方式 实现装饰器的知识储备: 函数即“变量”.每当定义一个函数时 ...

  7. j2ee消息中间件

    http://blog.csdn.net/apanious/article/details/51014396

  8. centos查看防火墙端口

    #centos7启动防火墙 systemctl start firewalld.service #centos7停止防火墙/关闭防火墙 systemctl stop firewalld.service ...

  9. POJ 2470 Ambiguous permutations(简单题 理解题意)

    [题目简述]:事实上就是依据题目描写叙述:A permutation of the integers 1 to n is an ordering of these integers. So the n ...

  10. UIButton上字体的对齐方式

    设置UIButton上字体的对齐方式,不是用: [Button.titleLabel setTextAlignment:UITextAlignmentCenter]; 而是用: [Button set ...