使用Retrofit和Rxjava实现列表刷新

本文介绍了如何结合Retrofit和Rxjava来实现列表数据的刷新功能。涉及的文件包括build.gradle, config.gradle, activity_piece, item_duanzi等,并详细列出了各组件如Contract, Presenter, Adapter, Base类以及Http相关组件如Api, Service和Interceptor的使用。" 133464919,19987386,AutoJs实现蚂蚁森林能量自动收集,"['JavaScript', '开发语言', '自动化工具', '支付宝应用', '移动开发']
摘要由CSDN通过智能技术生成

使用的依赖和权限

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!--<uses-permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS"/>-->
<uses-permission android:name="android.permission.INTERNET"/>
implementation rootProject.ext.dependencies["appcompat-v7"]
implementation rootProject.ext.dependencies["constraint-layout"]
implementation rootProject.ext.dependencies["retrofit2"]
implementation rootProject.ext.dependencies["converter-gson"]
implementation rootProject.ext.dependencies["rxjava2"]
implementation rootProject.ext.dependencies["rxjava2:rxandroid"]
implementation rootProject.ext.dependencies["dagger"]
annotationProcessor rootProject.ext.dependencies["dagger-compiler"]
implementation rootProject.ext.dependencies["adapter-rxjava"]
implementation 'com.facebook.fresco:fresco:0.12.0'
// 支持 GIF 动图,需要添加
implementation 'com.facebook.fresco:animated-gif:0.12.0'
implementation 'com.sunfusheng:marqueeview:1.3.3'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.jcodecraeer:xrecyclerview:1.3.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'

build.gradle

apply from: "config.gradle"
buildscript {}

config.gradle

ext {
    android = [
            compileSdkVersion: 27,
            applicationId    : "com.example.ruiyonghui.combwieruiyonghui0512",
            minSdkVersion    : 15,
            targetSdkVersion : 27,
            versionCode      : 1,
            versionName      : "1.0"
    ]

    dependencies = [
            "appcompat-v7"     : "com.android.support:appcompat-v7:27.1.1",
            "constraint-layout": "com.android.support.constraint:constraint-layout:1.1.0",
            "retrofit2"        : "com.squareup.retrofit2:retrofit:2.4.0",
            "converter-gson"   : "com.squareup.retrofit2:converter-gson:2.4.0",
            "adapter-rxjava"  :  "com.squareup.retrofit2:adapter-rxjava2:2.4.0",
            "rxjava2"          : "io.reactivex.rxjava2:rxjava:2.1.13",
            "rxjava2:rxandroid": "io.reactivex.rxjava2:rxandroid:2.0.2",
            "dagger"           : "com.google.dagger:dagger:2.8",
            "dagger-compiler" : "com.google.dagger:dagger-compiler:2.7"

    ]
}

activtiy_piece

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".PieceActivity">

    <com.jcodecraeer.xrecyclerview.XRecyclerView
        android:id="@+id/recycler_duanzi"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </com.jcodecraeer.xrecyclerview.XRecyclerView>

</RelativeLayout>

item_duanzi

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="15dp"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/sdv_yuan"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_marginTop="15dp"
        app:actualImageScaleType="centerCrop"
        app:roundAsCircle="true"/>
    <TextView
        android:id="@&#
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值