mirror of
https://github.com/WuXiaolong/AndroidMVPSample.git
synced 2025-06-07 22:04:04 +08:00
update
This commit is contained in:
parent
77bfdb5d4a
commit
6d23bebca7
@ -1,8 +1,8 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 24
|
compileSdkVersion 25
|
||||||
buildToolsVersion "23.0.3"
|
buildToolsVersion "25.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.wuxiaolong.androidmvpsample"
|
applicationId "com.wuxiaolong.androidmvpsample"
|
||||||
@ -21,7 +21,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
compile 'com.android.support:appcompat-v7:24.2.0'
|
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||||
compile 'com.wuxiaolong.androidutils:androidutils:1.0.5'
|
compile 'com.wuxiaolong.androidutils:androidutils:1.0.5'
|
||||||
compile 'com.jakewharton:butterknife:7.0.1'
|
compile 'com.jakewharton:butterknife:7.0.1'
|
||||||
compile 'com.squareup.retrofit2:retrofit:2.0.2'
|
compile 'com.squareup.retrofit2:retrofit:2.0.2'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.wuxiaolong.androidmvpsample.mvp.other;
|
package com.wuxiaolong.androidmvpsample.mvp.other;
|
||||||
|
|
||||||
import com.wuxiaolong.androidmvpsample.retrofit.ApiStores;
|
import com.wuxiaolong.androidmvpsample.retrofit.ApiStores;
|
||||||
import com.wuxiaolong.androidmvpsample.retrofit.AppClient;
|
import com.wuxiaolong.androidmvpsample.retrofit.ApiClient;
|
||||||
|
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.Subscriber;
|
import rx.Subscriber;
|
||||||
@ -23,7 +23,7 @@ public class BasePresenter<V> {
|
|||||||
|
|
||||||
public void attachView(V mvpView) {
|
public void attachView(V mvpView) {
|
||||||
this.mvpView = mvpView;
|
this.mvpView = mvpView;
|
||||||
apiStores = AppClient.retrofit().create(ApiStores.class);
|
apiStores = ApiClient.retrofit().create(ApiStores.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||||||
* 微信公众号:吴小龙同学
|
* 微信公众号:吴小龙同学
|
||||||
* 个人博客:http://wuxiaolong.me/
|
* 个人博客:http://wuxiaolong.me/
|
||||||
*/
|
*/
|
||||||
public class AppClient {
|
public class ApiClient {
|
||||||
public static Retrofit mRetrofit;
|
public static Retrofit mRetrofit;
|
||||||
|
|
||||||
public static Retrofit retrofit() {
|
public static Retrofit retrofit() {
|
@ -14,7 +14,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.wuxiaolong.androidmvpsample.R;
|
import com.wuxiaolong.androidmvpsample.R;
|
||||||
import com.wuxiaolong.androidmvpsample.retrofit.ApiStores;
|
import com.wuxiaolong.androidmvpsample.retrofit.ApiStores;
|
||||||
import com.wuxiaolong.androidmvpsample.retrofit.AppClient;
|
import com.wuxiaolong.androidmvpsample.retrofit.ApiClient;
|
||||||
import com.wuxiaolong.androidutils.library.LogUtil;
|
import com.wuxiaolong.androidutils.library.LogUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -37,7 +37,6 @@ import rx.subscriptions.CompositeSubscription;
|
|||||||
*/
|
*/
|
||||||
public class BaseActivity extends AppCompatActivity {
|
public class BaseActivity extends AppCompatActivity {
|
||||||
public Activity mActivity;
|
public Activity mActivity;
|
||||||
public ApiStores apiStores = AppClient.retrofit().create(ApiStores.class);
|
|
||||||
private CompositeSubscription mCompositeSubscription;
|
private CompositeSubscription mCompositeSubscription;
|
||||||
private List<Call> calls;
|
private List<Call> calls;
|
||||||
|
|
||||||
@ -72,6 +71,10 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApiStores apiStores() {
|
||||||
|
return ApiClient.retrofit().create(ApiStores.class);
|
||||||
|
}
|
||||||
|
|
||||||
public void addCalls(Call call) {
|
public void addCalls(Call call) {
|
||||||
if (calls == null) {
|
if (calls == null) {
|
||||||
calls = new ArrayList<>();
|
calls = new ArrayList<>();
|
||||||
|
@ -75,7 +75,7 @@ public class MainActivity extends MvpActivity<MainPresenter> implements MainView
|
|||||||
|
|
||||||
private void loadDataByRetrofit() {
|
private void loadDataByRetrofit() {
|
||||||
showProgressDialog();
|
showProgressDialog();
|
||||||
Call<MainModel> call = apiStores.loadDataByRetrofit("101190201");
|
Call<MainModel> call = apiStores().loadDataByRetrofit("101190201");
|
||||||
call.enqueue(new RetrofitCallback<MainModel>() {
|
call.enqueue(new RetrofitCallback<MainModel>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(MainModel model) {
|
public void onSuccess(MainModel model) {
|
||||||
@ -103,7 +103,7 @@ public class MainActivity extends MvpActivity<MainPresenter> implements MainView
|
|||||||
//全国+国外主要城市代码http://mobile.weather.com.cn/js/citylist.xml
|
//全国+国外主要城市代码http://mobile.weather.com.cn/js/citylist.xml
|
||||||
private void loadDataByRetrofitRxjava() {
|
private void loadDataByRetrofitRxjava() {
|
||||||
showProgressDialog();
|
showProgressDialog();
|
||||||
addSubscription(apiStores.loadDataByRetrofitRxjava("101220602"),
|
addSubscription(apiStores().loadDataByRetrofitRxjava("101220602"),
|
||||||
new ApiCallback<MainModel>() {
|
new ApiCallback<MainModel>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(MainModel model) {
|
public void onSuccess(MainModel model) {
|
||||||
|
@ -5,7 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.2.0'
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Thu Sep 22 09:35:31 CST 2016
|
#Fri Jun 02 11:35:48 CST 2017
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||||
|
Loading…
x
Reference in New Issue
Block a user