├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── itheima │ │ └── leon │ │ └── funhttp │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── itheima │ │ │ └── leon │ │ │ └── funhttp │ │ │ ├── HomeListItemBean.java │ │ │ ├── MVRequest.java │ │ │ ├── MainActivity.java │ │ │ └── URLProviderUtils.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── itheima │ └── leon │ └── funhttp │ └── ExampleUnitTest.java ├── build.gradle ├── funhttplib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── itheima │ └── leon │ └── funhttplib │ ├── NetworkListener.java │ ├── NetworkManager.java │ └── Request.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 1.8 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 简介 # 2 | FunHttp是对Okttp的Get请求的简单封装,处理了网络回调的线程切换 3 | # 使用姿势 # 4 | ## 添加依赖 ## 5 | //项目build.gradle 6 | allprojects { 7 | repositories { 8 | ... 9 | maven { url 'https://jitpack.io' } 10 | } 11 | } 12 | 13 | //app模块下的build.gradle 14 | dependencies { 15 | compile 'com.github.uncleleonfan:funhttp:1.2.1' 16 | } 17 | 18 | ## 创建请求 ## 19 | 所有的请求必须继承自Request, 泛型T传入网络结果想要解析成的数据类型 20 | 21 | public class MVRequest extends Request>{ 22 | 23 | public MVRequest(String url, NetworkListener listener) { 24 | super(url, listener); 25 | } 26 | 27 | public static MVRequest getRequest(NetworkListener listener) { 28 | return new MVRequest(URLProviderUtils.getHomeUrl(0, 10), listener); 29 | } 30 | } 31 | 32 | ## 执行请求 ## 33 | MVRequest.getRequest(mListNetworkListener).execute(); 34 | 35 | ## 监听网络结果 ## 36 | 网络结果在主线程被回调 37 | 38 | private NetworkListener> mListNetworkListener = new NetworkListener>() { 39 | @Override 40 | public void onFailed(String s) { 41 | 42 | } 43 | 44 | @Override 45 | public void onSuccess(List result) { 46 | Toast.makeText(MainActivity.this, "onSuccess " + result.size(), Toast.LENGTH_SHORT).show(); 47 | } 48 | }; 49 | 50 | # OKHttp的Get请求的封装 # 51 | 52 | ## Request ## 53 | 54 | ### 构造方法 ### 55 | public Request(String url, NetworkListener listener) { 56 | mUrl = url; 57 | mNetworkListener = listener; 58 | mGson = new Gson(); 59 | } 60 | ### 执行网络请求 ### 61 | public void execute() { 62 | NetworkManager.getInstance().sendRequest(this); 63 | } 64 | ### 解析网络响应 ### 65 | public T parseNetworkResponse(String result) { 66 | Class c = this.getClass(); 67 | ParameterizedType parameterizedType = (ParameterizedType) c.getGenericSuperclass(); 68 | Type actualType = parameterizedType.getActualTypeArguments()[0]; 69 | return mGson.fromJson(result, actualType); 70 | } 71 | 72 | ## NetworkListener ## 73 | public interface NetworkListener { 74 | 75 | //请求失败的回调 76 | void onError(String errorMsg); 77 | 78 | //请求失败的回调 79 | void onSuccess(T result); 80 | } 81 | ## NetworkManager ## 82 | NetworkManager维护一个OkhttpClient的对象来执行网络请求。当收到网络结果后,通过绑定主线程的Handler回调到主线程。 83 | 84 | public void sendRequest(final Request funRequest) { 85 | final okhttp3.Request request = new okhttp3.Request.Builder().url(funRequest.getUrl()).get().build(); 86 | mOkHttpClient.newCall(request).enqueue(new Callback() { 87 | @Override 88 | public void onFailure(Call call, final IOException e) { 89 | mHandler.post(new Runnable() { 90 | @Override 91 | public void run() { 92 | funRequest.getNetworkListener().onFailed(e.getLocalizedMessage()); 93 | } 94 | }); 95 | } 96 | 97 | @Override 98 | public void onResponse(Call call, Response response) throws IOException { 99 | //解析结果在在子线程做 100 | final Object o = funRequest.parseNetworkResponse(response.body().string()); 101 | //回调网络请求成功,传入解析后的结果 102 | mHandler.post(new Runnable() { 103 | @Override 104 | public void run() { 105 | funRequest.getNetworkListener().onSuccess(o); 106 | } 107 | }); 108 | } 109 | }); 110 | } 111 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | buildToolsVersion "26.0.2" 6 | defaultConfig { 7 | applicationId "com.itheima.leon.funhttp" 8 | minSdkVersion 15 9 | targetSdkVersion 26 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:26.1.0' 28 | testCompile 'junit:junit:4.12' 29 | compile project(':funhttplib') 30 | } 31 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\software\AndroidStudio\SDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/itheima/leon/funhttp/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttp; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.itheima.leon.funhttp", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/itheima/leon/funhttp/HomeListItemBean.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttp; 2 | 3 | public class HomeListItemBean { 4 | public static final String TAG = "HomeListItemBean"; 5 | 6 | 7 | /** 8 | * type : ACTIVITY 9 | * id : 0 10 | * title : EXO合集 11 | * description : 12 | * posterPic : http://img0.c.yinyuetai.com/others/mobile_front_page/161219/0/-M-f416bcf2e5d7246b7e4a8a149b80d821_0x0.jpg 13 | * url : http://activity.shop.yinyuetai.com/index.html#/Activity/25?_k=8xy9rr 14 | * videoSize : 0 15 | * hdVideoSize : 0 16 | * uhdVideoSize : 0 17 | * status : 0 18 | * traceUrl : http://www.yinyuetai.com/v?a=102437&un=53a621a9362eb7ed4e46425ac834f4b545fe1eff443acb1e2ba5fdc547da9314f66a78b03b640904a24e6f25376102b0c1dc16842b2b37e0d446aaffccd10a8cf69d2ebc6c2e79bfe31b925f005aee7e12ef159d573c37c97845c34d5e9dc329d8763c9a0e375997 19 | * clickUrl : http://mapi.yinyuetai.com/statistics/click.json?id=5008 20 | */ 21 | 22 | private String type; 23 | private int id; 24 | private String title; 25 | private String description; 26 | private String posterPic; 27 | private String url; 28 | private int videoSize; 29 | private int hdVideoSize; 30 | private int uhdVideoSize; 31 | private int status; 32 | private String traceUrl; 33 | private String clickUrl; 34 | 35 | public String getType() { 36 | return type; 37 | } 38 | 39 | public void setType(String type) { 40 | this.type = type; 41 | } 42 | 43 | public int getId() { 44 | return id; 45 | } 46 | 47 | public void setId(int id) { 48 | this.id = id; 49 | } 50 | 51 | public String getTitle() { 52 | return title; 53 | } 54 | 55 | public void setTitle(String title) { 56 | this.title = title; 57 | } 58 | 59 | public String getDescription() { 60 | return description; 61 | } 62 | 63 | public void setDescription(String description) { 64 | this.description = description; 65 | } 66 | 67 | public String getPosterPic() { 68 | return posterPic; 69 | } 70 | 71 | public void setPosterPic(String posterPic) { 72 | this.posterPic = posterPic; 73 | } 74 | 75 | public String getUrl() { 76 | return url; 77 | } 78 | 79 | public void setUrl(String url) { 80 | this.url = url; 81 | } 82 | 83 | public int getVideoSize() { 84 | return videoSize; 85 | } 86 | 87 | public void setVideoSize(int videoSize) { 88 | this.videoSize = videoSize; 89 | } 90 | 91 | public int getHdVideoSize() { 92 | return hdVideoSize; 93 | } 94 | 95 | public void setHdVideoSize(int hdVideoSize) { 96 | this.hdVideoSize = hdVideoSize; 97 | } 98 | 99 | public int getUhdVideoSize() { 100 | return uhdVideoSize; 101 | } 102 | 103 | public void setUhdVideoSize(int uhdVideoSize) { 104 | this.uhdVideoSize = uhdVideoSize; 105 | } 106 | 107 | public int getStatus() { 108 | return status; 109 | } 110 | 111 | public void setStatus(int status) { 112 | this.status = status; 113 | } 114 | 115 | public String getTraceUrl() { 116 | return traceUrl; 117 | } 118 | 119 | public void setTraceUrl(String traceUrl) { 120 | this.traceUrl = traceUrl; 121 | } 122 | 123 | public String getClickUrl() { 124 | return clickUrl; 125 | } 126 | 127 | public void setClickUrl(String clickUrl) { 128 | this.clickUrl = clickUrl; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /app/src/main/java/com/itheima/leon/funhttp/MVRequest.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttp; 2 | 3 | import com.itheima.leon.funhttplib.NetworkListener; 4 | import com.itheima.leon.funhttplib.Request; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by Leon on 2017/1/15. 10 | */ 11 | 12 | public class MVRequest extends Request>{ 13 | 14 | public MVRequest(String url, NetworkListener listener) { 15 | super(url, listener); 16 | } 17 | 18 | public static MVRequest getRequest(NetworkListener listener) { 19 | return new MVRequest(URLProviderUtils.getHomeUrl(0, 10), listener); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/itheima/leon/funhttp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttp; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.widget.Toast; 6 | 7 | import com.itheima.leon.funhttplib.NetworkListener; 8 | 9 | import java.util.List; 10 | 11 | public class MainActivity extends AppCompatActivity { 12 | 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | super.onCreate(savedInstanceState); 16 | setContentView(R.layout.activity_main); 17 | MVRequest.getRequest(mListNetworkListener).execute(); 18 | } 19 | 20 | private NetworkListener> mListNetworkListener = new NetworkListener>() { 21 | @Override 22 | public void onFailed(String s) { 23 | 24 | } 25 | 26 | @Override 27 | public void onSuccess(List result) { 28 | Toast.makeText(MainActivity.this, "onSuccess " + result.size(), Toast.LENGTH_SHORT).show(); 29 | } 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/itheima/leon/funhttp/URLProviderUtils.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttp; 2 | 3 | import android.util.Log; 4 | 5 | public class URLProviderUtils { 6 | 7 | /** 8 | * 获取首页的url 9 | * 10 | * @param offset 数据偏移量 11 | * @param size 返回数据的条目个数 12 | * @return url 13 | */ 14 | public static String getHomeUrl(int offset, int size) { 15 | String url = "http://mapi.yinyuetai.com/suggestions/front_page.json?deviceinfo=" 16 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 17 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 18 | + "\"rn\":\"480*800\"," 19 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 20 | + "\"cr\":\"46000\"," 21 | + "\"as\":" 22 | + "\"WIFI\"," 23 | + "\"uid\":" 24 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 25 | + "\"clid\":110025000}" 26 | + "&offset=" + offset 27 | + "&size=" + size 28 | + "&v=4&rn=640*540"; 29 | Log.i("Main_url", url); 30 | return url; 31 | } 32 | 33 | public static String getMVareaUrl() { 34 | String url = "http://mapi.yinyuetai.com/video/get_mv_areas.json?deviceinfo=" 35 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 36 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 37 | + "\"rn\":\"480*800\"," 38 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 39 | + "\"cr\":\"46000\"," 40 | + "\"as\":" 41 | + "\"WIFI\"," 42 | + "\"uid\":" 43 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 44 | + "\"clid\":110025000}"; 45 | return url; 46 | } 47 | 48 | public static String getMVListUrl(String area, int offset, int size) { 49 | String url = "http://mapi.yinyuetai.com/video/list.json?deviceinfo=" 50 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 51 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 52 | + "\"rn\":\"480*800\"," 53 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 54 | + "\"cr\":\"46000\"," 55 | + "\"as\":" 56 | + "\"WIFI\"," 57 | + "\"uid\":" 58 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 59 | + "\"clid\":110025000}" 60 | + "&area=" + area 61 | + "&offset=" + offset 62 | + "&size=" + size; 63 | return url; 64 | } 65 | 66 | public static String getYueDanUrl(int offset, int size) { 67 | String url = "http://mapi.yinyuetai.com/playlist/list.json?deviceinfo=" 68 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 69 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 70 | + "\"rn\":\"480*800\"," 71 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 72 | + "\"cr\":\"46000\"," 73 | + "\"as\":" 74 | + "\"WIFI\"," 75 | + "\"uid\":" 76 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 77 | + "\"clid\":110025000}" 78 | + "&offset=" + offset 79 | + "&size=" + size; 80 | return url; 81 | } 82 | 83 | /** 84 | *

