Commit 61429a1fa9131068c341283eb92ed4b1e606a6b7
1 parent
93daa41a
更新demo
Showing
11 changed files
with
20 additions
and
87 deletions
.idea/modules.xml
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | <modules> | 4 | <modules> |
| 5 | <module fileurl="file://$PROJECT_DIR$/CNChatNDemo.iml" filepath="$PROJECT_DIR$/CNChatNDemo.iml" /> | 5 | <module fileurl="file://$PROJECT_DIR$/CNChatNDemo.iml" filepath="$PROJECT_DIR$/CNChatNDemo.iml" /> |
| 6 | <module fileurl="file://$PROJECT_DIR$/CNIMDemo.iml" filepath="$PROJECT_DIR$/CNIMDemo.iml" /> | 6 | <module fileurl="file://$PROJECT_DIR$/CNIMDemo.iml" filepath="$PROJECT_DIR$/CNIMDemo.iml" /> |
| 7 | + <module fileurl="file://$PROJECT_DIR$/CNIMDemo23.iml" filepath="$PROJECT_DIR$/CNIMDemo23.iml" /> | ||
| 7 | <module fileurl="file://$PROJECT_DIR$/CNIMDemo5.iml" filepath="$PROJECT_DIR$/CNIMDemo5.iml" /> | 8 | <module fileurl="file://$PROJECT_DIR$/CNIMDemo5.iml" filepath="$PROJECT_DIR$/CNIMDemo5.iml" /> |
| 8 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> | 9 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
| 9 | </modules> | 10 | </modules> |
app/libs/libcnliveutil.jar
No preview for this file type
app/src/main/AndroidManifest.xml
| @@ -34,8 +34,6 @@ | @@ -34,8 +34,6 @@ | ||
| 34 | 34 | ||
| 35 | <activity | 35 | <activity |
| 36 | android:name="com.cnlive.im.ui.ChatRoomActivity" | 36 | android:name="com.cnlive.im.ui.ChatRoomActivity" |
| 37 | - android:launchMode="singleTop" | ||
| 38 | - android:screenOrientation="portrait" | ||
| 39 | android:windowSoftInputMode="adjustResize" | 37 | android:windowSoftInputMode="adjustResize" |
| 40 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" | 38 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" |
| 41 | > | 39 | > |
| @@ -43,102 +41,35 @@ | @@ -43,102 +41,35 @@ | ||
| 43 | 41 | ||
| 44 | <activity | 42 | <activity |
| 45 | android:name="com.cnlive.im.ui.LoGinActivity" | 43 | android:name="com.cnlive.im.ui.LoGinActivity" |
| 46 | - android:launchMode="singleTop" | ||
| 47 | - android:screenOrientation="portrait" | ||
| 48 | - android:windowSoftInputMode="adjustResize" | ||
| 49 | - android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 44 | + /> |
| 50 | 45 | ||
| 51 | <activity | 46 | <activity |
| 52 | android:name=".ui.UserLoginActivity" | 47 | android:name=".ui.UserLoginActivity" |
| 53 | - android:launchMode="singleTop" | ||
| 54 | - android:screenOrientation="portrait" | ||
| 55 | - android:windowSoftInputMode="adjustResize" | ||
| 56 | - android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 48 | + /> |
| 57 | <activity | 49 | <activity |
| 58 | android:name="com.cnlive.im.ui.PrivateChatActivity" | 50 | android:name="com.cnlive.im.ui.PrivateChatActivity" |
| 59 | - android:launchMode="singleTop" | ||
| 60 | - android:screenOrientation="portrait" | ||
| 61 | - android:windowSoftInputMode="adjustResize" | ||
| 62 | - android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 51 | + /> |
| 63 | 52 | ||
| 64 | <activity | 53 | <activity |
| 65 | android:name="com.cnlive.im.ui.CommentActivity" | 54 | android:name="com.cnlive.im.ui.CommentActivity" |
| 66 | - android:launchMode="singleTop" | ||
| 67 | - android:screenOrientation="portrait" | ||
| 68 | - android:windowSoftInputMode="adjustResize" | ||
| 69 | - android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 55 | + /> |
| 70 | 56 | ||
| 71 | 57 | ||
| 72 | - <activity | ||
| 73 | - android:name=".ui.ChatItemActivity" | ||
| 74 | - android:launchMode="singleTop" | ||
| 75 | - android:screenOrientation="portrait" | ||
| 76 | - android:windowSoftInputMode="adjustResize" | ||
| 77 | - android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | ||
| 78 | 58 | ||
| 79 | <service | 59 | <service |
| 80 | android:name="io.rong.imlib.ipc.RongService" | 60 | android:name="io.rong.imlib.ipc.RongService" |
| 81 | android:exported="true" | 61 | android:exported="true" |
| 82 | android:process=":ipc" /> | 62 | android:process=":ipc" /> |
| 83 | 63 | ||
| 84 | - <service | ||
| 85 | - android:name="io.rong.imlib.ReConnectService" | ||
| 86 | - android:exported="true" /> | 64 | + <service android:name="io.rong.imlib.ReConnectService" |
| 65 | + android:exported="true"/> | ||
| 87 | 66 | ||
| 88 | - <receiver | ||
| 89 | - android:name="io.rong.imlib.ConnectChangeReceiver" | ||
| 90 | - android:exported="true" /> | 67 | + <receiver android:name="io.rong.imlib.ConnectChangeReceiver" |
| 68 | + android:exported="true"/> | ||
| 91 | 69 | ||
| 92 | <receiver | 70 | <receiver |
| 93 | android:name="io.rong.imlib.HeartbeatReceiver" | 71 | android:name="io.rong.imlib.HeartbeatReceiver" |
| 94 | android:process=":ipc" /> | 72 | android:process=":ipc" /> |
| 95 | - <!-- com.cnlive.libs.chat config end --> | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - <!--必选: SDK 核心功能--> | ||
| 99 | - <!--第三方相关,向第三方推送服务请求 token 的服务 --> | ||
| 100 | - <service | ||
| 101 | - android:name="io.rong.push.core.PushRegistrationService" | ||
| 102 | - android:exported="false"></service> | ||
| 103 | - | ||
| 104 | - <!-- 处理 push 消息相关的服务 --> | ||
| 105 | - <service | ||
| 106 | - android:name="io.rong.push.core.MessageHandleService" | ||
| 107 | - android:exported="true"></service> | ||
| 108 | - | ||
| 109 | - <!-- push服务 --> | ||
| 110 | - <service | ||
| 111 | - android:name="io.rong.push.PushService" | ||
| 112 | - android:exported="true" | ||
| 113 | - android:process="io.rong.push"> <!-- push进程,可以改名 --> | ||
| 114 | - </service> | ||
| 115 | - | ||
| 116 | - <!-- push 相关事件接收器 --> | ||
| 117 | - <receiver | ||
| 118 | - android:name="io.rong.push.PushReceiver" | ||
| 119 | - android:process="io.rong.push"> <!-- 此处进程可以改名,名称需要和PushService所在进程统一 --> | ||
| 120 | - <!-- 心跳事件 --> | ||
| 121 | - <intent-filter> | ||
| 122 | - <action android:name="io.rong.push.intent.action.HEART_BEAT" /> | ||
| 123 | - </intent-filter> | ||
| 124 | - <!-- 网络变动事件 --> | ||
| 125 | - <intent-filter> | ||
| 126 | - <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> | ||
| 127 | - </intent-filter> | ||
| 128 | - <!-- 部分用户事件 --> | ||
| 129 | - <intent-filter> | ||
| 130 | - <action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
| 131 | - </intent-filter> | ||
| 132 | - <intent-filter> | ||
| 133 | - <action android:name="android.intent.action.USER_PRESENT" /> | ||
| 134 | - <action android:name="android.intent.action.ACTION_POWER_CONNECTED" /> | ||
| 135 | - <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" /> | ||
| 136 | - </intent-filter> | ||
| 137 | - </receiver> | ||
| 138 | - | ||
| 139 | - <!--必选: SDK 核心功能--> | ||
| 140 | - | ||
| 141 | - <!-- end --> | ||
| 142 | </application> | 73 | </application> |
| 143 | 74 | ||
| 144 | </manifest> | 75 | </manifest> |
| 145 | \ No newline at end of file | 76 | \ No newline at end of file |
app/src/main/java/com/cnlive/im/ui/ChatRoomActivity.java
| @@ -68,12 +68,13 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -68,12 +68,13 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 68 | ChatUtil.setOnReceiveMessageListener(receiveMessageListener); | 68 | ChatUtil.setOnReceiveMessageListener(receiveMessageListener); |
| 69 | 69 | ||
| 70 | ChatUtil.setKickedOfflineListener(onKickedOfflineListener); | 70 | ChatUtil.setKickedOfflineListener(onKickedOfflineListener); |
| 71 | + | ||
| 71 | Intent intent = getIntent(); | 72 | Intent intent = getIntent(); |
| 72 | user_name_string = intent.getStringExtra("user_name_string"); | 73 | user_name_string = intent.getStringExtra("user_name_string"); |
| 73 | String user_id_string = intent.getStringExtra("user_id_string"); | 74 | String user_id_string = intent.getStringExtra("user_id_string"); |
| 74 | if (user_name_string != null) | 75 | if (user_name_string != null) |
| 75 | - ChatUtil.login(new CNUserInfo(user_id_string, user_name_string, ""), connectListener); | ||
| 76 | - else ChatUtil.logOut(connectListener); | 76 | + ChatUtil.login(new CNUserInfo(user_id_string, user_name_string, "")); |
| 77 | + else ChatUtil.logOut(); | ||
| 77 | 78 | ||
| 78 | } | 79 | } |
| 79 | 80 | ||
| @@ -317,22 +318,20 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -317,22 +318,20 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 317 | @Override | 318 | @Override |
| 318 | public void onTokenIncorrect(String s) { | 319 | public void onTokenIncorrect(String s) { |
| 319 | Log.e(TAG, "ConnectListener TokenIncorrect"); | 320 | Log.e(TAG, "ConnectListener TokenIncorrect"); |
| 320 | - Toast.makeText(ChatRoomActivity.this, "TokenIncorrect", Toast.LENGTH_SHORT).show(); | ||
| 321 | - finish(); | 321 | + |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | @Override | 324 | @Override |
| 325 | - public void onSuccess(String s) { | 325 | + public void onSuccess(final String s) { |
| 326 | Log.e(TAG, "ConnectListener 连接监听" + s); | 326 | Log.e(TAG, "ConnectListener 连接监听" + s); |
| 327 | 327 | ||
| 328 | - Toast.makeText(ChatRoomActivity.this, s, Toast.LENGTH_SHORT).show(); | ||
| 329 | } | 328 | } |
| 330 | 329 | ||
| 331 | @Override | 330 | @Override |
| 332 | - public void onError(int i, String s) { | 331 | + public void onError(int i, final String s) { |
| 333 | Log.e(TAG, "ConnectListener errorCode : " + i + " : errorMessage : " + s); | 332 | Log.e(TAG, "ConnectListener errorCode : " + i + " : errorMessage : " + s); |
| 334 | - Toast.makeText(ChatRoomActivity.this, s, Toast.LENGTH_SHORT).show(); | ||
| 335 | - finish(); | 333 | + |
| 334 | + | ||
| 336 | 335 | ||
| 337 | } | 336 | } |
| 338 | }; | 337 | }; |
app/src/main/java/com/cnlive/im/ui/LoGinActivity.java
| @@ -42,6 +42,7 @@ public class LoGinActivity extends AppCompatActivity implements View.OnClickList | @@ -42,6 +42,7 @@ public class LoGinActivity extends AppCompatActivity implements View.OnClickList | ||
| 42 | case R.id.vis_login: | 42 | case R.id.vis_login: |
| 43 | Intent intent = new Intent(LoGinActivity.this, ChatRoomActivity.class); | 43 | Intent intent = new Intent(LoGinActivity.this, ChatRoomActivity.class); |
| 44 | startActivity(intent); | 44 | startActivity(intent); |
| 45 | + | ||
| 45 | break; | 46 | break; |
| 46 | case R.id.user_logOut: | 47 | case R.id.user_logOut: |
| 47 | ChatUtil.disconnect(false); | 48 | ChatUtil.disconnect(false); |
app/src/main/java/com/cnlive/im/ui/MainActivity.java
| @@ -50,6 +50,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | @@ -50,6 +50,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ||
| 50 | public void onSuccess(String s) { | 50 | public void onSuccess(String s) { |
| 51 | Intent intent = new Intent(MainActivity.this,LoGinActivity.class); | 51 | Intent intent = new Intent(MainActivity.this,LoGinActivity.class); |
| 52 | startActivity(intent); | 52 | startActivity(intent); |
| 53 | + | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | @Override | 56 | @Override |
app/src/main/java/com/cnlive/im/ui/PrivateChatActivity.java
| @@ -139,7 +139,7 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | @@ -139,7 +139,7 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | ||
| 139 | edit_layout.setVisibility(View.VISIBLE); | 139 | edit_layout.setVisibility(View.VISIBLE); |
| 140 | chatListView.setVisibility(View.VISIBLE); | 140 | chatListView.setVisibility(View.VISIBLE); |
| 141 | CNUserInfo cnName = new CNUserInfo(user_id_string, user_name_string, ""); | 141 | CNUserInfo cnName = new CNUserInfo(user_id_string, user_name_string, ""); |
| 142 | - ChatUtil.login(cnName, connectListener); | 142 | + ChatUtil.login(cnName); |
| 143 | 143 | ||
| 144 | } | 144 | } |
| 145 | 145 |
app/src/main/jniLibs/arm64-v8a/libRongIMLib.so
No preview for this file type
app/src/main/jniLibs/armeabi-v7a/libRongIMLib.so
No preview for this file type
app/src/main/jniLibs/armeabi/libRongIMLib.so
No preview for this file type
app/src/main/jniLibs/x86/libRongIMLib.so
No preview for this file type