Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RvApp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lify
RvApp
Commits
b5a6f627
Commit
b5a6f627
authored
Sep 10, 2019
by
linfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的发布删除
parent
2bb34864
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
910 additions
and
177 deletions
+910
-177
AndroidManifest.xml
RvClient/src/main/AndroidManifest.xml
+6
-5
MainActivity.java
RvClient/src/main/java/com/xxfc/rv/MainActivity.java
+24
-0
MyJPushMessageReceiver.java
...c/main/java/com/xxfc/rv/other/MyJPushMessageReceiver.java
+0
-77
MyReceiver.java
RvClient/src/main/java/com/xxfc/rv/other/MyReceiver.java
+146
-81
logo_title.png
RvClient/src/main/res/drawable-hdpi/logo_title.png
+0
-0
logo_title.png
RvClient/src/main/res/drawable-mdpi/logo_title.png
+0
-0
logo_title.png
RvClient/src/main/res/drawable-xhdpi/logo_title.png
+0
-0
customer_notitfication_layout.xml
...ent/src/main/res/layout/customer_notitfication_layout.xml
+54
-0
build.gradle
RvWrapper/build.gradle
+13
-0
ExampleUtil.java
...rc/main/java/com/ruiwenliu/wrapper/other/ExampleUtil.java
+136
-0
MyJPushMessageReceiver.java
...a/com/ruiwenliu/wrapper/other/MyJPushMessageReceiver.java
+34
-0
PushService.java
...rc/main/java/com/ruiwenliu/wrapper/other/PushService.java
+1
-1
TagAliasOperatorHelper.java
...a/com/ruiwenliu/wrapper/other/TagAliasOperatorHelper.java
+339
-0
BottomDeleteDialog.java
...main/java/com/rv/component/dialog/BottomDeleteDialog.java
+1
-1
ApiConfig.java
...e_home/src/main/java/com/rv/home/rv/module/ApiConfig.java
+6
-0
BaseLoginActivity.java
...n/java/com/rv/home/rv/module/basic/BaseLoginActivity.java
+15
-0
MyReleasePatAdapter.java
.../main/java/com/rv/rvmine/adapter/MyReleasePatAdapter.java
+2
-0
MyReleaseVideoAdapter.java
...ain/java/com/rv/rvmine/adapter/MyReleaseVideoAdapter.java
+2
-0
MyReleaseIMTokenBean.java
...rc/main/java/com/rv/rvmine/bean/MyReleaseIMTokenBean.java
+17
-0
MyReleasePatFragment.java
...ain/java/com/rv/rvmine/fragment/MyReleasePatFragment.java
+35
-12
MyReleaseVideoFragment.java
...n/java/com/rv/rvmine/fragment/MyReleaseVideoFragment.java
+61
-0
SettingActivity.java
...src/main/java/com/rv/rvmine/traveler/SettingActivity.java
+18
-0
No files found.
RvClient/src/main/AndroidManifest.xml
View file @
b5a6f627
...
...
@@ -37,6 +37,9 @@
<uses-permission
android:name=
"android.permission.RECORD_AUDIO"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.GET_TASKS"
/>
<uses-permission
android:name=
"com.xxfc.rv.permission.JPUSH_MESSAGE"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_USER_PRESENT"
/>
<!-- 暂时不用 -->
<!-- <uses-permission android:name="android.permission.BLUETOOTH" /> -->
...
...
@@ -257,9 +260,7 @@
<activity
android:name=
"com.rv.home.rv.module.ui.main.home.order.EvaluationActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"com.rv.home.rv.module.ui.main.home.ShareImageActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"com.rv.home.rv.module.ui.main.home.order.CancelTheTripActivity"
android:screenOrientation=
"portrait"
/>
...
...
@@ -394,7 +395,7 @@
<!-- Since JCore2.0.0 Required SDK核心功能-->
<!-- 这个Service要继承JCommonService -->
<service
android:name=
".other.PushService"
android:name=
"
com.ruiwenliu.wrapper
.other.PushService"
android:process=
":pushcore"
>
<intent-filter>
<action
android:name=
"cn.jiguang.user.service.action"
/>
...
...
@@ -402,7 +403,7 @@
</service>
<!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调-->
<receiver
android:name=
".other.MyJPushMessageReceiver"
>
<receiver
android:name=
"
com.ruiwenliu.wrapper
.other.MyJPushMessageReceiver"
>
<intent-filter>
<action
android:name=
"cn.jpush.android.intent.RECEIVE_MESSAGE"
/>
<category
android:name=
"com.xxfc.rv"
></category>
...
...
RvClient/src/main/java/com/xxfc/rv/MainActivity.java
View file @
b5a6f627
package
com
.
xxfc
.
rv
;
import
android.app.AlertDialog
;
import
android.app.Notification
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.DialogInterface
;
...
...
@@ -48,6 +49,7 @@ import com.rv.tourism.TourismFragment;
import
com.rv.version.bean.VersionCheckBean
;
import
com.rv.version.util.DownloadAppUtils
;
import
com.rv.version.util.UpdateAppUtils
;
import
com.squareup.haha.perflib.Main
;
import
com.xxfc.discovery.DiscoveryFragment
;
import
com.yuyife.okgo.OkGoUtil
;
...
...
@@ -59,6 +61,9 @@ import java.util.Map;
import
butterknife.BindView
;
import
butterknife.OnClick
;
import
cn.jpush.android.api.BasicPushNotificationBuilder
;
import
cn.jpush.android.api.CustomPushNotificationBuilder
;
import
cn.jpush.android.api.JPushInterface
;
public
class
MainActivity
extends
BaseActivity
<
CommonPresenter
>
{
...
...
@@ -124,6 +129,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> {
viewPager
.
setOffscreenPageLimit
(
5
);
setCurrent
(
TYPE_HOME_PAGE
);
registerNetWorkListener
();
initNotification
();
SwitchFragment
.
setFragmentSelected
(
postion
->
setCurrent
(
postion
));
if
(!
isGpsOpen
())
{
...
...
@@ -140,6 +146,24 @@ public class MainActivity extends BaseActivity<CommonPresenter> {
}
}
private
void
initNotification
()
{
BasicPushNotificationBuilder
builder
=
new
BasicPushNotificationBuilder
(
mActivity
);
builder
.
statusBarDrawable
=
R
.
drawable
.
logo_title
;
builder
.
notificationFlags
=
Notification
.
FLAG_AUTO_CANCEL
|
Notification
.
FLAG_SHOW_LIGHTS
;
//设置为自动消失和呼吸灯闪烁
builder
.
notificationDefaults
=
Notification
.
DEFAULT_SOUND
|
Notification
.
DEFAULT_VIBRATE
|
Notification
.
DEFAULT_LIGHTS
;
// 设置为铃声、震动、呼吸灯闪烁都要
JPushInterface
.
setPushNotificationBuilder
(
1
,
builder
);
JPushInterface
.
setDefaultPushNotificationBuilder
(
builder
);
// CustomPushNotificationBuilder builder2 = new CustomPushNotificationBuilder(mActivity, R.layout.customer_notitfication_layout, R.id.icon, R.id.title, R.id.text,R.id.time);
// builder2.statusBarDrawable = R.drawable.logo_title;
// builder2.layoutIconDrawable = R.mipmap.logo;
// builder2.developerArg0 = "developerArg2";
// JPushInterface.setPushNotificationBuilder(2, builder2);
}
private
boolean
isGpsOpen
()
{
LocationManager
locationManager
=
(
LocationManager
)
this
.
getSystemService
(
Context
.
LOCATION_SERVICE
);
...
...
RvClient/src/main/java/com/xxfc/rv/other/MyJPushMessageReceiver.java
deleted
100644 → 0
View file @
2bb34864
package
com
.
xxfc
.
rv
.
other
;
import
android.content.Context
;
import
android.util.Log
;
import
cn.jpush.android.api.CustomMessage
;
import
cn.jpush.android.api.JPushMessage
;
import
cn.jpush.android.api.NotificationMessage
;
import
cn.jpush.android.service.JPushMessageReceiver
;
/**
* 自定义JPush message 接收器,包括操作tag/alias的结果返回(仅仅包含tag/alias新接口部分)
* */
public
class
MyJPushMessageReceiver
extends
JPushMessageReceiver
{
private
static
final
String
TAG
=
"JIGUANG"
;
/**
* TODO 连接极光服务器
*/
@Override
public
void
onConnected
(
Context
context
,
boolean
b
)
{
super
.
onConnected
(
context
,
b
);
Log
.
e
(
TAG
,
"onConnected"
);
}
/**
* TODO 注册极光时的回调
*/
@Override
public
void
onRegister
(
Context
context
,
String
s
)
{
super
.
onRegister
(
context
,
s
);
Log
.
e
(
TAG
,
"onRegister"
+
s
);
}
/**
* TODO 注册以及解除注册别名时回调
*/
@Override
public
void
onAliasOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
)
{
super
.
onAliasOperatorResult
(
context
,
jPushMessage
);
Log
.
e
(
TAG
,
jPushMessage
.
toString
());
}
/**
* TODO 接收到推送下来的通知
* 可以利用附加字段(notificationMessage.notificationExtras)来区别Notication,指定不同的动作,附加字段是个json字符串
* 通知(Notification),指在手机的通知栏(状态栏)上会显示的一条通知信息
*/
@Override
public
void
onNotifyMessageArrived
(
Context
context
,
NotificationMessage
notificationMessage
)
{
super
.
onNotifyMessageArrived
(
context
,
notificationMessage
);
Log
.
e
(
TAG
,
notificationMessage
.
toString
());
}
/**
* TODO 打开了通知
* notificationMessage.notificationExtras(附加字段)的内容处理代码
* 比如打开新的Activity, 打开一个网页等..
*/
@Override
public
void
onNotifyMessageOpened
(
Context
context
,
NotificationMessage
notificationMessage
)
{
super
.
onNotifyMessageOpened
(
context
,
notificationMessage
);
Log
.
e
(
TAG
,
notificationMessage
.
notificationExtras
);
}
/**
* TODO 接收到推送下来的自定义消息
* 自定义消息不是通知,默认不会被SDK展示到通知栏上,极光推送仅负责透传给SDK。其内容和展示形式完全由开发者自己定义。
* 自定义消息主要用于应用的内部业务逻辑和特殊展示需求
*/
@Override
public
void
onMessage
(
Context
context
,
CustomMessage
customMessage
)
{
super
.
onMessage
(
context
,
customMessage
);
Log
.
e
(
TAG
,
"onMessage"
);
}
}
RvClient/src/main/java/com/xxfc/rv/other/MyReceiver.java
View file @
b5a6f627
package
com
.
xxfc
.
rv
.
other
;
import
android.app.ActivityManager
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
...
...
@@ -7,101 +8,165 @@ import android.os.Bundle;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.rv.home.rv.module.ui.main.home.order.OrderListActivity
;
import
com.rv.rvmine.traveler.CollectionActivity
;
import
com.rv.share.ShareActivity
;
import
com.xxfc.rv.MainActivity
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.Iterator
;
import
java.util.List
;
import
cn.jpush.android.api.JPushInterface
;
/**
* 自定义接收器
*
*
<p>
* 如果不定义这个 Receiver,则:
* 1) 默认用户会打开主界面
* 2) 接收不到自定义消息
*/
public
class
MyReceiver
extends
BroadcastReceiver
{
private
static
final
String
TAG
=
"JIGUANG-Example"
;
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
try
{
Bundle
bundle
=
intent
.
getExtras
();
Log
.
d
(
TAG
,
"[MyReceiver] onReceive - "
+
intent
.
getAction
()
+
", extras: "
+
printBundle
(
bundle
));
if
(
JPushInterface
.
ACTION_REGISTRATION_ID
.
equals
(
intent
.
getAction
()))
{
String
regId
=
bundle
.
getString
(
JPushInterface
.
EXTRA_REGISTRATION_ID
);
Log
.
d
(
TAG
,
"[MyReceiver] 接收Registration Id : "
+
regId
);
//send the Registration Id to your server...
}
else
if
(
JPushInterface
.
ACTION_MESSAGE_RECEIVED
.
equals
(
intent
.
getAction
()))
{
Log
.
d
(
TAG
,
"[MyReceiver] 接收到推送下来的自定义消息: "
+
bundle
.
getString
(
JPushInterface
.
EXTRA_MESSAGE
));
}
else
if
(
JPushInterface
.
ACTION_NOTIFICATION_RECEIVED
.
equals
(
intent
.
getAction
()))
{
Log
.
d
(
TAG
,
"[MyReceiver] 接收到推送下来的通知"
);
int
notifactionId
=
bundle
.
getInt
(
JPushInterface
.
EXTRA_NOTIFICATION_ID
);
Log
.
d
(
TAG
,
"[MyReceiver] 接收到推送下来的通知的ID: "
+
notifactionId
);
}
else
if
(
JPushInterface
.
ACTION_NOTIFICATION_OPENED
.
equals
(
intent
.
getAction
()))
{
Log
.
d
(
TAG
,
"[MyReceiver] 用户点击打开了通知"
);
// //打开自定义的Activity
// Intent i = new Intent(context, TestActivity.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);
}
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, 打开一个网页等..
}
else
if
(
JPushInterface
.
ACTION_CONNECTION_CHANGE
.
equals
(
intent
.
getAction
()))
{
boolean
connected
=
intent
.
getBooleanExtra
(
JPushInterface
.
EXTRA_CONNECTION_CHANGE
,
false
);
Log
.
w
(
TAG
,
"[MyReceiver]"
+
intent
.
getAction
()
+
" connected state change to "
+
connected
);
}
else
{
Log
.
d
(
TAG
,
"[MyReceiver] Unhandled intent - "
+
intent
.
getAction
());
}
}
catch
(
Exception
e
){
}
}
// 打印所有的 intent extra 数据
private
static
String
printBundle
(
Bundle
bundle
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
String
key
:
bundle
.
keySet
())
{
if
(
key
.
equals
(
JPushInterface
.
EXTRA_NOTIFICATION_ID
))
{
sb
.
append
(
"\nkey:"
+
key
+
", value:"
+
bundle
.
getInt
(
key
));
}
else
if
(
key
.
equals
(
JPushInterface
.
EXTRA_CONNECTION_CHANGE
)){
sb
.
append
(
"\nkey:"
+
key
+
", value:"
+
bundle
.
getBoolean
(
key
));
}
else
if
(
key
.
equals
(
JPushInterface
.
EXTRA_EXTRA
))
{
if
(
TextUtils
.
isEmpty
(
bundle
.
getString
(
JPushInterface
.
EXTRA_EXTRA
)))
{
Log
.
i
(
TAG
,
"This message has no Extra data"
);
continue
;
}
try
{
JSONObject
json
=
new
JSONObject
(
bundle
.
getString
(
JPushInterface
.
EXTRA_EXTRA
));
Iterator
<
String
>
it
=
json
.
keys
();
while
(
it
.
hasNext
())
{
String
myKey
=
it
.
next
();
sb
.
append
(
"\nkey:"
+
key
+
", value: ["
+
myKey
+
" - "
+
json
.
optString
(
myKey
)
+
"]"
);
}
}
catch
(
JSONException
e
)
{
Log
.
e
(
TAG
,
"Get message extra JSON error!"
);
}
}
else
{
sb
.
append
(
"\nkey:"
+
key
+
", value:"
+
bundle
.
get
(
key
));
}
}
return
sb
.
toString
();
}
private
static
final
String
TAG
=
"tagtag"
;
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
try
{
Bundle
bundle
=
intent
.
getExtras
();
Log
.
d
(
TAG
,
"[MyReceiver] onReceive - "
+
intent
.
getAction
()
+
", extras: "
+
printBundle
(
bundle
));
if
(
JPushInterface
.
ACTION_REGISTRATION_ID
.
equals
(
intent
.
getAction
()))
{
String
regId
=
bundle
.
getString
(
JPushInterface
.
EXTRA_REGISTRATION_ID
);
Log
.
d
(
TAG
,
"[MyReceiver] 接收Registration Id : "
+
regId
);
//send the Registration Id to your server...
}
else
if
(
JPushInterface
.
ACTION_MESSAGE_RECEIVED
.
equals
(
intent
.
getAction
()))
{
Log
.
d
(
TAG
,
"[MyReceiver] 接收到推送下来的自定义消息: "
+
bundle
.
getString
(
JPushInterface
.
EXTRA_MESSAGE
));
}
else
if
(
JPushInterface
.
ACTION_NOTIFICATION_RECEIVED
.
equals
(
intent
.
getAction
()))
{
Log
.
d
(
TAG
,
"[MyReceiver] 接收到推送下来的通知"
);
int
notifactionId
=
bundle
.
getInt
(
JPushInterface
.
EXTRA_NOTIFICATION_ID
);
Log
.
d
(
TAG
,
"[MyReceiver] 接收到推送下来的通知的ID: "
+
notifactionId
);
}
else
if
(
JPushInterface
.
ACTION_NOTIFICATION_OPENED
.
equals
(
intent
.
getAction
()))
{
Log
.
d
(
TAG
,
"[MyReceiver] 用户点击打开了通知"
);
//获取推送消息的方法
String
extra
=
bundle
.
getString
(
JPushInterface
.
EXTRA_EXTRA
);
JSONObject
jsonObject
=
new
JSONObject
(
extra
);
String
onclickType
=
jsonObject
.
getString
(
"onclickType"
);
if
(
isAppRunning
(
context
,
"com.xxfc.rv"
))
{
//判断App是否在运行
Intent
intent2
=
new
Intent
();
intent2
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
switch
(
onclickType
)
{
case
"1"
:
intent2
.
setClass
(
context
,
OrderListActivity
.
class
);
context
.
startActivity
(
intent2
);
break
;
case
"2"
:
intent2
.
setClass
(
context
,
CollectionActivity
.
class
);
context
.
startActivity
(
intent2
);
break
;
case
"3"
:
intent2
.
setClass
(
context
,
ShareActivity
.
class
);
context
.
startActivity
(
intent2
);
break
;
}
}
else
{
Intent
intent3
=
new
Intent
();
intent3
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
Intent
intent4
=
new
Intent
();
intent4
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
intent4
.
setClass
(
context
,
MainActivity
.
class
);
switch
(
onclickType
)
{
case
"1"
:
intent3
.
setClass
(
context
,
OrderListActivity
.
class
);
context
.
startActivity
(
intent3
);
break
;
case
"2"
:
intent3
.
setClass
(
context
,
CollectionActivity
.
class
);
context
.
startActivity
(
intent3
);
break
;
case
"3"
:
intent3
.
setClass
(
context
,
ShareActivity
.
class
);
context
.
startActivity
(
intent3
);
break
;
}
}
}
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, 打开一个网页等..
}
else
if
(
JPushInterface
.
ACTION_CONNECTION_CHANGE
.
equals
(
intent
.
getAction
()))
{
boolean
connected
=
intent
.
getBooleanExtra
(
JPushInterface
.
EXTRA_CONNECTION_CHANGE
,
false
);
Log
.
w
(
TAG
,
"[MyReceiver]"
+
intent
.
getAction
()
+
" connected state change to "
+
connected
);
}
else
{
Log
.
d
(
TAG
,
"[MyReceiver] Unhandled intent - "
+
intent
.
getAction
());
}
}
catch
(
Exception
e
)
{
}
}
// 打印所有的 intent extra 数据
private
static
String
printBundle
(
Bundle
bundle
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
String
key
:
bundle
.
keySet
())
{
if
(
key
.
equals
(
JPushInterface
.
EXTRA_NOTIFICATION_ID
))
{
sb
.
append
(
"\nkey:"
+
key
+
", value:"
+
bundle
.
getInt
(
key
));
}
else
if
(
key
.
equals
(
JPushInterface
.
EXTRA_CONNECTION_CHANGE
))
{
sb
.
append
(
"\nkey:"
+
key
+
", value:"
+
bundle
.
getBoolean
(
key
));
}
else
if
(
key
.
equals
(
JPushInterface
.
EXTRA_EXTRA
))
{
if
(
TextUtils
.
isEmpty
(
bundle
.
getString
(
JPushInterface
.
EXTRA_EXTRA
)))
{
Log
.
i
(
TAG
,
"This message has no Extra data"
);
continue
;
}
try
{
JSONObject
json
=
new
JSONObject
(
bundle
.
getString
(
JPushInterface
.
EXTRA_EXTRA
));
Iterator
<
String
>
it
=
json
.
keys
();
while
(
it
.
hasNext
())
{
String
myKey
=
it
.
next
();
sb
.
append
(
"\nkey:"
+
key
+
", value: ["
+
myKey
+
" - "
+
json
.
optString
(
myKey
)
+
"]"
);
}
}
catch
(
JSONException
e
)
{
Log
.
e
(
TAG
,
"Get message extra JSON error!"
);
}
}
else
{
sb
.
append
(
"\nkey:"
+
key
+
", value:"
+
bundle
.
get
(
key
));
}
}
return
sb
.
toString
();
}
/**
* 方法描述:判断某一应用是否正在运行
*
* @param context 上下文
* @param packageName 应用的包名
* @return true 表示正在运行,false 表示没有运行
*/
public
static
boolean
isAppRunning
(
Context
context
,
String
packageName
)
{
ActivityManager
am
=
(
ActivityManager
)
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
List
<
ActivityManager
.
RunningTaskInfo
>
list
=
am
.
getRunningTasks
(
100
);
if
(
list
.
size
()
<=
0
)
{
return
false
;
}
for
(
ActivityManager
.
RunningTaskInfo
info
:
list
)
{
if
(
info
.
baseActivity
.
getPackageName
().
equals
(
packageName
))
{
return
true
;
}
}
return
false
;
}
}
RvClient/src/main/res/drawable-hdpi/logo_title.png
0 → 100644
View file @
b5a6f627
790 Bytes
RvClient/src/main/res/drawable-mdpi/logo_title.png
0 → 100644
View file @
b5a6f627
662 Bytes
RvClient/src/main/res/drawable-xhdpi/logo_title.png
0 → 100644
View file @
b5a6f627
1.12 KB
RvClient/src/main/res/layout/customer_notitfication_layout.xml
0 → 100644
View file @
b5a6f627
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_rv_bg_translucent_black_half"
android:gravity=
"center_vertical"
android:orientation=
"vertical"
android:paddingTop=
"@dimen/size_5"
android:paddingBottom=
"@dimen/size_5"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/icon"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_5"
android:src=
"@mipmap/logo"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dip"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"2222"
android:textColor=
"#000000"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"444444444444444444"
android:textColor=
"#000000"
android:textSize=
"14sp"
/>
</LinearLayout>
<DateTimeView
android:id=
"@+id/time"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:gravity=
"right"
android:maxLines=
"1"
android:textColor=
"#000000"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
RvWrapper/build.gradle
View file @
b5a6f627
...
...
@@ -9,6 +9,16 @@ android {
versionCode
1
versionName
"1.0"
flavorDimensions
"default"
manifestPlaceholders
=
[
JPUSH_PKGNAME
:
"com.xxfc.rv"
,
JPUSH_APPKEY
:
"530b223034b92715e0295047"
,
//JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL
:
"developer-default"
,
//暂时填写默认值即可.
]
ndk
{
abiFilters
"armeabi"
,
"armeabi-v7a"
,
"x86"
,
"mips"
,
'arm64-v8a'
}
}
buildTypes
{
...
...
@@ -71,4 +81,7 @@ dependencies {
implementation
'com.alibaba:fastjson:1.2.21'
implementation
project
(
':component_utils'
)
implementation
files
(
'libs/tbs_sdk_thirdapp_v3.6.0.1310_43612_sharewithdownload_withoutGame_obfs_20180706_163319.jar'
)
api
'cn.jiguang.sdk:jpush:3.3.4'
// 此处以JPush 3.3.4 版本为例。
api
'cn.jiguang.sdk:jcore:2.1.2'
// 此处以JCore 2.1.2 版本为例。
}
RvWrapper/src/main/java/com/ruiwenliu/wrapper/other/ExampleUtil.java
0 → 100644
View file @
b5a6f627
package
com
.
ruiwenliu
.
wrapper
.
other
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager.NameNotFoundException
;
import
android.net.ConnectivityManager
;
import
android.net.NetworkInfo
;
import
android.os.Bundle
;
import
android.os.Looper
;
import
android.telephony.TelephonyManager
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.widget.Toast
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
cn.jpush.android.api.JPushInterface
;
public
class
ExampleUtil
{
public
static
final
String
PREFS_NAME
=
"JPUSH_EXAMPLE"
;
public
static
final
String
PREFS_DAYS
=
"JPUSH_EXAMPLE_DAYS"
;
public
static
final
String
PREFS_START_TIME
=
"PREFS_START_TIME"
;
public
static
final
String
PREFS_END_TIME
=
"PREFS_END_TIME"
;
public
static
final
String
KEY_APP_KEY
=
"JPUSH_APPKEY"
;
public
static
boolean
isEmpty
(
String
s
)
{
if
(
null
==
s
)
return
true
;
if
(
s
.
length
()
==
0
)
return
true
;
if
(
s
.
trim
().
length
()
==
0
)
return
true
;
return
false
;
}
/**
* 只能以 “+” 或者 数字开头;后面的内容只能包含 “-” 和 数字。
* */
private
final
static
String
MOBILE_NUMBER_CHARS
=
"^[+0-9][-0-9]{1,}$"
;
public
static
boolean
isValidMobileNumber
(
String
s
)
{
if
(
TextUtils
.
isEmpty
(
s
))
return
true
;
Pattern
p
=
Pattern
.
compile
(
MOBILE_NUMBER_CHARS
);
Matcher
m
=
p
.
matcher
(
s
);
return
m
.
matches
();
}
// 校验Tag Alias 只能是数字,英文字母和中文
public
static
boolean
isValidTagAndAlias
(
String
s
)
{
Pattern
p
=
Pattern
.
compile
(
"^[\u4E00-\u9FA50-9a-zA-Z_!@#$&*+=.|]+$"
);
Matcher
m
=
p
.
matcher
(
s
);
return
m
.
matches
();
}
// 取得AppKey
public
static
String
getAppKey
(
Context
context
)
{
Bundle
metaData
=
null
;
String
appKey
=
null
;
try
{
ApplicationInfo
ai
=
context
.
getPackageManager
().
getApplicationInfo
(
context
.
getPackageName
(),
PackageManager
.
GET_META_DATA
);
if
(
null
!=
ai
)
metaData
=
ai
.
metaData
;
if
(
null
!=
metaData
)
{
appKey
=
metaData
.
getString
(
KEY_APP_KEY
);
if
((
null
==
appKey
)
||
appKey
.
length
()
!=
24
)
{
appKey
=
null
;
}
}
}
catch
(
NameNotFoundException
e
)
{
}
return
appKey
;
}
// 取得版本号
public
static
String
GetVersion
(
Context
context
)
{
try
{
PackageInfo
manager
=
context
.
getPackageManager
().
getPackageInfo
(
context
.
getPackageName
(),
0
);
return
manager
.
versionName
;
}
catch
(
NameNotFoundException
e
)
{
return
"Unknown"
;
}
}
public
static
void
showToast
(
final
String
toast
,
final
Context
context
)
{
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Looper
.
prepare
();
Toast
.
makeText
(
context
,
toast
,
Toast
.
LENGTH_SHORT
).
show
();
Looper
.
loop
();
}
}).
start
();
}
public
static
boolean
isConnected
(
Context
context
)
{
ConnectivityManager
conn
=
(
ConnectivityManager
)
context
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
NetworkInfo
info
=
conn
.
getActiveNetworkInfo
();
return
(
info
!=
null
&&
info
.
isConnected
());
}
@SuppressLint
(
"MissingPermission"
)
public
static
String
getImei
(
Context
context
,
String
imei
)
{
String
ret
=
null
;
try
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
ret
=
telephonyManager
.
getDeviceId
();
}
catch
(
Exception
e
)
{
Log
.
e
(
ExampleUtil
.
class
.
getSimpleName
(),
e
.
getMessage
());
}
if
(
isReadableASCII
(
ret
)){
return
ret
;
}
else
{
return
imei
;
}
}
private
static
boolean
isReadableASCII
(
CharSequence
string
){
if
(
TextUtils
.
isEmpty
(
string
))
return
false
;
try
{
Pattern
p
=
Pattern
.
compile
(
"[\\x20-\\x7E]+"
);
return
p
.
matcher
(
string
).
matches
();
}
catch
(
Throwable
e
){
return
true
;
}
}
public
static
String
getDeviceId
(
Context
context
)
{
return
JPushInterface
.
getUdid
(
context
);
}
}
RvWrapper/src/main/java/com/ruiwenliu/wrapper/other/MyJPushMessageReceiver.java
0 → 100644
View file @
b5a6f627
package
com
.
ruiwenliu
.
wrapper
.
other
;
import
android.content.Context
;
import
cn.jpush.android.api.JPushMessage
;
import
cn.jpush.android.service.JPushMessageReceiver
;
/**
* 自定义JPush message 接收器,包括操作tag/alias的结果返回(仅仅包含tag/alias新接口部分)
* */
public
class
MyJPushMessageReceiver
extends
JPushMessageReceiver
{
@Override
public
void
onTagOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
)
{
TagAliasOperatorHelper
.
getInstance
().
onTagOperatorResult
(
context
,
jPushMessage
);
super
.
onTagOperatorResult
(
context
,
jPushMessage
);
}
@Override
public
void
onCheckTagOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
){
TagAliasOperatorHelper
.
getInstance
().
onCheckTagOperatorResult
(
context
,
jPushMessage
);
super
.
onCheckTagOperatorResult
(
context
,
jPushMessage
);
}
@Override
public
void
onAliasOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
)
{
TagAliasOperatorHelper
.
getInstance
().
onAliasOperatorResult
(
context
,
jPushMessage
);
super
.
onAliasOperatorResult
(
context
,
jPushMessage
);
}
@Override
public
void
onMobileNumberOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
)
{
TagAliasOperatorHelper
.
getInstance
().
onMobileNumberOperatorResult
(
context
,
jPushMessage
);
super
.
onMobileNumberOperatorResult
(
context
,
jPushMessage
);
}
}
Rv
Client/src/main/java/com/xxfc/rv
/other/PushService.java
→
Rv
Wrapper/src/main/java/com/ruiwenliu/wrapper
/other/PushService.java
View file @
b5a6f627
package
com
.
xxfc
.
rv
.
other
;
package
com
.
ruiwenliu
.
wrapper
.
other
;
import
cn.jpush.android.service.JCommonService
;
...
...
RvWrapper/src/main/java/com/ruiwenliu/wrapper/other/TagAliasOperatorHelper.java
0 → 100644
View file @
b5a6f627
package
com
.
ruiwenliu
.
wrapper
.
other
;
import
android.content.Context
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.util.Log
;
import
android.util.SparseArray
;
import
java.util.Locale
;
import
java.util.Set
;
import
cn.jpush.android.api.JPushInterface
;
import
cn.jpush.android.api.JPushMessage
;
/**
* 处理tagalias相关的逻辑
* */
public
class
TagAliasOperatorHelper
{
private
static
final
String
TAG
=
"JIGUANG-TagAliasHelper"
;
public
static
int
sequence
=
1
;
/**增加*/
public
static
final
int
ACTION_ADD
=
1
;
/**覆盖*/
public
static
final
int
ACTION_SET
=
2
;
/**删除部分*/
public
static
final
int
ACTION_DELETE
=
3
;
/**删除所有*/
public
static
final
int
ACTION_CLEAN
=
4
;
/**查询*/
public
static
final
int
ACTION_GET
=
5
;
public
static
final
int
ACTION_CHECK
=
6
;
public
static
final
int
DELAY_SEND_ACTION
=
1
;
public
static
final
int
DELAY_SET_MOBILE_NUMBER_ACTION
=
2
;
private
Context
context
;
private
static
TagAliasOperatorHelper
mInstance
;
private
TagAliasOperatorHelper
(){
}
public
static
TagAliasOperatorHelper
getInstance
(){
if
(
mInstance
==
null
){
synchronized
(
TagAliasOperatorHelper
.
class
){
if
(
mInstance
==
null
){
mInstance
=
new
TagAliasOperatorHelper
();
}
}
}
return
mInstance
;
}
public
void
init
(
Context
context
){
if
(
context
!=
null
)
{
this
.
context
=
context
.
getApplicationContext
();
}
}
private
SparseArray
<
Object
>
setActionCache
=
new
SparseArray
<
Object
>();
public
Object
get
(
int
sequence
){
return
setActionCache
.
get
(
sequence
);
}
public
Object
remove
(
int
sequence
){
return
setActionCache
.
get
(
sequence
);
}
public
void
put
(
int
sequence
,
Object
tagAliasBean
){
setActionCache
.
put
(
sequence
,
tagAliasBean
);
}
private
Handler
delaySendHandler
=
new
Handler
(){
@Override
public
void
handleMessage
(
Message
msg
)
{
switch
(
msg
.
what
){
case
DELAY_SEND_ACTION:
if
(
msg
.
obj
!=
null
&&
msg
.
obj
instanceof
TagAliasBean
){
Log
.
i
(
TAG
,
"on delay time"
);
sequence
++;
TagAliasBean
tagAliasBean
=
(
TagAliasBean
)
msg
.
obj
;
setActionCache
.
put
(
sequence
,
tagAliasBean
);
if
(
context
!=
null
)
{
handleAction
(
context
,
sequence
,
tagAliasBean
);
}
else
{
Log
.
e
(
TAG
,
"#unexcepted - context was null"
);
}
}
else
{
Log
.
w
(
TAG
,
"#unexcepted - msg obj was incorrect"
);
}
break
;
case
DELAY_SET_MOBILE_NUMBER_ACTION:
if
(
msg
.
obj
!=
null
&&
msg
.
obj
instanceof
String
)
{
Log
.
i
(
TAG
,
"retry set mobile number"
);
sequence
++;
String
mobileNumber
=
(
String
)
msg
.
obj
;
setActionCache
.
put
(
sequence
,
mobileNumber
);
if
(
context
!=
null
)
{
handleAction
(
context
,
sequence
,
mobileNumber
);
}
else
{
Log
.
e
(
TAG
,
"#unexcepted - context was null"
);
}
}
else
{
Log
.
w
(
TAG
,
"#unexcepted - msg obj was incorrect"
);
}
break
;
}
}
};
public
void
handleAction
(
Context
context
,
int
sequence
,
String
mobileNumber
){
put
(
sequence
,
mobileNumber
);
Log
.
d
(
TAG
,
"sequence:"
+
sequence
+
",mobileNumber:"
+
mobileNumber
);
JPushInterface
.
setMobileNumber
(
context
,
sequence
,
mobileNumber
);
}
/**
* 处理设置tag
* */
public
void
handleAction
(
Context
context
,
int
sequence
,
TagAliasBean
tagAliasBean
){
init
(
context
);
if
(
tagAliasBean
==
null
){
Log
.
w
(
TAG
,
"tagAliasBean was null"
);
return
;
}
put
(
sequence
,
tagAliasBean
);
if
(
tagAliasBean
.
isAliasAction
){
switch
(
tagAliasBean
.
action
){
case
ACTION_GET:
JPushInterface
.
getAlias
(
context
,
sequence
);
break
;
case
ACTION_DELETE:
JPushInterface
.
deleteAlias
(
context
,
sequence
);
break
;
case
ACTION_SET:
JPushInterface
.
setAlias
(
context
,
sequence
,
tagAliasBean
.
alias
);
break
;
default
:
Log
.
w
(
TAG
,
"unsupport alias action type"
);
return
;
}
}
else
{
switch
(
tagAliasBean
.
action
)
{
case
ACTION_ADD:
JPushInterface
.
addTags
(
context
,
sequence
,
tagAliasBean
.
tags
);
break
;
case
ACTION_SET:
JPushInterface
.
setTags
(
context
,
sequence
,
tagAliasBean
.
tags
);
break
;
case
ACTION_DELETE:
JPushInterface
.
deleteTags
(
context
,
sequence
,
tagAliasBean
.
tags
);
break
;
case
ACTION_CHECK:
//一次只能check一个tag
String
tag
=
(
String
)
tagAliasBean
.
tags
.
toArray
()[
0
];
JPushInterface
.
checkTagBindState
(
context
,
sequence
,
tag
);
break
;
case
ACTION_GET:
JPushInterface
.
getAllTags
(
context
,
sequence
);
break
;
case
ACTION_CLEAN:
JPushInterface
.
cleanTags
(
context
,
sequence
);
break
;
default
:
Log
.
w
(
TAG
,
"unsupport tag action type"
);
return
;
}
}
}
private
boolean
RetryActionIfNeeded
(
int
errorCode
,
TagAliasBean
tagAliasBean
){
if
(!
ExampleUtil
.
isConnected
(
context
)){
Log
.
w
(
TAG
,
"no network"
);
return
false
;
}
//返回的错误码为6002 超时,6014 服务器繁忙,都建议延迟重试
if
(
errorCode
==
6002
||
errorCode
==
6014
){
Log
.
d
(
TAG
,
"need retry"
);
if
(
tagAliasBean
!=
null
){
Message
message
=
new
Message
();
message
.
what
=
DELAY_SEND_ACTION
;
message
.
obj
=
tagAliasBean
;
delaySendHandler
.
sendMessageDelayed
(
message
,
1000
*
60
);
String
logs
=
getRetryStr
(
tagAliasBean
.
isAliasAction
,
tagAliasBean
.
action
,
errorCode
);
// ExampleUtil.showToast(logs, context);
return
true
;
}
}
return
false
;
}
private
boolean
RetrySetMObileNumberActionIfNeeded
(
int
errorCode
,
String
mobileNumber
){
if
(!
ExampleUtil
.
isConnected
(
context
)){
Log
.
w
(
TAG
,
"no network"
);
return
false
;
}
//返回的错误码为6002 超时,6024 服务器内部错误,建议稍后重试
if
(
errorCode
==
6002
||
errorCode
==
6024
){
Log
.
d
(
TAG
,
"need retry"
);
Message
message
=
new
Message
();
message
.
what
=
DELAY_SET_MOBILE_NUMBER_ACTION
;
message
.
obj
=
mobileNumber
;
delaySendHandler
.
sendMessageDelayed
(
message
,
1000
*
60
);
String
str
=
"Failed to set mobile number due to %s. Try again after 60s."
;
str
=
String
.
format
(
Locale
.
ENGLISH
,
str
,(
errorCode
==
6002
?
"timeout"
:
"server internal error”"
));
// ExampleUtil.showToast(str, context);
return
true
;
}
return
false
;
}
private
String
getRetryStr
(
boolean
isAliasAction
,
int
actionType
,
int
errorCode
){
String
str
=
"Failed to %s %s due to %s. Try again after 60s."
;
str
=
String
.
format
(
Locale
.
ENGLISH
,
str
,
getActionStr
(
actionType
),(
isAliasAction
?
"alias"
:
" tags"
)
,(
errorCode
==
6002
?
"timeout"
:
"server too busy"
));
return
str
;
}
private
String
getActionStr
(
int
actionType
){
switch
(
actionType
){
case
ACTION_ADD:
return
"add"
;
case
ACTION_SET:
return
"set"
;
case
ACTION_DELETE:
return
"delete"
;
case
ACTION_GET:
return
"get"
;
case
ACTION_CLEAN:
return
"clean"
;
case
ACTION_CHECK:
return
"check"
;
}
return
"unkonw operation"
;
}
public
void
onTagOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
)
{
int
sequence
=
jPushMessage
.
getSequence
();
Log
.
i
(
TAG
,
"action - onTagOperatorResult, sequence:"
+
sequence
+
",tags:"
+
jPushMessage
.
getTags
());
Log
.
i
(
TAG
,
"tags size:"
+
jPushMessage
.
getTags
().
size
());
init
(
context
);
//根据sequence从之前操作缓存中获取缓存记录
TagAliasBean
tagAliasBean
=
(
TagAliasBean
)
setActionCache
.
get
(
sequence
);
if
(
tagAliasBean
==
null
){
// ExampleUtil.showToast("获取缓存记录失败", context);
return
;
}
if
(
jPushMessage
.
getErrorCode
()
==
0
){
Log
.
i
(
TAG
,
"action - modify tag Success,sequence:"
+
sequence
);
setActionCache
.
remove
(
sequence
);
String
logs
=
getActionStr
(
tagAliasBean
.
action
)+
" tags success"
;
Log
.
i
(
TAG
,
logs
);
// ExampleUtil.showToast(logs, context);
}
else
{
String
logs
=
"Failed to "
+
getActionStr
(
tagAliasBean
.
action
)+
" tags"
;
if
(
jPushMessage
.
getErrorCode
()
==
6018
){
//tag数量超过限制,需要先清除一部分再add
logs
+=
", tags is exceed limit need to clean"
;
}
logs
+=
", errorCode:"
+
jPushMessage
.
getErrorCode
();
Log
.
e
(
TAG
,
logs
);
if
(!
RetryActionIfNeeded
(
jPushMessage
.
getErrorCode
(),
tagAliasBean
))
{
// ExampleUtil.showToast(logs, context);
}
}
}
public
void
onCheckTagOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
){
int
sequence
=
jPushMessage
.
getSequence
();
Log
.
i
(
TAG
,
"action - onCheckTagOperatorResult, sequence:"
+
sequence
+
",checktag:"
+
jPushMessage
.
getCheckTag
());
init
(
context
);
//根据sequence从之前操作缓存中获取缓存记录
TagAliasBean
tagAliasBean
=
(
TagAliasBean
)
setActionCache
.
get
(
sequence
);
if
(
tagAliasBean
==
null
){
// ExampleUtil.showToast("获取缓存记录失败", context);
return
;
}
if
(
jPushMessage
.
getErrorCode
()
==
0
){
Log
.
i
(
TAG
,
"tagBean:"
+
tagAliasBean
);
setActionCache
.
remove
(
sequence
);
String
logs
=
getActionStr
(
tagAliasBean
.
action
)+
" tag "
+
jPushMessage
.
getCheckTag
()
+
" bind state success,state:"
+
jPushMessage
.
getTagCheckStateResult
();
Log
.
i
(
TAG
,
logs
);
// ExampleUtil.showToast(logs, context);
}
else
{
String
logs
=
"Failed to "
+
getActionStr
(
tagAliasBean
.
action
)+
" tags, errorCode:"
+
jPushMessage
.
getErrorCode
();
Log
.
e
(
TAG
,
logs
);
if
(!
RetryActionIfNeeded
(
jPushMessage
.
getErrorCode
(),
tagAliasBean
))
{
// ExampleUtil.showToast(logs, context);
}
}
}
public
void
onAliasOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
)
{
int
sequence
=
jPushMessage
.
getSequence
();
Log
.
i
(
TAG
,
"action - onAliasOperatorResult, sequence:"
+
sequence
+
",alias:"
+
jPushMessage
.
getAlias
());
init
(
context
);
//根据sequence从之前操作缓存中获取缓存记录
TagAliasBean
tagAliasBean
=
(
TagAliasBean
)
setActionCache
.
get
(
sequence
);
if
(
tagAliasBean
==
null
){
// ExampleUtil.showToast("获取缓存记录失败", context);
return
;
}
if
(
jPushMessage
.
getErrorCode
()
==
0
){
Log
.
i
(
TAG
,
"action - modify alias Success,sequence:"
+
sequence
);
setActionCache
.
remove
(
sequence
);
String
logs
=
getActionStr
(
tagAliasBean
.
action
)+
" alias success"
;
Log
.
i
(
TAG
,
logs
);
// ExampleUtil.showToast(logs, context);
}
else
{
String
logs
=
"Failed to "
+
getActionStr
(
tagAliasBean
.
action
)+
" alias, errorCode:"
+
jPushMessage
.
getErrorCode
();
Log
.
e
(
TAG
,
logs
);
if
(!
RetryActionIfNeeded
(
jPushMessage
.
getErrorCode
(),
tagAliasBean
))
{
// ExampleUtil.showToast(logs, context);
}
}
}
//设置手机号码回调
public
void
onMobileNumberOperatorResult
(
Context
context
,
JPushMessage
jPushMessage
)
{
int
sequence
=
jPushMessage
.
getSequence
();
Log
.
i
(
TAG
,
"action - onMobileNumberOperatorResult, sequence:"
+
sequence
+
",mobileNumber:"
+
jPushMessage
.
getMobileNumber
());
init
(
context
);
if
(
jPushMessage
.
getErrorCode
()
==
0
){
Log
.
i
(
TAG
,
"action - set mobile number Success,sequence:"
+
sequence
);
setActionCache
.
remove
(
sequence
);
}
else
{
String
logs
=
"Failed to set mobile number, errorCode:"
+
jPushMessage
.
getErrorCode
();
Log
.
e
(
TAG
,
logs
);
if
(!
RetrySetMObileNumberActionIfNeeded
(
jPushMessage
.
getErrorCode
(),
jPushMessage
.
getMobileNumber
())){
// ExampleUtil.showToast(logs, context);
}
}
}
public
static
class
TagAliasBean
{
public
int
action
;
public
Set
<
String
>
tags
;
public
String
alias
;
public
boolean
isAliasAction
;
@Override
public
String
toString
()
{
return
"TagAliasBean{"
+
"action="
+
action
+
", tags="
+
tags
+
", alias='"
+
alias
+
'\''
+
", isAliasAction="
+
isAliasAction
+
'}'
;
}
}
}
component_dialog/src/main/java/com/rv/component/dialog/BottomDeleteDialog.java
View file @
b5a6f627
...
...
@@ -20,7 +20,7 @@ public class BottomDeleteDialog extends BaseDialog {
@Override
public
int
getViewLayout
()
{
return
R
.
layout
.
dialog_
prompt
_bottom
;
return
R
.
layout
.
dialog_
delete
_bottom
;
}
}
module_home/src/main/java/com/rv/home/rv/module/ApiConfig.java
View file @
b5a6f627
...
...
@@ -129,9 +129,15 @@ public class ApiConfig {
//我的发布
public
static
String
RVENTHUSIAST_GETBYUSERID_LIST
=
RvFrameConfig
.
HOST
+
"/api/im/msg/getByUserId"
;
//删除消息
public
static
String
RVENTHUSIAST_MSG_DELETE
=
RvFrameConfig
.
IMA_BASEUSRL
+
"/b/circle/msg/delete"
;
//会员信息
public
static
String
RVENTHUSIAST_GETUSERMEMBER
=
RvFrameConfig
.
HOST
+
"/api/admin/baseUserMember/app/getUserMember"
;
//im登录
public
static
String
DISCOVERY_IM_LOGIN
=
RvFrameConfig
.
HOST
+
"/api/auth/jwt/imi/login"
;
/**
* 检查token是否有效
*/
...
...
module_home/src/main/java/com/rv/home/rv/module/basic/BaseLoginActivity.java
View file @
b5a6f627
...
...
@@ -12,6 +12,7 @@ import com.frame.base.bus.RxBus;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.SPConstance
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.other.TagAliasOperatorHelper
;
import
com.ruiwenliu.wrapper.presenter.MvpPresenter
;
import
com.ruiwenliu.wrapper.util.UtilsManager
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
...
...
@@ -30,6 +31,9 @@ import com.yuyife.okgo.OkGoUtil;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
static
com
.
ruiwenliu
.
wrapper
.
other
.
TagAliasOperatorHelper
.
ACTION_SET
;
import
static
com
.
ruiwenliu
.
wrapper
.
other
.
TagAliasOperatorHelper
.
sequence
;
/**
* Created :Auser
* Date: 2019/5/15.
...
...
@@ -151,6 +155,17 @@ public abstract class BaseLoginActivity<P extends MvpPresenter> extends BaseStat
// finish();
// break;
// }
boolean
isAliasAction
=
true
;
TagAliasOperatorHelper
.
TagAliasBean
tagAliasBean
=
new
TagAliasOperatorHelper
.
TagAliasBean
();
tagAliasBean
.
action
=
ACTION_SET
;
sequence
++;
if
(
isAliasAction
)
{
tagAliasBean
.
alias
=
registeredBean
.
getData
().
getUserId
();
}
else
{
tagAliasBean
.
tags
=
null
;
}
tagAliasBean
.
isAliasAction
=
isAliasAction
;
TagAliasOperatorHelper
.
getInstance
().
handleAction
(
getApplicationContext
(),
sequence
,
tagAliasBean
);
RxBus
.
post
(
new
LoginSuccessfulEvent
());
finish
();
...
...
module_mine/src/main/java/com/rv/rvmine/adapter/MyReleasePatAdapter.java
View file @
b5a6f627
...
...
@@ -46,6 +46,8 @@ public class MyReleasePatAdapter extends BaseQuickAdapter<MyReleaseBean.DataBean
}
else
{
helper
.
setGone
(
R
.
id
.
iv_isvideo
,
false
);
}
helper
.
addOnLongClickListener
(
R
.
id
.
ll_item_rv_enthusiast
);
}
}
}
module_mine/src/main/java/com/rv/rvmine/adapter/MyReleaseVideoAdapter.java
View file @
b5a6f627
...
...
@@ -49,6 +49,8 @@ public class MyReleaseVideoAdapter extends BaseQuickAdapter<MyReleaseBean.DataBe
}
else
{
helper
.
setGone
(
R
.
id
.
iv_isvideo
,
false
);
}
helper
.
addOnLongClickListener
(
R
.
id
.
ll_item_rv_enthusiast
);
}
}
}
module_mine/src/main/java/com/rv/rvmine/bean/MyReleaseIMTokenBean.java
0 → 100644
View file @
b5a6f627
package
com
.
rv
.
rvmine
.
bean
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
public
class
MyReleaseIMTokenBean
extends
BaseBean
{
private
String
data
;
private
boolean
rel
;
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
module_mine/src/main/java/com/rv/rvmine/fragment/MyReleasePatFragment.java
View file @
b5a6f627
...
...
@@ -29,6 +29,7 @@ import com.rv.rvmine.R;
import
com.rv.rvmine.R2
;
import
com.rv.rvmine.adapter.MyReleasePatAdapter
;
import
com.rv.rvmine.bean.MyReleaseBean
;
import
com.rv.rvmine.bean.MyReleaseIMTokenBean
;
import
com.rv.rvmine.traveler.MyReleaseActivity
;
import
com.xxrv.coupon.fragment.ExpiredCouponFragment
;
import
com.yuyife.okgo.OkGoUtil
;
...
...
@@ -49,7 +50,8 @@ public class MyReleasePatFragment extends BaseFragment<CommonPresenter> implemen
SimpleRefreshLayout
mSimpleRefreshLayout
;
private
int
countPage
;
private
int
mPage
;
private
String
deleteMsgId
;
private
int
deletePosition
;
private
MyReleasePatAdapter
mAdapter
;
public
static
MyReleasePatFragment
getInstance
(
int
type
)
{
...
...
@@ -111,21 +113,20 @@ public class MyReleasePatFragment extends BaseFragment<CommonPresenter> implemen
});
mAdapter
.
setOnItemChildLongClickListener
(
new
BaseQuickAdapter
.
OnItemChildLongClickListener
()
{
@Override
public
boolean
onItemChildLongClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
return
true
;
}
});
mAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
showDeleteDialgo
();
public
boolean
onItemChildLongClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
int
id
=
view
.
getId
();
deletePosition
=
position
;
MyReleaseBean
.
DataBeanX
.
DataBean
dataBean
=
(
MyReleaseBean
.
DataBeanX
.
DataBean
)
adapter
.
getItem
(
position
);
deleteMsgId
=
dataBean
.
getMsgId
();
if
(
id
==
R
.
id
.
ll_item_rv_enthusiast
)
{
showDeleteDialgo
();
}
return
false
;
}
});
mAdapter
.
setOnLoadMoreListener
(
new
BaseQuickAdapter
.
RequestLoadMoreListener
()
{
@Override
public
void
onLoadMoreRequested
()
{
...
...
@@ -159,7 +160,13 @@ public class MyReleasePatFragment extends BaseFragment<CommonPresenter> implemen
case
0
:
processData
((
MyReleaseBean
)
result
);
break
;
case
1
:
deleteData
((
MyReleaseIMTokenBean
)
result
);
break
;
case
2
:
mAdapter
.
remove
(
deletePosition
);
mAdapter
.
notifyItemChanged
(
deletePosition
);
break
;
}
}
...
...
@@ -216,6 +223,7 @@ public class MyReleasePatFragment extends BaseFragment<CommonPresenter> implemen
public
void
onClick
(
View
v
)
{
int
i
=
v
.
getId
();
if
(
i
==
R
.
id
.
ll_item_delete
)
{
getImToken
();
dismiss
();
}
}
...
...
@@ -224,6 +232,21 @@ public class MyReleasePatFragment extends BaseFragment<CommonPresenter> implemen
}.
show
();
}
private
void
getImToken
()
{
if
(
OkGoUtil
.
getToken
()
!=
null
)
{
Map
<
String
,
Object
>
headMap
=
new
LinkedHashMap
<>();
headMap
.
put
(
"Authorization"
,
OkGoUtil
.
getToken
());
mPresenter
.
postData
(
RvFrameConfig
.
HOST
,
1
,
ApiConfig
.
DISCOVERY_IM_LOGIN
,
MyReleaseIMTokenBean
.
class
,
headMap
,
headMap
,
true
);
}
}
private
void
deleteData
(
MyReleaseIMTokenBean
imTokenBean
)
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"messageId"
,
deleteMsgId
);
map
.
put
(
"access_token"
,
imTokenBean
.
getData
());
mPresenter
.
getData
(
RvFrameConfig
.
HOST
,
2
,
ApiConfig
.
RVENTHUSIAST_MSG_DELETE
,
BaseBean
.
class
,
map
,
true
);
}
public
class
AbSpacesItemDecoration
extends
RecyclerView
.
ItemDecoration
{
private
int
left
;
...
...
module_mine/src/main/java/com/rv/rvmine/fragment/MyReleaseVideoFragment.java
View file @
b5a6f627
...
...
@@ -13,8 +13,10 @@ import com.frame.rv.config.RvFrameConfig;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseFragment
;
import
com.ruiwenliu.wrapper.base.presenter.CommonPresenter
;
import
com.ruiwenliu.wrapper.util.ViewHolder
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView
;
import
com.rv.component.dialog.BottomDeleteDialog
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.rv.home.rv.module.ui.main.home.bean.HomeRecommendBean
;
import
com.rv.rvmine.R
;
...
...
@@ -22,6 +24,7 @@ import com.rv.rvmine.R2;
import
com.rv.rvmine.adapter.MyReleasePatAdapter
;
import
com.rv.rvmine.adapter.MyReleaseVideoAdapter
;
import
com.rv.rvmine.bean.MyReleaseBean
;
import
com.rv.rvmine.bean.MyReleaseIMTokenBean
;
import
com.yuyife.okgo.OkGoUtil
;
import
java.util.LinkedHashMap
;
...
...
@@ -40,6 +43,8 @@ public class MyReleaseVideoFragment extends BaseFragment<CommonPresenter> implem
SimpleRefreshLayout
mSimpleRefreshLayout
;
private
int
countPage
;
private
int
mPage
;
private
String
deleteMsgId
;
private
int
deletePosition
;
private
MyReleaseVideoAdapter
mAdapter
;
...
...
@@ -102,6 +107,21 @@ public class MyReleaseVideoFragment extends BaseFragment<CommonPresenter> implem
});
mAdapter
.
setOnItemChildLongClickListener
(
new
BaseQuickAdapter
.
OnItemChildLongClickListener
()
{
@Override
public
boolean
onItemChildLongClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
deletePosition
=
position
;
MyReleaseBean
.
DataBeanX
.
DataBean
dataBean
=
(
MyReleaseBean
.
DataBeanX
.
DataBean
)
adapter
.
getItem
(
position
);
deleteMsgId
=
dataBean
.
getMsgId
();
int
id
=
view
.
getId
();
if
(
id
==
R
.
id
.
ll_item_rv_enthusiast
)
{
showDeleteDialgo
();
}
return
false
;
}
});
mAdapter
.
setOnLoadMoreListener
(
new
BaseQuickAdapter
.
RequestLoadMoreListener
()
{
@Override
public
void
onLoadMoreRequested
()
{
...
...
@@ -135,10 +155,51 @@ public class MyReleaseVideoFragment extends BaseFragment<CommonPresenter> implem
case
0
:
processData
((
MyReleaseBean
)
result
);
break
;
case
1
:
deleteData
((
MyReleaseIMTokenBean
)
result
);
break
;
case
2
:
mAdapter
.
remove
(
deletePosition
);
mAdapter
.
notifyItemChanged
(
deletePosition
);
break
;
}
}
public
void
showDeleteDialgo
()
{
new
BottomDeleteDialog
(
_mActivity
)
{
@Override
public
void
helper
(
ViewHolder
helper
)
{
super
.
helper
(
helper
);
helper
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
int
i
=
v
.
getId
();
if
(
i
==
R
.
id
.
ll_item_delete
)
{
getImToken
();
dismiss
();
}
}
},
R
.
id
.
ll_item_delete
);
}
}.
show
();
}
private
void
getImToken
()
{
if
(
OkGoUtil
.
getToken
()
!=
null
)
{
Map
<
String
,
Object
>
headMap
=
new
LinkedHashMap
<>();
headMap
.
put
(
"Authorization"
,
OkGoUtil
.
getToken
());
mPresenter
.
postData
(
RvFrameConfig
.
HOST
,
1
,
ApiConfig
.
DISCOVERY_IM_LOGIN
,
MyReleaseIMTokenBean
.
class
,
headMap
,
headMap
,
true
);
}
}
private
void
deleteData
(
MyReleaseIMTokenBean
imTokenBean
)
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"messageId"
,
deleteMsgId
);
map
.
put
(
"access_token"
,
imTokenBean
.
getData
());
mPresenter
.
getData
(
RvFrameConfig
.
HOST
,
2
,
ApiConfig
.
RVENTHUSIAST_MSG_DELETE
,
BaseBean
.
class
,
map
,
true
);
}
private
void
processData
(
MyReleaseBean
bean
)
{
if
(
mPage
==
1
)
{
countPage
=
bean
.
getData
().
getPageSize
();
...
...
module_mine/src/main/java/com/rv/rvmine/traveler/SettingActivity.java
View file @
b5a6f627
...
...
@@ -12,6 +12,7 @@ import android.widget.Toast;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.other.TagAliasOperatorHelper
;
import
com.ruiwenliu.wrapper.util.UtilsManager
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.rv.component.utils.Cookie
;
...
...
@@ -32,6 +33,10 @@ import butterknife.BindView;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
import
static
com
.
ruiwenliu
.
wrapper
.
other
.
TagAliasOperatorHelper
.
ACTION_DELETE
;
import
static
com
.
ruiwenliu
.
wrapper
.
other
.
TagAliasOperatorHelper
.
ACTION_SET
;
import
static
com
.
ruiwenliu
.
wrapper
.
other
.
TagAliasOperatorHelper
.
sequence
;
/**
* 设置
*/
...
...
@@ -129,6 +134,19 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
}
else
if
(
id
==
R
.
id
.
tv_out_sign
)
{
//退出登录
boolean
isAliasAction
=
true
;
TagAliasOperatorHelper
.
TagAliasBean
tagAliasBean
=
new
TagAliasOperatorHelper
.
TagAliasBean
();
tagAliasBean
.
action
=
ACTION_DELETE
;
sequence
++;
// if (isAliasAction) {
// tagAliasBean.alias = registeredBean.getData().getUserId();
// } else {
// tagAliasBean.tags = null;
// }
tagAliasBean
.
isAliasAction
=
isAliasAction
;
TagAliasOperatorHelper
.
getInstance
().
handleAction
(
getApplicationContext
(),
sequence
,
tagAliasBean
);
UtilsManager
.
getInstance
(
mActivity
).
clearShareData
(
"city_json"
);
UtilsManager
.
getInstance
(
mActivity
).
setShNull
();
RvCache
.
getInstance
(
getApplicationContext
()).
clear
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment