Skip to content

Commit

Permalink
结构调整
Browse files Browse the repository at this point in the history
  • Loading branch information
beaven11 committed Jun 4, 2018
1 parent c3573ed commit 3c5a7b0
Show file tree
Hide file tree
Showing 39 changed files with 96 additions and 193 deletions.
28 changes: 20 additions & 8 deletions app/src/main/java/com/zhuazhu/frame/app/FrameApplication.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package com.zhuazhu.frame.app

import android.app.Application
import android.view.View
import com.squareup.leakcanary.LeakCanary
import com.zhuazhu.frame.BuildConfig
import com.zhuazhu.frame.R
import com.zhuazhu.frame.di.component.AppComponent
import com.zhuazhu.frame.di.component.DaggerAppComponent
import com.zhuazhu.frame.mvp.image.ImageActivity
import conm.zhuazhu.common.utils.Utils
import mejust.frame.FrameManager
import mejust.frame.config.FrameConfig
import mejust.frame.image.ImageConfig
import mejust.frame.annotation.TitleBarMenuLocation
import mejust.frame.common.image.ImageConfig
import mejust.frame.data.FrameConfig
import mejust.frame.di.component.FrameComponent
import mejust.frame.net.config.NetConfig
import mejust.frame.widget.title.TitleBarSetting
import mejust.frame.widget.title.TitleBarSetting.TitleMenu

