Skip to content

Commit 0507ef7

Browse files
authored
feat: update sdk (#16)
* feat: update sdk
1 parent 3090e0b commit 0507ef7

File tree

5 files changed

+33
-52
lines changed

5 files changed

+33
-52
lines changed

Diff for: android_app_bootstrap/build.gradle

+10-8
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ apply plugin: 'jacoco'
33
apply plugin: 'pmd'
44

55
jacoco {
6-
toolVersion = '0.7.9'
6+
toolVersion = '0.8.1'
77
}
88

99
android {
10-
compileSdkVersion 19
11-
buildToolsVersion '26.0.2'
10+
compileSdkVersion 27
11+
buildToolsVersion "27.0.3"
1212

1313
lintOptions {
1414
abortOnError false
1515
}
1616

1717
defaultConfig {
1818
applicationId 'com.github.android_app_bootstrap'
19-
minSdkVersion 19
20-
targetSdkVersion 19
19+
minSdkVersion 22
20+
targetSdkVersion 22
2121
}
2222

2323
buildTypes {
@@ -33,7 +33,9 @@ android {
3333
}
3434

3535
dependencies {
36-
compile 'com.android.support:support-v4:19+'
37-
compile 'com.facebook.fresco:fresco:0.10.0'
38-
compile 'com.alibaba:fastjson:1.2.38'
36+
implementation 'com.android.support:support-v4:25.3.1'
37+
implementation 'com.facebook.fresco:fresco:0.10.0'
38+
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
39+
implementation 'com.alibaba:fastjson:1.2.38'
40+
implementation 'com.airbnb.android:lottie:2.5.4'
3941
}

Diff for: android_app_bootstrap/src/main/java/com/github/android_app_bootstrap/activity/DataHubActivity.java

+18-38
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,15 @@
1515
import android.widget.Toast;
1616

1717
import com.alibaba.fastjson.JSON;
18-
import com.alibaba.fastjson.JSONException;
1918
import com.alibaba.fastjson.JSONObject;
2019
import com.github.android_app_bootstrap.R;
2120
import com.github.android_app_bootstrap.common.Utils;
2221

23-
import java.io.BufferedReader;
2422
import java.io.IOException;
25-
import java.io.InputStreamReader;
2623

27-
import org.apache.http.HttpResponse;
28-
import org.apache.http.client.ClientProtocolException;
29-
import org.apache.http.client.HttpClient;
30-
import org.apache.http.client.methods.HttpGet;
31-
import org.apache.http.impl.client.DefaultHttpClient;
24+
import okhttp3.OkHttpClient;
25+
import okhttp3.Request;
26+
import okhttp3.Response;
3227

3328
public class DataHubActivity extends Activity implements View.OnClickListener {
3429

@@ -43,40 +38,26 @@ public Task() {
4338
}
4439

4540
@Override
46-
protected String doInBackground(Integer... params) {
47-
HttpClient client = new DefaultHttpClient();
48-
StringBuilder builder = new StringBuilder();
49-
HttpGet myget = new HttpGet(API);
41+
protected String doInBackground(Integer... params) {
5042
String lastVersionStr = null;
5143
Log.i(TAG, API);
44+
45+
OkHttpClient client = new OkHttpClient();
46+
5247
try {
53-
HttpResponse response = client.execute(myget);
54-
int statusCode = response.getStatusLine().getStatusCode();
55-
Log.i(TAG, "status code: " + statusCode);
56-
if (statusCode == 200) {
57-
BufferedReader reader = new BufferedReader(
58-
new InputStreamReader(response.getEntity()
59-
.getContent()));
60-
for (String s = reader.readLine(); s != null; s = reader
61-
.readLine()) {
62-
builder.append(s);
63-
}
64-
JSONObject res = JSON.parseObject(builder.toString());
65-
Log.i(TAG, res.toJSONString());
66-
lastVersionStr = res.toJSONString();
67-
} else {
68-
Log.i(TAG, "failed");
69-
}
70-
} catch (ClientProtocolException e) {
71-
// TODO Auto-generated catch block
72-
e.printStackTrace();
48+
Request request = new Request.Builder()
49+
.url(API)
50+
.get()
51+
.build();
52+
53+
Response response = client.newCall(request).execute();
54+
JSONObject res = JSON.parseObject(response.body().string());
55+
Log.i(TAG, res.toJSONString());
56+
lastVersionStr = res.toJSONString();
7357
} catch (IOException e) {
74-
// TODO Auto-generated catch block
75-
e.printStackTrace();
76-
} catch (JSONException e) {
77-
// TODO Auto-generated catch block
7858
e.printStackTrace();
7959
}
60+
8061
return lastVersionStr;
8162
}
8263

@@ -119,5 +100,4 @@ public void onClick(View view) {
119100

120101
}
121102
}
122-
}
123-
103+
}

Diff for: build.gradle

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
buildscript {
44
repositories {
5+
google()
56
jcenter()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.1'
9+
classpath 'com.android.tools.build:gradle:3.1.2'
910
}
1011
}
1112

1213
allprojects {
1314
repositories {
15+
google()
1416
jcenter()
15-
mavenCentral()
1617
}
1718
}
18-
19-

Diff for: gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# This option should only be used with decoupled projects. More details, visit
1313
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1414
# org.gradle.parallel=true
15-
#Tue May 17 10:18:35 CST 2016
15+
#Tue May 17 10:18:35 CST 2016

Diff for: gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

0 commit comments

Comments
 (0)