获取音乐节目列表

85 | * 86 | * @param artistIds 87 | * @param offset 88 | * @param size 89 | * @return 90 | */ 91 | public static String getYinYueProgramList(String artistIds, int offset, int size) { 92 | String url = "http://mapi.yinyuetai.com/playlist/show.json?deviceinfo=" 93 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 94 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 95 | + "\"rn\":\"480*800\"," 96 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 97 | + "\"cr\":\"46000\"," 98 | + "\"as\":" 99 | + "\"WIFI\"," 100 | + "\"uid\":" 101 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 102 | + "\"clid\":110025000}" 103 | + "&offset=" + offset 104 | + "&size=" + size 105 | + "&artistIds=" + artistIds; 106 | return url; 107 | } 108 | 109 | /** 110 | * 获取V榜地址 111 | * 112 | * @return 113 | */ 114 | public static String getVChartAreasUrl() { 115 | String url = "http://mapi.yinyuetai.com/vchart/get_vchart_areas.json?deviceinfo=" 116 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 117 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 118 | + "\"rn\":\"480*800\"," 119 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 120 | + "\"cr\":\"46000\"," 121 | + "\"as\":" 122 | + "\"WIFI\"," 123 | + "\"uid\":" 124 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 125 | + "\"clid\":110025000}"; 126 | return url; 127 | } 128 | 129 | /** 130 | * 获取V榜的周期 131 | * 132 | * @return 133 | */ 134 | public static String getVChartPeriodUrl(String area) { 135 | String url = "http://mapi.yinyuetai.com/vchart/period.json?deviceinfo=" 136 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 137 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 138 | + "\"rn\":\"480*800\"," 139 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 140 | + "\"cr\":\"46000\"," 141 | + "\"as\":" 142 | + "\"WIFI\"," 143 | + "\"uid\":" 144 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 145 | + "\"clid\":110025000}" 146 | + "&area=" + area; 147 | return url; 148 | } 149 | 150 | /** 151 | * 获取V榜列表 152 | * 153 | * @param area 154 | * @param dateCode 155 | * @return 156 | */ 157 | public static String getVChartListUrl(String area, int dateCode) { 158 | String url = "http://mapi.yinyuetai.com/vchart/show.json?deviceinfo=" 159 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 160 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 161 | + "\"rn\":\"480*800\"," 162 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 163 | + "\"cr\":\"46000\"," 164 | + "\"as\":" 165 | + "\"WIFI\"," 166 | + "\"uid\":" 167 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 168 | + "\"clid\":110025000}" 169 | + "&area=" + area 170 | + "&datecode=" + dateCode; 171 | return url; 172 | } 173 | 174 | /** 175 | * 获取相关MV 176 | * 177 | * @param id 178 | * @return 179 | */ 180 | public static String getRelativeVideoListUrl(int id) { 181 | String url = "http://mapi.yinyuetai.com/video/show.json?deviceinfo=" 182 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 183 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 184 | + "\"rn\":\"480*800\"," 185 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 186 | + "\"cr\":\"46000\"," 187 | + "\"as\":" 188 | + "\"WIFI\"," 189 | + "\"uid\":" 190 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 191 | + "\"clid\":110025000}" 192 | + "&relatedVideos=true" 193 | + "&id=" + id; 194 | return url; 195 | } 196 | 197 | /** 198 | * 通过id 获取某人的悦单 199 | * 200 | * @param id 201 | * @return 202 | */ 203 | public static String getPeopleYueDanList(int id) { 204 | String url = "http://mapi.yinyuetai.com/playlist/show.json?deviceinfo=" 205 | + "{\"aid\":\"10201036\",\"os\":\"Android\"," 206 | + "\"ov\":" + "\"" + getSystemVersion() + "\"" + "," 207 | + "\"rn\":\"480*800\"," 208 | + "\"dn\":" + "\"" + getPhoneModel() + "\"" + "," 209 | + "\"cr\":\"46000\"," 210 | + "\"as\":" 211 | + "\"WIFI\"," 212 | + "\"uid\":" 213 | + "\"dbcaa6c4482bc05ecb0bf39dabf207d2\"," 214 | + "\"clid\":110025000}" 215 | + "&id=" + id; 216 | return url; 217 | } 218 | 219 | private static String getSystemVersion() { 220 | return android.os.Build.VERSION.RELEASE; 221 | } 222 | 223 | private static String getPhoneModel() { 224 | return android.os.Build.MODEL; 225 | } 226 | } 227 | 228 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/FunHttp/90b5dbb9fdec666f30ff5e2c905634288a0dcafa/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/FunHttp/90b5dbb9fdec666f30ff5e2c905634288a0dcafa/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/FunHttp/90b5dbb9fdec666f30ff5e2c905634288a0dcafa/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/FunHttp/90b5dbb9fdec666f30ff5e2c905634288a0dcafa/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/FunHttp/90b5dbb9fdec666f30ff5e2c905634288a0dcafa/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FunHttp 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/itheima/leon/funhttp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttp; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | google() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.0.0' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | google() 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } 26 | -------------------------------------------------------------------------------- /funhttplib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /funhttplib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | 4 | group='com.github.uncleleonfan' 5 | 6 | android { 7 | compileSdkVersion 26 8 | buildToolsVersion "26.0.2" 9 | 10 | defaultConfig { 11 | minSdkVersion 15 12 | targetSdkVersion 26 13 | versionCode 1 14 | versionName "1.0" 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | compile fileTree(include: ['*.jar'], dir: 'libs') 26 | compile 'com.android.support:appcompat-v7:26.1.0' 27 | compile 'com.google.code.gson:gson:2.8.2' 28 | compile 'com.squareup.okhttp3:okhttp:3.8.1' 29 | } 30 | -------------------------------------------------------------------------------- /funhttplib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\software\AndroidStudio\SDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /funhttplib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /funhttplib/src/main/java/com/itheima/leon/funhttplib/NetworkListener.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttplib; 2 | 3 | public interface NetworkListener { 4 | 5 | void onFailed(String s); 6 | 7 | /** 8 | * 回调解析后的结果 9 | * @param result 10 | */ 11 | void onSuccess(T result); 12 | } 13 | -------------------------------------------------------------------------------- /funhttplib/src/main/java/com/itheima/leon/funhttplib/NetworkManager.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttplib; 2 | 3 | import android.os.Handler; 4 | import android.os.Looper; 5 | 6 | import java.io.IOException; 7 | 8 | import okhttp3.Call; 9 | import okhttp3.Callback; 10 | import okhttp3.OkHttpClient; 11 | import okhttp3.Response; 12 | import okhttp3.ResponseBody; 13 | 14 | /** 15 | * NetworkManager 持有一个OkHttpClient对象来发送网络请求,处理网络结果的线程的切换 16 | */ 17 | public class NetworkManager { 18 | 19 | public static final String TAG = "NetworkManager"; 20 | 21 | private static NetworkManager sNetworkManager; 22 | 23 | private Handler mHandler = new Handler(Looper.getMainLooper()); 24 | 25 | private NetworkManager() { 26 | mOkHttpClient = new OkHttpClient(); 27 | } 28 | 29 | private OkHttpClient mOkHttpClient; 30 | 31 | public static NetworkManager getInstance() { 32 | if (sNetworkManager == null) { 33 | synchronized (NetworkManager.class) { 34 | if (sNetworkManager == null) { 35 | sNetworkManager = new NetworkManager(); 36 | } 37 | } 38 | } 39 | return sNetworkManager; 40 | } 41 | 42 | public void sendRequest(final Request funRequest) { 43 | final okhttp3.Request request = new okhttp3.Request.Builder() 44 | .url(funRequest.getUrl()) 45 | .get().build(); 46 | 47 | mOkHttpClient.newCall(request).enqueue(new Callback() { 48 | @Override 49 | public void onFailure(Call call, final IOException e) { 50 | mHandler.post(new Runnable() { 51 | @Override 52 | public void run() { 53 | funRequest.getNetworkListener().onFailed(e.getLocalizedMessage()); 54 | } 55 | }); 56 | } 57 | 58 | @Override 59 | public void onResponse(Call call, Response response) throws IOException { 60 | response.header("Connection", "close"); 61 | ResponseBody body = response.body(); 62 | //解析结果在在子线程做 63 | final Object o = funRequest.parseNetworkResponse(body.string()); 64 | body.close(); 65 | //回调网络请求成功,传入解析后的结果 66 | mHandler.post(new Runnable() { 67 | @Override 68 | public void run() { 69 | funRequest.getNetworkListener().onSuccess(o); 70 | } 71 | }); 72 | } 73 | }); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /funhttplib/src/main/java/com/itheima/leon/funhttplib/Request.java: -------------------------------------------------------------------------------- 1 | package com.itheima.leon.funhttplib; 2 | 3 | import com.google.gson.Gson; 4 | 5 | import java.lang.reflect.ParameterizedType; 6 | import java.lang.reflect.Type; 7 | 8 | /** 9 | * 包含一个请求所需必要的信息url, 调用NetworkManager发送请求,解析网络结果,解析发送请求时想要的java bean 10 | * 还可以提供回调方法 11 | * @param 12 | */ 13 | public class Request { 14 | public static final String TAG = "Request"; 15 | 16 | public static final int DEFAULT_PAGE_SIZE = 10; 17 | 18 | private String mUrl; 19 | private NetworkListener mNetworkListener; 20 | 21 | private Gson mGson; 22 | 23 | public String getUrl() { 24 | return mUrl; 25 | } 26 | 27 | public void setUrl(String url) { 28 | mUrl = url; 29 | } 30 | 31 | public NetworkListener getNetworkListener() { 32 | return mNetworkListener; 33 | } 34 | 35 | public void setNetworkListener(NetworkListener networkListener) { 36 | mNetworkListener = networkListener; 37 | } 38 | 39 | public Request(String url, NetworkListener listener) { 40 | mUrl = url; 41 | mNetworkListener = listener; 42 | mGson = new Gson(); 43 | } 44 | 45 | public void execute() { 46 | NetworkManager.getInstance().sendRequest(this); 47 | } 48 | 49 | /** 50 | * 解析网络结果,解析发送请求时想要的java bean 51 | * @param string 52 | * @return 53 | */ 54 | public T parseNetworkResponse(String string) { 55 | Class classz = getClass(); 56 | Type genericSuperclass = classz.getGenericSuperclass(); 57 | ParameterizedType parameterized = (ParameterizedType) genericSuperclass; 58 | return mGson.fromJson(string, parameterized.getActualTypeArguments()[0]); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/FunHttp/90b5dbb9fdec666f30ff5e2c905634288a0dcafa/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Nov 10 12:57:54 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':funhttplib' 2 | --------------------------------------------------------------------------------