/**
* @author wangpeifeng
Expand All @@ -28,12 +34,11 @@ class FrameApplication : Application() {
return
}
LeakCanary.install(this)
initLibrary()
appComponent = DaggerAppComponent.builder().frameComponent(FrameManager.getFrameComponent())
.build()
val frameComponent = initLibrary()
appComponent = DaggerAppComponent.builder().frameComponent(frameComponent).build()
}

private fun initLibrary() {
private fun initLibrary(): FrameComponent {
val imageConfig = ImageConfig().apply {
hostUrl = BuildConfig.IMAGE_URL
placeholderResId = R.drawable.ic_launcher_background
Expand All @@ -45,9 +50,16 @@ class FrameApplication : Application() {
}
val frameConfig = FrameConfig().apply {
isDebug = BuildConfig.DEBUG
isOpenNetworkState = false
isOpenNetworkState = true
loginClass = ImageActivity::class.java
titleBarSetting = TitleBarSetting.Builder()
.addTitleMenu(TitleMenu(TitleBarMenuLocation.leftFirstMenu).apply {
setIconDrawableRes(this@FrameApplication, R.drawable.ic_arrow_back_white)
clickListener = View.OnClickListener {
Utils.getTopActivity().finish()
}
}).build()
}
FrameManager.init(this, imageConfig, netConfig, frameConfig)
return FrameManager.init(this, imageConfig, netConfig, frameConfig)
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/zhuazhu/frame/data/ApiOne.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.zhuazhu.frame.data

import com.zhuazhu.frame.mvp.http.model.ResultOne
import io.reactivex.Observable
import mejust.frame.annotation.ServiceUrl
import mejust.frame.data.annotation.ServiceUrl
import retrofit2.http.GET

/**
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/zhuazhu/frame/data/ApiTwo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.zhuazhu.frame.data

import com.zhuazhu.frame.mvp.http.model.ResultOne
import io.reactivex.Observable
import mejust.frame.annotation.ServiceUrl
import mejust.frame.data.annotation.ServiceUrl
import retrofit2.http.GET

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.zhuazhu.frame.mvp.http.presenter.HttpPresenter
import kotlinx.android.synthetic.main.activity_http.bt_get
import kotlinx.android.synthetic.main.activity_http.bt_test
import kotlinx.android.synthetic.main.activity_http.text_http_result
import mejust.frame.annotation.LayoutId
import mejust.frame.data.annotation.LayoutId
import mejust.frame.annotation.TitleBarConfig
import mejust.frame.common.log.Logger
import mejust.frame.mvp.view.BasePresenterActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import android.widget.LinearLayout
import com.zhuazhu.frame.mvp.image.ImageAdapter.ImageHolder
import conm.zhuazhu.common.utils.ScreenUtils
import mejust.frame.FrameManager
import mejust.frame.image.ImageLoadConfig
import mejust.frame.common.image.ImageLoadConfig
import java.io.File

/**
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<application>
<service
android:name=".upgrade.UpgradeDownloadService"
android:name=".common.upgrade.UpgradeDownloadService"
android:exported="false">

</service>
Expand Down
26 changes: 14 additions & 12 deletions library/src/main/java/mejust/frame/FrameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import android.app.Application;
import android.support.annotation.NonNull;
import conm.zhuazhu.common.utils.Utils;
import mejust.frame.app.CrashHandler;
import mejust.frame.common.CrashHandler;
import mejust.frame.common.json.IJsonManager;
import mejust.frame.common.log.DebugLogTree;
import mejust.frame.common.log.ReleaseLogTree;
import mejust.frame.config.FrameConfig;
import mejust.frame.data.FrameConfig;
import mejust.frame.di.component.DaggerFrameComponent;
import mejust.frame.di.component.FrameComponent;
import mejust.frame.image.IImageLoadManager;
import mejust.frame.image.ImageConfig;
import mejust.frame.common.image.IImageLoadManager;
import mejust.frame.common.image.ImageConfig;
import mejust.frame.net.NetManager;
import mejust.frame.net.config.NetConfig;
import mejust.frame.widget.ToastFrame;
Expand All @@ -23,17 +23,17 @@
*/
public class FrameManager {

private static FrameComponent frameComponent;

private static IImageLoadManager imageLoadManager;

private static NetManager netManager;

private static IJsonManager iJsonManager;

public static void init(Application application, ImageConfig imageConfig, NetConfig netConfig,
FrameConfig frameConfig) {
frameComponent = DaggerFrameComponent.builder()
private static FrameConfig frameConfig;

public static FrameComponent init(Application application, ImageConfig imageConfig,
NetConfig netConfig, FrameConfig frameConfig) {
FrameComponent frameComponent = DaggerFrameComponent.builder()
.application(application)
.imageConfig(imageConfig)
.netConfig(netConfig)
Expand All @@ -42,6 +42,7 @@ public static void init(Application application, ImageConfig imageConfig, NetCon
imageLoadManager = frameComponent.imageLoadManager();
netManager = frameComponent.netManager();
iJsonManager = frameComponent.jsonManager();
FrameManager.frameConfig = frameConfig;
if (frameConfig.isDebug()) {
Timber.plant(new DebugLogTree());
} else {
Expand All @@ -50,9 +51,6 @@ public static void init(Application application, ImageConfig imageConfig, NetCon
Utils.init(application);
ToastFrame.init(application);
CrashHandler.getInstance().init(application);
}

public static FrameComponent getFrameComponent() {
return frameComponent;
}

Expand Down Expand Up @@ -84,4 +82,8 @@ public static IJsonManager jsonManager() {
}
return iJsonManager;
}

public static FrameConfig provideFrameConfig() {
return frameConfig;
}
}
95 changes: 0 additions & 95 deletions library/src/main/java/mejust/frame/app/AppConfig.java

This file was deleted.

32 changes: 0 additions & 32 deletions library/src/main/java/mejust/frame/app/ConfigInterface.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.app;
package mejust.frame.common;

import android.content.Context;
import android.content.pm.PackageInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.image;
package mejust.frame.common.image;

import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.image;
package mejust.frame.common.image;

import android.widget.ImageView;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.image;
package mejust.frame.common.image;

/**
* @author wangpeifeng
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.image;
package mejust.frame.common.image;

/**
* @author wangpeifeng
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.image;
package mejust.frame.common.image;

import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.upgrade;
package mejust.frame.common.upgrade;

import android.content.Context;
import android.os.Bundle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.upgrade;
package mejust.frame.common.upgrade;

import android.os.Bundle;
import android.os.Handler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.upgrade;
package mejust.frame.common.upgrade;

import android.app.NotificationChannel;
import android.app.NotificationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.upgrade;
package mejust.frame.common.upgrade;

/**
* 创建时间: 2018/03/09 17:37<br>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.upgrade;
package mejust.frame.common.upgrade;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.upgrade;
package mejust.frame.common.upgrade;

import android.support.annotation.IntDef;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.upgrade;
package mejust.frame.common.upgrade;

import android.content.Context;
import android.content.Intent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mejust.frame.upgrade;
package mejust.frame.common.upgrade;

import android.app.IntentService;
import android.content.Context;
Expand Down
Loading

0 comments on commit 3c5a7b0

Please sign in to comment.