Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
门心叼龙
MVPArms
提交
97bf1a2f
M
MVPArms
项目概览
门心叼龙
/
MVPArms
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
MVPArms
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
97bf1a2f
编写于
2月 21, 2017
作者:
J
jessyan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ActivityLifecycle
上级
d9167da2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
76 addition
and
10 deletion
+76
-10
app/src/main/java/me/jessyan/mvparms/demo/app/EventBusTags.java
...c/main/java/me/jessyan/mvparms/demo/app/EventBusTags.java
+1
-1
arms/src/main/java/com/jess/arms/base/ActivityLifecycle.java
arms/src/main/java/com/jess/arms/base/ActivityLifecycle.java
+69
-0
arms/src/main/java/com/jess/arms/base/BaseApplication.java
arms/src/main/java/com/jess/arms/base/BaseApplication.java
+6
-1
arms/src/main/java/com/jess/arms/base/Config.java
arms/src/main/java/com/jess/arms/base/Config.java
+0
-8
未找到文件。
app/src/main/java/me/jessyan/mvparms/demo/app/EventBusTag.java
→
app/src/main/java/me/jessyan/mvparms/demo/app/EventBusTag
s
.java
浏览文件 @
97bf1a2f
...
...
@@ -4,6 +4,6 @@ package me.jessyan.mvparms.demo.app;
* Created by jess on 8/30/16 16:39
* Contact with jess.yan.effort@gmail.com
*/
public
interface
EventBusTag
{
public
interface
EventBusTag
s
{
}
arms/src/main/java/com/jess/arms/base/ActivityLifecycle.java
0 → 100644
浏览文件 @
97bf1a2f
package
com.jess.arms.base
;
import
android.app.Activity
;
import
android.app.Application
;
import
android.os.Bundle
;
import
javax.inject.Inject
;
import
javax.inject.Singleton
;
import
static
com
.
jess
.
arms
.
base
.
BaseActivity
.
IS_NOT_ADD_ACTIVITY_LIST
;
/**
* Created by jess on 21/02/2017 14:23
* Contact with jess.yan.effort@gmail.com
*/
@Singleton
public
class
ActivityLifecycle
implements
Application
.
ActivityLifecycleCallbacks
{
private
AppManager
mAppManager
;
@Inject
public
ActivityLifecycle
(
AppManager
appManager
)
{
this
.
mAppManager
=
appManager
;
}
@Override
public
void
onActivityCreated
(
Activity
activity
,
Bundle
savedInstanceState
)
{
//如果intent包含了此字段,并且为true说明不加入到list
// 默认为false,如果不需要管理(比如不需要在退出所有activity(killAll)时,退出此activity就在intent加此字段为true)
boolean
isNotAdd
=
false
;
if
(
activity
.
getIntent
()
!=
null
)
isNotAdd
=
activity
.
getIntent
().
getBooleanExtra
(
IS_NOT_ADD_ACTIVITY_LIST
,
false
);
if
(!
isNotAdd
)
mAppManager
.
addActivity
((
BaseActivity
)
activity
);
}
@Override
public
void
onActivityStarted
(
Activity
activity
)
{
}
@Override
public
void
onActivityResumed
(
Activity
activity
)
{
mAppManager
.
setCurrentActivity
((
BaseActivity
)
activity
);
}
@Override
public
void
onActivityPaused
(
Activity
activity
)
{
if
(
mAppManager
.
getCurrentActivity
()
==
activity
)
{
mAppManager
.
setCurrentActivity
(
null
);
}
}
@Override
public
void
onActivityStopped
(
Activity
activity
)
{
}
@Override
public
void
onActivitySaveInstanceState
(
Activity
activity
,
Bundle
outState
)
{
}
@Override
public
void
onActivityDestroyed
(
Activity
activity
)
{
mAppManager
.
removeActivity
((
BaseActivity
)
activity
);
}
}
arms/src/main/java/com/jess/arms/base/BaseApplication.java
浏览文件 @
97bf1a2f
...
...
@@ -30,6 +30,8 @@ public abstract class BaseApplication extends Application {
private
GlobeConfigModule
mGlobeConfigModule
;
@Inject
protected
AppManager
mAppManager
;
@Inject
protected
ActivityLifecycle
mActivityLifecycle
;
protected
final
String
TAG
=
this
.
getClass
().
getSimpleName
();
...
...
@@ -46,7 +48,7 @@ public abstract class BaseApplication extends Application {
this
.
mImagerModule
=
new
ImageModule
();
//图片加载框架默认使用glide
this
.
mClientModule
=
new
ClientModule
(
mAppManager
);
//用于提供okhttp和retrofit的单例
this
.
mGlobeConfigModule
=
checkNotNull
(
getGlobeConfigModule
(),
"lobeConfigModule is required"
);
registerActivityLifecycleCallbacks
(
mActivityLifecycle
);
}
/**
...
...
@@ -61,6 +63,9 @@ public abstract class BaseApplication extends Application {
this
.
mAppModule
=
null
;
if
(
mImagerModule
!=
null
)
this
.
mImagerModule
=
null
;
if
(
mActivityLifecycle
!=
null
)
{
unregisterActivityLifecycleCallbacks
(
mActivityLifecycle
);
}
if
(
mAppManager
!=
null
)
{
//释放资源
this
.
mAppManager
.
release
();
this
.
mAppManager
=
null
;
...
...
arms/src/main/java/com/jess/arms/base/Config.java
已删除
100644 → 0
浏览文件 @
d9167da2
package
com.jess.arms.base
;
/**
* Created by jess on 8/30/16 17:00
* Contact with jess.yan.effort@gmail.com
*/
public
class
Config
{
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录