Skip to content

Commit

Permalink
2018.5.25
Browse files Browse the repository at this point in the history
  • Loading branch information
tome34 committed May 25, 2018
1 parent 6e99689 commit 102c0a4
Show file tree
Hide file tree
Showing 117 changed files with 1,975 additions and 245 deletions.
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies["appcompat_v7"]
implementation rootProject.ext.dependencies["constraint_layout"]
testImplementation rootProject.ext.dependencies["junit"]
androidTestImplementation rootProject.ext.dependencies["runner"]
androidTestImplementation rootProject.ext.dependencies["espresso_core"]
Expand All @@ -43,5 +41,8 @@ dependencies {
if (!rootProject.ext.appDebug) {
implementation project(':module_shop_mall')
implementation project(':module_shop_cart')
implementation project(':module_shop_goods')
implementation project(':module_self')
}

}
3 changes: 0 additions & 3 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
8 changes: 0 additions & 8 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
21 changes: 19 additions & 2 deletions component_base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ android {
versionName rootProject.ext.android.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

//MultiDex分包方法
multiDexEnabled true

//Arouter路由配置
javaCompileOptions {
annotationProcessorOptions {
Expand All @@ -32,22 +35,36 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//防止编译的时候oom、GC
dexOptions {
javaMaxHeapSize "4g"
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api rootProject.ext.dependencies["appcompat_v7"]
api rootProject.ext.dependencies["constraint_layout"]
api rootProject.ext.dependencies["cardview-v7"]
api rootProject.ext.dependencies["design"]
testImplementation rootProject.ext.dependencies["junit"]
androidTestImplementation rootProject.ext.dependencies["runner"]
androidTestImplementation rootProject.ext.dependencies["espresso_core"]

/*implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies["appcompat_v7"]
implementation rootProject.ext.dependencies["cardview-v7"]
implementation rootProject.ext.dependencies["support-v4"]
implementation rootProject.ext.dependencies["recyclerview-v7"]
implementation rootProject.ext.dependencies["design"]
implementation rootProject.ext.dependencies["constraint_layout"]
implementation rootProject.ext.dependencies["support_annotations"]
testImplementation rootProject.ext.dependencies["junit"]
androidTestImplementation rootProject.ext.dependencies["runner"]
androidTestImplementation rootProject.ext.dependencies["espresso_core"]
androidTestImplementation rootProject.ext.dependencies["espresso_core"]*/

//MultiDex分包方法
api rootProject.ext.dependencies["multidex"]
//Arouter路由
annotationProcessor rootProject.ext.dependencies["arouter_compiler"]
api rootProject.ext.dependencies["arouter_api"]
Expand Down
14 changes: 13 additions & 1 deletion component_base/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tome.component_base" >

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

<application
android:allowBackup="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">

</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//package com.example.tome.component_base.arouter;
//
//import android.app.Activity;
//import android.content.Context;
//
//import com.alibaba.android.arouter.launcher.ARouter;
//import com.example.tome.component_data.d_arouter.RouterURLS;
//
///**
// * @Created by TOME .
// * @时间 2018/4/26 10:19
// * @描述 ${路由中心}
// */
////ARouter 提供了大量的参数类型 跳转携带 https://blog.csdn.net/zhaoyanjun6/article/details/76165252
//public class RouterCenter {
// /**
// * 测试首页
// */
// public static void toMain() {
// ARouter.getInstance().build(RouterURLS.BASE_MAIN).navigation();
// }
//
// /**
// * shopCart 模块页面
// */
// public static void toShopCart() {
// ARouter.getInstance().build(RouterURLS.MODULE_SHOP_CART_MAIN).navigation();
// }
//
// public static void toShopCart(Activity context) {
// ARouter.getInstance().build(RouterURLS.MODULE_SHOP_CART_MAIN).navigation(context);
// }
//
// /**
// * 主页
// */
// public static void toHome() {
// ARouter.getInstance().build(RouterURLS.MODULE_SHOP_MALL_HOME).navigation();
// }
//
// /* public static void toMainOder() {
// ARouter.getInstance().build(RouterURLS.BASE_MAIN)
// .withInt(IntentKV.K_TO_MAIN_ORDER, IntentKV.V_TO_MAIN_ORDER)
// .navigation();
// }*/
//}
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package com.example.tome.component_base.base;

import com.example.tome.component_base.util.T;

/**
* @Created by TOME .
* @时间 2018/5/2 17:56
* @描述 ${Presenter 基类}
*/

public interface AbstractPresenter<T extends BaseView> {
public interface AbstractPresenter<V extends BaseView> {

/**
* 注入View
*
* @param view view
*/
void attachView(T view);
void attachView(V view);

/**
* 回收View
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.example.tome.component_base.R;
import com.example.tome.component_base.baseApp.BaseApplication;
import com.example.tome.component_base.helper.HUDFactory;
import com.example.tome.component_base.util.L;
import com.example.tome.component_base.util.StatuBarCompat;
import com.example.tome.component_base.util.T;
import com.example.tome.component_data.constant.BaseEventbusBean;
import com.kaopiz.kprogresshud.KProgressHUD;

Expand All @@ -27,9 +29,9 @@
* @描述 ${MVP模式的Base Activity}
*/

public abstract class BaseMVPActivity<T extends AbstractPresenter> extends AppCompatActivity implements BaseView {
public abstract class BaseMVPActivity<P extends AbstractPresenter> extends AppCompatActivity implements BaseView {

protected T mPresenter ;
protected P mPresenter ;
private Unbinder unBinder;
protected boolean regEvent;
public BaseMVPActivity mActivity ;
Expand Down Expand Up @@ -77,14 +79,15 @@ protected void onEvent(BaseEventbusBean event) {


@Override
public void showHUD() {
public void showHUD(String msg) {
if (isDestory){
return;
}
kProgressHUD = HUDFactory.getInstance().creatHUD(this);
kProgressHUD.setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
//.setLabel(getString(R.string.loading))
.setLabel(null)
// .setLabel(getString(R.string.loading))
.setLabel(msg)
// .setLabel(null)
.setCancellable(true)
.setAnimationSpeed(2)
.setDimAmount(0.3f).show();
Expand Down Expand Up @@ -147,13 +150,14 @@ protected void onDestroy() {
*/
protected void setImmeriveStatuBar() {
StatuBarCompat.setImmersiveStatusBar(true, Color.WHITE, this);

}

/**
* 获取当前的persenter
* @return
*/
protected abstract T getPresenter();
protected abstract P getPresenter();

/**
* 获取当前Activity的UI布局
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package com.example.tome.component_base.base;

import android.app.Activity;
import android.text.TextUtils;
import android.widget.Toast;


import com.example.tome.component_base.util.ActivityUtil;
import com.example.tome.component_base.util.L;
import com.example.tome.component_base.util.NetUtils;
import com.kaopiz.kprogresshud.KProgressHUD;

import io.reactivex.observers.ResourceObserver;
import retrofit2.HttpException;
Expand All @@ -21,17 +26,27 @@ public abstract class BaseObserver<T> extends ResourceObserver<T> {

private BaseView mView;
private String mErrorMsg;
protected ILoadingDialogView mDialogView;
protected String msg = "正在加载中...";
private boolean isShowError = true;



protected BaseObserver(BaseView view){
this.mView = view;
this.mDialogView = view;
}

protected BaseObserver(BaseView view, String errorMsg){
this.mView = view;
this.mErrorMsg = errorMsg;
protected BaseObserver(BaseView view, String msg1){
mView = view;
mDialogView = view;
msg = msg1;
}

protected BaseObserver(BaseView view,ILoadingDialogView dialogView , String msg1){
mView = view;
mDialogView = dialogView;
msg = msg1;
}

protected BaseObserver(BaseView view, boolean isShowError){
Expand All @@ -54,14 +69,26 @@ protected BaseObserver(BaseView view, String errorMsg, boolean isShowError){
protected void onStart() {
super.onStart();

if (mDialogView != null){
mDialogView.showHUD(msg);
}

Activity currentActivity = ActivityUtil.getInstance().currentActivity();
if (currentActivity != null && !NetUtils.isNetConnected(currentActivity)) {
Toast.makeText(currentActivity, "当前无网络", Toast.LENGTH_SHORT).show();
onComplete();
}

}

/**
* 执行结果
*/
@Override
public void onComplete() {

if (mDialogView != null) {
mDialogView.dismissHUD();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package com.example.tome.component_base.base;

import android.app.Activity;

import com.example.tome.component_base.helper.HUDFactory;
import com.example.tome.component_base.util.ActivityUtil;
import com.example.tome.component_base.util.L;
import com.example.tome.component_base.util.T;
import com.kaopiz.kprogresshud.KProgressHUD;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

Expand All @@ -9,9 +17,9 @@
* @描述 ${管理事件流订阅的生命周期CompositeDisposable}
*/

public class BasePresenter<T extends BaseView> implements AbstractPresenter<T> {
public class BasePresenter<V extends BaseView> implements AbstractPresenter<V> {

protected T mView;
protected V mView;
private CompositeDisposable compositeDisposable;

protected void addSubscribe(Disposable disposable) {
Expand All @@ -22,7 +30,7 @@ protected void addSubscribe(Disposable disposable) {
}

@Override
public void attachView(T view) {
public void attachView(V view) {
this.mView = view;
}

Expand All @@ -33,4 +41,6 @@ public void detachView() {
compositeDisposable.clear();
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @描述 ${v接口}
*/

public interface BaseView {
public interface BaseView extends ILoadingDialogView {

void onSuccess();

Expand All @@ -16,13 +16,4 @@ public interface BaseView {

void showLoading();

/**
* 显示Dialog
*/
void showHUD();

/**
* 关闭Dialog
*/
void dismissHUD();
}
Loading

0 comments on commit 102c0a4

Please sign in to comment.