Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
IMSDK_Demo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
王文龙
IMSDK_Demo
Commits
4c9ec549
Commit
4c9ec549
authored
Dec 24, 2020
by
王文龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add]添加网络监听与推送配置
parent
75ab9224
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
130 additions
and
16 deletions
+130
-16
build.gradle
app/build.gradle
+1
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-2
ChatListFragmentWrapper.java
...n/java/com/offcn/imclient/ui/ChatListFragmentWrapper.java
+46
-0
MainActivity.java
app/src/main/java/com/offcn/imclient/ui/MainActivity.java
+2
-0
fragment_chat_list_wrapper.xml
app/src/main/res/layout/fragment_chat_list_wrapper.xml
+42
-7
ic_nonet.png
app/src/main/res/mipmap-xhdpi/ic_nonet.png
+0
-0
strings.xml
app/src/main/res/values/strings.xml
+7
-6
推送配置.txt
推送配置.txt
+29
-0
No files found.
app/build.gradle
View file @
4c9ec549
...
...
@@ -94,7 +94,7 @@ dependencies {
implementation
'com.android.support:multidex:1.0.3'
implementation
(
"com.offcn.live:titleview:1.1.0-s1"
)
implementation
(
"com.offcn.live:imsdk-kit:1.0.0.
28
"
)
implementation
(
"com.offcn.live:imsdk-kit:1.0.0.
30
"
)
// DB
implementation
'org.greenrobot:greendao:3.2.2'
...
...
app/src/main/AndroidManifest.xml
View file @
4c9ec549
...
...
@@ -116,10 +116,11 @@
android:configChanges=
"keyboardHidden|screenSize|orientation"
android:excludeFromRecents=
"true"
android:screenOrientation=
"portrait"
android:taskAffinity=
"com.offcn.im
.demo.push.activity
.PushTranslateActivity"
android:taskAffinity=
"com.offcn.im
client.ui
.PushTranslateActivity"
android:theme=
"@style/Activity.Translucent"
>
<intent-filter>
<action
android:name=
"com.offcn.live.im.push"
/>
<!--注意此处为 包名.push,不可随意修改为其它,否则推送通知栏点击无效-->
<action
android:name=
"${applicationId}.push"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
</intent-filter>
</activity>
...
...
app/src/main/java/com/offcn/imclient/ui/ChatListFragmentWrapper.java
View file @
4c9ec549
package
com
.
offcn
.
imclient
.
ui
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.net.ConnectivityManager
;
import
android.view.View
;
import
android.widget.ExpandableListView
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
com.android.volley.Request
;
...
...
@@ -26,6 +29,7 @@ import com.offcn.imclient.view.AnimatedExpandableListView;
import
com.offcn.live.im.OIMSDK
;
import
com.offcn.live.im.bean.OIMSendTypeEnum
;
import
com.offcn.live.im.util.ZGLLogUtils
;
import
com.offcn.live.im.util.ZGLNetworkChangeReceiver
;
import
com.offcn.live.im.util.ZGLParseUtils
;
import
org.json.JSONObject
;
...
...
@@ -42,6 +46,11 @@ import java.util.List;
public
class
ChatListFragmentWrapper
extends
BaseFragment
{
private
static
final
String
TAG
=
ChatListFragmentWrapper
.
class
.
getSimpleName
();
LinearLayout
mNoNetView
;
private
ZGLNetworkChangeReceiver
mNetworkChangeReceiver
;
@Override
protected
int
getContentViewId
()
{
return
R
.
layout
.
fragment_chat_list_wrapper
;
...
...
@@ -49,6 +58,8 @@ public class ChatListFragmentWrapper extends BaseFragment {
@Override
protected
void
init
(
View
view
)
{
mNoNetView
=
view
.
findViewById
(
R
.
id
.
container_nonet
);
view
.
findViewById
(
R
.
id
.
search
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
...
...
@@ -58,10 +69,45 @@ public class ChatListFragmentWrapper extends BaseFragment {
}
}
});
initNet
();
}
@Override
protected
boolean
setLoadAlways
()
{
return
false
;
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
try
{
if
(
mNetworkChangeReceiver
!=
null
)
{
getActivity
().
unregisterReceiver
(
mNetworkChangeReceiver
);
}
}
catch
(
Exception
e
)
{
}
}
private
void
initNet
()
{
mNetworkChangeReceiver
=
new
ZGLNetworkChangeReceiver
();
final
IntentFilter
intentFilter
=
new
IntentFilter
();
intentFilter
.
addAction
(
ConnectivityManager
.
CONNECTIVITY_ACTION
);
getActivity
().
registerReceiver
(
mNetworkChangeReceiver
,
intentFilter
);
mNetworkChangeReceiver
.
setOnNetChangeListener
(
new
ZGLNetworkChangeReceiver
.
OnNetChangeListener
()
{
@Override
public
void
onConnected
(
boolean
isWifi
)
{
ZGLLogUtils
.
e
(
TAG
,
"onConnected"
);
mNoNetView
.
setVisibility
(
View
.
GONE
);
}
@Override
public
void
onDisconnected
()
{
mNoNetView
.
setVisibility
(
View
.
VISIBLE
);
}
});
}
}
app/src/main/java/com/offcn/imclient/ui/MainActivity.java
View file @
4c9ec549
...
...
@@ -30,6 +30,7 @@ import com.offcn.live.im.bean.OIMCode;
import
com.offcn.live.im.bean.OIMMsg
;
import
com.offcn.live.im.util.ZGLCommonUtils
;
import
com.offcn.live.im.util.ZGLLogUtils
;
import
com.offcn.live.im.util.ZGLNetworkChangeReceiver
;
import
com.offcn.live.imkit.ui.ChatListFragment
;
import
com.offcn.live.imkit.util.KitConstants
;
import
com.offcn.live.imkit.view.ScrollEnabledViewPager
;
...
...
@@ -58,6 +59,7 @@ public class MainActivity extends BaseActivity {
private
UserBean
mUserBean
;
@Override
protected
int
getContentViewLayoutId
()
{
return
R
.
layout
.
activity_main
;
...
...
app/src/main/res/layout/fragment_chat_list_wrapper.xml
View file @
4c9ec549
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
android:gravity=
"center"
android:orientation=
"vertical"
android:background=
"@android:color/white"
android:paddingTop=
"@dimen/main_padding_top"
>
<RelativeLayout
...
...
@@ -28,12 +29,46 @@
android:textSize=
"15sp"
/>
</RelativeLayout>
<fragment
android:name=
"com.offcn.live.imkit.ui.ChatListFragment"
android:id=
"@+id/chat_list_fragment"
android:layout_marginTop=
"15dp"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
android:layout_marginTop=
"15dp"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/container_nonet"
android:layout_width=
"match_parent"
android:layout_height=
"30dp"
android:background=
"#fdedee"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:paddingLeft=
"15dp"
android:visibility=
"gone"
tools:visibility=
"visible"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/ic_nonet"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:singleLine=
"true"
android:text=
"当前网络不可用,请检查网络设置"
android:textColor=
"@color/color_333333"
android:textSize=
"12sp"
/>
</LinearLayout>
<fragment
android:id=
"@+id/chat_list_fragment"
android:name=
"com.offcn.live.imkit.ui.ChatListFragment"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
</LinearLayout>
app/src/main/res/mipmap-xhdpi/ic_nonet.png
0 → 100644
View file @
4c9ec549
1.37 KB
app/src/main/res/values/strings.xml
View file @
4c9ec549
...
...
@@ -2,11 +2,11 @@
<string
name=
"app_name"
>
在线课堂教师版
</string>
<string
name=
"push_mi_appid"
>
2882303761518
588294
</string>
<string
name=
"push_mi_appkey"
>
5
761858881294
</string>
<string
name=
"push_vivo_appid"
>
10
4300660
</string>
<string
name=
"push_vivo_appkey"
>
5920cbae23f22a915ecabf26554b644e
</string>
<string
name=
"push_oppo_appkey"
>
aa5d4f8306b04b7c820019b906e2ce92
</string>
<string
name=
"push_oppo_appsecret"
>
365b1426c0a14519b3f96092f0a729a9
</string>
<string
name=
"push_mi_appid"
>
2882303761518
931116
</string>
<string
name=
"push_mi_appkey"
>
5
231893188116
</string>
<string
name=
"push_vivo_appid"
>
10
5430534
</string>
<string
name=
"push_vivo_appkey"
>
d2b91a4841e49704211a25bde2dc9e11
</string>
<string
name=
"push_oppo_appkey"
>
1115a09757a147d3a25433e0404b9055
</string>
<string
name=
"push_oppo_appsecret"
>
239dd9255c5349bab1bd526301e07bae
</string>
<string
name=
"search"
>
搜索姓名或者手机号
</string>
</resources>
\ No newline at end of file
推送配置.txt
0 → 100644
View file @
4c9ec549
------------小米----------
包名:
com.offcn.imteacher
AppID:
2882303761518931116
AppKey:
5231893188116
AppSecret:
YxfHTk1OHPmctQzgRDZ+Yg==
----------VIVO----------------
应用包名:com.offcn.imteacher
AppID:105430534
AppKey:d2b91a4841e49704211a25bde2dc9e11
AppSecret:9ae21754-7e4a-42e2-8546-20b249d60743
----------OPPO---------------
appid: 30441883
appkey:1115a09757a147d3a25433e0404b9055(勿外泄)
appsecret:239dd9255c5349bab1bd526301e07bae(勿外泄)
appserversecret:b36e458a2e7a46188058a61bdbb9a633(勿外泄)
\ No newline at end of file
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