├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── bxyun.jks ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── rui │ │ └── myapp │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ ├── layout │ │ └── app_activity_main.xml │ │ ├── values │ │ └── strings.xml │ │ └── xml │ │ ├── app_file_paths.xml │ │ └── app_network_security_config.xml │ └── test │ └── java │ └── com │ └── rui │ └── myapp │ └── ExampleUnitTest.java ├── build.gradle ├── config.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library-base ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── rui │ │ └── base │ │ ├── AppApplication.kt │ │ ├── base │ │ └── BaseModuleInit.kt │ │ ├── debug │ │ └── DebugApplication.kt │ │ ├── entity │ │ ├── ApiResponse.kt │ │ ├── ApiResponseTest.kt │ │ ├── BannerInfo.kt │ │ ├── LoginUnNormalBean.java │ │ └── UserInfoEntity.kt │ │ ├── global │ │ └── SPKeyGlobal.kt │ │ ├── network │ │ ├── HttpsUtils.java │ │ └── RetrofitClient.kt │ │ ├── router │ │ ├── RouterActivityPath.kt │ │ └── RouterFragmentPath.kt │ │ ├── service │ │ └── PublicApiService.kt │ │ ├── ui │ │ ├── fragment │ │ │ └── BasePagerFragment.kt │ │ └── viewModel │ │ │ └── BasePaginationViewModel.kt │ │ ├── utils │ │ ├── BindConvertUtils.kt │ │ ├── BindUtils.kt │ │ ├── CleanCacheDataUtils.kt │ │ ├── Constant.kt │ │ ├── DialogUtils.kt │ │ ├── GpsUtil.kt │ │ ├── ImageAdapter.kt │ │ ├── ImageDispose.kt │ │ ├── ImageHolder.kt │ │ ├── TimeFormater.kt │ │ └── UserInfoUtils.kt │ │ └── view │ │ ├── EditTextBottomPopup.java │ │ └── HintPopup.java │ └── res │ ├── anim │ ├── pickerview_dialog_scale_in.xml │ ├── pickerview_dialog_scale_out.xml │ ├── pickerview_slide_in_bottom.xml │ ├── pickerview_slide_out_bottom.xml │ ├── translate_in.xml │ └── translate_out.xml │ ├── drawable-xhdpi │ ├── ic_scenic_checked_circle.png │ ├── ic_scenic_checked_gou.png │ ├── ic_scenic_uncheck_circle.png │ ├── ic_scenic_uncheck_gou.png │ ├── ic_scenic_uncheck_square.png │ ├── ic_star_empty.png │ ├── ic_star_full.png │ └── ic_star_half.png │ ├── drawable-xxhdpi │ ├── base_dialog_update_bg.png │ ├── circle_flag.png │ ├── demo_arr_right.png │ ├── ic_def_loading.png │ ├── ic_scenic_checked_circle.png │ ├── ic_scenic_checked_gou.png │ ├── ic_scenic_checked_square.png │ ├── ic_scenic_uncheck_circle.png │ ├── ic_scenic_uncheck_gou.png │ ├── ic_scenic_uncheck_square.png │ ├── ic_search.png │ ├── ic_star_empty.png │ ├── ic_star_full.png │ └── ic_star_half.png │ ├── drawable │ ├── bg_black_r10.xml │ ├── bg_dialog_bottom.xml │ ├── bg_spinner_window.xml │ ├── btn_bg_frame_439057_green.xml │ ├── btn_bg_frame_r0.xml │ ├── btn_bg_frame_r10.xml │ ├── btn_bg_frame_r10_blue.xml │ ├── btn_bg_frame_r22_gray.xml │ ├── btn_bg_frame_r3_gray.xml │ ├── btn_bg_frame_r45_blue.xml │ ├── btn_bg_frame_r45_shape.xml │ ├── btn_bg_frame_r9_ffb701.xml │ ├── btn_bg_r11_color_ffb701.xml │ ├── btn_bg_r16_selector.xml │ ├── btn_bg_r1_color_f3.xml │ ├── btn_bg_r1_color_fc.xml │ ├── btn_bg_r45_selector.xml │ ├── btn_bg_r4_color_ffb701.xml │ ├── btn_bg_r5_color_black.xml │ ├── btn_bg_r5_color_ffb701.xml │ ├── btn_ripple_bg_r10_blue.xml │ ├── btn_ripple_bg_r10_red.xml │ ├── btn_ripple_bg_r15_blue.xml │ ├── btn_ripple_bg_r15_white.xml │ ├── btn_ripple_bg_r15_yellow.xml │ ├── btn_ripple_bg_r45_blue.xml │ ├── btn_ripple_bg_r45_f5f5f6.xml │ ├── btn_ripple_bg_r45_yellow.xml │ ├── btn_ripple_bg_r5_yellow.xml │ ├── btn_text_color_selecor.xml │ ├── common_item_circle_local.xml │ ├── common_red_shape.xml │ ├── common_translation_background.xml │ ├── common_video_tag_back.xml │ ├── error_ic.xml │ ├── et_login_r45_shape.xml │ ├── finish_ic.xml │ ├── ic_sharp_arrow_back.xml │ ├── indicator_bottom_line.xml │ ├── indicator_bottom_line_white.xml │ ├── indicator_round_default_background.xml │ ├── label_bg.xml │ ├── label_text_color.xml │ ├── radio_nomal.xml │ ├── rating_yellow.xml │ ├── red_point_bg.xml │ ├── reply_view_bg.xml │ ├── ripple_white_bg.xml │ ├── search_view_bg.xml │ ├── selector_radio_circle.xml │ ├── selector_radio_square.xml │ ├── seletor_radio_gou.xml │ ├── shape_ciecle_f7f8fa.xml │ ├── shape_ciecle_ffb100.xml │ ├── shape_circle_00bb9b.xml │ ├── shape_circle_ff6b33.xml │ ├── shape_circle_gray.xml │ ├── shape_circle_white.xml │ ├── shape_dialog_time_btn1.xml │ ├── shape_line_stroke.xml │ ├── shape_r11_gray.xml │ ├── shape_r25_gray_live_list.xml │ ├── shape_r25_green_live_list.xml │ ├── shape_r2_solid_999999.xml │ ├── shape_r30_gradual_ffb701.xml │ ├── shape_recommend_item_btn3_type3.xml │ ├── shape_recommend_item_location.xml │ ├── shape_scenic_ciecle_app_the_them.xml │ ├── shape_select_city_diaolog.xml │ ├── shape_tab_line.xml │ ├── share_top_shape.xml │ └── warning_ic.xml │ ├── layout │ ├── base_fragment_base_pager.xml │ ├── base_toolbar.xml │ ├── base_view_pagination.xml │ ├── edittext_bottom_popup.xml │ ├── hint_dialog.xml │ └── view_version_update_dialog.xml │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values │ ├── attrs.xml │ ├── color.xml │ ├── dimens.xml │ ├── ids.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ ├── app_file_paths.xml │ └── app_network_security_config.xml ├── library-mvvmlazy ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── rui │ │ └── mvvmlazy │ │ ├── base │ │ ├── AppManager.kt │ │ ├── BaseModel.kt │ │ ├── BaseViewModel.kt │ │ ├── ContainerActivity.kt │ │ ├── IBaseView.kt │ │ ├── IBaseViewModel.kt │ │ ├── IModel.kt │ │ ├── ItemViewModel.kt │ │ ├── Ktx.kt │ │ ├── MultiItemViewModel.kt │ │ ├── activity │ │ │ ├── BaseVmActivity.kt │ │ │ └── BaseVmDbActivity.kt │ │ └── fragment │ │ │ ├── BaseVmDbFragment.kt │ │ │ └── BaseVmFragment.kt │ │ ├── binding │ │ └── viewadapter │ │ │ ├── checkbox │ │ │ └── ViewAdapter.kt │ │ │ ├── edittext │ │ │ └── ViewAdapter.kt │ │ │ ├── image │ │ │ └── ViewAdapter.kt │ │ │ ├── mswitch │ │ │ └── ViewAdapter.kt │ │ │ ├── multistateview │ │ │ └── ViewAdapter.kt │ │ │ ├── radiogroup │ │ │ └── ViewAdapter.kt │ │ │ ├── recyclerview │ │ │ ├── DataBindingAdapter.kt │ │ │ ├── LayoutManagers.kt │ │ │ ├── LineManagers.kt │ │ │ └── ViewAdapter.kt │ │ │ ├── scrollview │ │ │ └── ViewAdapter.kt │ │ │ ├── spinner │ │ │ ├── IKeyAndValue.kt │ │ │ └── ViewAdapter.kt │ │ │ ├── swiperefresh │ │ │ ├── SmartRefreshState.kt │ │ │ └── ViewAdapter.kt │ │ │ ├── view │ │ │ └── ViewAdapter.kt │ │ │ ├── viewpager │ │ │ └── ViewAdapter.kt │ │ │ └── webview │ │ │ └── ViewAdapter.kt │ │ ├── bus │ │ └── event │ │ │ ├── SingleLiveEvent.java │ │ │ └── SnackbarMessage.java │ │ ├── ext │ │ ├── BaseViewModelExt.kt │ │ ├── util │ │ │ ├── CommonExt.kt │ │ │ ├── LogExt.kt │ │ │ ├── StringExt.kt │ │ │ └── SystemServiceExt.kt │ │ └── view │ │ │ ├── EditTextViewExt.kt │ │ │ └── ViewExt.kt │ │ ├── http │ │ ├── AppException.kt │ │ ├── BaseResponse.kt │ │ ├── ExceptionHandle.kt │ │ ├── NetworkUtil.java │ │ ├── PagingData.kt │ │ ├── ResponseThrowable.java │ │ ├── cookie │ │ │ ├── CookieJarImpl.kt │ │ │ └── store │ │ │ │ ├── CookieStore.kt │ │ │ │ ├── MemoryCookieStore.kt │ │ │ │ ├── PersistentCookieStore.kt │ │ │ │ └── SerializableHttpCookie.kt │ │ └── interceptor │ │ │ ├── BaseInterceptor.java │ │ │ ├── CacheInterceptor.java │ │ │ └── logging │ │ │ ├── I.java │ │ │ ├── Level.java │ │ │ ├── Logger.java │ │ │ ├── LoggingInterceptor.java │ │ │ └── Printer.java │ │ ├── state │ │ └── ResultState.kt │ │ ├── utils │ │ ├── GlobalUtils.kt │ │ ├── InputTools.kt │ │ ├── app │ │ │ ├── FragmentUtils.kt │ │ │ ├── PackageUtils.kt │ │ │ ├── PathUtils.kt │ │ │ ├── ProcessUtils.kt │ │ │ └── ServiceUtils.kt │ │ ├── common │ │ │ ├── BigDecimalUtils.kt │ │ │ ├── ClickUtils.kt │ │ │ ├── ConvertUtils.kt │ │ │ ├── IDCardUtils.kt │ │ │ ├── KLog.kt │ │ │ ├── LanguageUtils.kt │ │ │ ├── RegexUtils.kt │ │ │ ├── ScreenUtil.kt │ │ │ ├── ShellUtils.kt │ │ │ ├── StringUtils.kt │ │ │ └── ToastUtils.kt │ │ ├── constant │ │ │ ├── DateFormatConstants.kt │ │ │ ├── MemoryConstants.kt │ │ │ ├── PathConstants.kt │ │ │ ├── PermissionConstants.kt │ │ │ ├── RegexConstants.kt │ │ │ └── TimeConstants.kt │ │ ├── data │ │ │ ├── DateUtils.kt │ │ │ └── SPUtils.kt │ │ ├── display │ │ │ ├── ImageUtils.kt │ │ │ ├── ScreenUtils.kt │ │ │ ├── ShotShareUtil.kt │ │ │ └── ViewUtils.kt │ │ ├── file │ │ │ ├── CloseUtils.kt │ │ │ ├── FileIOUtils.kt │ │ │ ├── FileUtils.kt │ │ │ ├── SDCardUtils.kt │ │ │ └── ZipUtils.kt │ │ ├── net │ │ │ └── InternetUtil.kt │ │ └── resource │ │ │ └── ResourceUtils.kt │ │ └── widget │ │ ├── ControlDistributeLinearLayout.kt │ │ ├── CountDownTextView.kt │ │ ├── DragView.kt │ │ └── MultiStateView.kt │ └── res │ ├── drawable-hdpi │ └── customactivityoncrash_error_image.png │ ├── drawable-mdpi │ └── customactivityoncrash_error_image.png │ ├── drawable-xhdpi │ └── customactivityoncrash_error_image.png │ ├── drawable-xxhdpi │ ├── back.png │ ├── base_view_empty_cache.png │ ├── customactivityoncrash_error_image.png │ └── icon_net_error.png │ ├── drawable-xxxhdpi │ └── customactivityoncrash_error_image.png │ ├── layout │ ├── activity_container.xml │ ├── customactivityoncrash_default_error_activity.xml │ ├── view_empty.xml │ ├── view_error.xml │ └── view_loading.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── module-demo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── alone │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── rui │ │ │ └── demo │ │ │ ├── DemoModuleInit.kt │ │ │ ├── data │ │ │ ├── DiscoverRepository.kt │ │ │ ├── bean │ │ │ │ ├── CityInfo.kt │ │ │ │ ├── JokeInfo.kt │ │ │ │ └── MsgInfo.kt │ │ │ └── source │ │ │ │ ├── HttpDataSource.kt │ │ │ │ ├── LocalDataSource.kt │ │ │ │ ├── http │ │ │ │ ├── HttpDataSourceImpl.kt │ │ │ │ └── service │ │ │ │ │ └── HomeApiService.kt │ │ │ │ └── local │ │ │ │ ├── LocalDataSourceImpl.kt │ │ │ │ └── db │ │ │ │ ├── Person.kt │ │ │ │ ├── PersonDao.kt │ │ │ │ └── PersonDatabase.kt │ │ │ └── ui │ │ │ ├── activity │ │ │ └── TestActivity.kt │ │ │ ├── fragment │ │ │ ├── BindingFragment.kt │ │ │ ├── BtmTabFragment.kt │ │ │ ├── DialogFragment.kt │ │ │ ├── ListFragment.kt │ │ │ ├── MutiFragment.kt │ │ │ ├── NetWorkFragment.kt │ │ │ ├── PaginationFragment.kt │ │ │ ├── RoomSampleFragment.kt │ │ │ ├── ShapeViewFragment.kt │ │ │ ├── TestFragment.kt │ │ │ ├── TitleBarFragment.kt │ │ │ ├── ViewPagerGroupFragment.kt │ │ │ └── tab │ │ │ │ ├── TabBar1Fragment.kt │ │ │ │ ├── TabBar2Fragment.kt │ │ │ │ ├── TabBar3Fragment.kt │ │ │ │ └── TabBar4Fragment.kt │ │ │ └── viewmodel │ │ │ ├── BindingViewModel.kt │ │ │ ├── BtmTabViewModel.kt │ │ │ ├── DialogViewModel.kt │ │ │ ├── ListViewModel.kt │ │ │ ├── MutiViewModel.kt │ │ │ ├── NetWorkViewModel.kt │ │ │ ├── PaginationViewModel.kt │ │ │ ├── RoomSampleViewModel.kt │ │ │ ├── ShapeViewModel.kt │ │ │ ├── TestViewModel.kt │ │ │ └── TitleBarViewModel.kt │ └── res │ │ ├── drawable-xhdpi │ │ ├── qr_code_ic.png │ │ ├── shape_gradient.xml │ │ ├── test_icon_phone_normal.png │ │ └── test_icon_phone_pressed.png │ │ ├── drawable │ │ ├── test_ic_add.xml │ │ ├── test_ic_contact.xml │ │ ├── test_ic_home.xml │ │ ├── test_ic_message.xml │ │ ├── test_ic_setting.xml │ │ ├── test_search.xml │ │ └── test_shape_gradient.xml │ │ ├── layout │ │ ├── test_activity_test.xml │ │ ├── test_fragment_binding.xml │ │ ├── test_fragment_btmtab.xml │ │ ├── test_fragment_dialog.xml │ │ ├── test_fragment_home.xml │ │ ├── test_fragment_list.xml │ │ ├── test_fragment_muti.xml │ │ ├── test_fragment_net_work.xml │ │ ├── test_fragment_pagination.xml │ │ ├── test_fragment_room.xml │ │ ├── test_fragment_shapeview.xml │ │ ├── test_fragment_tab_bar_1.xml │ │ ├── test_fragment_tab_bar_2.xml │ │ ├── test_fragment_tab_bar_3.xml │ │ ├── test_fragment_tab_bar_4.xml │ │ ├── test_fragment_titlebar.xml │ │ ├── test_item_list_content.xml │ │ └── test_layout_item_joke.xml │ │ ├── navigation │ │ └── test_nav_home.xml │ │ └── values │ │ ├── array.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── rui │ └── demo │ └── ExampleUnitTest.java ├── module-home ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── rui │ │ └── home │ │ └── ExampleInstrumentedTest.kt │ └── main │ ├── AndroidManifest.xml │ ├── alone │ └── AndroidManifest.xml │ ├── java │ └── com │ │ └── rui │ │ └── home │ │ ├── HomeModuleInit.kt │ │ ├── data │ │ ├── HomeRepository.kt │ │ └── source │ │ │ ├── HttpDataSource.java │ │ │ ├── LocalDataSource.java │ │ │ ├── http │ │ │ ├── HttpDataSourceImpl.kt │ │ │ └── service │ │ │ │ └── HomeApiService.kt │ │ │ └── local │ │ │ └── LocalDataSourceImpl.kt │ │ ├── ui │ │ ├── activity │ │ │ ├── MainActivity.kt │ │ │ └── SplashActivity.kt │ │ └── viewmodel │ │ │ ├── MainViewModel.kt │ │ │ └── SplashViewModel.kt │ │ └── utils │ │ └── TextBackClickUtils.kt │ └── res │ ├── drawable-xxhdpi │ └── home_ic_splash.png │ ├── layout │ ├── home_activity_main.xml │ └── home_activity_splash.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── module-sign ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── rui │ │ └── sign │ │ └── ExampleInstrumentedTest.kt │ └── main │ ├── AndroidManifest.xml │ ├── alone │ └── AndroidManifest.xml │ ├── java │ └── com │ │ └── rui │ │ └── sign │ │ ├── SignModuleInit.kt │ │ └── data │ │ ├── SignRepository.kt │ │ └── source │ │ ├── HttpDataSource.kt │ │ ├── LocalDataSource.kt │ │ ├── http │ │ ├── HttpDataSourceImpl.kt │ │ └── service │ │ │ └── SignApiService.kt │ │ └── local │ │ └── LocalDataSourceImpl.kt │ └── res │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── module.build.gradle └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/bxyun.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/app/bxyun.jks -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/rui/myapp/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.rui.myapp; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.bxyun.book", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/app_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Android懒人框架 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/xml/app_file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/xml/app_network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/test/java/com/rui/myapp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | 2 | plugins { 3 | id 'com.android.application' version '8.3.0' apply false 4 | id 'com.android.library' version '8.3.0' apply false 5 | id 'org.jetbrains.kotlin.android' version '1.9.21' apply false 6 | id 'com.google.devtools.ksp' version '1.9.21-1.0.16' apply false 7 | } 8 | 9 | tasks.register('clean', Delete) { 10 | delete rootProject.buildDir 11 | } 12 | 13 | apply from: "config.gradle" -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | # When configured, Gradle will run in incubating parallel mode. 10 | # This option should only be used with decoupled projects. More details, visit 11 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 12 | # org.gradle.parallel=true 13 | # AndroidX package structure to make it clearer which packages are bundled with the 14 | # Android operating system, and which are packaged with your app's APK 15 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 16 | org.gradle.daemon=true 17 | #JVM最大允许分配的堆内存,按需分配 18 | org.gradle.jvmargs=-Xmx4096m 19 | #使用并行编译 20 | org.gradle.parallel=true 21 | org.gradle.configureondemand=true 22 | 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | Android.useDeprecatedNdk=true 27 | # ʽfalse, ʽtrue; 28 | isBuildModule=false 29 | -Pandroid.debug.obsoleteApi=true 30 | org.gradel.daemon=true 31 | org.gradel.configureondemand=tru 32 | android.nonTransitiveRClass=false 33 | android.nonFinalResIds=false 34 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Feb 29 23:22:27 CST 2024 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /library-base/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /library-base/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/AppApplication.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base 2 | 3 | import android.app.Application 4 | 5 | class AppApplication : Application() { 6 | override fun onCreate() { 7 | super.onCreate() 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/debug/DebugApplication.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.debug 2 | 3 | import android.app.Application 4 | 5 | /** 6 | * Created by zjr on 2018/6/25 0025. 7 | * debug包下的代码不参与编译,仅作为独立模块运行时初始化数据 8 | */ 9 | class DebugApplication : Application() { 10 | override fun onCreate() { 11 | super.onCreate() 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/entity/ApiResponse.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.entity 2 | 3 | import com.rui.mvvmlazy.http.BaseResponse 4 | 5 | /** 6 | * 作者 : zjr 7 | * 时间 : 2019/12/23 8 | * 描述 :服务器返回数据的基类 9 | * 如果你的项目中有基类,那美滋滋,可以继承BaseResponse,请求时框架可以帮你自动脱壳,自动判断是否请求成功,怎么做: 10 | * 1.继承 BaseResponse 11 | * 2.重写isSucces 方法,编写你的业务需求,根据自己的条件判断数据是否请求成功 12 | * 3.重写 getResponseCode、getResponseData、getResponseMsg方法,传入你的 code data msg 13 | */ 14 | data class ApiResponse(val code: Int, val message: String, val result: T) : 15 | BaseResponse() { 16 | 17 | override fun isSuccess() = code == 200 18 | 19 | override fun getResponseCode() = code 20 | 21 | override fun getResponseData() = result 22 | 23 | override fun getResponseMsg() = message 24 | 25 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/entity/ApiResponseTest.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.entity 2 | 3 | import com.rui.mvvmlazy.http.BaseResponse 4 | 5 | /** 6 | * 作者 : zjr 7 | * 时间 : 2019/12/23 8 | * 描述 :服务器返回数据的基类 9 | * 如果你的项目中有基类,那美滋滋,可以继承BaseResponse,请求时框架可以帮你自动脱壳,自动判断是否请求成功,怎么做: 10 | * 1.继承 BaseResponse 11 | * 2.重写isSucces 方法,编写你的业务需求,根据自己的条件判断数据是否请求成功 12 | * 3.重写 getResponseCode、getResponseData、getResponseMsg方法,传入你的 code data msg 13 | */ 14 | data class ApiResponseTest(val code: Int, val msg: String, val data: T) : 15 | BaseResponse() { 16 | 17 | override fun isSuccess() = code == 0 18 | 19 | override fun getResponseCode() = code 20 | 21 | override fun getResponseData() = data 22 | 23 | override fun getResponseMsg() = msg 24 | 25 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/entity/BannerInfo.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.entity 2 | 3 | class BannerInfo { 4 | var bannerId: String? = null 5 | var bannerPath: String? = null 6 | var bannerContent: String? = null 7 | var bannerRange: String? = null 8 | var bannerSeq: String? = null 9 | var bannerType: String? = null 10 | var bannerTitle: String? = null 11 | var apptypeId: String? = null 12 | var bannerStartdate: String? = null 13 | var bannerEnddate: String? = null 14 | var bannerCreator: String? = null 15 | var bannerCreatorname: String? = null 16 | var bannerCreateddate: String? = null 17 | var bannerModifier: String? = null 18 | var bannerModifiername: String? = null 19 | var bannerModifieddate: String? = null 20 | var bannerTypeName: String? = null 21 | var appTypeName: String? = null 22 | var bannerRangeName: String? = null 23 | var projectName: String? = null 24 | var dataType: String? = null 25 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/entity/LoginUnNormalBean.java: -------------------------------------------------------------------------------- 1 | package com.rui.base.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | public class LoginUnNormalBean implements Serializable { 6 | private String access_token; 7 | private String token_type; 8 | private String refresh_token; 9 | private long expires_in; 10 | private String scope; 11 | 12 | public String getAccess_token() { 13 | return access_token; 14 | } 15 | 16 | public void setAccess_token(String access_token) { 17 | this.access_token = access_token; 18 | } 19 | 20 | public String getToken_type() { 21 | return token_type; 22 | } 23 | 24 | public void setToken_type(String token_type) { 25 | this.token_type = token_type; 26 | } 27 | 28 | public String getRefresh_token() { 29 | return refresh_token; 30 | } 31 | 32 | public void setRefresh_token(String refresh_token) { 33 | this.refresh_token = refresh_token; 34 | } 35 | 36 | public long getExpires_in() { 37 | return expires_in; 38 | } 39 | 40 | public void setExpires_in(long expires_in) { 41 | this.expires_in = expires_in; 42 | } 43 | 44 | public String getScope() { 45 | return scope; 46 | } 47 | 48 | public void setScope(String scope) { 49 | this.scope = scope; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /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-base/src/main/java/com/rui/base/global/SPKeyGlobal.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.global 2 | 3 | /** 4 | * 全局SharedPreferences Key 统一存放在这里,单个组件中的key可以另外在组件中定义 5 | * Created by zjr on 2018/6/21 0021. 6 | */ 7 | object SPKeyGlobal { 8 | const val USER_INFO = "user_info" 9 | const val AUTH = "auth" 10 | const val ACCOUNT = "account" 11 | const val PSD = "psd" 12 | const val PHONE = "phone" 13 | const val LIVE_VIDEO_QUALITY = "live_video_quality" 14 | const val USER_ID = "user_id" 15 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/router/RouterActivityPath.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.router 2 | 3 | /** 4 | * ****************************** 5 | * *description: 用于组件开发中,ARouter单Activity跳转的统一路径注册 6 | * 在这里注册添加路由路径,需要清楚的写好注释,标明功能界面 7 | * ******************************* 8 | */ 9 | class RouterActivityPath { 10 | /** 11 | * 主业务组件 12 | */ 13 | object Main { 14 | private const val MAIN = "/main" 15 | 16 | /*主业务界面*/ 17 | const val PAGER_MAIN = MAIN + "/Main" 18 | const val PAGER_TEST = MAIN + "/Test" 19 | 20 | //用户主界面 21 | const val USER_MAIN = MAIN + "/UserMain" 22 | const val PAGER_WEBVIEW = MAIN + "/webview" 23 | const val ABOUT_US = MAIN + "/aboutus" 24 | } 25 | 26 | /** 27 | * 身份验证组件 28 | */ 29 | object Sign { 30 | private const val SIGN = "/sign" 31 | const val PAGER_ACCOUNT_LOGIN = SIGN + "/accountLogin" 32 | const val PAGER_MOBILE_LOGIN = SIGN + "/mobileLogin" 33 | } 34 | 35 | /** 36 | * 用户组件 37 | */ 38 | object Mine { 39 | private const val MINE = "/mine" 40 | const val PAGER_OSNOTICE = MINE + "/OsNotice" 41 | const val POLICYPAGER = MINE + "/policyPage" 42 | } 43 | 44 | object Test { 45 | const val TEST = "/test" 46 | const val TESTPAGER = TEST + "/testPage" 47 | } 48 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/service/PublicApiService.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.service 2 | 3 | /** 4 | * ****************************** 5 | * 6 | * 7 | * *description:公用接口服务类 8 | * ******************************* 9 | */ 10 | interface PublicApiService { // /*获取支付宝支付信息*/ 11 | // @Headers({"Content-Type: application/json", "Accept: application/json"}) 12 | // @GET("ali/config/aliPay") 13 | // Observable> aliPay(@QueryMap Map params); 14 | // 15 | // /*创建订单*/ 16 | // @GET("ac/order/add/wares") 17 | // Observable> addWares(@Query("params") String params); 18 | // 19 | // /*获取微信支付信息*/ 20 | // @Headers({"Content-Type: application/json", "Accept: application/json"}) 21 | // @GET("wx/config/wxPay") 22 | // Observable> weiXinPay(@QueryMap Map params); 23 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/utils/Constant.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.utils 2 | 3 | /** 4 | * ******************************* 5 | * *@Author 6 | * *date : 7 | * *description:常量类 8 | * ******************************* 9 | */ 10 | object Constant { 11 | 12 | //当前获得编码的秒 13 | var CURRENT_TIME = 0 14 | const val baseUrl = "https://api.apiopen.top" 15 | const val IMAGE_URL = "https://ufileuat.niceloo.com/api/file/download?action=view&path=" 16 | const val CTYPE = "D.ADMIN.WEB" 17 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/utils/GpsUtil.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.utils 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import android.os.Build 6 | import android.provider.Settings 7 | import android.provider.Settings.SettingNotFoundException 8 | import android.text.TextUtils 9 | 10 | object GpsUtil { 11 | /** 12 | * 判断位置服务是否打开 13 | * @return 14 | */ 15 | fun isLocationEnabled(context: Context): Boolean { 16 | var locationMode = 0 17 | val locationProviders: String 18 | return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 19 | locationMode = try { 20 | Settings.Secure.getInt(context.contentResolver, Settings.Secure.LOCATION_MODE) 21 | } catch (e: SettingNotFoundException) { 22 | e.printStackTrace() 23 | return false 24 | } 25 | locationMode != Settings.Secure.LOCATION_MODE_OFF 26 | } else { 27 | locationProviders = Settings.Secure.getString( 28 | context.contentResolver, 29 | Settings.Secure.LOCATION_PROVIDERS_ALLOWED 30 | ) 31 | !TextUtils.isEmpty(locationProviders) 32 | } 33 | } 34 | 35 | /** 36 | * 开启位置服务 37 | */ 38 | fun openLoactionService(context: Context) { 39 | val intent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS) 40 | context.startActivity(intent) 41 | } 42 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/utils/ImageAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.utils 2 | 3 | import android.view.ViewGroup 4 | import android.widget.ImageView 5 | import coil.load 6 | import com.rui.base.R 7 | import com.rui.base.entity.BannerInfo 8 | import com.youth.banner.adapter.BannerAdapter 9 | 10 | /** 11 | * 自定义布局,图片 12 | */ 13 | class ImageAdapter(mDatas: List) : BannerAdapter(mDatas) { 14 | //更新数据 15 | fun updateData(data: List?) { 16 | //这里的代码自己发挥,比如如下的写法等等 17 | mDatas.addAll(data!!) 18 | notifyDataSetChanged() 19 | } 20 | 21 | //创建ViewHolder,可以用viewType这个字段来区分不同的ViewHolder 22 | override fun onCreateHolder(parent: ViewGroup, viewType: Int): ImageHolder { 23 | val imageView = ImageView(parent.context) 24 | //注意,必须设置为match_parent,这个是viewpager2强制要求的 25 | val params = ViewGroup.LayoutParams( 26 | ViewGroup.LayoutParams.MATCH_PARENT, 27 | ViewGroup.LayoutParams.MATCH_PARENT 28 | ) 29 | imageView.layoutParams = params 30 | imageView.scaleType = ImageView.ScaleType.FIT_XY 31 | return ImageHolder(imageView) 32 | } 33 | 34 | override fun onBindView(holder: ImageHolder, data: BannerInfo, position: Int, size: Int) { 35 | val params = holder.imageView.layoutParams 36 | // val width=ScreenUtil.getScreenWidth(context)-ScreenUtil.dip2px(context,20f) 37 | // val height= BigDecimal(width.toString()).divide(BigDecimal("2.09"),2, RoundingMode.HALF_UP).toInt() 38 | holder.imageView.load(Constant.IMAGE_URL + data.bannerPath) 39 | } 40 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/utils/ImageHolder.kt: -------------------------------------------------------------------------------- 1 | package com.rui.base.utils 2 | 3 | import android.view.View 4 | import android.widget.ImageView 5 | import androidx.recyclerview.widget.RecyclerView 6 | 7 | class ImageHolder(view: View) : RecyclerView.ViewHolder(view) { 8 | var imageView: ImageView = view as ImageView 9 | 10 | } -------------------------------------------------------------------------------- /library-base/src/main/java/com/rui/base/view/EditTextBottomPopup.java: -------------------------------------------------------------------------------- 1 | package com.rui.base.view; 2 | 3 | import android.content.Context; 4 | import android.text.TextUtils; 5 | import android.view.View; 6 | import android.widget.EditText; 7 | 8 | import androidx.annotation.NonNull; 9 | 10 | import com.lxj.xpopup.core.BottomPopupView; 11 | import com.lxj.xpopup.interfaces.OnInputConfirmListener; 12 | import com.rui.base.R; 13 | 14 | /** 15 | * Description: 自定义带有输入框的Bottom弹窗 16 | * Create by dance, at 2019/2/27 17 | */ 18 | public class EditTextBottomPopup extends BottomPopupView { 19 | 20 | public EditTextBottomPopup(@NonNull Context context, OnInputConfirmListener inputConfirmListener) { 21 | super(context); 22 | this.inputConfirmListener = inputConfirmListener; 23 | } 24 | 25 | @Override 26 | protected int getImplLayoutId() { 27 | return R.layout.edittext_bottom_popup; 28 | } 29 | 30 | @Override 31 | protected void onCreate() { 32 | super.onCreate(); 33 | } 34 | 35 | @Override 36 | protected void onShow() { 37 | super.onShow(); 38 | EditText etComment = findViewById(R.id.et_comment); 39 | findViewById(R.id.btn_finish).setOnClickListener(v -> { 40 | String content = etComment.getText().toString().trim(); 41 | if (!TextUtils.isEmpty(content)) { 42 | if (inputConfirmListener != null) { 43 | inputConfirmListener.onConfirm(content); 44 | } 45 | etComment.setText(""); 46 | dismiss(); 47 | } 48 | }); 49 | 50 | 51 | } 52 | 53 | @Override 54 | protected void onDismiss() { 55 | super.onDismiss(); 56 | } 57 | 58 | OnInputConfirmListener inputConfirmListener; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /library-base/src/main/res/anim/pickerview_dialog_scale_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 18 | 19 | -------------------------------------------------------------------------------- /library-base/src/main/res/anim/pickerview_dialog_scale_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 18 | -------------------------------------------------------------------------------- /library-base/src/main/res/anim/pickerview_slide_in_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/anim/pickerview_slide_out_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/anim/translate_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /library-base/src/main/res/anim/translate_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xhdpi/ic_scenic_checked_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xhdpi/ic_scenic_checked_circle.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xhdpi/ic_scenic_checked_gou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xhdpi/ic_scenic_checked_gou.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xhdpi/ic_scenic_uncheck_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xhdpi/ic_scenic_uncheck_circle.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xhdpi/ic_scenic_uncheck_gou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xhdpi/ic_scenic_uncheck_gou.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xhdpi/ic_scenic_uncheck_square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xhdpi/ic_scenic_uncheck_square.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xhdpi/ic_star_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xhdpi/ic_star_empty.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xhdpi/ic_star_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xhdpi/ic_star_full.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xhdpi/ic_star_half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xhdpi/ic_star_half.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/base_dialog_update_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/base_dialog_update_bg.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/circle_flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/circle_flag.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/demo_arr_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/demo_arr_right.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_def_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_def_loading.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_scenic_checked_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_scenic_checked_circle.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_scenic_checked_gou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_scenic_checked_gou.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_scenic_checked_square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_scenic_checked_square.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_scenic_uncheck_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_scenic_uncheck_circle.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_scenic_uncheck_gou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_scenic_uncheck_gou.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_scenic_uncheck_square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_scenic_uncheck_square.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_search.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_star_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_star_empty.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_star_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_star_full.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable-xxhdpi/ic_star_half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/drawable-xxhdpi/ic_star_half.png -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/bg_black_r10.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/bg_dialog_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/bg_spinner_window.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_439057_green.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_r0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_r10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_r10_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_r22_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_r3_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_r45_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_r45_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_frame_r9_ffb701.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_r11_color_ffb701.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_r1_color_f3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_r1_color_fc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_r45_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_r4_color_ffb701.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_r5_color_black.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_bg_r5_color_ffb701.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r10_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r10_red.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r15_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r15_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r15_yellow.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r45_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r45_f5f5f6.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r45_yellow.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_ripple_bg_r5_yellow.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/btn_text_color_selecor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/common_item_circle_local.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/common_red_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/common_translation_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/common_video_tag_back.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/et_login_r45_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/finish_ic.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 21 | 30 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/ic_sharp_arrow_back.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/indicator_bottom_line.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/indicator_bottom_line_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/indicator_round_default_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/label_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/label_text_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/radio_nomal.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 10 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/rating_yellow.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/red_point_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/reply_view_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/ripple_white_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/search_view_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/selector_radio_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/selector_radio_square.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/seletor_radio_gou.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_ciecle_f7f8fa.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_ciecle_ffb100.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_circle_00bb9b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_circle_ff6b33.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_circle_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_circle_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_dialog_time_btn1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_line_stroke.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_r11_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_r25_gray_live_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 7 | 8 | 10 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_r25_green_live_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 7 | 8 | 10 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_r2_solid_999999.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_r30_gradual_ffb701.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_recommend_item_btn3_type3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_recommend_item_location.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_scenic_ciecle_app_the_them.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_select_city_diaolog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/shape_tab_line.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/share_top_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library-base/src/main/res/drawable/warning_ic.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 22 | 27 | 32 | -------------------------------------------------------------------------------- /library-base/src/main/res/layout/base_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library-base/src/main/res/layout/edittext_bottom_popup.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 21 | 22 | 23 | 36 | -------------------------------------------------------------------------------- /library-base/src/main/res/layout/hint_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 21 | 22 | 28 | 29 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /library-base/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-base/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library-base/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /library-base/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-base/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | base 3 | 4 | 5 | 6 | 取消 7 | 确定 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /library-base/src/main/res/xml/app_file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /library-base/src/main/res/xml/app_network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /library-mvvmlazy/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library-mvvmlazy/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\AndroidSDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 20 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/base/BaseModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.base 2 | 3 | /** 4 | * Created by zjr on 2020/6/15. 5 | */ 6 | open class BaseModel : IModel { 7 | override fun onCleared() {} 8 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/base/IBaseView.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.base 2 | 3 | /** 4 | * Created by zjr on 2020/6/15. 5 | */ 6 | interface IBaseView { 7 | /** 8 | * 初始化界面传递参数 9 | */ 10 | fun initParam() 11 | 12 | /** 13 | * 初始化数据 14 | */ 15 | fun initData() 16 | 17 | /** 18 | * 初始化界面观察者的监听 19 | */ 20 | fun initViewObservable() 21 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/base/IBaseViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.base 2 | 3 | import androidx.lifecycle.Lifecycle 4 | import androidx.lifecycle.LifecycleObserver 5 | import androidx.lifecycle.OnLifecycleEvent 6 | import androidx.lifecycle.LifecycleOwner 7 | 8 | /** 9 | * Created by zjr on 2020/6/15. 10 | */ 11 | interface IBaseViewModel : LifecycleObserver { 12 | @OnLifecycleEvent(Lifecycle.Event.ON_ANY) 13 | fun onAny(owner: LifecycleOwner?, event: Lifecycle.Event?) 14 | 15 | @OnLifecycleEvent(Lifecycle.Event.ON_CREATE) 16 | fun onCreate() 17 | 18 | @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) 19 | fun onDestroy() 20 | 21 | @OnLifecycleEvent(Lifecycle.Event.ON_START) 22 | fun onStart() 23 | 24 | @OnLifecycleEvent(Lifecycle.Event.ON_STOP) 25 | fun onStop() 26 | 27 | @OnLifecycleEvent(Lifecycle.Event.ON_RESUME) 28 | fun onResume() 29 | 30 | @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) 31 | fun onPause() 32 | fun initData() 33 | 34 | /** 35 | * 注册RxBus 36 | */ 37 | fun registerEventBus() 38 | 39 | /** 40 | * 移除RxBus 41 | */ 42 | fun removeEventBus() 43 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/base/IModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.base 2 | 3 | /** 4 | * Created by zjr on 2020/6/15. 5 | */ 6 | interface IModel { 7 | /** 8 | * ViewModel销毁时清除Model,与ViewModel共消亡。Model层同样不能持有长生命周期对象 9 | */ 10 | fun onCleared() 11 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/base/ItemViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.base 2 | 3 | /** 4 | * ItemViewModel 5 | * Created by zjr on 2018/10/3. 6 | */ 7 | open class ItemViewModel(protected var viewModel: VM) -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/base/MultiItemViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.base 2 | 3 | /** 4 | * Create Author:goldze 5 | * Create Date:2019/01/25 6 | * Description:RecycleView多布局ItemViewModel是封装 7 | */ 8 | class MultiItemViewModel(viewModel: VM) : ItemViewModel(viewModel) { 9 | var itemType: Any? = null 10 | protected set 11 | 12 | fun multiItemType(multiType: Any) { 13 | itemType = multiType 14 | } 15 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/base/activity/BaseVmDbActivity.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.base.activity 2 | 3 | import androidx.databinding.DataBindingUtil 4 | import androidx.databinding.ViewDataBinding 5 | import com.rui.mvvmlazy.base.BaseViewModel 6 | 7 | /** 8 | * 作者 : zjr 9 | * 时间 : 2019/12/12 10 | * 描述 : 包含ViewModel 和Databind ViewModelActivity基类,把ViewModel 和Databind注入进来了 11 | * 需要使用Databind的清继承它 12 | */ 13 | abstract class BaseVmDbActivity : BaseVmActivity() { 14 | 15 | lateinit var binding: DB 16 | 17 | /** 18 | * 注入绑定 19 | */ 20 | override fun initViewDataBinding(): Boolean { 21 | //DataBindingUtil类需要在project的build中配置 dataBinding {enabled true }, 同步后会自动关联android.databinding包 22 | binding = DataBindingUtil.setContentView(this, initContentView()) 23 | //关联ViewModel 24 | binding.setVariable(viewModelId, viewModel) 25 | 26 | binding.lifecycleOwner = this 27 | return true 28 | } 29 | 30 | //刷新布局 31 | fun refreshLayout() { 32 | binding.setVariable(viewModelId, viewModel) 33 | } 34 | 35 | override fun onDestroy() { 36 | super.onDestroy() 37 | binding.unbind() 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/base/fragment/BaseVmDbFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.base.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.databinding.DataBindingUtil 8 | import androidx.databinding.ViewDataBinding 9 | import com.rui.mvvmlazy.base.BaseViewModel 10 | 11 | /** 12 | * Created by zjr on 2020/6/15. 13 | */ 14 | abstract class BaseVmDbFragment : BaseVmFragment() { 15 | lateinit var binding: V 16 | override fun onCreateView( 17 | inflater: LayoutInflater, 18 | container: ViewGroup?, 19 | savedInstanceState: Bundle? 20 | ): View { 21 | binding = DataBindingUtil.inflate( 22 | inflater, 23 | initContentView(inflater, container, savedInstanceState), 24 | container, 25 | false 26 | ) 27 | binding.setVariable(viewModelId, viewModel) 28 | binding.lifecycleOwner = this 29 | return binding.root 30 | } 31 | 32 | override fun onDestroyView() { 33 | super.onDestroyView() 34 | binding.unbind() 35 | } 36 | 37 | /** 38 | * ===================================================================== 39 | */ 40 | //刷新布局 41 | fun refreshLayout() { 42 | binding.setVariable(viewModelId, viewModel) 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/checkbox/ViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.checkbox 2 | 3 | import android.widget.CheckBox 4 | import androidx.databinding.BindingAdapter 5 | 6 | /** 7 | * Created by zjr on 2020/6/16. 8 | */ 9 | object ViewAdapter { 10 | /** 11 | * @param bindingCommand //绑定监听 12 | */ 13 | 14 | @JvmStatic 15 | @BindingAdapter(value = ["onCheckedChangedCommand"], requireAll = false) 16 | fun setCheckedChanged(checkBox: CheckBox, bindingCommand: (Boolean) -> Unit) { 17 | checkBox.setOnCheckedChangeListener { compoundButton, b -> bindingCommand.invoke(b) } 18 | } 19 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/edittext/ViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.edittext 2 | 3 | import android.content.Context 4 | import android.text.Editable 5 | import android.text.TextWatcher 6 | import android.view.inputmethod.InputMethodManager 7 | import android.widget.EditText 8 | import androidx.databinding.BindingAdapter 9 | 10 | /** 11 | * Created by zjr on 2020/6/16. 12 | */ 13 | object ViewAdapter { 14 | /** 15 | * EditText重新获取焦点的事件绑定 16 | */ 17 | @JvmStatic 18 | @BindingAdapter(value = ["requestFocus"], requireAll = false) 19 | fun requestFocusCommand(editText: EditText, needRequestFocus: Boolean) { 20 | if (needRequestFocus) { 21 | editText.setSelection(editText.text.length) 22 | editText.requestFocus() 23 | val imm = 24 | editText.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager 25 | imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT) 26 | } 27 | editText.isFocusableInTouchMode = needRequestFocus 28 | } 29 | 30 | /** 31 | * EditText输入文字改变的监听 32 | */ 33 | @JvmStatic 34 | @BindingAdapter(value = ["textChanged"], requireAll = false) 35 | fun addTextChangedListener(editText: EditText, textChanged: (String) -> Unit) { 36 | editText.addTextChangedListener(object : TextWatcher { 37 | override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {} 38 | override fun onTextChanged(text: CharSequence, i: Int, i1: Int, i2: Int) { 39 | textChanged.invoke(text.toString()) 40 | } 41 | 42 | override fun afterTextChanged(editable: Editable) {} 43 | }) 44 | } 45 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/mswitch/ViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.mswitch 2 | 3 | import android.widget.Switch 4 | import androidx.databinding.BindingAdapter 5 | 6 | /** 7 | * Created by zjr on 2020/6/18. 8 | */ 9 | object ViewAdapter { 10 | /** 11 | * 设置开关状态 12 | * 13 | * @param mSwitch Switch控件 14 | */ 15 | @JvmStatic 16 | @BindingAdapter("switchState") 17 | fun setSwitchState(mSwitch: Switch, isChecked: Boolean) { 18 | mSwitch.isChecked = isChecked 19 | } 20 | 21 | /** 22 | * Switch的状态改变监听 23 | * 24 | * @param mSwitch Switch控件 25 | * @param changeListener 事件绑定命令 26 | */ 27 | @JvmStatic 28 | @BindingAdapter("onSwitchChangeCommand") 29 | fun onCheckedChangeCommand(mSwitch: Switch, changeListener: (Boolean) -> Unit) { 30 | mSwitch.setOnCheckedChangeListener { buttonView, isChecked -> 31 | changeListener.invoke( 32 | isChecked 33 | ) 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/multistateview/ViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.multistateview 2 | 3 | import android.view.View 4 | import androidx.databinding.BindingAdapter 5 | import com.rui.mvvmlazy.widget.MultiStateView 6 | import com.rui.mvvmlazy.widget.MultiStateView.ViewState 7 | 8 | /** 9 | * Created by zjr on 2020/6/18. 10 | */ 11 | object ViewAdapter { 12 | @JvmStatic 13 | @BindingAdapter("bindViewState") 14 | fun bindViewState(multiStateView: MultiStateView, viewState: ViewState?) { 15 | viewState?.let { 16 | multiStateView.viewState = viewState 17 | } 18 | } 19 | 20 | @JvmStatic 21 | @BindingAdapter("retryClick") 22 | fun retryClick(multiStateView: MultiStateView, clickCommand: () -> Unit) { 23 | clickCommand?.let { 24 | multiStateView.setOnEmptyClickListener { v: View? -> clickCommand.invoke() } 25 | multiStateView.setOnErrorClickListener { v: View? -> clickCommand.invoke() } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/recyclerview/DataBindingAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.recyclerview 2 | 3 | import androidx.databinding.DataBindingUtil 4 | import androidx.databinding.ViewDataBinding 5 | import com.chad.library.adapter.base.BaseQuickAdapter 6 | import com.chad.library.adapter.base.viewholder.BaseViewHolder 7 | 8 | /** 9 | * 文件名:DataBindingAdapter 10 | * 描 述:增加对databinding的支持 11 | * 作 者:zjr 12 | * 时 间:2018/1/10 13 | * 邮 箱: 14 | * 版 权: 15 | */ 16 | abstract class DataBindingAdapter(layoutResId: Int) : 17 | BaseQuickAdapter(layoutResId) { 18 | 19 | override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) { 20 | super.onItemViewHolderCreated(viewHolder, viewType) 21 | DataBindingUtil.bind(viewHolder.itemView) 22 | } 23 | 24 | override fun convert(holder: BaseViewHolder, item: T) { 25 | val binding = DataBindingUtil.getBinding(holder.itemView) 26 | convertItem(holder, binding, item) 27 | binding?.executePendingBindings() 28 | 29 | } 30 | 31 | protected abstract fun convertItem(holder: BaseViewHolder, binding: V?, item: T) 32 | } 33 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/scrollview/ViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.scrollview 2 | 3 | import android.widget.ScrollView 4 | import androidx.core.widget.NestedScrollView 5 | import androidx.databinding.BindingAdapter 6 | 7 | /** 8 | * Created by zjr on 2020/6/18. 9 | */ 10 | object ViewAdapter { 11 | @JvmStatic 12 | @BindingAdapter("onScrollChangeCommand") 13 | fun onScrollChangeCommand( 14 | nestedScrollView: NestedScrollView, 15 | onScrollChangeCommand: (NestScrollDataWrapper) -> Unit 16 | ) { 17 | nestedScrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY -> 18 | onScrollChangeCommand.invoke( 19 | NestScrollDataWrapper(scrollX, scrollY, oldScrollX, oldScrollY) 20 | ) 21 | }) 22 | } 23 | 24 | @JvmStatic 25 | @BindingAdapter("onScrollChangeCommand") 26 | fun onScrollChangeCommand( 27 | scrollView: ScrollView, 28 | onScrollChangeCommand: (ScrollDataWrapper) -> Unit 29 | ) { 30 | scrollView.viewTreeObserver.addOnScrollChangedListener { 31 | onScrollChangeCommand.invoke( 32 | ScrollDataWrapper( 33 | scrollView.scrollX.toFloat(), scrollView.scrollY.toFloat() 34 | ) 35 | ) 36 | } 37 | } 38 | 39 | class ScrollDataWrapper(var scrollX: Float, var scrollY: Float) 40 | class NestScrollDataWrapper( 41 | var scrollX: Int, 42 | var scrollY: Int, 43 | var oldScrollX: Int, 44 | var oldScrollY: Int 45 | ) 46 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/spinner/IKeyAndValue.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.spinner 2 | 3 | /** 4 | * Created by zjr on 2020/6/18. 5 | * 下拉Spinner控件的键值对, 实现该接口,返回key,value值, 在xml绑定List 6 | */ 7 | interface IKeyAndValue { 8 | val key: String? 9 | get() { 10 | return loadKey() 11 | } 12 | val value: String 13 | get() { 14 | return loadValue() 15 | } 16 | 17 | fun loadKey(): String 18 | fun loadValue(): String 19 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/swiperefresh/SmartRefreshState.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.swiperefresh 2 | 3 | /** 4 | * SmartRefreshLayout控件状态 5 | */ 6 | enum class SmartRefreshState { 7 | REFRESH_FINISH, //结束下拉刷新 8 | LOAD_FINISH, //结束本次上拉分页加载 9 | LOAD_FINISH_NOMOREDATA //加载到最后一页面 10 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/binding/viewadapter/webview/ViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.binding.viewadapter.webview 2 | 3 | import android.text.TextUtils 4 | import androidx.databinding.BindingAdapter 5 | import android.webkit.WebView 6 | 7 | /** 8 | * Created by zjr on 2020/6/18. 9 | */ 10 | object ViewAdapter { 11 | @JvmStatic 12 | @BindingAdapter("render") 13 | fun loadHtml(webView: WebView, html: String?) { 14 | if (!TextUtils.isEmpty(html)) { 15 | webView.loadDataWithBaseURL(null, html!!, "text/html", "UTF-8", null) 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/ext/util/LogExt.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.ext.util 2 | 3 | import com.rui.mvvmlazy.utils.common.KLog 4 | 5 | const val TAG = "MvvmLazy" 6 | 7 | /** 8 | * 9 | * 是否需要开启打印日志,默认打开,1.1.7-1.1.8版本是默认关闭的(1.0.0-1.1.6没有这个字段,框架在远程依赖下,直接不打印log),但是默认关闭后很多人反馈都没有日志,好吧,我的我的 10 | * 根据true|false 控制网络请求日志和该框架产生的打印 11 | */ 12 | var jetpackMvvmLog = true 13 | 14 | private enum class LEVEL { 15 | V, D, I, W, E 16 | } 17 | 18 | fun String.logv(tag: String = TAG) = 19 | log(LEVEL.V, tag, this) 20 | 21 | fun String.logd(tag: String = TAG) = 22 | log(LEVEL.D, tag, this) 23 | 24 | fun String.logi(tag: String = TAG) = 25 | log(LEVEL.I, tag, this) 26 | 27 | fun String.logw(tag: String = TAG) = 28 | log(LEVEL.W, tag, this) 29 | 30 | fun String.loge(tag: String = TAG) = 31 | log(LEVEL.E, tag, this) 32 | 33 | private fun log(level: LEVEL, tag: String, message: String) { 34 | if (!jetpackMvvmLog) return 35 | when (level) { 36 | LEVEL.V -> KLog.v(tag, message) 37 | LEVEL.D -> KLog.d(tag, message) 38 | LEVEL.I -> KLog.i(tag, message) 39 | LEVEL.W -> KLog.w(tag, message) 40 | LEVEL.E -> KLog.e(tag, message) 41 | } 42 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/ext/util/StringExt.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.ext.util 2 | 3 | import com.google.gson.Gson 4 | import java.util.regex.Pattern 5 | 6 | /** 7 | * 是否为手机号 0开头 12开头的不支持 8 | */ 9 | fun String?.isPhone(): Boolean { 10 | return this?.let { 11 | Pattern.matches(it, "0?(13|14|15|16|17|18|19)[0-9]{9}") 12 | }?:let { 13 | false 14 | } 15 | } 16 | 17 | /** 18 | * 是否为座机号 19 | */ 20 | fun String?.isTel(): Boolean { 21 | return this?.let { 22 | val matcher1 = Pattern.matches("^0(10|2[0-5|789]|[3-9]\\d{2})\\d{7,8}\$", this) 23 | val matcher2 = Pattern.matches("^0(10|2[0-5|789]|[3-9]\\d{2})-\\d{7,8}$", this) 24 | val matcher3 = Pattern.matches("^400\\d{7,8}$", this) 25 | val matcher4 = Pattern.matches("^400-\\d{7,8}$", this) 26 | val matcher5 = Pattern.matches("^800\\d{7,8}$", this) 27 | val matcher6 = Pattern.matches("^800-\\d{7,8}$", this) 28 | return matcher1 || matcher2 || matcher3 || matcher4 || matcher5 || matcher6 29 | }?:let { 30 | false 31 | } 32 | } 33 | 34 | /** 35 | * 是否为邮箱号 36 | */ 37 | fun String?.isEmail(): Boolean { 38 | return this?.let { 39 | Pattern.matches(this, "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$") 40 | }?:let { 41 | false 42 | } 43 | } 44 | 45 | /** 46 | * 将对象转为JSON字符串 47 | */ 48 | fun Any?.toJson():String{ 49 | return Gson().toJson(this) 50 | } 51 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/ext/view/EditTextViewExt.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.ext.view 2 | 3 | import android.text.Editable 4 | import android.text.TextWatcher 5 | import android.widget.EditText 6 | import android.widget.TextView 7 | 8 | /** 9 | * 优化输入框 10 | */ 11 | fun EditText.afterTextChange(afterTextChanged: (String) -> Unit) { 12 | 13 | this.addTextChangedListener(object : TextWatcher { 14 | override fun afterTextChanged(s: Editable?) { 15 | afterTextChanged.invoke(s.toString()) 16 | } 17 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { 18 | } 19 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { 20 | 21 | } 22 | }) 23 | } 24 | 25 | 26 | /** 27 | * 获取文本 28 | */ 29 | fun EditText.textString(): String { 30 | return this.text.toString() 31 | } 32 | /** 33 | * 获取去除空字符串的文本 34 | */ 35 | fun EditText.textStringTrim(): String { 36 | return this.textString().trim() 37 | } 38 | /** 39 | * 文本是否为空 40 | */ 41 | fun EditText.isEmpty(): Boolean { 42 | return this.textString().isEmpty() 43 | } 44 | /** 45 | * 去空字符串后文本是否为空 46 | */ 47 | fun EditText.isTrimEmpty(): Boolean { 48 | return this.textStringTrim().isEmpty() 49 | } 50 | /** 51 | * 获取文本 52 | */ 53 | fun TextView.textString(): String { 54 | return this.text.toString() 55 | } 56 | /** 57 | * 获取去除空字符串的文本 58 | */ 59 | fun TextView.textStringTrim(): String { 60 | return this.textString().trim() 61 | } 62 | /** 63 | * 文本是否为空 64 | */ 65 | fun TextView.isEmpty(): Boolean { 66 | return this.textString().isEmpty() 67 | } 68 | /** 69 | * 去空字符串后文本是否为空 70 | */ 71 | fun TextView.isTrimEmpty(): Boolean { 72 | return this.textStringTrim().isEmpty() 73 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/BaseResponse.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.http 2 | 3 | /** 4 | * Created by zjr on 2020/5/10. 5 | * 该类仅供参考,实际业务返回的固定字段, 根据需求来定义, 6 | */ 7 | /** 8 | * 作者 : zjr 9 | * 时间 : 2019/12/17 10 | * 描述 : 服务器返回数据的基类 11 | * 如果需要框架帮你做脱壳处理请继承它!!请注意: 12 | * 2.必须实现抽象方法,根据自己的业务判断返回请求结果是否成功 13 | */ 14 | abstract class BaseResponse { 15 | 16 | //抽象方法,用户的基类继承该类时,需要重写该方法 17 | abstract fun isSuccess(): Boolean 18 | 19 | abstract fun getResponseData(): T 20 | 21 | abstract fun getResponseCode(): Int 22 | 23 | abstract fun getResponseMsg(): String 24 | 25 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/PagingData.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.http 2 | 3 | /** 4 | * ****************************** 5 | * *@Author 6 | * *date :赵继瑞 7 | * *description:分页数据类型封装 8 | * ******************************* 9 | */ 10 | class PagingData { 11 | var list: MutableList? = null 12 | var total = 0 13 | var current = 0 14 | 15 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/ResponseThrowable.java: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.http; 2 | 3 | /** 4 | * Created by zjr on 2020/5/11. 5 | */ 6 | 7 | public class ResponseThrowable extends Exception { 8 | public int code; 9 | public String message; 10 | 11 | public ResponseThrowable(Throwable throwable, int code) { 12 | super(throwable); 13 | this.code = code; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /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-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/cookie/store/CookieStore.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.http.cookie.store 2 | 3 | import okhttp3.Cookie 4 | import okhttp3.HttpUrl 5 | 6 | /** 7 | * Created by zjr on 2020/5/13. 8 | */ 9 | interface CookieStore { 10 | /** 保存url对应所有cookie */ 11 | fun saveCookie(url: HttpUrl, cookie: List) 12 | 13 | /** 保存url对应所有cookie */ 14 | fun saveCookie(url: HttpUrl, cookie: Cookie) 15 | 16 | /** 加载url所有的cookie */ 17 | fun loadCookie(url: HttpUrl): List 18 | 19 | /** 获取当前所有保存的cookie */ 20 | val allCookie: List 21 | 22 | /** 获取当前url对应的所有的cookie */ 23 | fun getCookie(url: HttpUrl): List 24 | 25 | /** 根据url和cookie移除对应的cookie */ 26 | fun removeCookie(url: HttpUrl, cookie: Cookie?): Boolean 27 | 28 | /** 根据url移除所有的cookie */ 29 | fun removeCookie(url: HttpUrl): Boolean 30 | 31 | /** 移除所有的cookie */ 32 | fun removeAllCookie(): Boolean 33 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/interceptor/BaseInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.http.interceptor; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | 6 | import okhttp3.Interceptor; 7 | import okhttp3.Request; 8 | import okhttp3.Response; 9 | 10 | /** 11 | * Created by zjr on 2020/5/10. 12 | */ 13 | public class BaseInterceptor implements Interceptor { 14 | private Map headers; 15 | 16 | public BaseInterceptor(Map headers) { 17 | this.headers = headers; 18 | } 19 | 20 | @Override 21 | public Response intercept(Chain chain) throws IOException { 22 | Request.Builder builder = chain.request() 23 | .newBuilder(); 24 | // if (headers != null && headers.size() > 0) { 25 | // Set keys = headers.keySet(); 26 | // for (String headerKey : keys) { 27 | // builder.addHeader(headerKey, headers.get(headerKey)).build(); 28 | // } 29 | // } 30 | //请求信息 31 | return chain.proceed(builder.build()); 32 | } 33 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/http/interceptor/CacheInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.http.interceptor; 2 | 3 | import android.content.Context; 4 | 5 | import com.rui.mvvmlazy.http.NetworkUtil; 6 | 7 | import java.io.IOException; 8 | 9 | import okhttp3.CacheControl; 10 | import okhttp3.Interceptor; 11 | import okhttp3.Request; 12 | import okhttp3.Response; 13 | 14 | /** 15 | * Created by zjr on 2020/5/10. 16 | * 无网络状态下智能读取缓存的拦截器 17 | */ 18 | public class CacheInterceptor implements Interceptor { 19 | 20 | private Context context; 21 | 22 | public CacheInterceptor(Context context) { 23 | this.context = context; 24 | } 25 | 26 | @Override 27 | public Response intercept(Chain chain) throws IOException { 28 | Request request = chain.request(); 29 | if (NetworkUtil.isNetworkAvailable(context)) { 30 | Response response = chain.proceed(request); 31 | // read from cache for 60 s 32 | int maxAge = 60; 33 | return response.newBuilder() 34 | .removeHeader("Pragma") 35 | .removeHeader("Cache-Control") 36 | .header("Cache-Control", "public, max-age=" + maxAge) 37 | .build(); 38 | } else { 39 | //读取缓存信息 40 | request = request.newBuilder() 41 | .cacheControl(CacheControl.FORCE_CACHE) 42 | .build(); 43 | Response response = chain.proceed(request); 44 | //set cache times is 3 days 45 | int maxStale = 60 * 60 * 24 * 3; 46 | return response.newBuilder() 47 | .removeHeader("Pragma") 48 | .removeHeader("Cache-Control") 49 | .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) 50 | .build(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /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/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/Logger.java: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.http.interceptor.logging; 2 | 3 | import okhttp3.internal.platform.Platform; 4 | 5 | /** 6 | * @author ihsan on 11/07/2020. 7 | */ 8 | @SuppressWarnings({"WeakerAccess", "unused"}) 9 | public interface Logger { 10 | void log(int level, String tag, String msg); 11 | 12 | Logger DEFAULT = new Logger() { 13 | @Override 14 | public void log(int level, String tag, String message) { 15 | Platform.get().log( message, level,null); 16 | } 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/state/ResultState.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.state 2 | import androidx.lifecycle.MutableLiveData 3 | import com.rui.mvvmlazy.http.AppException 4 | import com.rui.mvvmlazy.http.BaseResponse 5 | import com.rui.mvvmlazy.http.ExceptionHandle 6 | 7 | /** 8 | * 作者 : zjr 9 | * 时间 : 2020/4/9 10 | * 描述 : 自定义结果集封装类 11 | */ 12 | sealed class ResultState { 13 | companion object { 14 | fun onAppSuccess(data: T): ResultState = Success(data) 15 | fun onAppLoading(loadingMessage: String): ResultState = Loading(loadingMessage) 16 | fun onAppError(error: AppException): ResultState = Error(error) 17 | } 18 | 19 | data class Loading(val loadingMessage: String) : ResultState() 20 | data class Success(val data: T) : ResultState() 21 | data class Error(val error: AppException) : ResultState() 22 | } 23 | 24 | /** 25 | * 处理返回值 26 | * @param result 请求结果 27 | */ 28 | fun MutableLiveData>.paresResult(result: BaseResponse) { 29 | value = when { 30 | result.isSuccess() -> { 31 | ResultState.onAppSuccess(result.getResponseData()) 32 | } 33 | else -> { 34 | ResultState.onAppError(AppException(result.getResponseCode(), result.getResponseMsg())) 35 | } 36 | } 37 | } 38 | 39 | /** 40 | * 不处理返回值 直接返回请求结果 41 | * @param result 请求结果 42 | */ 43 | fun MutableLiveData>.paresResult(result: T) { 44 | value = ResultState.onAppSuccess(result) 45 | } 46 | 47 | /** 48 | * 异常转换异常处理 49 | */ 50 | fun MutableLiveData>.paresException(e: Throwable) { 51 | this.value = ResultState.onAppError(ExceptionHandle.handleException(e)) 52 | } 53 | 54 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/utils/constant/DateFormatConstants.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 jirui_zhao(jirui_zhao@163.com) 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 | package com.rui.mvvmlazy.utils.constant 17 | 18 | /** 19 | * 日期格式 20 | * 21 | * @author zjr 22 | * @date 2018/2/16 下午10:23 23 | */ 24 | object DateFormatConstants { 25 | /** 26 | * yyyy-MM-dd 27 | */ 28 | const val yyyyMMdd = "yyyy-MM-dd" 29 | 30 | /** 31 | * yyyyMMdd 32 | */ 33 | const val yyyyMMddNoSep = "yyyyMMdd" 34 | 35 | /** 36 | * HH:mm:ss 37 | */ 38 | const val HHmmss = "HH:mm:ss" 39 | 40 | /** 41 | * HH:mm 42 | */ 43 | const val HHmm = "HH:mm" 44 | 45 | /** 46 | * yyyy-MM-dd HH:mm:ss 47 | */ 48 | const val yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss" 49 | 50 | /** 51 | * yyyyMMddHHmmss 52 | */ 53 | const val yyyyMMddHHmmssNoSep = "yyyyMMddHHmmss" 54 | 55 | /** 56 | * yyyy-MM-dd HH:mm 57 | */ 58 | const val yyyyMMddHHmm = "yyyy-MM-dd HH:mm" 59 | 60 | /** 61 | * yyyy-MM-dd HH:mm:ss:SSS 62 | */ 63 | const val yyyyMMddHHmmssSSS = "yyyy-MM-dd HH:mm:ss:SSS" 64 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/utils/constant/MemoryConstants.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.utils.constant 2 | 3 | import com.rui.mvvmlazy.utils.app.PathUtils.Companion.getExtStoragePath 4 | import com.rui.mvvmlazy.utils.app.PathUtils.Companion.getExtDownloadsPath 5 | import com.rui.mvvmlazy.utils.app.PathUtils.Companion.getExtPicturesPath 6 | import com.rui.mvvmlazy.utils.app.PathUtils.Companion.getExtDCIMPath 7 | import androidx.annotation.IntDef 8 | import com.rui.mvvmlazy.utils.constant.MemoryConstants 9 | import com.rui.mvvmlazy.utils.constant.PathConstants 10 | import android.annotation.SuppressLint 11 | import android.Manifest.permission 12 | import androidx.annotation.StringDef 13 | import com.rui.mvvmlazy.utils.constant.TimeConstants 14 | import java.lang.annotation.Retention 15 | import java.lang.annotation.RetentionPolicy 16 | 17 | /** 18 | * Created by zjr on 2020/5/14. 19 | * 存储相关常量 20 | */ 21 | object MemoryConstants { 22 | /** 23 | * Byte与Byte的倍数 24 | */ 25 | const val BYTE = 1 26 | 27 | /** 28 | * KB与Byte的倍数 29 | */ 30 | const val KB = 1024 31 | 32 | /** 33 | * MB与Byte的倍数 34 | */ 35 | const val MB = 1048576 36 | 37 | /** 38 | * GB与Byte的倍数 39 | */ 40 | const val GB = 1073741824 41 | 42 | @IntDef(BYTE, KB, MB, GB) 43 | @Retention(RetentionPolicy.SOURCE) 44 | annotation class Unit 45 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/utils/constant/TimeConstants.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.utils.constant 2 | 3 | import com.rui.mvvmlazy.utils.app.PathUtils.Companion.getExtStoragePath 4 | import com.rui.mvvmlazy.utils.app.PathUtils.Companion.getExtDownloadsPath 5 | import com.rui.mvvmlazy.utils.app.PathUtils.Companion.getExtPicturesPath 6 | import com.rui.mvvmlazy.utils.app.PathUtils.Companion.getExtDCIMPath 7 | import androidx.annotation.IntDef 8 | import com.rui.mvvmlazy.utils.constant.MemoryConstants 9 | import com.rui.mvvmlazy.utils.constant.PathConstants 10 | import android.annotation.SuppressLint 11 | import android.Manifest.permission 12 | import androidx.annotation.StringDef 13 | import com.rui.mvvmlazy.utils.constant.TimeConstants 14 | import java.lang.annotation.Retention 15 | import java.lang.annotation.RetentionPolicy 16 | 17 | /** 18 | * Created by zjr on 2020/5/14. 19 | * 时间相关常量 20 | */ 21 | object TimeConstants { 22 | /** 23 | * 毫秒与毫秒的倍数 24 | */ 25 | const val MSEC = 1 26 | 27 | /** 28 | * 秒与毫秒的倍数 29 | */ 30 | const val SEC = 1000 31 | 32 | /** 33 | * 分与毫秒的倍数 34 | */ 35 | const val MIN = 60000 36 | 37 | /** 38 | * 时与毫秒的倍数 39 | */ 40 | const val HOUR = 3600000 41 | 42 | /** 43 | * 天与毫秒的倍数 44 | */ 45 | const val DAY = 86400000 46 | 47 | @IntDef(MSEC, SEC, MIN, HOUR, DAY) 48 | @Retention(RetentionPolicy.SOURCE) 49 | annotation class Unit 50 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/utils/file/CloseUtils.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.utils.file 2 | 3 | import java.io.Closeable 4 | import java.io.IOException 5 | 6 | /** 7 | * Created by zjr on 2020/5/14. 8 | * 关闭相关工具类 9 | */ 10 | class CloseUtils private constructor() { 11 | companion object { 12 | /** 13 | * 关闭IO 14 | * 15 | * @param closeables closeables 16 | */ 17 | fun closeIO(vararg closeables: Closeable?) { 18 | if (closeables == null) return 19 | for (closeable in closeables) { 20 | if (closeable != null) { 21 | try { 22 | closeable.close() 23 | } catch (e: IOException) { 24 | e.printStackTrace() 25 | } 26 | } 27 | } 28 | } 29 | 30 | /** 31 | * 安静关闭IO 32 | * 33 | * @param closeables closeables 34 | */ 35 | fun closeIOQuietly(vararg closeables: Closeable?) { 36 | if (closeables == null) return 37 | for (closeable in closeables) { 38 | if (closeable != null) { 39 | try { 40 | closeable.close() 41 | } catch (ignored: IOException) { 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | init { 49 | throw UnsupportedOperationException("u can't instantiate me...") 50 | } 51 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/java/com/rui/mvvmlazy/widget/ControlDistributeLinearLayout.kt: -------------------------------------------------------------------------------- 1 | package com.rui.mvvmlazy.widget 2 | 3 | import android.content.Context 4 | import kotlin.jvm.JvmOverloads 5 | import android.widget.LinearLayout 6 | import android.view.MotionEvent 7 | import android.content.res.TypedArray 8 | import android.util.AttributeSet 9 | import com.rui.mvvmlazy.R 10 | 11 | /** 12 | * Created by zjr on 2020/3/16. 13 | * 控制事件分发的LinearLayout 14 | */ 15 | class ControlDistributeLinearLayout( 16 | context: Context?, 17 | attrs: AttributeSet? = null, 18 | defStyleAttr: Int = 0 19 | ) : LinearLayout(context, attrs, defStyleAttr) { 20 | //默认是不拦截事件,分发事件给子View 21 | var isDistributeEvent = false 22 | 23 | /** 24 | * 重写事件分发方法,false 为分发 , true 为父控件自己消耗, 由外面传进来的参数决定 25 | */ 26 | override fun onInterceptTouchEvent(ev: MotionEvent): Boolean { 27 | return isDistributeEvent 28 | } 29 | 30 | init { 31 | val typedArray = 32 | getContext().obtainStyledAttributes(attrs, R.styleable.ControlDistributeLinearLayout) 33 | isDistributeEvent = 34 | typedArray.getBoolean(R.styleable.ControlDistributeLinearLayout_distribute_event, false) 35 | } 36 | } -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/drawable-hdpi/customactivityoncrash_error_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-mvvmlazy/src/main/res/drawable-hdpi/customactivityoncrash_error_image.png -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/drawable-mdpi/customactivityoncrash_error_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-mvvmlazy/src/main/res/drawable-mdpi/customactivityoncrash_error_image.png -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/drawable-xhdpi/customactivityoncrash_error_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-mvvmlazy/src/main/res/drawable-xhdpi/customactivityoncrash_error_image.png -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/drawable-xxhdpi/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-mvvmlazy/src/main/res/drawable-xxhdpi/back.png -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/drawable-xxhdpi/base_view_empty_cache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-mvvmlazy/src/main/res/drawable-xxhdpi/base_view_empty_cache.png -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/drawable-xxhdpi/customactivityoncrash_error_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-mvvmlazy/src/main/res/drawable-xxhdpi/customactivityoncrash_error_image.png -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/drawable-xxhdpi/icon_net_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-mvvmlazy/src/main/res/drawable-xxhdpi/icon_net_error.png -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/drawable-xxxhdpi/customactivityoncrash_error_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/library-mvvmlazy/src/main/res/drawable-xxxhdpi/customactivityoncrash_error_image.png -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/layout/activity_container.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/layout/view_empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/layout/view_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 24 | 25 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/layout/view_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #000000 5 | #808080 6 | #FFFF00 7 | #008000 8 | #0000FF 9 | #FFA500 10 | #55E6E6E6 11 | #aaE6E6E6 12 | 13 | #4B03A9F4 14 | #3303A9F4 15 | #1903A9F4 16 | 17 | 18 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 12sp 8 | 9 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | mvvmhabit 3 | 发生意外错误。\n抱歉,给您带来不便。 4 | 重新启动 5 | 关闭程序 6 | 错误日志 7 | 错误详情 8 | 关闭 9 | 复制日志 10 | 复制日志 11 | 错误信息 12 | 13 | 数据不见了 14 | 请检查您的网络\n重新加载吧 15 | 暂无数据 16 | 17 | 18 | -------------------------------------------------------------------------------- /library-mvvmlazy/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /module-demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /module-demo/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'kotlin-android' 3 | id 'kotlin-kapt' 4 | } 5 | apply from: "../module.build.gradle" 6 | android { 7 | 8 | buildFeatures { 9 | viewBinding true 10 | } 11 | defaultConfig { 12 | //如果是独立模块,则使用当前组件的包名 13 | if (isBuildModule.toBoolean()) { 14 | applicationId "com.rui.demo" 15 | } 16 | } 17 | //统一资源前缀,规范资源引用 18 | resourcePrefix "test_" 19 | namespace 'com.rui.demo' 20 | sourceSets { 21 | main { 22 | jniLibs.srcDirs = ['libs'] 23 | } 24 | } 25 | } 26 | kapt { 27 | arguments { 28 | arg("AROUTER_MODULE_NAME", project.getName()) 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation fileTree(dir: 'libs', include: ['*.?ar']) 34 | api project(':library-base') 35 | //组件中依赖阿里路由编译框架 36 | kapt rootProject.ext.dependencies["arouter-compiler"] 37 | kapt rootProject.ext.android_x["room-compiler"] 38 | } 39 | -------------------------------------------------------------------------------- /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-demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/DemoModuleInit.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo 2 | 3 | import android.content.Context 4 | import androidx.startup.Initializer 5 | import com.rui.mvvmlazy.utils.common.KLog 6 | 7 | /** 8 | * Created by zjr on 2018/6/21 0021. 9 | */ 10 | class DemoModuleInit : Initializer { 11 | 12 | override fun create(context: Context) { 13 | KLog.d("demo组件初始化") 14 | } 15 | 16 | override fun dependencies(): MutableList>> { 17 | return mutableListOf() 18 | } 19 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/bean/CityInfo.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.bean 2 | 3 | import com.rui.mvvmlazy.binding.viewadapter.spinner.IKeyAndValue 4 | 5 | /** 6 | 7 | */ 8 | 9 | class CityInfo : IKeyAndValue { 10 | var name: String? = null 11 | var code: String? = null 12 | 13 | constructor(name: String?, code: String?) { 14 | this.name = name 15 | this.code = code 16 | } 17 | 18 | override fun loadKey(): String { 19 | return name ?: ""; 20 | } 21 | 22 | override fun loadValue(): String { 23 | return code ?: ""; 24 | } 25 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/bean/JokeInfo.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.bean 2 | 3 | /** 4 | * author :zjr 5 | * date: 2020/07/24 19:06 6 | * description: 7 | 8 | */ 9 | 10 | class JokeInfo(var title: String?, var url: String?) { 11 | 12 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/bean/MsgInfo.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.bean 2 | 3 | /** 4 | * author :zjr 5 | * date: 2020/07/24 19:06 6 | * description: 7 | 8 | */ 9 | 10 | class MsgInfo(var title: String?, var type: Int?) { 11 | 12 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/source/HttpDataSource.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.source 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.mvvmlazy.http.PagingData 7 | import retrofit2.http.Query 8 | 9 | /** 10 | * Created by zjr on 2019/3/26. 11 | */ 12 | interface HttpDataSource { 13 | suspend fun getJoke( 14 | @Query("page") page: Int, 15 | @Query("size") size: Int 16 | ): ApiResponse> 17 | suspend fun testApi( 18 | @Query("q") page: String 19 | ):ApiResponseTest> 20 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/source/LocalDataSource.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.source 2 | 3 | import androidx.lifecycle.LiveData 4 | import com.rui.demo.data.source.local.db.Person 5 | 6 | /** 7 | * Created by zjr on 2019/3/26. 8 | */ 9 | interface LocalDataSource { 10 | fun insertWords(vararg words: Person) 11 | fun updateWords(vararg words: Person) 12 | fun deleteWords(vararg words: Person) 13 | fun deleteAllWords() 14 | fun getAllWordsLive(): LiveData> 15 | } -------------------------------------------------------------------------------- /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> { 22 | return apiService.testApi(page) 23 | } 24 | 25 | 26 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/source/http/service/HomeApiService.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.source.http.service 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.mvvmlazy.http.PagingData 7 | import retrofit2.http.GET 8 | import retrofit2.http.Query 9 | 10 | /** 11 | * ****************************** 12 | * *@Author 13 | * *date : 14 | * *description:接口服务类 15 | * ******************************* 16 | */ 17 | interface HomeApiService { 18 | @GET("api/getImages") 19 | suspend fun getJoke( 20 | @Query("page") page: Int, 21 | @Query("size") count: Int, 22 | ): ApiResponse> 23 | @GET("https://insdoss.freeapptools.com/api/test") 24 | suspend fun testApi( 25 | @Query("q") page: String, 26 | ): ApiResponseTest> 27 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/source/local/LocalDataSourceImpl.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.source.local 2 | 3 | import androidx.lifecycle.LiveData 4 | import com.rui.demo.data.source.LocalDataSource 5 | import com.rui.demo.data.source.local.db.Person 6 | import com.rui.demo.data.source.local.db.PersonDao 7 | import com.rui.demo.data.source.local.db.PersonDatabase 8 | import com.rui.mvvmlazy.base.appContext 9 | 10 | /** 11 | * 本地数据源,可配合Room框架使用 12 | * Created by zjr on 2019/3/26. 13 | */ 14 | class LocalDataSourceImpl : LocalDataSource { 15 | private val wordDao: PersonDao by lazy { 16 | PersonDatabase.getDatabase(appContext)!!.wordDao 17 | } 18 | 19 | 20 | override fun insertWords(vararg words: Person) { 21 | wordDao.insertWords(*words) 22 | } 23 | 24 | override fun updateWords(vararg words: Person) { 25 | wordDao.updateWords(*words) 26 | } 27 | 28 | override fun deleteWords(vararg words: Person) { 29 | wordDao.deleteWords(*words) 30 | } 31 | 32 | override fun deleteAllWords() { 33 | wordDao.deleteAllWords() 34 | } 35 | 36 | override fun getAllWordsLive(): LiveData> { 37 | return wordDao.allWordsLive 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/source/local/db/Person.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.source.local.db 2 | 3 | import androidx.lifecycle.LiveData 4 | import androidx.room.* 5 | import com.rui.demo.data.source.local.db.PersonDao 6 | import com.rui.demo.data.source.local.db.PersonDatabase 7 | import kotlin.jvm.Synchronized 8 | 9 | @Entity 10 | class Person( 11 | @field:ColumnInfo(name = "user_name") var name: String, @field:ColumnInfo( 12 | name = "user_age" 13 | ) var age: String 14 | ) { 15 | @PrimaryKey(autoGenerate = true) 16 | var id = 0 17 | 18 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/source/local/db/PersonDao.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.source.local.db 2 | 3 | import androidx.lifecycle.LiveData 4 | import androidx.room.* 5 | import com.rui.demo.data.source.local.db.PersonDao 6 | import com.rui.demo.data.source.local.db.PersonDatabase 7 | import kotlin.jvm.Synchronized 8 | 9 | @Dao // Database access object 10 | interface PersonDao { 11 | @Insert 12 | fun insertWords(vararg people: Person) 13 | 14 | @Update 15 | fun updateWords(vararg people: Person) 16 | 17 | @Delete 18 | fun deleteWords(vararg people: Person) 19 | 20 | @Query("DELETE FROM Person") 21 | fun deleteAllWords() 22 | 23 | @get:Query("SELECT * FROM Person ORDER BY ID DESC") 24 | val allWordsLive: LiveData> 25 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/data/source/local/db/PersonDatabase.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.data.source.local.db 2 | 3 | import android.content.Context 4 | import androidx.room.Database 5 | import androidx.room.Room 6 | import androidx.room.RoomDatabase 7 | 8 | //singleton 9 | @Database(entities = [Person::class], version = 1, exportSchema = false) 10 | abstract class PersonDatabase : RoomDatabase() { 11 | abstract val wordDao: PersonDao 12 | 13 | companion object { 14 | private var INSTANCE: PersonDatabase? = null 15 | 16 | @Synchronized 17 | fun getDatabase(context: Context): PersonDatabase? { 18 | if (INSTANCE == null) { 19 | INSTANCE = Room.databaseBuilder( 20 | context.applicationContext, 21 | PersonDatabase::class.java, 22 | "database" 23 | ).build() 24 | } 25 | return INSTANCE 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/activity/TestActivity.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.activity 2 | 3 | import com.alibaba.android.arouter.facade.annotation.Route 4 | import com.hjq.bar.TitleBar 5 | import com.rui.base.router.RouterActivityPath 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestActivityTestBinding 9 | import com.rui.demo.ui.viewmodel.TestViewModel 10 | import com.rui.mvvmlazy.base.activity.BaseVmDbActivity 11 | 12 | @Route(path = RouterActivityPath.Test.TESTPAGER) 13 | class TestActivity : BaseVmDbActivity() { 14 | override fun initContentView(): Int { 15 | return R.layout.test_activity_test 16 | } 17 | 18 | override fun initVariableId(): Int { 19 | return BR.viewModel 20 | } 21 | 22 | override fun initData() { 23 | super.initData() 24 | } 25 | 26 | override fun initTitleBar(titleBar: TitleBar?) { 27 | super.initTitleBar(titleBar) 28 | titleBar!!.title = "demo测试" 29 | } 30 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/BindingFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentBindingBinding 9 | import com.rui.demo.ui.viewmodel.BindingViewModel 10 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 11 | 12 | class BindingFragment : BaseVmDbFragment() { 13 | override fun initContentView( 14 | inflater: LayoutInflater?, 15 | container: ViewGroup?, 16 | savedInstanceState: Bundle? 17 | ): Int { 18 | return R.layout.test_fragment_binding 19 | } 20 | 21 | override fun initVariableId(): Int { 22 | return BR.viewModel 23 | } 24 | 25 | override fun initData() { 26 | super.initData() 27 | } 28 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/ListFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentListBinding 9 | import com.rui.demo.ui.viewmodel.ListViewModel 10 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 11 | 12 | class ListFragment : BaseVmDbFragment() { 13 | override fun initContentView( 14 | inflater: LayoutInflater?, 15 | container: ViewGroup?, 16 | savedInstanceState: Bundle? 17 | ): Int { 18 | return R.layout.test_fragment_list 19 | } 20 | 21 | override fun initVariableId(): Int { 22 | return BR.viewModel 23 | } 24 | 25 | override fun initData() { 26 | super.initData() 27 | } 28 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/MutiFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentMutiBinding 9 | import com.rui.demo.ui.viewmodel.MutiViewModel 10 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 11 | 12 | class MutiFragment : BaseVmDbFragment() { 13 | override fun initContentView( 14 | inflater: LayoutInflater?, 15 | container: ViewGroup?, 16 | savedInstanceState: Bundle? 17 | ): Int { 18 | return R.layout.test_fragment_muti 19 | } 20 | 21 | override fun initVariableId(): Int { 22 | return BR.viewModel 23 | } 24 | 25 | override fun initData() { 26 | super.initData() 27 | } 28 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/NetWorkFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.google.gson.Gson 7 | import com.rui.demo.BR 8 | import com.rui.demo.R 9 | import com.rui.demo.databinding.TestFragmentNetWorkBinding 10 | import com.rui.demo.ui.viewmodel.NetWorkViewModel 11 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 12 | import com.rui.mvvmlazy.ext.parseState 13 | import com.rui.mvvmlazy.utils.common.ToastUtils 14 | 15 | class NetWorkFragment : BaseVmDbFragment() { 16 | override fun initContentView( 17 | inflater: LayoutInflater?, 18 | container: ViewGroup?, 19 | savedInstanceState: Bundle? 20 | ): Int { 21 | return R.layout.test_fragment_net_work 22 | } 23 | 24 | override fun initVariableId(): Int { 25 | return BR.viewModel 26 | } 27 | 28 | override fun initData() { 29 | super.initData() 30 | } 31 | 32 | override fun initViewObservable() { 33 | super.initViewObservable() 34 | viewModel.jokeInfo.observe(this) { resultState -> 35 | parseState(resultState, { 36 | viewModel.netDataStr.value = Gson().toJson(it) 37 | }, { 38 | ToastUtils.showShort(it.errorMsg) 39 | }) 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/PaginationFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentPaginationBinding 9 | import com.rui.demo.ui.viewmodel.PaginationViewModel 10 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 11 | 12 | class PaginationFragment : BaseVmDbFragment() { 13 | override fun initContentView( 14 | inflater: LayoutInflater?, 15 | container: ViewGroup?, 16 | savedInstanceState: Bundle? 17 | ): Int { 18 | return R.layout.test_fragment_pagination 19 | } 20 | 21 | override fun initVariableId(): Int { 22 | return BR.viewModel 23 | } 24 | 25 | override fun initData() { 26 | super.initData() 27 | } 28 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/ShapeViewFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentShapeviewBinding 9 | import com.rui.demo.ui.viewmodel.ShapeViewModel 10 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 11 | 12 | class ShapeViewFragment : BaseVmDbFragment() { 13 | override fun initContentView( 14 | inflater: LayoutInflater?, 15 | container: ViewGroup?, 16 | savedInstanceState: Bundle? 17 | ): Int { 18 | return R.layout.test_fragment_shapeview 19 | } 20 | 21 | override fun initVariableId(): Int { 22 | return BR.viewModel 23 | } 24 | 25 | override fun initData() { 26 | super.initData() 27 | } 28 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/TitleBarFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentTitlebarBinding 9 | import com.rui.demo.ui.viewmodel.TitleBarViewModel 10 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 11 | 12 | class TitleBarFragment : BaseVmDbFragment() { 13 | override fun initContentView( 14 | inflater: LayoutInflater?, 15 | container: ViewGroup?, 16 | savedInstanceState: Bundle? 17 | ): Int { 18 | return R.layout.test_fragment_titlebar 19 | } 20 | 21 | override fun initVariableId(): Int { 22 | return BR.viewModel 23 | } 24 | 25 | override fun initData() { 26 | super.initData() 27 | } 28 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/ViewPagerGroupFragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment 2 | 3 | import androidx.fragment.app.Fragment 4 | import com.rui.base.ui.fragment.BasePagerFragment 5 | import com.rui.demo.ui.fragment.tab.TabBar1Fragment 6 | import com.rui.demo.ui.fragment.tab.TabBar2Fragment 7 | import com.rui.demo.ui.fragment.tab.TabBar3Fragment 8 | import com.rui.demo.ui.fragment.tab.TabBar4Fragment 9 | import com.rui.mvvmlazy.base.BaseViewModel 10 | import java.util.* 11 | 12 | /** 13 | * Create Author:zjr 14 | * Create Date:2019/01/25 15 | * Description:ViewPager+Fragment的实现 16 | */ 17 | class ViewPagerGroupFragment : BasePagerFragment() { 18 | override fun pagerFragment(): List { 19 | val list: MutableList = ArrayList() 20 | list.add(TabBar1Fragment.newInstance()) 21 | list.add(TabBar2Fragment.newInstance()) 22 | list.add(TabBar3Fragment.newInstance()) 23 | list.add(TabBar4Fragment.newInstance()) 24 | return list 25 | } 26 | 27 | override fun pagerTitleString(): List { 28 | val list: MutableList = ArrayList() 29 | list.add("推荐") 30 | list.add("新闻") 31 | list.add("资讯") 32 | list.add("消息") 33 | return list 34 | } 35 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/tab/TabBar1Fragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment.tab 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentTabBar1Binding 9 | import com.rui.mvvmlazy.base.BaseViewModel 10 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 11 | 12 | /** 13 | * Created by zjr on 2018/7/18. 14 | */ 15 | class TabBar1Fragment : BaseVmDbFragment() { 16 | override fun initContentView( 17 | inflater: LayoutInflater?, 18 | container: ViewGroup?, 19 | savedInstanceState: Bundle? 20 | ): Int { 21 | return R.layout.test_fragment_tab_bar_1 22 | } 23 | 24 | override fun initVariableId(): Int { 25 | return BR.viewModel 26 | } 27 | 28 | companion object { 29 | fun newInstance(): TabBar1Fragment { 30 | val args = Bundle() 31 | val fragment = TabBar1Fragment() 32 | fragment.arguments = args 33 | return fragment 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/tab/TabBar2Fragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment.tab 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentTabBar2Binding 9 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 10 | import com.rui.mvvmlazy.base.BaseViewModel 11 | 12 | /** 13 | * Created by zjr on 2018/7/18. 14 | */ 15 | class TabBar2Fragment : BaseVmDbFragment() { 16 | override fun initContentView( 17 | inflater: LayoutInflater?, 18 | container: ViewGroup?, 19 | savedInstanceState: Bundle? 20 | ): Int { 21 | return R.layout.test_fragment_tab_bar_2 22 | } 23 | 24 | override fun initVariableId(): Int { 25 | return BR.viewModel 26 | } 27 | 28 | companion object { 29 | fun newInstance(): TabBar2Fragment { 30 | val args = Bundle() 31 | val fragment = TabBar2Fragment() 32 | fragment.arguments = args 33 | return fragment 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/tab/TabBar3Fragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment.tab 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentTabBar3Binding 9 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 10 | import com.rui.mvvmlazy.base.BaseViewModel 11 | 12 | /** 13 | * Created by zjr on 2018/7/18. 14 | */ 15 | class TabBar3Fragment : BaseVmDbFragment() { 16 | override fun initContentView( 17 | inflater: LayoutInflater?, 18 | container: ViewGroup?, 19 | savedInstanceState: Bundle? 20 | ): Int { 21 | return R.layout.test_fragment_tab_bar_3 22 | } 23 | 24 | override fun initVariableId(): Int { 25 | return BR.viewModel 26 | } 27 | 28 | companion object { 29 | fun newInstance(): TabBar3Fragment { 30 | val args = Bundle() 31 | val fragment = TabBar3Fragment() 32 | fragment.arguments = args 33 | return fragment 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/fragment/tab/TabBar4Fragment.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.fragment.tab 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import com.rui.demo.BR 7 | import com.rui.demo.R 8 | import com.rui.demo.databinding.TestFragmentTabBar4Binding 9 | import com.rui.mvvmlazy.base.fragment.BaseVmDbFragment 10 | import com.rui.mvvmlazy.base.BaseViewModel 11 | 12 | /** 13 | * Created by zjr on 2018/7/18. 14 | */ 15 | class TabBar4Fragment : BaseVmDbFragment() { 16 | override fun initContentView( 17 | inflater: LayoutInflater?, 18 | container: ViewGroup?, 19 | savedInstanceState: Bundle? 20 | ): Int { 21 | return R.layout.test_fragment_tab_bar_4 22 | } 23 | 24 | override fun initVariableId(): Int { 25 | return BR.viewModel 26 | } 27 | 28 | companion object { 29 | fun newInstance(): TabBar4Fragment { 30 | val args = Bundle() 31 | val fragment = TabBar4Fragment() 32 | fragment.arguments = args 33 | return fragment 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/BindingViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import androidx.lifecycle.MutableLiveData 4 | import com.rui.demo.data.bean.CityInfo 5 | import com.rui.mvvmlazy.base.BaseViewModel 6 | import com.rui.mvvmlazy.binding.viewadapter.spinner.IKeyAndValue 7 | import com.rui.mvvmlazy.utils.common.ToastUtils 8 | import java.util.* 9 | 10 | class BindingViewModel : BaseViewModel() { 11 | var imgUrl = 12 | MutableLiveData("http://video.hnbxwhy.com/ads/77b65f2b-e31d-4cfd-b6d9-39ee1f9dfc78.jpg") 13 | var data = MutableLiveData>() 14 | var clickCommand: () -> Unit = { 15 | ToastUtils.showShort("点到我了") 16 | } 17 | var swichCommand: (Boolean) -> Unit = { 18 | ToastUtils.showShort("开关$it") 19 | } 20 | var checkCommand: (Boolean) -> Unit = { 21 | ToastUtils.showShort("选中$it") 22 | } 23 | var selectCommand: (IKeyAndValue) -> Unit = { 24 | ToastUtils.showShort("选中" + it.key) 25 | } 26 | 27 | 28 | override fun initData() { 29 | super.initData() 30 | val iKeyAndValues: MutableList = ArrayList() 31 | iKeyAndValues.add(CityInfo("中国", "111")) 32 | iKeyAndValues.add(CityInfo("美国", "122")) 33 | iKeyAndValues.add(CityInfo("日本", "133")) 34 | iKeyAndValues.add(CityInfo("英国", "143")) 35 | data.value = iKeyAndValues 36 | } 37 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/BtmTabViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import com.rui.mvvmlazy.base.BaseViewModel 4 | 5 | class BtmTabViewModel : BaseViewModel() { 6 | override fun initData() { 7 | super.initData() 8 | } 9 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/DialogViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import com.rui.mvvmlazy.base.BaseViewModel 4 | 5 | class DialogViewModel : BaseViewModel() { 6 | override fun initData() { 7 | super.initData() 8 | } 9 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/MutiViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import androidx.lifecycle.MutableLiveData 4 | import com.rui.mvvmlazy.base.BaseViewModel 5 | import com.rui.mvvmlazy.widget.MultiStateView.ViewState 6 | 7 | class MutiViewModel : BaseViewModel() { 8 | //多状态布局控制 9 | var viewState = MutableLiveData() 10 | 11 | /** 12 | * 重新加载数据 13 | */ 14 | var reTryLoad: () -> Unit = { 15 | viewState.setValue( 16 | ViewState.CONTENT 17 | ) 18 | } 19 | var contentClick: () -> Unit = { 20 | viewState.setValue( 21 | ViewState.CONTENT 22 | ) 23 | } 24 | var loadingClick: () -> Unit = { 25 | viewState.setValue( 26 | ViewState.LOADING 27 | ) 28 | } 29 | var emptyClick: () -> Unit = { 30 | viewState.setValue( 31 | ViewState.EMPTY 32 | ) 33 | } 34 | var errorClick: () -> Unit = { 35 | viewState.setValue( 36 | ViewState.ERROR 37 | ) 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/NetWorkViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import androidx.lifecycle.MutableLiveData 4 | import com.google.gson.Gson 5 | import com.rui.demo.data.bean.JokeInfo 6 | import com.rui.demo.data.repository 7 | import com.rui.mvvmlazy.base.BaseViewModel 8 | import com.rui.mvvmlazy.ext.request 9 | import com.rui.mvvmlazy.http.PagingData 10 | import com.rui.mvvmlazy.state.ResultState 11 | 12 | class NetWorkViewModel : BaseViewModel() { 13 | var jokeInfo = MutableLiveData>>() 14 | var netDataStr = MutableLiveData() 15 | var clickCommand1: () -> Unit = { 16 | getNetworkData1() 17 | } 18 | var clickCommand2: () -> Unit = { 19 | getNetworkData2() 20 | } 21 | 22 | /** 23 | * 在viewModel回调处理结果 24 | */ 25 | private fun getNetworkData1() { 26 | request({ repository.getJoke(1, 10) }, { 27 | netDataStr.value = Gson().toJson(it) 28 | }, { 29 | 30 | }, isShowDialog = true, loadingMessage = "加载中,请稍后..") 31 | } 32 | 33 | /** 34 | * 将请求数据结果传给 MutableLiveData,通过页面检测处理结果 35 | */ 36 | private fun getNetworkData2() { 37 | request( 38 | { repository.getJoke(1, 10) }, 39 | jokeInfo, 40 | isShowDialog = true, 41 | loadingMessage = "加载中,请稍后.." 42 | ) 43 | } 44 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/PaginationViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import com.chad.library.adapter.base.BaseQuickAdapter 4 | import com.chad.library.adapter.base.viewholder.BaseViewHolder 5 | import com.rui.base.entity.ApiResponse 6 | import com.rui.base.ui.viewModel.BasePaginationViewModel 7 | import com.rui.demo.R 8 | import com.rui.demo.data.bean.JokeInfo 9 | import com.rui.demo.data.repository 10 | import com.rui.demo.databinding.TestLayoutItemJokeBinding 11 | import com.rui.mvvmlazy.binding.viewadapter.recyclerview.DataBindingAdapter 12 | import com.rui.mvvmlazy.http.PagingData 13 | 14 | class PaginationViewModel : BasePaginationViewModel() { 15 | private val myAdapter by lazy { 16 | object : 17 | DataBindingAdapter(R.layout.test_layout_item_joke) { 18 | override fun convertItem( 19 | holder: BaseViewHolder, 20 | binding: TestLayoutItemJokeBinding?, 21 | item: JokeInfo 22 | ) { 23 | binding!!.entity = item 24 | } 25 | } 26 | } 27 | override val adapter: BaseQuickAdapter 28 | get() = myAdapter 29 | 30 | /** 31 | * 接口数据格式通常有两种类型 32 | * 1.通常有不包含分页信息的,也就是data直接返回list 33 | * 2. 携带分页信息的,data包含分页信息和数据list 34 | * 根据接口数据类型选择解析方式 35 | * @return 36 | */ 37 | override val dateListType: ListType 38 | get() = ListType.WITH_PAGING_INFO 39 | 40 | override suspend fun getHttpRequestWithPagingData(pageIndex: Int): ApiResponse> { 41 | return repository.getJoke(pageIndex, 10 ) 42 | } 43 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/RoomSampleViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import androidx.lifecycle.LiveData 4 | import androidx.lifecycle.viewModelScope 5 | import com.rui.demo.data.repository 6 | import com.rui.demo.data.source.local.db.Person 7 | import com.rui.mvvmlazy.base.BaseViewModel 8 | import com.rui.mvvmlazy.ext.launch 9 | import kotlinx.coroutines.* 10 | 11 | /** 12 | * Create Date:2021/01/01 13 | * 实现Room数据的基本操作 14 | * zjr 15 | */ 16 | class RoomSampleViewModel() : 17 | BaseViewModel() { 18 | 19 | val allWordsLive: LiveData> 20 | get() = repository.getAllWordsLive() 21 | 22 | fun insertWords(vararg words: Person) { 23 | launch({ repository.insertWords(*words) }, {}) 24 | } 25 | 26 | fun updateWords(vararg words: Person) { 27 | launch({ repository.updateWords(*words) }, {}) 28 | 29 | } 30 | 31 | fun deleteWords(vararg words: Person) { 32 | launch({ repository.deleteWords(*words) }, {}) 33 | } 34 | 35 | fun deleteAllWords() { 36 | launch({ repository.deleteAllWords() }, {}) 37 | } 38 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/ShapeViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import com.rui.mvvmlazy.base.BaseViewModel 4 | 5 | class ShapeViewModel() : BaseViewModel() { 6 | override fun initData() { 7 | super.initData() 8 | } 9 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/TestViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import com.rui.mvvmlazy.base.BaseViewModel 4 | 5 | class TestViewModel : BaseViewModel() { 6 | override fun initData() { 7 | super.initData() 8 | } 9 | } -------------------------------------------------------------------------------- /module-demo/src/main/java/com/rui/demo/ui/viewmodel/TitleBarViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.rui.demo.ui.viewmodel 2 | 3 | import com.rui.mvvmlazy.base.BaseViewModel 4 | 5 | class TitleBarViewModel() : 6 | BaseViewModel() { 7 | override fun initData() { 8 | super.initData() 9 | } 10 | } -------------------------------------------------------------------------------- /module-demo/src/main/res/drawable-xhdpi/qr_code_ic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/module-demo/src/main/res/drawable-xhdpi/qr_code_ic.png -------------------------------------------------------------------------------- /module-demo/src/main/res/drawable-xhdpi/shape_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /module-demo/src/main/res/drawable-xhdpi/test_icon_phone_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/module-demo/src/main/res/drawable-xhdpi/test_icon_phone_normal.png -------------------------------------------------------------------------------- /module-demo/src/main/res/drawable-xhdpi/test_icon_phone_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jirywell/MvvmLazy-kotlin/b37dcb02d8b93699299aada9ec98a1c3ae10e346/module-demo/src/main/res/drawable-xhdpi/test_icon_phone_pressed.png -------------------------------------------------------------------------------- /module-demo/src/main/res/drawable/test_ic_add.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /module-demo/src/main/res/drawable/test_ic_home.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /module-demo/src/main/res/drawable/test_ic_message.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /module-demo/src/main/res/drawable/test_shape_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /module-demo/src/main/res/layout/test_activity_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 24 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /module-demo/src/main/res/layout/test_fragment_net_work.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 |