├── client-android ├── app │ ├── .gitignore │ ├── src │ │ ├── test │ │ │ ├── resources │ │ │ │ └── mockito-extensions │ │ │ │ │ └── org.mockito.plugins.MockMaker │ │ │ └── kotlin │ │ │ │ ├── javax │ │ │ │ └── microedition │ │ │ │ │ └── khronos │ │ │ │ │ └── opengles │ │ │ │ │ └── GL.java │ │ │ │ └── cn │ │ │ │ └── dreamtobe │ │ │ │ └── grpc │ │ │ │ └── client │ │ │ │ ├── AndroidTest.kt │ │ │ │ ├── GrpcClientTest.kt │ │ │ │ └── presenter │ │ │ │ ├── ConversationPresenterTest.kt │ │ │ │ └── LoginPresenterTest.kt │ │ └── main │ │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── drawable │ │ │ │ ├── ic_add_black_24dp.xml │ │ │ │ └── ic_cached_black_24dp.xml │ │ │ ├── menu │ │ │ │ └── menu_conversation.xml │ │ │ └── layout │ │ │ │ ├── activity_initial.xml │ │ │ │ ├── item_conversation.xml │ │ │ │ ├── activity_conversation.xml │ │ │ │ └── activity_login.xml │ │ │ ├── kotlin │ │ │ └── cn │ │ │ │ └── dreamtobe │ │ │ │ └── grpc │ │ │ │ └── client │ │ │ │ ├── model │ │ │ │ ├── Codes.kt │ │ │ │ └── ServerApi.kt │ │ │ │ ├── view │ │ │ │ ├── MvpView.kt │ │ │ │ ├── ConversationMvpView.kt │ │ │ │ └── LoginMvpView.kt │ │ │ │ ├── presenter │ │ │ │ ├── Presenter.kt │ │ │ │ ├── ConversationPresenter.kt │ │ │ │ └── LoginPresenter.kt │ │ │ │ ├── activity │ │ │ │ ├── LaunchActivity.kt │ │ │ │ ├── InitialActivity.kt │ │ │ │ ├── ConversationActivity.kt │ │ │ │ └── LoginActivity.kt │ │ │ │ ├── tools │ │ │ │ ├── Logger.kt │ │ │ │ ├── ProgressSubscriber.kt │ │ │ │ ├── HandlerThreadScheduler.kt │ │ │ │ └── AndroidSchedulers.kt │ │ │ │ ├── GrpcClientApplication.kt │ │ │ │ └── adapter │ │ │ │ └── ConversationListAdapter.kt │ │ │ └── AndroidManifest.xml │ ├── grpc-demo.jks │ ├── proguard-rules.pro │ └── build.gradle ├── settings.gradle ├── refresh-proto.sh ├── .idea │ ├── copyright │ │ ├── profiles_settings.xml │ │ └── Apache_V2.xml │ ├── encodings.xml │ ├── dictionaries │ │ └── Jacksgong.xml │ ├── modules.xml │ ├── runConfigurations.xml │ ├── gradle.xml │ └── compiler.xml ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .gitignore ├── debug.sh ├── gradle.properties ├── build.gradle ├── gradlew.bat ├── gradlew └── LICENSE.txt ├── run-android.sh ├── run-server.sh ├── arts ├── demo.gif ├── demo.mp4 ├── release-v1.apk ├── ic_launcher.psd └── release-v1.1.apk ├── refresh-android-proto.sh ├── refresh-backend-proto.sh ├── .gitmodules ├── CHANGELOG.md ├── README-zh.md ├── README.md └── LICENSE.txt /client-android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /client-android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /run-android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd client-android 4 | ./debug.sh 5 | -------------------------------------------------------------------------------- /run-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd grpc-chat-kotlin 4 | ./gradlew :server:run 5 | -------------------------------------------------------------------------------- /arts/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/arts/demo.gif -------------------------------------------------------------------------------- /arts/demo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/arts/demo.mp4 -------------------------------------------------------------------------------- /refresh-android-proto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd client-android 4 | ./refresh-proto.sh 5 | -------------------------------------------------------------------------------- /refresh-backend-proto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd grpc-chat-kotlin 4 | ./gradlew :proto:build 5 | -------------------------------------------------------------------------------- /arts/release-v1.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/arts/release-v1.apk -------------------------------------------------------------------------------- /client-android/app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline -------------------------------------------------------------------------------- /arts/ic_launcher.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/arts/ic_launcher.psd -------------------------------------------------------------------------------- /arts/release-v1.1.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/arts/release-v1.1.apk -------------------------------------------------------------------------------- /client-android/app/grpc-demo.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/client-android/app/grpc-demo.jks -------------------------------------------------------------------------------- /client-android/refresh-proto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./gradlew clean 4 | ./gradlew extractDebugProto 5 | ./gradlew assembleDebug 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "grpc-chat-kotlin"] 2 | path = grpc-chat-kotlin 3 | url = https://github.com/Jacksgong/grpc-chat-kotlin.git 4 | -------------------------------------------------------------------------------- /client-android/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /client-android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/client-android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /client-android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/client-android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /client-android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/client-android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /client-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/client-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /client-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/client-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGE LOG 2 | 3 | ## V1.1 4 | 5 | - Using domain(grpc.jacksgong.com) instread of direct-ip because of Migration-Backend 6 | 7 | ## V1.0 8 | 9 | initial apk 10 | -------------------------------------------------------------------------------- /client-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jacksgong/grpc-android-kotlin/HEAD/client-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /client-android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | /.idea/misc.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /client-android/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /client-android/.idea/dictionaries/Jacksgong.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | unsubscribed 5 | 6 | 7 | -------------------------------------------------------------------------------- /client-android/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./gradlew extractDebugProto 4 | ./gradlew installDebug 5 | adb shell am start -n "cn.dreamtobe.grpc.client/cn.dreamtobe.grpc.client.activity.LaunchActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER 6 | -------------------------------------------------------------------------------- /client-android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Mar 06 17:14:02 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /client-android/app/src/main/kotlin/cn/dreamtobe/grpc/client/model/Codes.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is special, under LGPLv3 license. 3 | */ 4 | package cn.dreamtobe.grpc.client.model 5 | 6 | class Codes { 7 | companion object { 8 | const val SUCCESS = 0 9 | const val LOCAL_ERROR = -1 10 | } 11 | } -------------------------------------------------------------------------------- /client-android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #727272 7 | #e1e1e1 8 | 9 | -------------------------------------------------------------------------------- /client-android/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /client-android/app/src/main/res/drawable/ic_add_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /client-android/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 12dp 7 | 12dp 8 | 6dp 9 | 6dp 10 | 11 | -------------------------------------------------------------------------------- /client-android/app/src/main/res/menu/menu_conversation.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /client-android/app/src/main/res/drawable/ic_cached_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /client-android/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /client-android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /client-android/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /client-android/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /client-android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /client-android/.idea/copyright/Apache_V2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /client-android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.1.0' 5 | repositories { 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:2.3.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.0" 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | jcenter() 21 | mavenCentral() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /client-android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GRPC 3 | 4 | 5 | UserName 6 | Password (at least 4 character) 7 | Sign in or register 8 | Sign in 9 | This email address is invalid 10 | This password is too short 11 | This password is incorrect 12 | This field is required 13 | "Contacts permissions are needed for providing email 14 | completions." 15 | 16 | 17 | -------------------------------------------------------------------------------- /client-android/app/src/test/kotlin/javax/microedition/khronos/opengles/GL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jacksgong(blog.dreamtobe.cn) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package javax.microedition.khronos.opengles; 18 | 19 | /** 20 | * Just for fix class not found on unit-test for show dialog. 21 | */ 22 | public interface GL { } -------------------------------------------------------------------------------- /client-android/app/src/main/kotlin/cn/dreamtobe/grpc/client/view/MvpView.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jacksgong(blog.dreamtobe.cn) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package cn.dreamtobe.grpc.client.view 18 | 19 | import android.content.Context 20 | 21 | /** 22 | * Created by Jacksgong on 09/03/2017. 23 | */ 24 | interface MvpView { 25 | fun getContext(): Context 26 | } -------------------------------------------------------------------------------- /client-android/app/src/main/kotlin/cn/dreamtobe/grpc/client/presenter/Presenter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jacksgong(blog.dreamtobe.cn) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package cn.dreamtobe.grpc.client.presenter 18 | 19 | /** 20 | * Created by Jacksgong on 08/03/2017. 21 | */ 22 | interface Presenter { 23 | fun attachView(view: V) 24 | fun detachView() 25 | } -------------------------------------------------------------------------------- /client-android/app/src/main/kotlin/cn/dreamtobe/grpc/client/view/ConversationMvpView.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jacksgong(blog.dreamtobe.cn) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package cn.dreamtobe.grpc.client.view 18 | 19 | import de.mkammerer.grpcchat.protocol.Error 20 | import de.mkammerer.grpcchat.protocol.RoomMessage 21 | 22 | /** 23 | * Created by Jacksgong on 08/03/2017. 24 | */ 25 | interface ConversationMvpView : MvpView { 26 | fun showLoading() 27 | fun showConversations(roomMessageList: List) 28 | fun showError(error: Error) 29 | fun createdNewRoom() 30 | } -------------------------------------------------------------------------------- /client-android/app/src/main/kotlin/cn/dreamtobe/grpc/client/activity/LaunchActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jacksgong(blog.dreamtobe.cn) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package cn.dreamtobe.grpc.client.activity 18 | 19 | import android.content.Intent 20 | import android.os.Bundle 21 | import android.support.v7.app.AppCompatActivity 22 | 23 | class LaunchActivity : AppCompatActivity() { 24 | 25 | override fun onCreate(savedInstanceState: Bundle?) { 26 | super.onCreate(savedInstanceState) 27 | startActivity(Intent(this, InitialActivity::class.java)) 28 | finish() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client-android/app/src/main/kotlin/cn/dreamtobe/grpc/client/view/LoginMvpView.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jacksgong(blog.dreamtobe.cn) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package cn.dreamtobe.grpc.client.view 18 | 19 | import de.mkammerer.grpcchat.protocol.Error 20 | 21 | /** 22 | * Created by Jacksgong on 09/03/2017. 23 | */ 24 | interface LoginMvpView : MvpView { 25 | fun showLoading() 26 | fun loggedIn(performedRegister: Boolean) 27 | fun showError(error: Error) 28 | fun showUserNameError(tipsId: Int) 29 | fun showPasswordError(tipsId: Int) 30 | fun resetError() 31 | fun addEmailsToAutoComplete(emailAddressCollection: List) 32 | } -------------------------------------------------------------------------------- /client-android/app/src/main/kotlin/cn/dreamtobe/grpc/client/tools/Logger.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jacksgong(blog.dreamtobe.cn) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package cn.dreamtobe.grpc.client.tools 18 | 19 | import android.util.Log 20 | 21 | /** 22 | * Created by Jacksgong on 07/03/2017. 23 | */ 24 | class Logger { 25 | companion object { 26 | fun log(o: Object, msg: String?, priority: Int = Log.DEBUG) { 27 | log(o.javaClass, msg, priority) 28 | } 29 | 30 | fun log(javaClass: Class<*>, msg: String?, priority: Int = Log.DEBUG) { 31 | msg ?: return 32 | 33 | Log.println(priority, javaClass.simpleName, msg) 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /client-android/app/src/test/kotlin/cn/dreamtobe/grpc/client/AndroidTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jacksgong(blog.dreamtobe.cn) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package cn.dreamtobe.grpc.client 18 | 19 | import android.content.Context 20 | import org.junit.runner.RunWith 21 | import org.robolectric.RobolectricTestRunner 22 | import org.robolectric.RuntimeEnvironment 23 | import org.robolectric.annotation.Config 24 | import java.io.File 25 | 26 | @RunWith(RobolectricTestRunner::class) 27 | @Config(constants = BuildConfig::class, 28 | application = GrpcClientApplication::class, 29 | sdk = intArrayOf(24)) 30 | abstract class AndroidTest { 31 | 32 | fun context(): Context { 33 | return RuntimeEnvironment.application 34 | } 35 | 36 | fun cacheDir(): File { 37 | return context().cacheDir 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client-android/app/src/main/res/layout/activity_initial.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 20 | 21 | 28 | 29 | 30 | 31 |