Skip to content
项目
Groups
代码片段
帮助
正在加载...
Sign in / Register
Toggle navigation
W
workoffice
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图表
统计图
Create a new issue
作业
提交
议题看板
Open sidebar
冷广德
workoffice
Commits
e24665d5
提交
e24665d5
authored
6月 26, 2020
作者:
lgd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.推送1.0,待确认
上级
21ae58f1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
87 行增加
和
13 行删除
+87
-13
build.gradle
app/build.gradle
+0
-4
NotifyEvent.java
...c/main/java/com/wd/workoffice/bean/event/NotifyEvent.java
+25
-0
JPushReceive.java
...src/main/java/com/wd/workoffice/service/JPushReceive.java
+10
-2
MainActivity.java
...main/java/com/wd/workoffice/ui/activity/MainActivity.java
+31
-7
DataKeeper.java
app/src/main/java/com/wd/workoffice/util/DataKeeper.java
+21
-0
没有找到文件。
app/build.gradle
浏览文件 @
e24665d5
...
...
@@ -70,13 +70,9 @@ dependencies {
//rxjava依赖
implementation
'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation
'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
//沉浸式
implementation
'com.gyf.immersionbar:immersionbar:2.3.3'
// glide 依赖
implementation
'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor
'com.github.bumptech.glide:compiler:4.11.0'
//banner依赖
implementation
'com.youth.banner:banner:1.4.9'
//design库
implementation
'com.google.android.material:material:1.0.0-beta01'
//recyclerview
...
...
app/src/main/java/com/wd/workoffice/bean/event/NotifyEvent.java
0 → 100644
浏览文件 @
e24665d5
package
com
.
wd
.
workoffice
.
bean
.
event
;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public
class
NotifyEvent
{
int
type
;
// 0, 通知,1,是点击
String
msgType
;
// approval 审批 notice 消息
public
NotifyEvent
(
int
type
,
String
msgType
)
{
this
.
type
=
type
;
this
.
msgType
=
msgType
;
}
public
int
getType
()
{
return
type
;
}
public
String
getMsgType
()
{
return
msgType
;
}
}
app/src/main/java/com/wd/workoffice/service/JPushReceive.java
浏览文件 @
e24665d5
...
...
@@ -6,7 +6,12 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.util.Log
;
import
com.wd.workoffice.bean.event.NotifyEvent
;
import
com.wd.workoffice.ui.activity.MainActivity
;
import
com.wd.workoffice.util.DataKeeper
;
import
com.wd.workoffice.util.UserKeeper
;
import
org.greenrobot.eventbus.EventBus
;
import
cn.jpush.android.api.JPushInterface
;
...
...
@@ -44,17 +49,20 @@ public class JPushReceive extends BroadcastReceiver {
Log
.
d
(
TAG
,
"[MyReceiver] 接收到推送下来的通知"
);
int
notifactionId
=
bundle
.
getInt
(
JPushInterface
.
EXTRA_NOTIFICATION_ID
);
Log
.
d
(
TAG
,
"[MyReceiver] 接收到推送下来的通知的ID: "
+
notifactionId
);
//TODO 判断消息.审核无动作,消息维系按钮
DataKeeper
.
getInstance
().
keepMsgStatus
(
true
);
EventBus
.
getDefault
().
post
(
new
NotifyEvent
(
0
,
"notice"
));
}
else
if
(
JPushInterface
.
ACTION_NOTIFICATION_OPENED
.
equals
(
intent
.
getAction
()))
{
Log
.
d
(
TAG
,
"[MyReceiver] 用户点击打开了通知"
);
//TODO 判断消息,审核跳转,消息无动作
//打开自定义的Activity
Intent
i
=
new
Intent
(
context
,
MainActivity
.
class
);
i
.
putExtras
(
bundle
);
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
context
.
startActivity
(
i
);
EventBus
.
getDefault
().
post
(
new
NotifyEvent
(
1
,
"approval"
));
}
else
if
(
JPushInterface
.
ACTION_RICHPUSH_CALLBACK
.
equals
(
intent
.
getAction
()))
{
Log
.
d
(
TAG
,
"[MyReceiver] 用户收到到RICH PUSH CALLBACK: "
+
bundle
.
getString
(
JPushInterface
.
EXTRA_EXTRA
));
//在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..
...
...
app/src/main/java/com/wd/workoffice/ui/activity/MainActivity.java
浏览文件 @
e24665d5
...
...
@@ -11,12 +11,15 @@ import android.widget.RelativeLayout;
import
com.ashokvarma.bottomnavigation.BottomNavigationBar
;
import
com.ashokvarma.bottomnavigation.BottomNavigationItem
;
import
com.ashokvarma.bottomnavigation.ShapeBadgeItem
;
import
com.ashokvarma.bottomnavigation.TextBadgeItem
;
import
com.qmuiteam.qmui.util.QMUIStatusBarHelper
;
import
com.wd.workoffice.R
;
import
com.wd.workoffice.app.WorkBaseActivity
;
import
com.wd.workoffice.bean.event.MesLoginEvent
;
import
com.wd.workoffice.bean.event.NotifyEvent
;
import
com.wd.workoffice.bean.event.RefreshTokenEvent
;
import
com.wd.workoffice.ui.activity.bat.approval.WorkApprovalActivity
;
import
com.wd.workoffice.ui.activity.login.LoginActivity
;
import
com.wd.workoffice.ui.activity.mes.MesLoginActivity
;
import
com.wd.workoffice.ui.adapter.VpMainAdapter
;
...
...
@@ -25,6 +28,7 @@ import com.wd.workoffice.ui.fg.MesFragment;
import
com.wd.workoffice.ui.fg.MsgFragment
;
import
com.wd.workoffice.ui.fg.MyFragment
;
import
com.wd.workoffice.ui.fg.WorkFragment
;
import
com.wd.workoffice.util.DataKeeper
;
import
com.wd.workoffice.util.UserKeeper
;
import
com.wd.workoffice.util.WorkUtils
;
...
...
@@ -54,8 +58,8 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
private
ArrayList
<
Fragment
>
fragments
;
private
FragmentManager
fm
;
private
TextBadgeItem
numberBadgeItem
;
private
int
oldPosition
;
private
ShapeBadgeItem
shapeBadgeItem
;
// private MainActivityPresenter mainPresenter;
@Override
...
...
@@ -71,10 +75,9 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
bnbMainBottomBar
.
setMode
(
BottomNavigationBar
.
MODE_FIXED
);
bnbMainBottomBar
.
setBackgroundStyle
(
BottomNavigationBar
.
BACKGROUND_STYLE_STATIC
);
bnbMainBottomBar
.
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
white
));
// numberBadgeItem = new TextBadgeItem();
// numberBadgeItem.setBorderWidth(4)
// .setBackgroundColorResource(R.color.red)
// .setText("0");
shapeBadgeItem
=
new
ShapeBadgeItem
();
shapeBadgeItem
.
setShape
(
ShapeBadgeItem
.
SHAPE_OVAL
);
shapeIsShow
();
bnbMainBottomBar
.
addItem
(
new
BottomNavigationItem
(
R
.
mipmap
.
main_bat_choose
,
"首页"
).
setActiveColorResource
(
R
.
color
.
main_icon_select
).
...
...
@@ -87,7 +90,7 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
setInactiveIconResource
(
R
.
mipmap
.
main_mes
))
.
addItem
(
new
BottomNavigationItem
(
R
.
mipmap
.
main_msg_choose
,
"消息"
).
setActiveColorResource
(
R
.
color
.
main_icon_select
).
setInActiveColorResource
(
R
.
color
.
main_icon
).
setInactiveIconResource
(
R
.
mipmap
.
main_msg
))
setInactiveIconResource
(
R
.
mipmap
.
main_msg
)
.
setBadgeItem
(
shapeBadgeItem
)
)
.
addItem
(
new
BottomNavigationItem
(
R
.
mipmap
.
main_my_choose
,
"我的"
)
.
setActiveColorResource
(
R
.
color
.
main_icon_select
).
setInActiveColorResource
(
R
.
color
.
main_icon
).
setInactiveIconResource
(
R
.
mipmap
.
main_my
))
...
...
@@ -104,6 +107,7 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
// }
}
@Override
protected
void
initData
()
{
...
...
@@ -158,6 +162,8 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
startActivity
(
MesLoginActivity
.
class
);
return
;
}
DataKeeper
.
getInstance
().
keepMsgStatus
(
false
);
shapeBadgeItem
.
hide
(
true
);
}
oldPosition
=
position
;
mainContent
.
setCurrentItem
(
position
);
...
...
@@ -197,7 +203,17 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
super
.
onBackPressed
();
}
}
/**
* 消息红点是否显示
*/
private
void
shapeIsShow
()
{
Boolean
msgStatus
=
DataKeeper
.
getInstance
().
getMsgStatus
();
if
(
msgStatus
)
{
shapeBadgeItem
.
show
();
}
else
{
shapeBadgeItem
.
hide
();
}
}
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
public
void
login
(
LoginEvent
lg
)
{
if
(!
UserKeeper
.
getInstance
().
getMesLogin
())
{
...
...
@@ -220,4 +236,12 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
}
}
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
public
void
notify
(
NotifyEvent
event
)
{
if
(
event
.
getType
()
==
0
)
{
shapeIsShow
();
}
else
{
startActivity
(
WorkApprovalActivity
.
class
,
"type"
,
"2"
,
"status"
,
"0"
,
"title"
,
"待我审批"
);
}
}
}
app/src/main/java/com/wd/workoffice/util/DataKeeper.java
浏览文件 @
e24665d5
...
...
@@ -12,6 +12,8 @@ public class DataKeeper {
private
SPUtils
sp
=
SPUtils
.
getInstance
(
"DataKeeper"
);
private
final
String
MES_MENU_ID
=
"MES_MENU_ID"
;
private
final
String
MES_MENU
=
"MES_MENU"
;
private
final
String
MSG_STATUS
=
"MSG_STATUS"
;
private
DataKeeper
()
{
}
...
...
@@ -43,6 +45,24 @@ public class DataKeeper {
sp
.
put
(
MES_MENU
,
""
);
}
/**
* 消息红点状态
*
* @param info
*/
public
void
keepMsgStatus
(
Boolean
info
)
{
sp
.
put
(
MSG_STATUS
,
info
);
}
public
Boolean
getMsgStatus
()
{
return
sp
.
getBoolean
(
MSG_STATUS
);
}
public
void
clearMsgStatus
()
{
sp
.
put
(
MSG_STATUS
,
false
);
}
// /**
// * mes菜单id
// *
...
...
@@ -62,5 +82,6 @@ public class DataKeeper {
public
void
clearAll
()
{
clearMenu
();
clearMsgStatus
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论