Android YapHttp开源个人轻量级网络框架

版权声明:本文为赵勇原创文章,注明出处随便转载。 https://blog.csdn.net/YaphetZhao/article/details/55101461

YapHttp

GitHub:

https://github.com/YaphetZhao/YapHttp

介绍

轻量级的网络请求框架,支持get/post请求
速度方面使用HttpURLConnection,没有多余的操作
支持网络请求成功与失败回调监听

使用

Application中初始化:

YapHttp.getInstance().init();

调用:

YapHttp.getInstance().doGet("https://www.baidu.com/", new YapHttpSingleListener() {
                    @Override
                    public void onSuccess(String response) {
                        showToast("YapHttp onSuccess" + response);
                    }

                    @Override
                    public void onFailed(int type) {
                        showToast("YapHttp onFailed" + type + "");
                    }
                });

添加:

Gradle

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
        compile 'com.github.YaphetZhao:YapHttp:1.0.0'
}

Maven

Step 1. Add the JitPack repository to your build file

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Step 2. Add the dependency

<dependency>
    <groupId>com.github.YaphetZhao</groupId>
    <artifactId>YapHttp</artifactId>
    <version>1.0.0</version>
</dependency>

猜你喜欢

转载自blog.csdn.net/YaphetZhao/article/details/55101461