Skip to content

Commit

Permalink
Merge pull request #150 from jinfengf/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jinfengf authored May 15, 2019
2 parents 0e82a6b + 7e72038 commit 458fc34
Show file tree
Hide file tree
Showing 167 changed files with 2,228 additions and 476 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ JChat 同时具备好友模式和无好友模式:
* 无好友模式:无需将对方加为好友,通过搜索对方的用户名可直接发起聊天。
* 好友模式:可申请将对方加为好友,对方会收到好友验证,验证通过则互为好友关系。

目前已覆盖 Android 和 [iOS](https://github.com/jpush/jchat-swift) 平台,之后将提供 web 版本,开发者可参照 JChat 快速打造自己的 APP,提高开发效率。
目前已覆盖 Android 、 [iOS](https://github.com/jpush/jchat-swift)[Web](https://github.com/jpush/jchat-web)[Windows](https://github.com/jpush/jchat-windows)平台,开发者可参照 JChat 快速打造自己的 APP,提高开发效率。

* 更换 AppKey
- 在 AndroidManifest.xml 文件中把 JChat 的 AppKey 替换成自己项目的 AppKey
* 更换包名
- 在 build.gradle 把 defaultConfig 节点下的 applicationId 替换成自己项目的包名

![jiguang](./image/6.gif)
![jiguang](./image/9.gif)
Expand Down Expand Up @@ -50,6 +55,10 @@ JChat 同时具备好友模式和无好友模式:
- Picasso —— 加载、显示、缓存图片
- 百度地图

### 特别说明
* JChat Eclipse版本需要开发者自己切换到eclipse-jchat分支.注:Eclipse版本以后不再维护更新.
* JChat 是一个单独的完整项目,不能作为module添加到其他项目中

### 相关文档

* [JMessage Android 集成指南](https://docs.jiguang.cn/jmessage/client/jmessage_android_guide/)
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.3.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -20,6 +21,7 @@ allprojects {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven { url "https://jitpack.io" }
google()
}
}

Expand Down
84 changes: 38 additions & 46 deletions chatapp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
buildToolsVersion '28.0.3'

defaultConfig {
applicationId "io.jchat.android"
Expand All @@ -11,14 +11,16 @@ android {
versionName "2.3.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "4f7aef34fb361292c566a1cd", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
]

ndk {
//选择要添加的对应cpu类型的.so库。
abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a', 'x86', 'x86_64', 'mips', 'mips64'
}
// javaCompileOptions {
// annotationProcessorOptions {
// includeCompileClasspath = true
// }
// }
}
buildTypes {
release {
Expand All @@ -27,25 +29,6 @@ android {
}
}

//忽略fragment的打包错误,这种做法有问题.应该http://blog.csdn.net/chniccs/article/details/51258972第三种方式
// lintOptions {
// abortOnError false
// }

signingConfigs {
release {
storeFile file("release.keystore")
storePassword "jpush-release"
keyAlias "release.keystore"
keyPassword "jpush-release"
}
debug {
storeFile file("debug.keystore")
storePassword "jpush-debug"
keyAlias "debug.keystore"
keyPassword "jpush-debug"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
Expand All @@ -57,28 +40,37 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
disable 'GoogleAppIndexingWarning'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.1'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
testCompile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.github.w446108264:AndroidEmoji:1.0.0'
compile 'com.github.chrisbanes.photoview:library:1.2.4'
compile 'com.facebook.fresco:fresco:0.8.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile project(':reclib-qq')
compile project(':reclib-testemoticons')
compile 'com.contrarywind:Android-PickerView:3.2.4'
compile 'com.yanzhenjie:permission:1.1.2'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.jakewharton:butterknife:7.0.1'
annotationProcessor 'com.jakewharton:butterknife:7.0.1'
implementation 'com.github.bumptech.glide:glide:3.6.1'
implementation 'com.github.chrisbanes.photoview:library:1.2.4'
implementation 'com.facebook.fresco:fresco:0.8.1'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation project(':emoji')
implementation project(':reclib-qq')
implementation project(':reclib-testemoticons')
implementation 'com.contrarywind:Android-PickerView:3.2.4'
implementation 'com.yanzhenjie:permission:1.1.2'
implementation 'cn.jiguang.sdk:jmessage:2.9.0' // 此处以J
implementation 'cn.jiguang.sdk:jcore:2.0.0'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'in.srain.cube:ptr-load-more:1.0.6'
}
Binary file removed chatapp/libs/arm64-v8a/libjcore118.so
Binary file not shown.
Binary file removed chatapp/libs/armeabi-v7a/libjcore118.so
Binary file not shown.
Binary file removed chatapp/libs/armeabi/libjcore118.so
Binary file not shown.
Binary file removed chatapp/libs/jcore-android-1.1.8.jar
Binary file not shown.
Binary file removed chatapp/libs/jmessage-android_v2.4.0.jar
Binary file not shown.
Binary file removed chatapp/libs/mips/libjcore118.so
Binary file not shown.
Binary file removed chatapp/libs/mips64/libjcore118.so
Binary file not shown.
Binary file removed chatapp/libs/x86/libjcore118.so
Binary file not shown.
Binary file removed chatapp/libs/x86_64/libjcore118.so
Binary file not shown.
112 changes: 28 additions & 84 deletions chatapp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="jiguang.chat"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jiguang.chat">

<permission
android:name="${applicationId}.permission.JPUSH_MESSAGE"
android:protectionLevel="signature"/>

<!-- Required -->
android:protectionLevel="signature"/> <!-- Required -->
<uses-permission android:name="${applicationId}.permission.JPUSH_MESSAGE"/>
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT"/>
<uses-permission android:name="android.permission.INTERNET"/>
Expand All @@ -21,8 +19,7 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.CAMERA"/>
<!-- Optional. Required for location feature -->
<uses-permission android:name="android.permission.CAMERA"/> <!-- Optional. Required for location feature -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Expand All @@ -33,102 +30,46 @@

<application
android:name=".application.JGApplication"
android:allowBackup="true"
android:allowBackup="false"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.NoActionBar">
<activity android:name=".activity.UserInfoActivity">
</activity>
<activity android:name=".activity.SearchForChatRoomActivity">
</activity>
<activity android:name=".activity.ChatRoomKeeperActivity">
</activity>

<meta-data
android:name="AA_DB_NAME"
android:value="jchat.db"/>
<meta-data
android:name="AA_MODELS"
android:value="jiguang.chat.database.UserEntry, jiguang.chat.database.FriendEntry,
jiguang.chat.database.FriendRecommendEntry, jiguang.chat.database.GroupApplyEntry
, jiguang.chat.database.RefuseGroupEntry"/>
android:value="jiguang.chat.database.UserEntry, jiguang.chat.database.FriendEntry, jiguang.chat.database.FriendRecommendEntry, jiguang.chat.database.GroupApplyEntry , jiguang.chat.database.RefuseGroupEntry"/>
<meta-data
android:name="AA_DB_VERSION"
android:value="4"/>

<!-- Required SDK 核心功能 -->
android:value="4"/> <!-- Since JCore2.0.0 Required SDK核心功能 -->
<!-- 可配置android:process参数将PushService放在其他进程中 -->
<service
android:name="cn.jpush.android.service.PushService"
android:name=".MyService"
android:enabled="true"
android:exported="false"
android:process=":remote">
android:process=":pushcore">
<intent-filter>
<action android:name="cn.jpush.android.intent.REGISTER"/>
<action android:name="cn.jpush.android.intent.REPORT"/>
<action android:name="cn.jpush.android.intent.PushService"/>
<action android:name="cn.jpush.android.intent.PUSH_TIME"/>
<action android:name="cn.jiguang.user.service.action"/>
</intent-filter>
</service>

<!-- Required SDK核心功能 -->
<receiver
android:name="cn.jpush.android.service.PushReceiver"
android:enabled="true"
android:exported="false">
<intent-filter android:priority="1000">
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY"/>

<category android:name="${applicationId}"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT"/>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter>
<!-- Optional -->
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>

<data android:scheme="package"/>
</intent-filter>
</receiver>

<!-- Required SDK核心功能 -->
<receiver
android:name="cn.jpush.im.android.helpers.IMReceiver"
android:enabled="true"
android:exported="false">
<intent-filter android:priority="1000">
<action android:name="cn.jpush.im.android.action.IM_RESPONSE"/>
<action android:name="cn.jpush.im.android.action.NOTIFICATION_CLICK_PROXY"/>

<category android:name="${applicationId}"/>
</intent-filter>
</receiver>


<service
android:name="com.baidu.location.f"
android:enabled="true"
android:process=":remote">
</service>
</service> <!-- 如果需要使用到位置服务,需要更换百度地图apikey为自己的apikey -->
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="UAkQeBK84ioVGzYgA1rSWYfuD4xYtpmV"/>

<!-- Required SDK核心功能 -->
<receiver
android:name="cn.jpush.android.service.AlarmReceiver"
android:exported="false"/>

<meta-data
android:name="JPUSH_CHANNEL"
android:value="developer-default"/>
<meta-data
android:name="JPUSH_APPKEY"
android:value="4f7aef34fb361292c566a1cd"/>

<provider
android:name="cn.jpush.android.service.DataProvider"
android:authorities="${applicationId}.DataProvider"
android:exported="true"/>

<activity
android:name=".activity.WelcomeActivity"
android:screenOrientation="portrait"
Expand All @@ -141,8 +82,7 @@
</activity>
<activity
android:name=".activity.LoginActivity"
android:screenOrientation="portrait"
/>
android:screenOrientation="portrait"/>
<activity
android:name=".activity.MainActivity"
android:screenOrientation="portrait"
Expand All @@ -152,7 +92,8 @@
<activity
android:name=".activity.FinishRegisterActivity"
android:screenOrientation="portrait"
android:theme="@style/BaseThemes"/>
android:theme="@style/BaseThemes"
android:windowSoftInputMode="stateVisible"/>
<activity
android:name=".activity.ResetPasswordActivity"
android:screenOrientation="portrait"
Expand All @@ -165,8 +106,7 @@
<activity
android:name=".activity.AboutJChatActivity"
android:screenOrientation="portrait"
android:theme="@style/BaseThemes"/>
<!--这里有个需要注意的地方就是,自定义的弹窗需要自定义一个theme否则系统会默认给设置padding自己设置的属性不生效-->
android:theme="@style/BaseThemes"/> <!-- 这里有个需要注意的地方就是,自定义的弹窗需要自定义一个theme否则系统会默认给设置padding自己设置的属性不生效 -->
<activity
android:name=".activity.PersonalActivity"
android:screenOrientation="portrait"
Expand Down Expand Up @@ -195,7 +135,6 @@
android:name=".activity.SearchFriendDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/BaseThemes"/>

<activity
android:name=".activity.ChatActivity"
android:screenOrientation="portrait"
Expand Down Expand Up @@ -433,12 +372,17 @@
<activity
android:name=".activity.SearchChatRoomActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible"
android:theme="@style/AppTh"/>
android:theme="@style/AppTh"
android:windowSoftInputMode="stateVisible"/>
<activity
android:name=".activity.GroupAvatarActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTh"/>

<provider
android:name="com.activeandroid.content.ContentProvider"
android:authorities="${applicationId}"
android:exported="false"/>
</application>

</manifest>
6 changes: 6 additions & 0 deletions chatapp/src/main/java/jiguang/chat/MyService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package jiguang.chat;

import cn.jpush.android.service.JCommonService;

public class MyService extends JCommonService {
}
Loading

0 comments on commit 458fc34

Please sign in to comment.