>
25 | }
--------------------------------------------------------------------------------
/module-demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
14 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/library-base/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
14 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/interceptor/logging/Level.java:
--------------------------------------------------------------------------------
1 | package com.rui.mvvmlazy.http.interceptor.logging;
2 |
3 | /**
4 | * @author ihsan on 21/02/2020.
5 | */
6 |
7 | public enum Level {
8 | /**
9 | * No logs.
10 | */
11 | NONE,
12 | /**
13 | * Example:
14 | *
{@code
15 | * - URL
16 | * - Method
17 | * - Headers
18 | * - Body
19 | * }
20 | */
21 | BASIC,
22 | /**
23 | * Example:
24 | *
{@code
25 | * - URL
26 | * - Method
27 | * - Headers
28 | * }
29 | */
30 | HEADERS,
31 | /**
32 | * Example:
33 | *
{@code
34 | * - URL
35 | * - Method
36 | * - Body
37 | * }
38 | */
39 | BODY
40 | }
41 |
--------------------------------------------------------------------------------
/library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/interceptor/logging/I.java:
--------------------------------------------------------------------------------
1 | package com.rui.mvvmlazy.http.interceptor.logging;
2 |
3 |
4 | import java.util.logging.Level;
5 |
6 | import okhttp3.internal.platform.Platform;
7 |
8 | /**
9 | * @author ihsan on 10/02/2020.
10 | */
11 | class I {
12 |
13 | protected I() {
14 | throw new UnsupportedOperationException();
15 | }
16 |
17 | static void log(int type, String tag, String msg) {
18 | java.util.logging.Logger logger = java.util.logging.Logger.getLogger(tag);
19 | switch (type) {
20 | case Platform.INFO:
21 | logger.log(Level.INFO, msg);
22 | break;
23 | default:
24 | logger.log(Level.WARNING, msg);
25 | break;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/radiogroup/ViewAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.rui.mvvmlazy.binding.viewadapter.radiogroup
2 |
3 | import android.view.View
4 | import android.widget.RadioButton
5 | import android.widget.RadioGroup
6 | import androidx.databinding.BindingAdapter
7 |
8 | /**
9 | * Created by zjr on 2020/6/18.
10 | */
11 | object ViewAdapter {
12 | @JvmStatic
13 | @BindingAdapter(value = ["onCheckedChangedCommand"], requireAll = false)
14 | fun onCheckedChangedCommand(radioGroup: RadioGroup, bindingCommand: (String) -> Unit) {
15 | radioGroup.setOnCheckedChangeListener { group, checkedId ->
16 | val radioButton = group.findViewById(checkedId) as RadioButton
17 | bindingCommand.invoke(radioButton.text.toString())
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/module-home/src/androidTest/java/com/rui/home/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.rui.home
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.bxyun.module_sign", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/module-sign/src/androidTest/java/com/rui/sign/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.rui.sign
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.bxyun.module_sign", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/library-mvvmlazy/src/main/res/layout/view_empty.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/module-sign/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'kotlin-android'
3 | id 'kotlin-kapt'
4 | }
5 | apply from: "../module.build.gradle"
6 | android {
7 | defaultConfig {
8 | //如果是独立模块,则使用当前组件的包名
9 | if (isBuildModule.toBoolean()) {
10 | c }
11 | }
12 | //统一资源前缀,规范资源引用
13 | resourcePrefix "sign_"
14 | namespace 'com.rui.sign'
15 | sourceSets {
16 | main {
17 | jniLibs.srcDirs = ['libs']
18 | }
19 | }
20 | }
21 | kapt {
22 | arguments {
23 | arg("AROUTER_MODULE_NAME", project.getName())
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.?ar'])
29 | implementation 'com.github.WGwangguan:SeparatedEditText:v1.2'
30 | api project(':library-base')
31 | kapt rootProject.ext.dependencies["arouter-compiler"]
32 | }
33 |
--------------------------------------------------------------------------------
/library-base/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/module-demo/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/module-home/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/module-home/src/main/java/com/rui/home/data/source/local/LocalDataSourceImpl.kt:
--------------------------------------------------------------------------------
1 | package com.rui.home.data.source.local
2 |
3 | import com.rui.home.data.source.LocalDataSource
4 | import com.rui.mvvmlazy.utils.data.SPUtils
5 |
6 | /**
7 | * 本地数据源,可配合Room框架使用
8 | * Created by zjr on 2019/3/26.
9 | */
10 |
11 |
12 | class LocalDataSourceImpl : LocalDataSource {
13 | override fun saveUserName(userName: String) {
14 | SPUtils.instance.put("UserName", userName)
15 | }
16 |
17 | override fun savePassword(password: String) {
18 | SPUtils.instance.put("password", password)
19 | }
20 |
21 | override fun getUserName(): String {
22 | return SPUtils.instance.getString("UserName")!!
23 | }
24 |
25 | override fun getPassword(): String {
26 | return SPUtils.instance.getString("password")!!
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/module-sign/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/library-base/src/main/res/drawable/btn_bg_r16_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
16 | -
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/module-demo/src/main/res/layout/test_item_list_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/cookie/CookieJarImpl.kt:
--------------------------------------------------------------------------------
1 | package com.rui.mvvmlazy.http.cookie
2 |
3 | import com.rui.mvvmlazy.http.cookie.store.CookieStore
4 | import okhttp3.Cookie
5 | import okhttp3.CookieJar
6 | import okhttp3.HttpUrl
7 |
8 | /**
9 | * Created by zjr on 2020/5/13.
10 | */
11 | class CookieJarImpl(cookieStore: CookieStore?) : CookieJar {
12 | val cookieStore: CookieStore
13 |
14 | @Synchronized
15 | override fun saveFromResponse(url: HttpUrl, cookies: List) {
16 | cookieStore.saveCookie(url, cookies)
17 | }
18 |
19 | @Synchronized
20 | override fun loadForRequest(url: HttpUrl): List {
21 | return cookieStore.loadCookie(url)
22 | }
23 |
24 | init {
25 | requireNotNull(cookieStore) { "cookieStore can not be null!" }
26 | this.cookieStore = cookieStore
27 | }
28 | }
--------------------------------------------------------------------------------
/library-base/src/main/java/com/rui/base/entity/UserInfoEntity.kt:
--------------------------------------------------------------------------------
1 | package com.rui.base.entity
2 |
3 | import java.io.Serializable
4 |
5 | /**
6 | * ******************************
7 | * *@Author
8 | * *date :
9 | * *description:用户信息
10 | * *******************************
11 | */
12 | class UserInfoEntity(
13 | var access_token: String,
14 | var token_type: String,
15 | var refresh_token: String,
16 | var expires_in: Long,
17 | var scope: String
18 | ) : Serializable {
19 | override fun toString(): String {
20 | return "UserInfoEntity{" +
21 | "access_token='" + access_token + '\'' +
22 | ", token_type='" + token_type + '\'' +
23 | ", refresh_token='" + refresh_token + '\'' +
24 | ", expires_in='" + expires_in + '\'' +
25 | ", scope='" + scope +
26 | '}'
27 | }
28 | }
--------------------------------------------------------------------------------
/library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/AppException.kt:
--------------------------------------------------------------------------------
1 | package com.rui.mvvmlazy.http
2 |
3 | /**
4 | * 作者 : zjr
5 | * 时间 : 2019/12/17
6 | * 描述 :自定义错误信息异常
7 | */
8 | class AppException : Exception {
9 |
10 | var errorMsg: String //错误消息
11 | var errCode: Int = 0 //错误码
12 | var errorLog: String? //错误日志
13 | var throwable: Throwable? = null
14 |
15 | constructor(errCode: Int, error: String?, errorLog: String? = "", throwable: Throwable? = null) : super(error) {
16 | this.errorMsg = error ?: "请求失败,请稍后再试"
17 | this.errCode = errCode
18 | this.errorLog = errorLog ?: this.errorMsg
19 | this.throwable = throwable
20 | }
21 |
22 | constructor(error: Error, e: Throwable?) {
23 | errCode = error.getKey()
24 | errorMsg = error.getValue()
25 | errorLog = e?.message
26 | throwable = e
27 | }
28 | }
--------------------------------------------------------------------------------
/module-demo/src/main/res/layout/test_fragment_tab_bar_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
19 |
20 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/module-demo/src/main/java/com/rui/demo/data/source/http/HttpDataSourceImpl.kt:
--------------------------------------------------------------------------------
1 | package com.rui.demo.data.source.http
2 |
3 | import com.rui.base.entity.ApiResponse
4 | import com.rui.base.entity.ApiResponseTest
5 | import com.rui.demo.data.bean.JokeInfo
6 | import com.rui.demo.data.source.HttpDataSource
7 | import com.rui.demo.data.source.http.service.HomeApiService
8 | import com.rui.mvvmlazy.http.PagingData
9 |
10 | /**
11 | * Created by zjr on 2019/3/26.
12 | */
13 | class HttpDataSourceImpl(var apiService: HomeApiService) : HttpDataSource {
14 | override suspend fun getJoke(
15 | page: Int,
16 | size: Int
17 | ): ApiResponse> {
18 | return apiService.getJoke(page, size)
19 | }
20 |
21 | override suspend fun testApi(page: String): ApiResponseTest