├── .gitignore ├── .idea ├── .gitignore ├── .name ├── compiler.xml ├── gradle.xml ├── jarRepositories.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app-debug.apk ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bbq │ │ └── wanandroid │ │ ├── MainActivity.kt │ │ ├── SplashActivity.kt │ │ └── app │ │ ├── AppModels.kt │ │ └── WanApp.kt │ └── res │ ├── color │ └── select_bottom_nav_color.xml │ ├── drawable │ ├── ic_icon_faq.xml │ ├── ic_icon_home.xml │ ├── ic_icon_mine.xml │ ├── ic_icon_navigation.xml │ ├── ic_icon_project.xml │ ├── ic_icon_system.xml │ └── ic_launcher_background.xml │ ├── layout │ ├── activity_main.xml │ └── activity_splash.xml │ ├── menu │ └── bottom_nav_menu.xml │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── navigation │ └── app_nav.xml │ ├── values-night │ └── themes.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ ├── styles.xml │ └── themes.xml ├── base ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bbq │ │ └── base │ │ ├── base │ │ ├── BaseActivity.kt │ │ ├── BaseApp.kt │ │ ├── BaseFragment.kt │ │ ├── BaseVMActivity.kt │ │ ├── BaseVMFragment.kt │ │ └── BaseViewModel.kt │ │ ├── bean │ │ ├── EventCollectBean.kt │ │ └── User.kt │ │ ├── loadsir │ │ ├── EmptyCallback.kt │ │ └── ErrorCallback.kt │ │ ├── rository │ │ ├── BaseRepository.kt │ │ └── StateLiveData.kt │ │ ├── route │ │ ├── RouteModel.kt │ │ └── ServiceUtils.kt │ │ ├── utils │ │ ├── ActivityUtil.kt │ │ ├── BannerHelper.kt │ │ ├── DensityUtil.kt │ │ ├── FixFragmentNavigator.java │ │ ├── KeyBoardUtils.kt │ │ ├── LiveDataBus.kt │ │ ├── SpUtils.kt │ │ ├── StatusBarUtil.kt │ │ └── UtilExt.kt │ │ └── view │ │ ├── CircleImageView.java │ │ ├── CustomBlackToastStyle.java │ │ ├── FabViewModel.kt │ │ ├── LoadingDialog.kt │ │ └── TitleViewModel.kt │ └── res │ ├── drawable-xxhdpi │ └── up_arrow_white.png │ ├── drawable │ ├── ic_loading.png │ ├── ic_network_error.xml │ ├── ic_result_nodata.xml │ └── shape_load_bg.xml │ ├── layout │ ├── base_common_refresh.xml │ ├── base_layout_empty.xml │ ├── base_layout_error.xml │ ├── base_layout_loading.xml │ ├── empty_view.xml │ ├── error_view.xml │ ├── layout_loading_view.xml │ ├── view_model_fab.xml │ └── view_model_title.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ └── string.xml ├── build.gradle ├── buildSrc ├── build.gradle.kts ├── build │ ├── classes │ │ └── kotlin │ │ │ └── main │ │ │ ├── META-INF │ │ │ └── buildSrc.kotlin_module │ │ │ └── com │ │ │ └── sss │ │ │ └── plugin │ │ │ ├── AndroidX.class │ │ │ ├── AndroidXVersion.class │ │ │ ├── BuildVersion.class │ │ │ ├── Deps.class │ │ │ ├── Kotlin.class │ │ │ └── KotlinVersion.class │ ├── kotlin │ │ ├── buildSrcjar-classes.txt │ │ └── compileKotlin │ │ │ ├── build-history.bin │ │ │ ├── caches-jvm │ │ │ ├── inputs │ │ │ │ ├── source-to-output.tab │ │ │ │ ├── source-to-output.tab.keystream │ │ │ │ ├── source-to-output.tab.keystream.len │ │ │ │ ├── source-to-output.tab.len │ │ │ │ ├── source-to-output.tab.values.at │ │ │ │ ├── source-to-output.tab_i │ │ │ │ └── source-to-output.tab_i.len │ │ │ ├── jvm │ │ │ │ └── kotlin │ │ │ │ │ ├── class-fq-name-to-source.tab │ │ │ │ │ ├── class-fq-name-to-source.tab.keystream │ │ │ │ │ ├── class-fq-name-to-source.tab.keystream.len │ │ │ │ │ ├── class-fq-name-to-source.tab.len │ │ │ │ │ ├── class-fq-name-to-source.tab.values.at │ │ │ │ │ ├── class-fq-name-to-source.tab_i │ │ │ │ │ ├── class-fq-name-to-source.tab_i.len │ │ │ │ │ ├── internal-name-to-source.tab │ │ │ │ │ ├── internal-name-to-source.tab.keystream │ │ │ │ │ ├── internal-name-to-source.tab.keystream.len │ │ │ │ │ ├── internal-name-to-source.tab.len │ │ │ │ │ ├── internal-name-to-source.tab.values.at │ │ │ │ │ ├── internal-name-to-source.tab_i │ │ │ │ │ ├── internal-name-to-source.tab_i.len │ │ │ │ │ ├── proto.tab │ │ │ │ │ ├── proto.tab.keystream │ │ │ │ │ ├── proto.tab.keystream.len │ │ │ │ │ ├── proto.tab.len │ │ │ │ │ ├── proto.tab.values.at │ │ │ │ │ ├── proto.tab_i │ │ │ │ │ ├── proto.tab_i.len │ │ │ │ │ ├── source-to-classes.tab │ │ │ │ │ ├── source-to-classes.tab.keystream │ │ │ │ │ ├── source-to-classes.tab.keystream.len │ │ │ │ │ ├── source-to-classes.tab.len │ │ │ │ │ ├── source-to-classes.tab.values.at │ │ │ │ │ ├── source-to-classes.tab_i │ │ │ │ │ └── source-to-classes.tab_i.len │ │ │ └── lookups │ │ │ │ ├── counters.tab │ │ │ │ ├── file-to-id.tab │ │ │ │ ├── file-to-id.tab.keystream │ │ │ │ ├── file-to-id.tab.keystream.len │ │ │ │ ├── file-to-id.tab.len │ │ │ │ ├── file-to-id.tab.values.at │ │ │ │ ├── file-to-id.tab_i │ │ │ │ ├── file-to-id.tab_i.len │ │ │ │ ├── id-to-file.tab │ │ │ │ ├── id-to-file.tab.keystream │ │ │ │ ├── id-to-file.tab.keystream.len │ │ │ │ ├── id-to-file.tab.len │ │ │ │ ├── id-to-file.tab.values.at │ │ │ │ ├── id-to-file.tab_i │ │ │ │ ├── id-to-file.tab_i.len │ │ │ │ ├── lookups.tab │ │ │ │ ├── lookups.tab.keystream │ │ │ │ ├── lookups.tab.keystream.len │ │ │ │ ├── lookups.tab.len │ │ │ │ ├── lookups.tab.values.at │ │ │ │ ├── lookups.tab_i │ │ │ │ └── lookups.tab_i.len │ │ │ └── last-build.bin │ ├── libs │ │ └── buildSrc.jar │ ├── pluginUnderTestMetadata │ │ └── plugin-under-test-metadata.properties │ ├── reports │ │ └── plugin-development │ │ │ └── validation-report.txt │ ├── source-roots │ │ └── buildSrc │ │ │ └── source-roots.txt │ └── tmp │ │ └── jar │ │ └── MANIFEST.MF └── src │ └── main │ └── java │ └── com.sss.plugin │ ├── AndroidX.kt │ ├── BuildVersion.kt │ ├── Deps.kt │ └── Kotlin.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── home ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bbq │ │ └── home │ │ ├── adapter │ │ ├── BannerAdapter.kt │ │ ├── HistoryAdapter.kt │ │ ├── HomeArticleAdapter.kt │ │ ├── HomePageAdapter.kt │ │ └── HotKeyAdapter.kt │ │ ├── api │ │ └── HomeApi.kt │ │ ├── bean │ │ ├── ArticleBean.kt │ │ ├── ArticleTag.kt │ │ ├── BannerBean.kt │ │ └── HotKeyBean.kt │ │ ├── db │ │ ├── ArticleDao.kt │ │ ├── HomeDatabase.kt │ │ └── TagTypeConverter.kt │ │ ├── di │ │ └── LibHome.kt │ │ ├── repo │ │ ├── HomePageDataResource.kt │ │ └── HomeRepo.kt │ │ ├── route │ │ └── CollectionServiceImpl.kt │ │ ├── ui │ │ ├── CollectionActivity.kt │ │ ├── FaqFragment.kt │ │ ├── HomeFragment.kt │ │ └── SearchActivity.kt │ │ ├── viewmodel │ │ ├── FaqVM.kt │ │ ├── HomeViewModel.kt │ │ ├── ItemHomeArticle.kt │ │ ├── SearchActivityVM.kt │ │ └── TagViewModel.kt │ │ └── weight │ │ ├── FooterAdapter.kt │ │ └── SimpleEditText.kt │ └── res │ ├── drawable-xxhdpi │ ├── collect_gray.png │ ├── collect_red.png │ ├── ic_add.webp │ ├── ic_back.webp │ ├── ic_clear_normal.webp │ ├── ic_clear_pressed.webp │ ├── ic_delete.webp │ ├── ic_search.webp │ └── shanchu_ico.png │ ├── drawable │ ├── layer_while_item_top.xml │ ├── rect_red_shape.xml │ ├── selector_corners_gray.xml │ ├── selector_edit_text_delete.xml │ ├── shape_corners_solid_ccc.xml │ ├── shape_corners_solid_gray.xml │ └── shape_top_search_bg.xml │ ├── layout │ ├── activity_search.xml │ ├── fbl_hot_key.xml │ ├── fragment_faq.xml │ ├── fragment_home.xml │ ├── item_head_banner.xml │ ├── item_history_search.xml │ ├── item_home.xml │ ├── item_home_search.xml │ ├── item_hot_key.xml │ ├── layout_top_search.xml │ ├── layout_top_search_search.xml │ ├── paging_load_more.xml │ └── view_model_tag.xml │ └── values │ ├── colors.xml │ └── strings.xml ├── login ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bbq │ │ └── login │ │ ├── api │ │ └── LoginApi.kt │ │ ├── di │ │ └── LoginModel.kt │ │ ├── model │ │ └── LoginLayoutBean.kt │ │ ├── repo │ │ └── LoginRepository.kt │ │ ├── route │ │ └── LoginServiceImpl.kt │ │ ├── ui │ │ └── LoginActivity.kt │ │ ├── utils │ │ └── UserManager.kt │ │ └── viewmodel │ │ └── LoginViewModel.kt │ └── res │ ├── drawable │ ├── edittext_cursor_color.xml │ ├── ic_login_close.xml │ └── login_btn_bg.xml │ ├── layout │ └── activity_login.xml │ └── values │ └── style.xml ├── navigation ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── bbq │ │ └── navigation │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── alone │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── bbq │ │ │ └── navigation │ │ │ ├── adapter │ │ │ ├── NavTabLeftAdapter.kt │ │ │ ├── NavTabRightAdapter.kt │ │ │ ├── ProjectArticleAdapter.kt │ │ │ ├── ProjectRightArticleAdapter.kt │ │ │ ├── PublicTabLeftAdapter.kt │ │ │ ├── SystemArticleAdapter.kt │ │ │ └── TreeTabAdapter.kt │ │ │ ├── alone │ │ │ ├── AloneActivity.kt │ │ │ └── AloneApp.kt │ │ │ ├── api │ │ │ └── NavApi.kt │ │ │ ├── bean │ │ │ ├── ArticleBean.kt │ │ │ ├── NavTabBean.kt │ │ │ ├── PublicBean.kt │ │ │ └── TreeBean.kt │ │ │ ├── di │ │ │ └── navModel.kt │ │ │ ├── repo │ │ │ └── NavRepo.kt │ │ │ ├── ui │ │ │ ├── NavigationFragment.kt │ │ │ ├── NavigationTabFragment.kt │ │ │ ├── ProjectTabFragment.kt │ │ │ ├── ProjectTreeTabFragment.kt │ │ │ ├── PublicTabFragment.kt │ │ │ ├── SystemListActivity.kt │ │ │ ├── SystemListFragment.kt │ │ │ └── SystemTabFragment.kt │ │ │ └── viewmodel │ │ │ ├── ItemHomeArticle.kt │ │ │ ├── ItemProject.kt │ │ │ ├── NavTabVM.kt │ │ │ ├── SystemListVM.kt │ │ │ └── TagViewModel.kt │ └── res │ │ ├── drawable-xxhdpi │ │ ├── nav_collect_gray.png │ │ ├── nav_collect_red.png │ │ ├── nav_place_holder.png │ │ └── nav_shanchu_ico.png │ │ ├── drawable │ │ ├── nav_paper_divider.xml │ │ ├── nav_rect_red_shape.xml │ │ ├── nav_selector_corners_gray.xml │ │ ├── nav_shape_corners_solid_ccc.xml │ │ ├── nav_shape_corners_solid_gray.xml │ │ └── nav_tab_text_selector.xml │ │ ├── layout │ │ ├── activity_alone.xml │ │ ├── nav_activity_system_list.xml │ │ ├── nav_fbl_system_children.xml │ │ ├── nav_fragment_navigation.xml │ │ ├── nav_fragment_navigation_tab.xml │ │ ├── nav_fragment_project_tab.xml │ │ ├── nav_fragment_project_tree_tab.xml │ │ ├── nav_fragment_public_tab.xml │ │ ├── nav_fragment_system_list.xml │ │ ├── nav_fragment_system_tab.xml │ │ ├── nav_item_nav_left.xml │ │ ├── nav_item_nav_right.xml │ │ ├── nav_item_project.xml │ │ ├── nav_item_project_right.xml │ │ ├── nav_item_system_list.xml │ │ ├── nav_item_tab_paper.xml │ │ ├── nav_item_tree.xml │ │ └── nav_item_tree_view_model_tag.xml │ │ └── values │ │ ├── strings.xml │ │ └── style.xml │ └── test │ └── java │ └── com │ └── bbq │ └── navigation │ └── ExampleUnitTest.kt ├── net ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── bbq │ └── net │ ├── cookie │ ├── HttpsHelper.kt │ └── SimpleCookieJar.kt │ ├── exception │ ├── ApiCode.kt │ ├── DealException.kt │ └── ResultException.kt │ ├── model │ ├── BasePagingResult.kt │ ├── BaseResult.kt │ ├── DataStatus.kt │ └── ResultState.kt │ └── net │ └── RetrofitManager.kt ├── settings.gradle ├── user ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── bbq │ │ └── user │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── bbq │ │ │ └── user │ │ │ ├── api │ │ │ └── UserApi.kt │ │ │ ├── bean │ │ │ └── IntegralBean.kt │ │ │ ├── di │ │ │ └── userModel.kt │ │ │ ├── repo │ │ │ └── UserRepo.kt │ │ │ ├── ui │ │ │ └── UserFragment.kt │ │ │ └── viewmodel │ │ │ ├── UserItem.kt │ │ │ └── UserVM.kt │ └── res │ │ ├── drawable │ │ ├── ic_user_arrow_right.xml │ │ ├── ic_user_collect.xml │ │ ├── ic_user_un_authen.xml │ │ └── shape_theme_bg_btn.xml │ │ └── layout │ │ └── fragment_user.xml │ └── test │ └── java │ └── com │ └── bbq │ └── user │ └── ExampleUnitTest.kt └── webview ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── bbq │ └── webview │ └── ExampleInstrumentedTest.kt ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── bbq │ │ └── webview │ │ ├── api │ │ └── WebApi.kt │ │ ├── di │ │ └── WebModels.kt │ │ ├── repo │ │ └── WebRepo.kt │ │ ├── route │ │ └── WebServiceImpl.kt │ │ ├── ui │ │ └── WebActivity.kt │ │ └── viewmodel │ │ └── WebViewModel.kt └── res │ ├── drawable-xxhdpi │ ├── collect_gray.png │ ├── collect_red.png │ ├── sc_white_stroke_ico.png │ ├── snail_1.webp │ ├── snail_2.webp │ ├── snail_3.webp │ ├── snail_4.webp │ └── snail_5.webp │ ├── drawable │ ├── animation_snail_bar.xml │ └── layer_snail_bar.xml │ ├── layout │ └── activity_web.xml │ └── values │ └── strings.xml └── test └── java └── com └── bbq └── webview └── ExampleUnitTest.kt /.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 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | WanAndroid -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 27 | 28 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/app-debug.apk -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | import com.sss.plugin.AndroidX 2 | import com.sss.plugin.BuildVersion 3 | import com.sss.plugin.Deps 4 | 5 | plugins { 6 | id 'com.android.application' 7 | id 'kotlin-android' 8 | id 'kotlin-kapt' 9 | } 10 | 11 | kapt { 12 | arguments { 13 | arg("AROUTER_MODULE_NAME", project.getName()) 14 | } 15 | } 16 | 17 | android { 18 | compileSdkVersion BuildVersion.compileSdkVersion 19 | buildToolsVersion BuildVersion.buildToolsVersion 20 | 21 | defaultConfig { 22 | applicationId BuildVersion.applicationId 23 | minSdkVersion BuildVersion.minSdkVersion 24 | targetSdkVersion BuildVersion.targetSdkVersion 25 | versionCode BuildVersion.versionCode 26 | versionName BuildVersion.versionName 27 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 28 | multiDexEnabled true 29 | } 30 | 31 | buildTypes { 32 | release { 33 | minifyEnabled false 34 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 35 | } 36 | } 37 | compileOptions { 38 | sourceCompatibility JavaVersion.VERSION_1_8 39 | targetCompatibility JavaVersion.VERSION_1_8 40 | } 41 | kotlinOptions { 42 | jvmTarget = '1.8' 43 | } 44 | 45 | buildFeatures { 46 | dataBinding = true 47 | } 48 | } 49 | 50 | dependencies { 51 | implementation project(":base") 52 | implementation project(":home") 53 | implementation project(":net") 54 | implementation project(":webview") 55 | implementation project(":navigation") 56 | implementation project(":user") 57 | implementation project(":login") 58 | implementation AndroidX.multidex 59 | kapt Deps.aroute_processor 60 | } -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/bbq/wanandroid/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.wanandroid 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import androidx.appcompat.app.AppCompatActivity 6 | import com.hjq.permissions.Permission 7 | import com.hjq.permissions.XXPermissions 8 | 9 | class SplashActivity : AppCompatActivity() { 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | setContentView(R.layout.activity_splash) 13 | 14 | if (XXPermissions.isGranted(this, Permission.Group.STORAGE)) { 15 | doThings() 16 | } else { 17 | XXPermissions.with(this) 18 | .permission(Permission.Group.STORAGE) 19 | .request { permissions, all -> 20 | doThings() 21 | } 22 | } 23 | } 24 | 25 | private fun doThings() { 26 | val intent = Intent(this, MainActivity::class.java) 27 | startActivity(intent) 28 | } 29 | } -------------------------------------------------------------------------------- /app/src/main/java/com/bbq/wanandroid/app/AppModels.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.wanandroid.app 2 | 3 | import com.bbq.home.di.homeModels 4 | import com.bbq.login.di.loginModel 5 | import com.bbq.navigation.di.navModel 6 | import com.bbq.net.net.RetrofitManager 7 | import com.bbq.user.di.userModel 8 | import com.bbq.webview.di.webModels 9 | import com.google.gson.GsonBuilder 10 | import okhttp3.internal.immutableListOf 11 | import org.koin.dsl.module 12 | 13 | val otherModule = module { 14 | single { 15 | RetrofitManager.instance 16 | } 17 | 18 | single { 19 | GsonBuilder().disableHtmlEscaping().create() 20 | } 21 | } 22 | 23 | 24 | val appModule = immutableListOf(otherModule, homeModels, webModels, loginModel, navModel, userModel) -------------------------------------------------------------------------------- /app/src/main/java/com/bbq/wanandroid/app/WanApp.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.wanandroid.app 2 | 3 | import android.content.Context 4 | import androidx.loader.content.Loader 5 | import androidx.multidex.MultiDex 6 | import com.alibaba.android.arouter.launcher.ARouter 7 | import com.bbq.base.base.BaseApp 8 | import com.bbq.base.loadsir.EmptyCallback 9 | import com.bbq.base.view.CustomBlackToastStyle 10 | import com.bbq.wanandroid.BuildConfig 11 | import com.hjq.permissions.XXPermissions 12 | import com.hjq.toast.ToastUtils 13 | import com.kingja.loadsir.core.LoadSir 14 | import com.scwang.smart.refresh.layout.SmartRefreshLayout 15 | import com.tencent.mmkv.MMKV 16 | import org.koin.android.ext.koin.androidContext 17 | import org.koin.core.context.startKoin 18 | 19 | class WanApp : BaseApp() { 20 | override fun attachBaseContext(base: Context?) { 21 | super.attachBaseContext(base) 22 | MultiDex.install(this) 23 | } 24 | 25 | override fun onCreate() { 26 | super.onCreate() 27 | MMKV.initialize(this) 28 | startKoin { 29 | androidContext(this@WanApp) 30 | modules(appModule) 31 | } 32 | val toastStyle = CustomBlackToastStyle() 33 | ToastUtils.init(this, toastStyle) 34 | if (BuildConfig.DEBUG) { 35 | ARouter.openLog() 36 | ARouter.openDebug() 37 | } 38 | ARouter.init(this) 39 | // 当前项目是否已经适配了分区存储的特性 40 | XXPermissions.setScopedStorage(true) 41 | //让SmartRefreshLayout可以拉伸的更有弹性 42 | SmartRefreshLayout.setDefaultRefreshInitializer { context, layout -> 43 | layout.setEnableOverScrollDrag(true) 44 | layout.setFooterMaxDragRate(4.0f) 45 | } 46 | //loadsir 47 | LoadSir.beginBuilder() 48 | .addCallback(EmptyCallback()) 49 | .addCallback(EmptyCallback()) 50 | .commit() 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /app/src/main/res/color/select_bottom_nav_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_icon_faq.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_icon_home.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_icon_mine.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_icon_navigation.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_icon_project.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_icon_system.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 17 | 18 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/menu/bottom_nav_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/navigation/app_nav.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 24 | 29 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 玩安卓 3 | 4 | HomeFragment 5 | FaqFragment 6 | NavigationFragment 7 | SystemFragment 8 | UserFragment 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /base/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /base/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/base/consumer-rules.pro -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /base/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/base/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.base 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import com.bbq.base.R 6 | import com.bbq.base.utils.ActivityUtil 7 | import com.bbq.base.utils.StatusBarUtil 8 | import com.bbq.base.utils.getResColor 9 | import com.bbq.base.view.LoadingDialog 10 | import com.hjq.toast.ToastUtils 11 | 12 | open class BaseActivity : AppCompatActivity() { 13 | private lateinit var mLoadingDialog: LoadingDialog 14 | 15 | override fun onCreate(savedInstanceState: Bundle?) { 16 | super.onCreate(savedInstanceState) 17 | mLoadingDialog = LoadingDialog(this) 18 | ActivityUtil.addActivity(this) 19 | //向上便宜 20 | StatusBarUtil.setTransparentForWindow(this) 21 | //让模式我深色模式,也就是状态懒字体变黑 22 | // StatusBarUtil.setDarkMode(this) 23 | } 24 | 25 | override fun onDestroy() { 26 | super.onDestroy() 27 | ActivityUtil.removeActivity(this) 28 | 29 | } 30 | 31 | /** 32 | * show 加载中 33 | */ 34 | fun showLoading() { 35 | mLoadingDialog.showDialog(this) 36 | } 37 | 38 | /** 39 | * dismiss loading dialog 40 | */ 41 | fun dismissLoading() { 42 | mLoadingDialog.dismissDialog() 43 | } 44 | 45 | fun toast(message: String) { 46 | ToastUtils.show(message) 47 | } 48 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/base/BaseApp.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.base 2 | 3 | import android.app.Application 4 | 5 | open class BaseApp : Application() { 6 | 7 | companion object { 8 | private lateinit var instance: Application 9 | fun getInstance(): Application { 10 | return instance 11 | } 12 | } 13 | 14 | override fun onCreate() { 15 | super.onCreate() 16 | instance = this 17 | } 18 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/base/BaseFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.base 2 | 3 | import android.os.Bundle 4 | import android.view.View 5 | import androidx.fragment.app.Fragment 6 | import com.bbq.base.view.LoadingDialog 7 | import com.hjq.toast.ToastUtils 8 | 9 | abstract class BaseFragment : Fragment() { 10 | 11 | private lateinit var mLoadingDialog: LoadingDialog 12 | 13 | 14 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 15 | super.onViewCreated(view, savedInstanceState) 16 | mLoadingDialog = LoadingDialog(view.context) 17 | } 18 | 19 | 20 | /** 21 | * show 加载中 22 | */ 23 | fun showLoading() { 24 | mLoadingDialog.showDialog(requireContext()) 25 | } 26 | 27 | /** 28 | * dismiss loading dialog 29 | */ 30 | fun dismissLoading() { 31 | mLoadingDialog.dismissDialog() 32 | } 33 | 34 | 35 | fun toast(message: String) { 36 | ToastUtils.show(message) 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/base/BaseViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.base 2 | 3 | import android.app.Application 4 | import androidx.lifecycle.AndroidViewModel 5 | import androidx.lifecycle.MutableLiveData 6 | import androidx.lifecycle.Observer 7 | import com.hjq.toast.ToastUtils 8 | import kotlinx.coroutines.Dispatchers 9 | import kotlinx.coroutines.withContext 10 | import java.lang.ref.WeakReference 11 | 12 | open class BaseViewModel(application: Application) : AndroidViewModel(application) { 13 | 14 | var isDialogShow = MutableLiveData() 15 | 16 | 17 | /** 18 | * 用来控制dialog的 19 | */ 20 | fun dialogState(activity: BaseActivity) { 21 | val weakActivity = WeakReference(activity) 22 | isDialogShow.observe(activity, Observer { 23 | if (it) weakActivity.get()?.showLoading() else weakActivity.get()?.dismissLoading() 24 | }) 25 | } 26 | 27 | 28 | /** 29 | * 用来控制dialog的 30 | */ 31 | fun dialogState(fragment: BaseFragment) { 32 | val weakFragment = WeakReference(fragment) 33 | isDialogShow.observe(fragment, Observer { 34 | if (it) weakFragment.get()?.showLoading() else weakFragment.get()?.dismissLoading() 35 | }) 36 | } 37 | 38 | suspend fun toast(message: String?) { 39 | withContext(Dispatchers.Main) { 40 | if (message != null) { 41 | ToastUtils.show(message) 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/bean/EventCollectBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.bean 2 | 3 | data class EventCollectBean( 4 | var articleId: Int, 5 | var isCollect: Boolean 6 | ) -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/bean/User.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.bean 2 | 3 | import android.os.Parcel 4 | import android.os.Parcelable 5 | import androidx.databinding.BaseObservable 6 | 7 | /** 8 | * Create by liwen on 2020/5/27 9 | */ 10 | data class User( 11 | val id: Int = 0, 12 | val username: String, 13 | val icon: String = "", 14 | val email: String = "", 15 | val password: String="" 16 | ) : Parcelable{ 17 | constructor(parcel: Parcel) : this( 18 | parcel.readInt(), 19 | parcel.readString()!!, 20 | parcel.readString()!!, 21 | parcel.readString()!!, 22 | parcel.readString()!! 23 | ) 24 | 25 | override fun writeToParcel(parcel: Parcel, flags: Int) { 26 | parcel.writeInt(id) 27 | parcel.writeString(username) 28 | parcel.writeString(icon) 29 | parcel.writeString(email) 30 | parcel.writeString(password) 31 | } 32 | 33 | override fun describeContents(): Int { 34 | return 0 35 | } 36 | 37 | companion object CREATOR : Parcelable.Creator { 38 | override fun createFromParcel(parcel: Parcel): User { 39 | return User(parcel) 40 | } 41 | 42 | override fun newArray(size: Int): Array { 43 | return arrayOfNulls(size) 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/loadsir/EmptyCallback.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.loadsir 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import com.bbq.base.R 6 | import com.kingja.loadsir.callback.Callback 7 | 8 | class EmptyCallback : Callback() { 9 | override fun onCreateView(): Int { 10 | return R.layout.empty_view 11 | } 12 | 13 | override fun onViewCreate(context: Context?, view: View?) { 14 | super.onViewCreate(context, view) 15 | 16 | } 17 | 18 | override fun onReloadEvent(context: Context?, view: View?): Boolean { 19 | return super.onReloadEvent(context, view) 20 | } 21 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/loadsir/ErrorCallback.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.loadsir 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import com.bbq.base.R 6 | import com.kingja.loadsir.callback.Callback 7 | 8 | class ErrorCallback : Callback() { 9 | override fun onCreateView(): Int { 10 | return R.layout.error_view 11 | } 12 | 13 | override fun onViewCreate(context: Context?, view: View?) { 14 | super.onViewCreate(context, view) 15 | 16 | } 17 | 18 | override fun onReloadEvent(context: Context?, view: View?): Boolean { 19 | return super.onReloadEvent(context, view) 20 | } 21 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/rository/StateLiveData.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.rository 2 | 3 | import androidx.lifecycle.MutableLiveData 4 | import com.bbq.net.model.BaseResult 5 | 6 | class StateLiveData : MutableLiveData>() { 7 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/route/RouteModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.route 2 | 3 | import android.content.Context 4 | import androidx.lifecycle.LiveData 5 | import com.alibaba.android.arouter.facade.template.IProvider 6 | import com.bbq.base.bean.User 7 | 8 | interface WebService : IProvider { 9 | fun goWeb(context: Context, title: String, url: String, id: Int?, isCollect: Boolean) 10 | } 11 | 12 | interface LoginService : IProvider { 13 | 14 | fun isLogin(): Boolean 15 | 16 | fun getUserInfo(): User? 17 | 18 | fun removeUserInfo() 19 | 20 | fun start(context: Context) 21 | 22 | fun getLiveData(): LiveData 23 | 24 | } 25 | 26 | interface CollectionService : IProvider { 27 | fun launch(context: Context) 28 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/route/ServiceUtils.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.route 2 | 3 | import android.content.Context 4 | import androidx.lifecycle.LiveData 5 | import com.alibaba.android.arouter.launcher.ARouter 6 | import com.bbq.base.bean.User 7 | 8 | class WebServiceUtils { 9 | companion object { 10 | fun goWeb( 11 | context: Context, 12 | title: String, 13 | url: String, 14 | id: Int = -1, 15 | isCollect: Boolean = false 16 | ) { 17 | ARouter.getInstance().navigation(WebService::class.java) 18 | .goWeb(context, title, url, id, isCollect) 19 | } 20 | } 21 | } 22 | 23 | class CollectionServiceUtils { 24 | companion object { 25 | fun launch(context: Context) { 26 | ARouter.getInstance().navigation(CollectionService::class.java) 27 | .launch(context) 28 | } 29 | } 30 | 31 | } 32 | 33 | 34 | class LoginServiceUtils { 35 | companion object { 36 | fun isLogin(): Boolean { 37 | return ARouter.getInstance().navigation(LoginService::class.java).isLogin() 38 | } 39 | 40 | fun getUserInfo(): User? { 41 | return ARouter.getInstance().navigation(LoginService::class.java).getUserInfo() 42 | } 43 | 44 | fun removeUserInfo() { 45 | ARouter.getInstance().navigation(LoginService::class.java).removeUserInfo() 46 | } 47 | 48 | fun start(context: Context) { 49 | ARouter.getInstance().navigation(LoginService::class.java).start(context) 50 | 51 | } 52 | 53 | fun getLiveData(): LiveData { 54 | return ARouter.getInstance().navigation(LoginService::class.java).getLiveData() 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/utils/ActivityUtil.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.utils 2 | 3 | import android.app.Activity 4 | import java.lang.IllegalArgumentException 5 | 6 | object ActivityUtil { 7 | 8 | var mActivities = arrayListOf() 9 | 10 | fun addActivity(activity: Activity) { 11 | if (!mActivities.contains(activity)) { 12 | mActivities.add(activity) 13 | } 14 | } 15 | 16 | fun removeActivity(activity: Activity) { 17 | if (mActivities.contains(activity)) { 18 | mActivities.remove(activity) 19 | } 20 | } 21 | 22 | fun getStackTopAct(): Activity { 23 | if (mActivities.isEmpty()) { 24 | throw IllegalArgumentException("can't get Activity ") 25 | } 26 | return mActivities[mActivities.size - 1] 27 | } 28 | 29 | fun finishAllActivity() { 30 | mActivities.forEach { 31 | if (!it.isFinishing) { 32 | it.finish() 33 | } 34 | } 35 | } 36 | 37 | 38 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/utils/DensityUtil.kt: -------------------------------------------------------------------------------- 1 | package com.win.lib_base.utils 2 | 3 | import android.content.res.Configuration 4 | import android.content.res.Resources 5 | import android.util.DisplayMetrics 6 | 7 | /** 8 | * Created by liwen on 2015/10/10. 9 | */ 10 | object DensityUtil { 11 | 12 | /** 13 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素) 14 | */ 15 | @JvmStatic 16 | fun dip2px(dpValue: Float): Int { 17 | val scale = Resources.getSystem().displayMetrics.density 18 | return (dpValue * scale + 0.5f).toInt() 19 | } 20 | 21 | /** 22 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp 23 | */ 24 | @JvmStatic 25 | fun px2dip(pxValue: Float): Int { 26 | val scale = Resources.getSystem().displayMetrics.density 27 | return (pxValue / scale + 0.5f).toInt() 28 | } 29 | 30 | 31 | /** 32 | * 横竖屏判断 33 | * 34 | * @return 35 | */ 36 | @JvmStatic 37 | fun isLandscape(): Boolean { 38 | 39 | if (Resources.getSystem().configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { 40 | return true 41 | } else if (Resources.getSystem().configuration.orientation == Configuration.ORIENTATION_PORTRAIT) { 42 | return false 43 | } 44 | return false 45 | } 46 | 47 | @JvmStatic 48 | fun getScreenWidth(): Int { 49 | return Resources.getSystem().displayMetrics.widthPixels 50 | } 51 | 52 | @JvmStatic 53 | fun getScreenHeight(): Int { 54 | return Resources.getSystem().displayMetrics.heightPixels 55 | } 56 | 57 | @JvmStatic 58 | private fun getDisplayMetrics(): DisplayMetrics { 59 | return Resources.getSystem().displayMetrics 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/utils/KeyBoardUtils.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.utils 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import android.view.inputmethod.InputMethodManager 6 | 7 | 8 | object KeyBoardUtils { 9 | fun showKeyboard(view: View) { 10 | val imm = view.context 11 | .getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager 12 | view.requestFocus() 13 | imm.showSoftInput(view, 0) 14 | } 15 | 16 | fun hideKeyboard(view: View) { 17 | val imm = view.context 18 | .getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager 19 | imm.hideSoftInputFromWindow(view.windowToken, 0) 20 | } 21 | 22 | fun toggleSoftInput(view: View) { 23 | val imm = view.context 24 | .getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager 25 | imm.toggleSoftInput(0, 0) 26 | } 27 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/utils/LiveDataBus.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.utils 2 | 3 | import androidx.lifecycle.MutableLiveData 4 | 5 | object LiveDataBus { 6 | 7 | private val mMapAll = HashMap() 8 | fun with(key: String): MutableLiveData { 9 | if (!mMapAll.containsKey(key)) { 10 | mMapAll[key] = MutableLiveData() 11 | } 12 | return (mMapAll[key] as MutableLiveData) 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/view/CustomBlackToastStyle.java: -------------------------------------------------------------------------------- 1 | package com.bbq.base.view; 2 | 3 | import android.content.Context; 4 | import android.view.Gravity; 5 | 6 | import com.hjq.toast.style.BlackToastStyle; 7 | import com.win.lib_base.utils.DensityUtil; 8 | 9 | /** 10 | * 自定义的黑色的toast样式 11 | */ 12 | public class CustomBlackToastStyle extends BlackToastStyle { 13 | @Override 14 | public int getYOffset() { 15 | return DensityUtil.dip2px(100); 16 | } 17 | 18 | @Override 19 | public int getGravity() { 20 | return Gravity.BOTTOM; 21 | } 22 | 23 | @Override 24 | protected int getHorizontalPadding(Context context) { 25 | return DensityUtil.dip2px(17); 26 | } 27 | 28 | @Override 29 | protected int getVerticalPadding(Context context) { 30 | return DensityUtil.dip2px(6); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/view/FabViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.view 2 | 3 | import android.graphics.drawable.Drawable 4 | import androidx.databinding.ObservableField 5 | import com.bbq.base.R 6 | import com.bbq.base.utils.getDrawable 7 | import com.bbq.base.utils.getResColor 8 | import com.bbq.base.utils.getResDimen 9 | 10 | class FabViewModel( 11 | var size: Int = R.dimen.dp_50.getResDimen().toInt(), 12 | var drawable: Drawable? = R.drawable.up_arrow_white.getDrawable(), 13 | var onClick: (() -> Unit)? = null, 14 | var background: Int = R.color.colorAccent.getResColor() 15 | ) { 16 | val mDrawable = ObservableField(drawable) 17 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/view/LoadingDialog.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.view 2 | 3 | import android.app.Activity 4 | import android.app.Dialog 5 | import android.content.Context 6 | import android.view.animation.Animation 7 | import android.view.animation.RotateAnimation 8 | import android.widget.ImageView 9 | import com.bbq.base.R 10 | 11 | class LoadingDialog(context: Context) : Dialog( 12 | context, 13 | R.style.LoadingDialog 14 | ) { 15 | 16 | private var loadingDialog: LoadingDialog? = null 17 | 18 | init { 19 | setContentView(R.layout.layout_loading_view) 20 | val imageView: ImageView = findViewById(R.id.iv_image) 21 | val animation: Animation = RotateAnimation( 22 | 0f, 23 | 360f, 24 | Animation.RELATIVE_TO_SELF, 25 | 0.5f, 26 | Animation.RELATIVE_TO_SELF, 27 | 0.5f 28 | ) 29 | animation.duration = 2000 30 | animation.repeatCount = 10 31 | animation.fillAfter = true 32 | imageView.startAnimation(animation) 33 | } 34 | 35 | fun showDialog(context: Context) { 36 | if (context is Activity) { 37 | if (context.isFinishing) { 38 | return 39 | } 40 | } 41 | 42 | if (loadingDialog == null) { 43 | loadingDialog = LoadingDialog(context) 44 | } 45 | loadingDialog?.show() 46 | } 47 | 48 | fun dismissDialog() { 49 | loadingDialog?.dismiss() 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /base/src/main/java/com/bbq/base/view/TitleViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.base.view 2 | 3 | import android.graphics.drawable.Drawable 4 | import androidx.databinding.ObservableField 5 | import com.bbq.base.R 6 | import com.bbq.base.utils.getDrawable 7 | import com.bbq.base.utils.getResColor 8 | 9 | /** 10 | * Created by jhb on 2020-01-15. 11 | */ 12 | class TitleViewModel( 13 | var leftText: String? = "", 14 | var leftDrawable: Drawable? = R.drawable.abc_vector_test.getDrawable(), 15 | var leftAction: (() -> Unit)? = null, 16 | var title: String = "", 17 | var rightText: String = "", 18 | var rightDrawable: Drawable? = null, 19 | var rightAction: (() -> Unit)? = null, 20 | var background: Int = R.color.theme.getResColor() 21 | ) { 22 | val mTitle = ObservableField(title) 23 | val mRightDrawable = ObservableField(rightDrawable) 24 | } -------------------------------------------------------------------------------- /base/src/main/res/drawable-xxhdpi/up_arrow_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/base/src/main/res/drawable-xxhdpi/up_arrow_white.png -------------------------------------------------------------------------------- /base/src/main/res/drawable/ic_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/base/src/main/res/drawable/ic_loading.png -------------------------------------------------------------------------------- /base/src/main/res/drawable/ic_network_error.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /base/src/main/res/drawable/ic_result_nodata.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /base/src/main/res/drawable/shape_load_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 16 | 17 | -------------------------------------------------------------------------------- /base/src/main/res/layout/base_common_refresh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 12 | 13 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /base/src/main/res/layout/base_layout_empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /base/src/main/res/layout/base_layout_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /base/src/main/res/layout/base_layout_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /base/src/main/res/layout/empty_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 18 | -------------------------------------------------------------------------------- /base/src/main/res/layout/error_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 18 | -------------------------------------------------------------------------------- /base/src/main/res/layout/layout_loading_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 24 | 25 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /base/src/main/res/layout/view_model_fab.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 19 | 20 | -------------------------------------------------------------------------------- /base/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /base/src/main/res/values/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 暂无数据 4 | 暂无数据,点击重试~ 5 | 网络错误 6 | 网络错误,点击重试 7 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext.kotlin_version = "1.5.0" 4 | repositories { 5 | google() 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath "com.android.tools.build:gradle:4.1.1" 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | mavenCentral() 19 | maven { url 'https://jitpack.io' } 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | repositories{ 5 | jcenter() 6 | } -------------------------------------------------------------------------------- /buildSrc/build/classes/kotlin/main/META-INF/buildSrc.kotlin_module: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /buildSrc/build/classes/kotlin/main/com/sss/plugin/AndroidX.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/classes/kotlin/main/com/sss/plugin/AndroidX.class -------------------------------------------------------------------------------- /buildSrc/build/classes/kotlin/main/com/sss/plugin/AndroidXVersion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/classes/kotlin/main/com/sss/plugin/AndroidXVersion.class -------------------------------------------------------------------------------- /buildSrc/build/classes/kotlin/main/com/sss/plugin/BuildVersion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/classes/kotlin/main/com/sss/plugin/BuildVersion.class -------------------------------------------------------------------------------- /buildSrc/build/classes/kotlin/main/com/sss/plugin/Deps.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/classes/kotlin/main/com/sss/plugin/Deps.class -------------------------------------------------------------------------------- /buildSrc/build/classes/kotlin/main/com/sss/plugin/Kotlin.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/classes/kotlin/main/com/sss/plugin/Kotlin.class -------------------------------------------------------------------------------- /buildSrc/build/classes/kotlin/main/com/sss/plugin/KotlinVersion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/classes/kotlin/main/com/sss/plugin/KotlinVersion.class -------------------------------------------------------------------------------- /buildSrc/build/kotlin/buildSrcjar-classes.txt: -------------------------------------------------------------------------------- 1 | /Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/kotlin/main/com/sss/plugin/AndroidX.class:/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/kotlin/main/com/sss/plugin/AndroidXVersion.class:/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/kotlin/main/com/sss/plugin/BuildVersion.class:/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/kotlin/main/com/sss/plugin/Deps.class:/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/kotlin/main/com/sss/plugin/Kotlin.class:/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/kotlin/main/com/sss/plugin/KotlinVersion.class -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/build-history.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/build-history.bin -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at: -------------------------------------------------------------------------------- 1 | /Header Record For PersistentHashMapValueStorageba/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/AndroidX.ktba/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/AndroidX.ktfe/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/BuildVersion.kt^]/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/Deps.kt`_/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/Kotlin.kt`_/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/Kotlin.kt -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at: -------------------------------------------------------------------------------- 1 | /Header Record For PersistentHashMapValueStorageba/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/AndroidX.ktba/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/AndroidX.ktfe/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/BuildVersion.kt^]/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/Deps.kt`_/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/Kotlin.kt`_/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/Kotlin.kt -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at: -------------------------------------------------------------------------------- 1 | /Header Record For PersistentHashMapValueStorageFcom/sss/plugin/AndroidXVersioncom/sss/plugin/AndroidX.kotlin_module+com/sss/plugin/BuildVersion.kotlin_module#com/sss/plugin/Deps.kotlin_moduleBcom/sss/plugin/KotlinVersioncom/sss/plugin/Kotlin.kotlin_module -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab: -------------------------------------------------------------------------------- 1 | 4 2 | 0 -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at: -------------------------------------------------------------------------------- 1 | /Header Record For PersistentHashMapValueStorage -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at: -------------------------------------------------------------------------------- 1 | /Header Record For PersistentHashMapValueStorageba/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/AndroidX.ktfe/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/BuildVersion.kt^]/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/Deps.kt`_/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/src/main/java/com.sss.plugin/Kotlin.kt -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at: -------------------------------------------------------------------------------- 1 | /Header Record For PersistentHashMapValueStorage -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len -------------------------------------------------------------------------------- /buildSrc/build/kotlin/compileKotlin/last-build.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/kotlin/compileKotlin/last-build.bin -------------------------------------------------------------------------------- /buildSrc/build/libs/buildSrc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/libs/buildSrc.jar -------------------------------------------------------------------------------- /buildSrc/build/pluginUnderTestMetadata/plugin-under-test-metadata.properties: -------------------------------------------------------------------------------- 1 | implementation-classpath=/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/java/main\:/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/groovy/main\:/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/classes/kotlin/main\:/Users/gexuelei/Projects/Source/WanAndroidkotin/buildSrc/build/resources/main 2 | -------------------------------------------------------------------------------- /buildSrc/build/reports/plugin-development/validation-report.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/buildSrc/build/reports/plugin-development/validation-report.txt -------------------------------------------------------------------------------- /buildSrc/build/source-roots/buildSrc/source-roots.txt: -------------------------------------------------------------------------------- 1 | src/main/resources 2 | src/main/java 3 | src/main/groovy 4 | src/main/kotlin 5 | src/test/resources 6 | src/test/java 7 | src/test/groovy 8 | src/test/kotlin 9 | -------------------------------------------------------------------------------- /buildSrc/build/tmp/jar/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | 3 | -------------------------------------------------------------------------------- /buildSrc/src/main/java/com.sss.plugin/BuildVersion.kt: -------------------------------------------------------------------------------- 1 | package com.sss.plugin 2 | 3 | 4 | object BuildVersion { 5 | val applicationId = "com.bbq.wanandroid" 6 | val compileSdkVersion = 30 7 | val buildToolsVersion = "30.0.3" 8 | val minSdkVersion = 21 9 | val targetSdkVersion = 30 10 | val versionCode = 1 11 | val versionName = "1.0" 12 | } -------------------------------------------------------------------------------- /buildSrc/src/main/java/com.sss.plugin/Kotlin.kt: -------------------------------------------------------------------------------- 1 | package com.sss.plugin 2 | 3 | private object KotlinVersion { 4 | val kotlin_version = "1.5.0" 5 | val koin_version = "2.2.0-rc-3" 6 | } 7 | 8 | /** 9 | * kotlin 相关依赖 10 | */ 11 | object Kotlin { 12 | val kotlin_stdlib = "org.jetbrains.kotlin:kotlin-stdlib:${KotlinVersion.kotlin_version}" 13 | val kotlin_stdlib_jdk7 = 14 | "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${KotlinVersion.kotlin_version}" 15 | val kotlin_stdlib_jdk8 = 16 | "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${KotlinVersion.kotlin_version}" 17 | 18 | //协程 19 | val kotlinx_coroutines_android = 20 | "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9" 21 | 22 | // Koin for Kotlin 23 | val koin_core = "org.koin:koin-core:${KotlinVersion.koin_version}" 24 | val koin_core_ext = "org.koin:koin-core-ext:${KotlinVersion.koin_version}" 25 | 26 | // Koin for AndroidX 27 | val koin_androidx_scope = "org.koin:koin-androidx-scope:${KotlinVersion.koin_version}" 28 | val koin_androidx_viewmodel = "org.koin:koin-androidx-viewmodel:${KotlinVersion.koin_version}" 29 | val koin_androidx_fragment = "org.koin:koin-androidx-fragment:${KotlinVersion.koin_version}" 30 | val koin_androidx_ext = "org.koin:koin-androidx-ext:${KotlinVersion.koin_version}" 31 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | #开启gradle缓存 3 | org.gradle.caching=true 4 | android.enableBuildCache=true 5 | 6 | 7 | #开启kotlin的增量和并行编译 8 | kotlin.incremental=true 9 | kotlin.incremental.java=true 10 | kotlin.incremental.js=true 11 | kotlin.caching.enabled=true 12 | kotlin.parallel.tasks.in.project=true 13 | 14 | #调大 jvmargs 15 | org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 16 | org.gradle.configureondemand=true 17 | org.gradle.parallel=true 18 | 19 | #优化kapt 20 | kapt.use.worker.api=true //并行运行 21 | kapt.incremental.apt=true //增量编译 22 | kapt.include.compile.classpath=false 23 | 24 | 25 | android.useAndroidX=true 26 | android.enableJetifier=true 27 | BUILD_TYPE=debug 28 | org.gradle.daemon=true 29 | #android.useDeprecatedNdk=true 30 | android.enableD8=true 31 | 32 | isBuildModule=false 33 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 25 20:28:33 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /home/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /home/build.gradle: -------------------------------------------------------------------------------- 1 | import com.sss.plugin.AndroidX 2 | import com.sss.plugin.BuildVersion 3 | import com.sss.plugin.Deps 4 | 5 | plugins { 6 | id 'com.android.library' 7 | id 'kotlin-android' 8 | id 'kotlin-kapt' 9 | } 10 | kapt { 11 | arguments { 12 | arg("AROUTER_MODULE_NAME", project.getName()) 13 | } 14 | } 15 | 16 | android { 17 | compileSdkVersion BuildVersion.compileSdkVersion 18 | buildToolsVersion BuildVersion.buildToolsVersion 19 | 20 | defaultConfig { 21 | minSdkVersion BuildVersion.minSdkVersion 22 | targetSdkVersion BuildVersion.targetSdkVersion 23 | versionCode 1 24 | versionName "1.0" 25 | 26 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 27 | consumerProguardFiles "consumer-rules.pro" 28 | } 29 | 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 34 | } 35 | } 36 | compileOptions { 37 | sourceCompatibility JavaVersion.VERSION_1_8 38 | targetCompatibility JavaVersion.VERSION_1_8 39 | } 40 | kotlinOptions { 41 | jvmTarget = '1.8' 42 | } 43 | buildFeatures { 44 | dataBinding = true 45 | } 46 | } 47 | 48 | dependencies { 49 | implementation project(":base") 50 | implementation Deps.banner 51 | implementation Deps.flexbox 52 | kapt AndroidX.room_compiler 53 | kapt Deps.aroute_processor 54 | 55 | 56 | } -------------------------------------------------------------------------------- /home/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/consumer-rules.pro -------------------------------------------------------------------------------- /home/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /home/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/adapter/BannerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.adapter 2 | 3 | import com.bbq.home.bean.BannerBean 4 | import com.bumptech.glide.Glide 5 | import com.bumptech.glide.load.resource.bitmap.RoundedCorners 6 | import com.bumptech.glide.request.RequestOptions 7 | import com.youth.banner.adapter.BannerImageAdapter 8 | import com.youth.banner.holder.BannerImageHolder 9 | 10 | /** 11 | * @author jhb 12 | * @date 2020/10/28 13 | */ 14 | class BannerAdapter(mData: MutableList?) : BannerImageAdapter(mData) { 15 | override fun onBindView(holder: BannerImageHolder, data: BannerBean?, position: Int, size: Int) { 16 | //图片加载自己实现 17 | Glide.with(holder.itemView) 18 | .load(data?.imagePath) 19 | .apply(RequestOptions.bitmapTransform(RoundedCorners(30))) 20 | .into(holder.imageView); 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/adapter/HistoryAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.adapter 2 | 3 | import com.bbq.home.R 4 | import com.bbq.home.databinding.ItemHistorySearchBinding 5 | import com.chad.library.adapter.base.BaseQuickAdapter 6 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 7 | 8 | class HistoryAdapter(list: MutableList?) : 9 | BaseQuickAdapter>( 10 | R.layout.item_history_search, 11 | list 12 | ) { 13 | override fun convert(holder: BaseDataBindingHolder, item: String) { 14 | holder.dataBinding?.title?.text = item 15 | addChildClickViewIds(R.id.delete) 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/adapter/HomeArticleAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.adapter 2 | 3 | import com.bbq.home.R 4 | import com.bbq.home.bean.ArticleBean 5 | import com.bbq.home.databinding.ItemHomeBinding 6 | import com.bbq.home.databinding.ItemHomeSearchBinding 7 | import com.bbq.home.viewmodel.ItemHomeArticle 8 | import com.chad.library.adapter.base.BaseQuickAdapter 9 | import com.chad.library.adapter.base.module.LoadMoreModule 10 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 11 | 12 | class HomeArticleAdapter(list: MutableList?) : 13 | BaseQuickAdapter>( 14 | R.layout.item_home_search, list 15 | ), LoadMoreModule { 16 | override fun convert(holder: BaseDataBindingHolder, item: ArticleBean) { 17 | val binding = holder.dataBinding 18 | val article = ItemHomeArticle(item) 19 | article.bindData() 20 | binding?.item = article 21 | addChildClickViewIds(R.id.tvCollect) 22 | } 23 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/adapter/HotKeyAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.adapter 2 | 3 | import com.bbq.home.R 4 | import com.bbq.home.bean.HotKeyBean 5 | import com.chad.library.adapter.base.BaseQuickAdapter 6 | import com.chad.library.adapter.base.viewholder.BaseViewHolder 7 | 8 | class HotKeyAdapter(list: MutableList?) : 9 | BaseQuickAdapter(R.layout.item_hot_key, list) { 10 | override fun convert(holder: BaseViewHolder, item: HotKeyBean) { 11 | holder.setText(R.id.hot_key, item.name) 12 | } 13 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/api/HomeApi.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.api 2 | 3 | import com.bbq.home.bean.ArticleBean 4 | import com.bbq.home.bean.BannerBean 5 | import com.bbq.home.bean.HotKeyBean 6 | import com.bbq.net.model.BasePagingResult 7 | import com.bbq.net.model.BaseResult 8 | import retrofit2.http.GET 9 | import retrofit2.http.POST 10 | import retrofit2.http.Path 11 | import retrofit2.http.Query 12 | 13 | interface HomeApi { 14 | @GET("/hotkey/json") 15 | suspend fun getHotKey(): BaseResult> 16 | 17 | @GET("/banner/json") 18 | suspend fun getBanner(): BaseResult> 19 | 20 | //文章 21 | @GET("/article/list/{count}/json") 22 | suspend fun getHomeList(@Path("count") count: Int): BaseResult>> 23 | 24 | 25 | //置顶文章 26 | @GET("/article/top/json") 27 | suspend fun articleTop(): BaseResult> 28 | 29 | 30 | @POST("/article/query/{page}/json") 31 | suspend fun search( 32 | @Path("page") page: Int, 33 | @Query("k") key: String 34 | ): BaseResult>> 35 | 36 | 37 | //收藏站内文章 文章id,拼接在链接中。 38 | @POST("/lg/collect/{id}/json") 39 | suspend fun collect(@Path("id") id: Int?): BaseResult 40 | 41 | //取消收藏 文章列表 文章id,拼接在链接中。 42 | @POST("lg/uncollect_originId/{id}/json") 43 | suspend fun unCollect(@Path("id") id: Int?): BaseResult 44 | 45 | //获取问答列表 46 | @GET("wenda/list/{page}/json ") 47 | suspend fun wendaList(@Path("page") page: Int): BaseResult>> 48 | 49 | 50 | //自己收藏文章列表 51 | @GET("lg/collect/list/{page}/json") 52 | suspend fun lgCollectList(@Path("page") page: Int): BaseResult>> 53 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/bean/ArticleBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.bean 2 | 3 | import androidx.room.Entity 4 | import androidx.room.PrimaryKey 5 | import androidx.room.TypeConverters 6 | import com.bbq.home.db.TagTypeConverter 7 | 8 | @Entity(tableName = "tab_article") 9 | @TypeConverters(TagTypeConverter::class) 10 | data class ArticleBean( 11 | var page: Int, 12 | var articleType: Int, 13 | val apkLink: String, 14 | val audit: Int, 15 | val author: String, 16 | val canEdit: Boolean, 17 | val chapterId: Int, 18 | val chapterName: String, 19 | var collect: Boolean, 20 | val courseId: Int, 21 | val desc: String, 22 | val descMd: String, 23 | val envelopePic: String, 24 | val fresh: Boolean, 25 | val host: String, 26 | @PrimaryKey 27 | val id: Int, 28 | val link: String?, 29 | val niceDate: String, 30 | val niceShareDate: String, 31 | val origin: String, 32 | val prefix: String, 33 | val projectLink: String, 34 | val publishTime: Long, 35 | val realSuperChapterId: Int, 36 | val selfVisible: Int, 37 | val shareDate: Long, 38 | val shareUser: String?, 39 | val superChapterId: Int?, 40 | val superChapterName: String?, 41 | var tags: MutableList?, 42 | val title: String, 43 | val type: Int?, 44 | val userId: Int?, 45 | val visible: Int?, 46 | val zan: Int? 47 | ) 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/bean/ArticleTag.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.bean 2 | 3 | data class ArticleTag( 4 | val name: String?, 5 | val url: String? = null 6 | ) -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/bean/BannerBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.bean 2 | 3 | data class BannerBean(var desc: String, var imagePath: String, var title: String, var url: String) 4 | -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/bean/HotKeyBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.bean 2 | 3 | 4 | data class HotKeyBean( 5 | val id: String = "", 6 | val link: String = "", 7 | val name: String = "", 8 | val order: String = "", 9 | val visible: String = "" 10 | ) -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/db/ArticleDao.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.db 2 | 3 | import androidx.room.Dao 4 | import androidx.room.Insert 5 | import androidx.room.OnConflictStrategy 6 | import androidx.room.Query 7 | import com.bbq.home.bean.ArticleBean 8 | 9 | @Dao 10 | interface ArticleDao { 11 | @Insert(onConflict = OnConflictStrategy.REPLACE) 12 | suspend fun insertArticle(articleDataList: List) 13 | 14 | @Query("SELECT * FROM tab_article where page=:page") 15 | fun queryLocalArticle(page: Int): List 16 | 17 | @Query("DELETE FROM tab_article where page=:page") 18 | suspend fun clearArticleByPage(page: Int) 19 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/db/HomeDatabase.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.db 2 | 3 | import android.content.Context 4 | import androidx.room.Database 5 | import androidx.room.Room 6 | import androidx.room.RoomDatabase 7 | import com.bbq.home.bean.ArticleBean 8 | 9 | @Database( 10 | entities = [ArticleBean::class], 11 | version = 3, 12 | exportSchema = false 13 | ) 14 | abstract class HomeDatabase : RoomDatabase() { 15 | 16 | abstract fun articleDao(): ArticleDao 17 | 18 | companion object { 19 | private const val DB_NAME = "app.db" 20 | 21 | @Volatile 22 | private var instance: HomeDatabase? = null 23 | 24 | fun get(context: Context): HomeDatabase { 25 | return instance ?: Room.databaseBuilder( 26 | context, HomeDatabase::class.java, 27 | DB_NAME 28 | ) 29 | .allowMainThreadQueries() 30 | .fallbackToDestructiveMigration() 31 | .build() 32 | .also { 33 | instance = it 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/db/TagTypeConverter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.db 2 | 3 | import androidx.room.TypeConverter 4 | import com.bbq.home.bean.ArticleTag 5 | import com.google.gson.Gson 6 | import com.google.gson.reflect.TypeToken 7 | 8 | /** 9 | * @date:2021/5/20 10 | * @author fuusy 11 | * @instruction: List的类型转换 12 | */ 13 | class TagTypeConverter { 14 | @TypeConverter 15 | fun stringToObject(value: String): List { 16 | val listType = object : TypeToken>() { 17 | }.type 18 | return Gson().fromJson(value, listType) 19 | } 20 | 21 | @TypeConverter 22 | fun objectToString(list: List): String { 23 | return Gson().toJson(list) 24 | } 25 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/di/LibHome.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.di 2 | 3 | import com.bbq.home.api.HomeApi 4 | import com.bbq.home.db.HomeDatabase 5 | import com.bbq.home.repo.HomeRepo 6 | import com.bbq.home.viewmodel.FaqVM 7 | import com.bbq.home.viewmodel.HomeViewModel 8 | import com.bbq.home.viewmodel.SearchActivityVM 9 | import com.bbq.net.net.RetrofitManager 10 | import org.koin.android.ext.koin.androidApplication 11 | import org.koin.androidx.viewmodel.dsl.viewModel 12 | import org.koin.dsl.module 13 | 14 | val homeModels = module { 15 | single { 16 | RetrofitManager.instance.create(HomeApi::class.java) 17 | } 18 | single { 19 | HomeDatabase.get(androidApplication()) 20 | } 21 | 22 | single { 23 | HomeRepo(get()) 24 | } 25 | 26 | viewModel { 27 | HomeViewModel(androidApplication(), get(), get()) 28 | } 29 | viewModel { 30 | SearchActivityVM(androidApplication(), get()) 31 | } 32 | viewModel { 33 | FaqVM(androidApplication(), get()) 34 | } 35 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/route/CollectionServiceImpl.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.route 2 | 3 | import android.content.Context 4 | import com.alibaba.android.arouter.facade.annotation.Route 5 | import com.bbq.base.route.CollectionService 6 | import com.bbq.home.ui.CollectionActivity 7 | 8 | @Route(path = "/home/collect") 9 | class CollectionServiceImpl : CollectionService { 10 | override fun launch(context: Context) { 11 | CollectionActivity.launch(context) 12 | } 13 | 14 | override fun init(context: Context?) { 15 | } 16 | } -------------------------------------------------------------------------------- /home/src/main/java/com/bbq/home/viewmodel/TagViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.home.viewmodel 2 | 3 | import androidx.databinding.ObservableField 4 | import com.bbq.base.utils.getRandomColor 5 | import com.bbq.base.utils.getResColor 6 | import com.bbq.base.utils.getResDimen 7 | import com.bbq.base.utils.getResDrawable 8 | import com.bbq.home.R 9 | 10 | /** 11 | * @author jhb 12 | * @date 2020/10/23 13 | */ 14 | class TagViewModel { 15 | var mBgColor = ObservableField(getRandomColor()) 16 | var mContent = ObservableField("") 17 | var mTextColor = ObservableField(R.color.colorRed.getResColor()) 18 | var mTextSize = ObservableField(R.dimen.sp_12.getResDimen()) 19 | var mDrawable = ObservableField(R.drawable.rect_red_shape.getResDrawable()) 20 | } -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/collect_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/collect_gray.png -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/collect_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/collect_red.png -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/ic_add.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/ic_add.webp -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/ic_back.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/ic_back.webp -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/ic_clear_normal.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/ic_clear_normal.webp -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/ic_clear_pressed.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/ic_clear_pressed.webp -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/ic_delete.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/ic_delete.webp -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/ic_search.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/ic_search.webp -------------------------------------------------------------------------------- /home/src/main/res/drawable-xxhdpi/shanchu_ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/home/src/main/res/drawable-xxhdpi/shanchu_ico.png -------------------------------------------------------------------------------- /home/src/main/res/drawable/layer_while_item_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /home/src/main/res/drawable/rect_red_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /home/src/main/res/drawable/selector_corners_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /home/src/main/res/drawable/selector_edit_text_delete.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /home/src/main/res/drawable/shape_corners_solid_ccc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /home/src/main/res/drawable/shape_corners_solid_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /home/src/main/res/drawable/shape_top_search_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /home/src/main/res/layout/fbl_hot_key.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | -------------------------------------------------------------------------------- /home/src/main/res/layout/item_head_banner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /home/src/main/res/layout/item_history_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 20 | 21 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /home/src/main/res/layout/item_hot_key.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /home/src/main/res/layout/view_model_tag.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 20 | 21 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /home/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #00000000 4 | 5 | @color/theme 6 | #333 7 | #666 8 | #999 9 | #ccc 10 | @color/white 11 | #f0f0f0 12 | #F6F6F6 13 | 14 | -------------------------------------------------------------------------------- /home/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /login/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /login/build.gradle: -------------------------------------------------------------------------------- 1 | import com.sss.plugin.BuildVersion 2 | import com.sss.plugin.Deps 3 | 4 | plugins { 5 | id 'com.android.library' 6 | id 'kotlin-android' 7 | id 'kotlin-kapt' 8 | } 9 | kapt { 10 | arguments { 11 | arg("AROUTER_MODULE_NAME", project.getName()) 12 | } 13 | } 14 | android { 15 | compileSdkVersion BuildVersion.compileSdkVersion 16 | buildToolsVersion BuildVersion.buildToolsVersion 17 | 18 | defaultConfig { 19 | minSdkVersion BuildVersion.minSdkVersion 20 | targetSdkVersion BuildVersion.targetSdkVersion 21 | versionCode 1 22 | versionName "1.0" 23 | 24 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 25 | consumerProguardFiles "consumer-rules.pro" 26 | } 27 | 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | compileOptions { 35 | sourceCompatibility JavaVersion.VERSION_1_8 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | } 38 | kotlinOptions { 39 | jvmTarget = '1.8' 40 | } 41 | buildFeatures { 42 | dataBinding = true 43 | } 44 | } 45 | 46 | dependencies { 47 | implementation project(":base") 48 | kapt Deps.aroute_processor 49 | kapt Deps.glideCompiler 50 | 51 | } -------------------------------------------------------------------------------- /login/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/login/consumer-rules.pro -------------------------------------------------------------------------------- /login/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 -------------------------------------------------------------------------------- /login/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /login/src/main/java/com/bbq/login/api/LoginApi.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.login.api 2 | 3 | import com.bbq.base.bean.User 4 | import com.bbq.net.model.BaseResult 5 | import retrofit2.http.Field 6 | import retrofit2.http.FormUrlEncoded 7 | import retrofit2.http.POST 8 | 9 | interface LoginApi { 10 | @FormUrlEncoded 11 | @POST("/user/login") 12 | suspend fun login( 13 | @Field("username") username: String, 14 | @Field("password") password: String 15 | ): BaseResult 16 | 17 | @FormUrlEncoded 18 | @POST("/user/register") 19 | suspend fun register( 20 | @Field("username") username: String, 21 | @Field("password") password: String, 22 | @Field("repassword") repassword: String 23 | ): BaseResult 24 | } -------------------------------------------------------------------------------- /login/src/main/java/com/bbq/login/di/LoginModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.login.di 2 | 3 | import com.bbq.login.api.LoginApi 4 | import com.bbq.login.repo.LoginRepository 5 | import com.bbq.net.net.RetrofitManager 6 | import com.bbq.login.viewmodel.LoginViewModel 7 | import org.koin.android.ext.koin.androidApplication 8 | import org.koin.androidx.viewmodel.dsl.viewModel 9 | import org.koin.dsl.module 10 | 11 | 12 | val loginModel = module { 13 | single { 14 | RetrofitManager.instance.create(LoginApi::class.java) 15 | } 16 | single { 17 | LoginRepository(get()) 18 | } 19 | 20 | viewModel { 21 | LoginViewModel(androidApplication(), get()) 22 | } 23 | } -------------------------------------------------------------------------------- /login/src/main/java/com/bbq/login/model/LoginLayoutBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.login.model 2 | 3 | import androidx.databinding.BaseObservable 4 | import com.bbq.login.BR 5 | 6 | class LoginLayoutBean : BaseObservable() { 7 | 8 | var tips: String = "账号登录" 9 | get() { 10 | field = if (isLogin) { 11 | "账号登录" 12 | } else { 13 | "账号注册" 14 | } 15 | return field 16 | } 17 | 18 | var btnText: String = "登录" 19 | get() { 20 | field = if (isLogin) { 21 | "登录" 22 | } else { 23 | "注册" 24 | } 25 | return field 26 | } 27 | 28 | var featureName: String = "注册" 29 | get() { 30 | field = if (isLogin) { 31 | "注册" 32 | } else { 33 | "登录" 34 | } 35 | return field 36 | } 37 | 38 | 39 | var isLogin: Boolean = true 40 | set(value) { 41 | if (value == field) { 42 | return 43 | } 44 | field = value 45 | notifyPropertyChanged(BR._all) 46 | } 47 | } -------------------------------------------------------------------------------- /login/src/main/java/com/bbq/login/repo/LoginRepository.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.login.repo 2 | 3 | import com.bbq.base.rository.BaseRepository 4 | import com.bbq.base.rository.StateLiveData 5 | import com.bbq.login.api.LoginApi 6 | import com.bbq.base.bean.User 7 | 8 | class LoginRepository(private val service: LoginApi) : BaseRepository() { 9 | 10 | suspend fun login(username: String, password: String, result: StateLiveData) { 11 | executeRequest({ service.login(username, password) }, result) 12 | } 13 | 14 | suspend fun register( 15 | username: String, 16 | password: String, 17 | surePassword: String, 18 | result: StateLiveData 19 | ) { 20 | executeRequest({ service.register(username, password, surePassword) }, result) 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /login/src/main/java/com/bbq/login/route/LoginServiceImpl.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.login.route 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import androidx.lifecycle.LiveData 6 | import com.alibaba.android.arouter.facade.annotation.Route 7 | import com.bbq.base.bean.User 8 | import com.bbq.base.route.LoginService 9 | import com.bbq.login.ui.LoginActivity 10 | import com.bbq.login.utils.UserManager 11 | 12 | @Route(path = "/login/login") 13 | class LoginServiceImpl : LoginService { 14 | 15 | override fun isLogin(): Boolean { 16 | return UserManager.isLogin() 17 | } 18 | 19 | override fun getUserInfo(): User? { 20 | return UserManager.getUser() 21 | } 22 | 23 | override fun removeUserInfo() { 24 | UserManager.removeUser() 25 | } 26 | 27 | override fun start(context: Context) { 28 | val intent = Intent(context, LoginActivity::class.java) 29 | context.startActivity(intent) 30 | } 31 | 32 | override fun getLiveData(): LiveData { 33 | return UserManager.getLoginLiveData() 34 | } 35 | 36 | override fun init(context: Context?) { 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /login/src/main/java/com/bbq/login/utils/UserManager.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.login.utils 2 | 3 | import androidx.lifecycle.MutableLiveData 4 | import com.bbq.base.utils.SpUtils 5 | import com.bbq.base.bean.User 6 | 7 | object UserManager { 8 | 9 | private const val USER_DATA: String = "user_data" 10 | 11 | private val liveData = MutableLiveData() 12 | 13 | fun getLoginLiveData(): MutableLiveData { 14 | return liveData 15 | } 16 | 17 | fun getUser(): User? { 18 | return SpUtils.getParcelable(USER_DATA) 19 | } 20 | 21 | fun saveUser(user: User) { 22 | SpUtils.put(USER_DATA, user) 23 | if (liveData.hasObservers()) { 24 | liveData.postValue(user) 25 | } 26 | } 27 | 28 | fun isLogin(): Boolean { 29 | return getUser() != null 30 | } 31 | 32 | fun removeUser() { 33 | SpUtils.removeKey(USER_DATA) 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /login/src/main/java/com/bbq/login/viewmodel/LoginViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.login.viewmodel 2 | 3 | import android.app.Application 4 | import androidx.lifecycle.viewModelScope 5 | import com.bbq.base.base.BaseViewModel 6 | import com.bbq.base.rository.StateLiveData 7 | import com.bbq.base.bean.User 8 | import com.bbq.login.repo.LoginRepository 9 | import kotlinx.coroutines.launch 10 | 11 | /** 12 | * Create by liwen on 2020/5/27 13 | */ 14 | class LoginViewModel(application: Application, val loginRepo: LoginRepository) : 15 | BaseViewModel(application) { 16 | 17 | val mLoginUser = StateLiveData() 18 | fun login(username: String, password: String) { 19 | viewModelScope.launch { 20 | loginRepo.login(username, password, mLoginUser) 21 | } 22 | } 23 | 24 | val mRegisterUser = StateLiveData() 25 | fun register(username: String, password: String, surePassword: String) { 26 | viewModelScope.launch { 27 | loginRepo.register(username, password, surePassword, mRegisterUser) 28 | } 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /login/src/main/res/drawable/edittext_cursor_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /login/src/main/res/drawable/ic_login_close.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /login/src/main/res/drawable/login_btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /login/src/main/res/values/style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /navigation/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /navigation/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/navigation/consumer-rules.pro -------------------------------------------------------------------------------- /navigation/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 -------------------------------------------------------------------------------- /navigation/src/androidTest/java/com/bbq/navigation/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.bbq.navigation.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /navigation/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /navigation/src/main/alone/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/adapter/NavTabLeftAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.adapter 2 | 3 | import android.text.Html 4 | import com.bbq.base.utils.getResColor 5 | import com.bbq.navigation.R 6 | import com.bbq.navigation.bean.NavTabBean 7 | import com.bbq.navigation.databinding.NavItemNavLeftBinding 8 | import com.chad.library.adapter.base.BaseQuickAdapter 9 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 10 | 11 | class NavTabLeftAdapter(list: MutableList?) : 12 | BaseQuickAdapter>( 13 | R.layout.nav_item_nav_left, list 14 | ) { 15 | override fun convert(holder: BaseDataBindingHolder, item: NavTabBean) { 16 | holder.dataBinding?.tvLeftTxt?.text = Html.fromHtml(item.name) 17 | val bgColor = 18 | if (item.isSelected) R.color.white.getResColor() else R.color.colorWhiteDark.getResColor() 19 | holder.dataBinding?.tvLeftTxt?.setBackgroundColor(bgColor) 20 | } 21 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/adapter/NavTabRightAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.adapter 2 | 3 | import com.bbq.base.utils.getHtmlStr 4 | import com.bbq.base.utils.getRandomColor 5 | import com.bbq.navigation.R 6 | import com.bbq.navigation.bean.ArticleBean 7 | import com.bbq.navigation.databinding.NavItemNavRightBinding 8 | import com.chad.library.adapter.base.BaseQuickAdapter 9 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 10 | 11 | class NavTabRightAdapter(val list: MutableList?) : 12 | BaseQuickAdapter>( 13 | R.layout.nav_item_nav_right, 14 | list 15 | ) { 16 | override fun convert(holder: BaseDataBindingHolder, item: ArticleBean) { 17 | holder.dataBinding?.tvRightTxt?.text = item.title.getHtmlStr() 18 | holder.dataBinding?.cardView?.setBackgroundColor(getRandomColor()) 19 | } 20 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/adapter/ProjectArticleAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.adapter 2 | 3 | import com.bbq.navigation.R 4 | import com.bbq.navigation.bean.ArticleBean 5 | import com.bbq.navigation.databinding.NavItemProjectBinding 6 | import com.bbq.navigation.viewmodel.ItemProject 7 | import com.bumptech.glide.Glide 8 | import com.bumptech.glide.request.RequestOptions 9 | import com.chad.library.adapter.base.BaseQuickAdapter 10 | import com.chad.library.adapter.base.module.LoadMoreModule 11 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 12 | 13 | class ProjectArticleAdapter(list: MutableList?) : 14 | BaseQuickAdapter>( 15 | R.layout.nav_item_project, list 16 | ), LoadMoreModule { 17 | override fun convert( 18 | holder: BaseDataBindingHolder, 19 | item: ArticleBean 20 | ) { 21 | val binding = holder.dataBinding 22 | val article = ItemProject(item) 23 | binding?.item = article 24 | Glide.with(context) 25 | .applyDefaultRequestOptions( 26 | RequestOptions() 27 | .placeholder(R.drawable.nav_place_holder) 28 | .centerCrop()) 29 | .load(item.envelopePic).into(binding?.iv!!) 30 | addChildClickViewIds(R.id.tvCollect) 31 | } 32 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/adapter/ProjectRightArticleAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.adapter 2 | 3 | import com.bbq.navigation.R 4 | import com.bbq.navigation.bean.ArticleBean 5 | import com.bbq.navigation.databinding.NavItemProjectRightBinding 6 | import com.bbq.navigation.viewmodel.ItemProject 7 | import com.bumptech.glide.Glide 8 | import com.bumptech.glide.request.RequestOptions 9 | import com.chad.library.adapter.base.BaseQuickAdapter 10 | import com.chad.library.adapter.base.module.LoadMoreModule 11 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 12 | 13 | class ProjectRightArticleAdapter(list: MutableList?) : 14 | BaseQuickAdapter>( 15 | R.layout.nav_item_project_right, list 16 | ), LoadMoreModule { 17 | override fun convert( 18 | holder: BaseDataBindingHolder, 19 | item: ArticleBean 20 | ) { 21 | val binding = holder.dataBinding 22 | val article = ItemProject(item) 23 | binding?.item = article 24 | Glide.with(context) 25 | .applyDefaultRequestOptions( 26 | RequestOptions() 27 | .placeholder(R.drawable.nav_place_holder) 28 | .centerCrop() 29 | ) 30 | .load(item.envelopePic).into(binding?.iv!!) 31 | addChildClickViewIds(R.id.tvCollect) 32 | } 33 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/adapter/PublicTabLeftAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.adapter 2 | 3 | import com.bbq.base.utils.getResColor 4 | import com.bbq.navigation.R 5 | import com.bbq.navigation.bean.NavTabBean 6 | import com.bbq.navigation.bean.PublicBean 7 | import com.bbq.navigation.databinding.NavItemNavLeftBinding 8 | import com.chad.library.adapter.base.BaseQuickAdapter 9 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 10 | 11 | class PublicTabLeftAdapter(list: MutableList?) : 12 | BaseQuickAdapter>( 13 | R.layout.nav_item_nav_left, list 14 | ) { 15 | override fun convert(holder: BaseDataBindingHolder, item: PublicBean) { 16 | holder.dataBinding?.tvLeftTxt?.text = item.name 17 | val bgColor = 18 | if (item.isSelected) R.color.white.getResColor() else R.color.colorWhiteDark.getResColor() 19 | holder.dataBinding?.tvLeftTxt?.setBackgroundColor(bgColor) 20 | } 21 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/adapter/SystemArticleAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.adapter 2 | 3 | import com.bbq.navigation.R 4 | import com.bbq.navigation.bean.ArticleBean 5 | import com.bbq.navigation.databinding.NavItemSystemListBinding 6 | import com.bbq.navigation.viewmodel.ItemHomeArticle 7 | import com.chad.library.adapter.base.BaseQuickAdapter 8 | import com.chad.library.adapter.base.module.LoadMoreModule 9 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 10 | 11 | class SystemArticleAdapter(list: MutableList?) : 12 | BaseQuickAdapter>( 13 | R.layout.nav_item_system_list, list 14 | ), LoadMoreModule { 15 | override fun convert( 16 | holder: BaseDataBindingHolder, 17 | item: ArticleBean 18 | ) { 19 | val binding = holder.dataBinding 20 | val article = ItemHomeArticle(item) 21 | article.bindData() 22 | binding?.item = article 23 | addChildClickViewIds(R.id.tvCollect) 24 | } 25 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/adapter/TreeTabAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.adapter 2 | 3 | import android.view.LayoutInflater 4 | import android.widget.TextView 5 | import com.bbq.navigation.R 6 | import com.bbq.navigation.bean.TreeBean 7 | import com.bbq.navigation.databinding.NavItemTreeBinding 8 | import com.bbq.navigation.ui.SystemListActivity 9 | import com.chad.library.adapter.base.BaseQuickAdapter 10 | import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder 11 | 12 | class TreeTabAdapter(list: MutableList) : BaseQuickAdapter>( 14 | R.layout.nav_item_tree, list 15 | ) { 16 | override fun convert(holder: BaseDataBindingHolder, item: TreeBean) { 17 | holder.dataBinding?.name?.text = item.name 18 | holder.dataBinding?.fbl?.removeAllViews() 19 | 20 | item.children?.forEachIndexed { index, treeBean -> 21 | val inflater = LayoutInflater.from(context) 22 | val tv: TextView = 23 | inflater.inflate( 24 | R.layout.nav_fbl_system_children, 25 | holder.dataBinding?.fbl, 26 | false 27 | ) as TextView 28 | tv.text = treeBean.name 29 | tv.setOnClickListener { 30 | item.childrenSelectPosition = index 31 | SystemListActivity.launch(context, item) 32 | } 33 | holder.dataBinding?.fbl?.addView(tv) 34 | } 35 | holder.itemView.setOnClickListener { 36 | if (item.children.isNullOrEmpty()) return@setOnClickListener 37 | SystemListActivity.launch(context, item) 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/alone/AloneActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.alone 2 | 3 | import android.os.Bundle 4 | import com.bbq.base.base.BaseVMActivity 5 | import com.bbq.navigation.R 6 | import com.bbq.navigation.databinding.ActivityAloneBinding 7 | import com.bbq.navigation.ui.NavigationFragment 8 | 9 | class AloneActivity : BaseVMActivity() { 10 | override fun initView(savedInstanceState: Bundle?) { 11 | supportFragmentManager.beginTransaction().apply { 12 | add(R.id.fragment_layout, NavigationFragment()) 13 | commit() 14 | } 15 | } 16 | 17 | override fun getLayoutId(): Int { 18 | return R.layout.activity_alone 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/alone/AloneApp.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.alone 2 | 3 | import com.bbq.base.base.BaseApp 4 | 5 | class AloneApp:BaseApp() { 6 | 7 | override fun onCreate() { 8 | super.onCreate() 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/bean/ArticleBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.bean 2 | 3 | data class ArticleBean( 4 | val apkLink: String = "", 5 | val audit: String = "", 6 | val author: String = "", 7 | val canEdit: Boolean = false, 8 | val chapterId: String = "", 9 | val chapterName: String = "", 10 | var collect: Boolean = false, 11 | val courseId: String = "", 12 | val desc: String = "", 13 | val descMd: String = "", 14 | val envelopePic: String = "", 15 | var top: Boolean = false, 16 | val fresh: Boolean = false, 17 | val host: String = "", 18 | val id: Int, 19 | val link: String = "", 20 | val niceDate: String = "", 21 | val niceShareDate: String = "", 22 | val origin: String = "", 23 | val prefix: String = "", 24 | val projectLink: String = "", 25 | val publishTime: String = "", 26 | val realSuperChapterId: String = "", 27 | val selfVisible: String = "", 28 | val shareDate: String = "", 29 | val shareUser: String = "", 30 | val superChapterId: String = "", 31 | val superChapterName: String = "", 32 | var tags: List? = null, 33 | val title: String = "", 34 | val type: String = "", 35 | val userId: String = "", 36 | val visible: String = "", 37 | val zan: String = "", 38 | var isSelected: Boolean = false 39 | ) 40 | 41 | data class ArticleTag( 42 | val name: String = "", 43 | val url: String = "" 44 | ) -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/bean/NavTabBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.bean 2 | 3 | data class NavTabBean( 4 | val articles: List? = null, 5 | val cid: String = "", 6 | val name: String = "", 7 | var isSelected: Boolean = false 8 | ) -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/bean/PublicBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.bean 2 | 3 | data class PublicBean( 4 | val children: List? = null, 5 | val courseId: Int? = null, 6 | val id: Int, 7 | val name: String? = null, 8 | val order: Int? = null, 9 | val parentChapterId: Int? = null, 10 | val userControlSetTop: Boolean? = null, 11 | val visible: Int? = null, 12 | var isSelected: Boolean = false 13 | ) -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/bean/TreeBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.bean 2 | 3 | import android.os.Parcel 4 | import android.os.Parcelable 5 | 6 | class TreeBean( 7 | val children: List? = null, 8 | var childrenSelectPosition: Int = 0, 9 | val courseId: String? = "", 10 | val id: Int, 11 | val name: String? = "", 12 | val order: String? = "", 13 | val parentChapterId: String? = "", 14 | val userControlSetTop: String? = "", 15 | val visible: String? = "" 16 | ) : Parcelable { 17 | constructor(parcel: Parcel) : this( 18 | parcel.createTypedArrayList(CREATOR), 19 | parcel.readInt(), 20 | parcel.readString(), 21 | parcel.readInt(), 22 | parcel.readString(), 23 | parcel.readString(), 24 | parcel.readString(), 25 | parcel.readString(), 26 | parcel.readString() 27 | ) 28 | 29 | override fun writeToParcel(parcel: Parcel, flags: Int) { 30 | parcel.writeTypedList(children) 31 | parcel.writeInt(childrenSelectPosition) 32 | parcel.writeString(courseId) 33 | parcel.writeInt(id) 34 | parcel.writeString(name) 35 | parcel.writeString(order) 36 | parcel.writeString(parentChapterId) 37 | parcel.writeString(userControlSetTop) 38 | parcel.writeString(visible) 39 | } 40 | 41 | override fun describeContents(): Int { 42 | return 0 43 | } 44 | 45 | companion object CREATOR : Parcelable.Creator { 46 | override fun createFromParcel(parcel: Parcel): TreeBean { 47 | return TreeBean(parcel) 48 | } 49 | 50 | override fun newArray(size: Int): Array { 51 | return arrayOfNulls(size) 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/di/navModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.di 2 | 3 | import com.bbq.navigation.api.NavApi 4 | import com.bbq.navigation.repo.NavRepo 5 | import com.bbq.navigation.viewmodel.NavTabVM 6 | import com.bbq.navigation.viewmodel.SystemListVM 7 | import com.bbq.net.net.RetrofitManager 8 | import org.koin.android.ext.koin.androidApplication 9 | import org.koin.androidx.viewmodel.dsl.viewModel 10 | import org.koin.dsl.module 11 | 12 | 13 | val navModel = module { 14 | single { 15 | RetrofitManager.instance.create(NavApi::class.java) 16 | } 17 | 18 | single { 19 | NavRepo(get()) 20 | } 21 | 22 | viewModel { 23 | NavTabVM(androidApplication(), get()) 24 | } 25 | 26 | viewModel { 27 | SystemListVM(androidApplication(), get()) 28 | } 29 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/ui/NavigationFragment.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.ui 2 | 3 | import android.view.View 4 | import androidx.fragment.app.Fragment 5 | import androidx.viewpager2.adapter.FragmentStateAdapter 6 | import com.bbq.base.base.BaseVMFragment 7 | import com.bbq.navigation.R 8 | import com.bbq.navigation.databinding.NavFragmentNavigationBinding 9 | import com.google.android.material.tabs.TabLayoutMediator 10 | 11 | class NavigationFragment : BaseVMFragment() { 12 | private val mTitles = arrayOf("导航", "体系", "公众号", "项目", "项目分类") 13 | 14 | private val mFragmentList by lazy { 15 | val list = mutableListOf() 16 | list.add(NavigationTabFragment()) 17 | list.add(SystemTabFragment()) 18 | list.add(PublicTabFragment()) 19 | list.add(ProjectTabFragment()) 20 | list.add(ProjectTreeTabFragment()) 21 | list 22 | } 23 | 24 | override fun getLayoutId(): Int { 25 | return R.layout.nav_fragment_navigation 26 | } 27 | 28 | override fun initView(view: View) { 29 | mBinding.viewPager2.adapter = 30 | object : FragmentStateAdapter(childFragmentManager, lifecycle) { 31 | override fun getItemCount(): Int { 32 | return mFragmentList.size 33 | } 34 | 35 | override fun createFragment(position: Int): Fragment { 36 | return mFragmentList[position] 37 | } 38 | 39 | } 40 | TabLayoutMediator(mBinding.tabLayout, mBinding.viewPager2) { tab, position -> 41 | tab.text = mTitles[position] 42 | }.attach() 43 | mBinding.viewPager2.offscreenPageLimit = 5 44 | } 45 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/viewmodel/ItemProject.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.viewmodel 2 | 3 | import androidx.databinding.ObservableBoolean 4 | import androidx.databinding.ObservableField 5 | import com.bbq.navigation.bean.ArticleBean 6 | 7 | class ItemProject(val bean:ArticleBean) { 8 | var mTitle = ObservableField(bean.title) 9 | var mTime = ObservableField(bean.niceShareDate) 10 | var mDesc = ObservableField(bean.desc) 11 | var mAuthor = ObservableField(bean.author) 12 | var mCollect = ObservableBoolean(bean.collect) 13 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/viewmodel/SystemListVM.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.viewmodel 2 | 3 | import android.app.Application 4 | import androidx.lifecycle.MutableLiveData 5 | import androidx.lifecycle.viewModelScope 6 | import com.bbq.base.base.BaseViewModel 7 | import com.bbq.base.rository.StateLiveData 8 | import com.bbq.base.view.TitleViewModel 9 | import com.bbq.navigation.bean.ArticleBean 10 | import com.bbq.navigation.repo.NavRepo 11 | import com.bbq.net.model.BasePagingResult 12 | import kotlinx.coroutines.launch 13 | 14 | class SystemListVM(application: Application, val repo: NavRepo) : BaseViewModel(application) { 15 | val mIsFinish = MutableLiveData(false) 16 | val mTitleVM = TitleViewModel( 17 | leftAction = { 18 | mIsFinish.postValue(true) 19 | }, 20 | title = "", 21 | rightAction = { 22 | 23 | } 24 | ) 25 | 26 | fun setTitle(title: String) { 27 | mTitleVM.mTitle.set(title) 28 | } 29 | 30 | val mArticleList = StateLiveData>>() 31 | 32 | fun articleList(position: Int, cid: Int) { 33 | viewModelScope.launch { 34 | repo.getArticleList(position, cid, mArticleList) 35 | } 36 | } 37 | 38 | 39 | suspend fun collect(id: Int?): Boolean { 40 | return repo.collect(id) 41 | } 42 | 43 | suspend fun unCollect(id: Int?): Boolean { 44 | return repo.unCollect(id) 45 | } 46 | } -------------------------------------------------------------------------------- /navigation/src/main/java/com/bbq/navigation/viewmodel/TagViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation.viewmodel 2 | 3 | import androidx.databinding.ObservableField 4 | import com.bbq.base.utils.getRandomColor 5 | import com.bbq.base.utils.getResColor 6 | import com.bbq.base.utils.getResDimen 7 | import com.bbq.base.utils.getResDrawable 8 | import com.bbq.navigation.R 9 | 10 | /** 11 | * @author jhb 12 | * @date 2020/10/23 13 | */ 14 | class TagViewModel { 15 | var mBgColor = ObservableField(getRandomColor()) 16 | var mContent = ObservableField("") 17 | var mTextColor = ObservableField(R.color.colorRed.getResColor()) 18 | var mTextSize = ObservableField(R.dimen.sp_12.getResDimen()) 19 | var mDrawable = ObservableField(R.drawable.nav_rect_red_shape.getResDrawable()) 20 | } -------------------------------------------------------------------------------- /navigation/src/main/res/drawable-xxhdpi/nav_collect_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/navigation/src/main/res/drawable-xxhdpi/nav_collect_gray.png -------------------------------------------------------------------------------- /navigation/src/main/res/drawable-xxhdpi/nav_collect_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/navigation/src/main/res/drawable-xxhdpi/nav_collect_red.png -------------------------------------------------------------------------------- /navigation/src/main/res/drawable-xxhdpi/nav_place_holder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/navigation/src/main/res/drawable-xxhdpi/nav_place_holder.png -------------------------------------------------------------------------------- /navigation/src/main/res/drawable-xxhdpi/nav_shanchu_ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/navigation/src/main/res/drawable-xxhdpi/nav_shanchu_ico.png -------------------------------------------------------------------------------- /navigation/src/main/res/drawable/nav_paper_divider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 11 | -------------------------------------------------------------------------------- /navigation/src/main/res/drawable/nav_rect_red_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /navigation/src/main/res/drawable/nav_selector_corners_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /navigation/src/main/res/drawable/nav_shape_corners_solid_ccc.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /navigation/src/main/res/drawable/nav_shape_corners_solid_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /navigation/src/main/res/drawable/nav_tab_text_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/activity_alone.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_fbl_system_children.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_fragment_navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 26 | 27 | 28 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_fragment_navigation_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 20 | 21 | 32 | 33 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_fragment_project_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_fragment_project_tree_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 20 | 21 | 33 | 34 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_fragment_public_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 20 | 21 | 33 | 34 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_fragment_system_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_fragment_system_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_item_nav_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_item_nav_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 16 | 17 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_item_tab_paper.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 21 | 22 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_item_tree.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 20 | 21 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /navigation/src/main/res/layout/nav_item_tree_view_model_tag.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 20 | 21 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /navigation/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /navigation/src/main/res/values/style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /navigation/src/test/java/com/bbq/navigation/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.navigation 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /net/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /net/build.gradle: -------------------------------------------------------------------------------- 1 | import com.sss.plugin.BuildVersion 2 | import com.sss.plugin.Deps 3 | import com.sss.plugin.Kotlin 4 | 5 | plugins { 6 | id 'com.android.library' 7 | id 'kotlin-android' 8 | } 9 | 10 | android { 11 | compileSdkVersion BuildVersion.compileSdkVersion 12 | buildToolsVersion BuildVersion.buildToolsVersion 13 | 14 | defaultConfig { 15 | minSdkVersion BuildVersion.minSdkVersion 16 | targetSdkVersion BuildVersion.targetSdkVersion 17 | versionCode 1 18 | versionName "1.0" 19 | 20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 | consumerProguardFiles "consumer-rules.pro" 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | kotlinOptions { 35 | jvmTarget = '1.8' 36 | } 37 | } 38 | 39 | dependencies { 40 | api(Deps.okhttp) 41 | api(Deps.retrofit) 42 | api(Deps.rxjava3) 43 | api(Deps.adapter_rxjava3) 44 | api(Deps.gson) 45 | api(Deps.converter_gson) 46 | api(Deps.logging_interceptor) 47 | api(Deps.rxandroid) 48 | api Kotlin.kotlinx_coroutines_android 49 | // api Kotlin.kotlin_stdlib_jdk8 50 | api Kotlin.kotlin_stdlib 51 | 52 | } -------------------------------------------------------------------------------- /net/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/net/consumer-rules.pro -------------------------------------------------------------------------------- /net/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 -------------------------------------------------------------------------------- /net/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /net/src/main/java/com/bbq/net/cookie/SimpleCookieJar.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.net.cookie 2 | 3 | import android.webkit.CookieManager 4 | import okhttp3.Cookie 5 | import okhttp3.CookieJar 6 | import okhttp3.HttpUrl 7 | 8 | class SimpleCookieJar : CookieJar { 9 | 10 | //Http发送请求前回调,Request中设置Cookie 11 | override fun loadForRequest(url: HttpUrl): List { 12 | val cookieList: MutableList = ArrayList() 13 | CookieManager.getInstance().getCookie(url.toString())?.let { cookiesStr -> 14 | if (cookiesStr.isNotEmpty()) { 15 | val cookies = cookiesStr.split(";".toRegex()) 16 | for (cookie in cookies) { 17 | Cookie.parse(url, cookie)?.apply { 18 | cookieList.add(this) 19 | } 20 | } 21 | } 22 | } 23 | return cookieList 24 | } 25 | 26 | //Http请求结束,Response中有Cookie时候回调 27 | override fun saveFromResponse(url: HttpUrl, cookies: List) { 28 | val cookieManager = CookieManager.getInstance() 29 | cookieManager.setAcceptCookie(true) 30 | for (cookie in cookies) { 31 | cookieManager.setCookie(url.toString(), cookie.toString()) 32 | } 33 | cookieManager.flush() 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /net/src/main/java/com/bbq/net/exception/ApiCode.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.net.exception 2 | 3 | object ApiCode { 4 | 5 | //对应HTTP的状态码 6 | const val UNAUTHORIZED = 401 7 | const val FORBIDDEN = 403 8 | const val NOT_FOUND = 404 9 | const val REQUEST_TIMEOUT = 408 10 | const val INTERNAL_SERVER_ERROR = 500 11 | const val BAD_GATEWAY = 502 12 | const val SERVICE_UNAVAILABLE = 503 13 | const val GATEWAY_TIMEOUT = 504 14 | 15 | const val RESULT_NORMAL = 0 16 | const val UNKNOWN = "1000" 17 | const val PARSE_ERROR = "1001" 18 | const val NETWORK_NOTCONNECTION = "1002" 19 | const val UNKNOW_HOST = "1003" 20 | const val GW_ERROR = "1004" 21 | const val ARGS_ERROR = "1005" 22 | const val TOKEN_ERROR = "1006" 23 | const val SIGN_ERROR = "1007" 24 | 25 | /** 26 | * 网络错误 27 | */ 28 | const val USER_INVALID = "2001" 29 | const val SECRET_KEY_INVALID = "2002" 30 | const val TIME_INVALID = "2003" 31 | 32 | const val SSL_ERROR = "3001" 33 | const val API_RESULT_NORMAL = "000000" 34 | 35 | const val DATA_NULL = "201" 36 | 37 | const val CANCEL = "Multipart Cancel" 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /net/src/main/java/com/bbq/net/exception/ResultException.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.net.exception 2 | 3 | //异常结果类,错误码和错误信息 4 | class ResultException(var errCode: String, var msg: String) : Exception(msg) 5 | -------------------------------------------------------------------------------- /net/src/main/java/com/bbq/net/model/BasePagingResult.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.net.model 2 | 3 | data class BasePagingResult( 4 | var curPage: Int, 5 | var offset: Int, 6 | var over: Boolean, 7 | var pageCount: Int, var size: Int, var total: Int, 8 | var datas: T 9 | 10 | ) -------------------------------------------------------------------------------- /net/src/main/java/com/bbq/net/model/BaseResult.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.net.model 2 | 3 | import com.bbq.net.exception.ResultException 4 | 5 | //返回的基础model 6 | class BaseResult { 7 | //错误码0为正确 8 | var errorCode: Int = -1 9 | var errorMsg: String? = null 10 | 11 | //返回数据 12 | var data: T? = null 13 | private set 14 | 15 | //数据状态 16 | var dataStatus: DataStatus? = null 17 | 18 | //当STATE_ERROR状态的时候这个才会有值 19 | var exception: ResultException? = null 20 | } -------------------------------------------------------------------------------- /net/src/main/java/com/bbq/net/model/DataStatus.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.net.model 2 | 3 | enum class DataStatus { 4 | STATE_LOADING,//加载中 5 | STATE_SUCCESS,//成功 6 | STATE_ERROR,//1.服务器处理后的失败 2.网络等原因导致的失败 7 | } -------------------------------------------------------------------------------- /net/src/main/java/com/bbq/net/model/ResultState.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.net.model 2 | 3 | import com.bbq.net.exception.ResultException 4 | 5 | /** 6 | * 网络请求结果 7 | */ 8 | sealed class ResultState { 9 | 10 | //成功 11 | data class Success(val data: T?) : ResultState() 12 | 13 | //失败 14 | data class Error(val exception: ResultException) : ResultState() 15 | 16 | 17 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "WanAndroid" 2 | include ':app' 3 | include ':base' 4 | include ':home' 5 | include ':net' 6 | include ':webview' 7 | include ':navigation' 8 | include ':user' 9 | include ':login' 10 | -------------------------------------------------------------------------------- /user/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /user/build.gradle: -------------------------------------------------------------------------------- 1 | import com.sss.plugin.BuildVersion 2 | import com.sss.plugin.Deps 3 | 4 | plugins { 5 | id 'com.android.library' 6 | id 'kotlin-android' 7 | id 'kotlin-kapt' 8 | } 9 | kapt { 10 | arguments { 11 | arg("AROUTER_MODULE_NAME", project.getName()) 12 | } 13 | } 14 | android { 15 | compileSdkVersion BuildVersion.compileSdkVersion 16 | buildToolsVersion BuildVersion.buildToolsVersion 17 | 18 | defaultConfig { 19 | minSdkVersion BuildVersion.minSdkVersion 20 | targetSdkVersion BuildVersion.targetSdkVersion 21 | versionCode 1 22 | versionName "1.0" 23 | 24 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 25 | consumerProguardFiles "consumer-rules.pro" 26 | } 27 | 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | compileOptions { 35 | sourceCompatibility JavaVersion.VERSION_1_8 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | } 38 | kotlinOptions { 39 | jvmTarget = '1.8' 40 | } 41 | buildFeatures { 42 | dataBinding = true 43 | } 44 | } 45 | 46 | dependencies { 47 | implementation project(":base") 48 | kapt Deps.aroute_processor 49 | } -------------------------------------------------------------------------------- /user/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/user/consumer-rules.pro -------------------------------------------------------------------------------- /user/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 -------------------------------------------------------------------------------- /user/src/androidTest/java/com/bbq/user/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.user 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.bbq.user.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /user/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /user/src/main/java/com/bbq/user/api/UserApi.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.user.api 2 | 3 | import com.bbq.net.model.BaseResult 4 | import com.bbq.user.bean.IntegralBean 5 | import retrofit2.http.GET 6 | 7 | interface UserApi { 8 | 9 | //获取个人积分,需要登录后访问 10 | @GET("lg/coin/userinfo/json") 11 | suspend fun coinUserInfo(): BaseResult 12 | } -------------------------------------------------------------------------------- /user/src/main/java/com/bbq/user/bean/IntegralBean.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.user.bean 2 | 3 | data class IntegralBean( 4 | val coinCount: Int, 5 | val level: Int, 6 | val nickname: String, 7 | val rank: String, 8 | val userId: Int, 9 | val username: String 10 | ) -------------------------------------------------------------------------------- /user/src/main/java/com/bbq/user/di/userModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.user.di 2 | 3 | import com.bbq.net.net.RetrofitManager 4 | import com.bbq.user.api.UserApi 5 | import com.bbq.user.repo.UserRepo 6 | import com.bbq.user.viewmodel.UserVM 7 | import org.koin.android.ext.koin.androidApplication 8 | import org.koin.androidx.viewmodel.dsl.viewModel 9 | import org.koin.dsl.module 10 | 11 | 12 | val userModel = module { 13 | single { 14 | RetrofitManager.instance.create(UserApi::class.java) 15 | } 16 | single { 17 | UserRepo(get()) 18 | } 19 | viewModel { 20 | UserVM(androidApplication(), get()) 21 | } 22 | } -------------------------------------------------------------------------------- /user/src/main/java/com/bbq/user/repo/UserRepo.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.user.repo 2 | 3 | import com.bbq.base.rository.BaseRepository 4 | import com.bbq.base.rository.StateLiveData 5 | import com.bbq.user.api.UserApi 6 | import com.bbq.user.bean.IntegralBean 7 | 8 | class UserRepo(val api: UserApi) : BaseRepository() { 9 | suspend fun getInterData(data: StateLiveData) { 10 | executeRequest({ api.coinUserInfo() }, data) 11 | } 12 | } -------------------------------------------------------------------------------- /user/src/main/java/com/bbq/user/viewmodel/UserItem.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.user.viewmodel 2 | 3 | import androidx.databinding.BaseObservable 4 | import com.bbq.base.route.LoginServiceUtils 5 | import com.bbq.user.BR 6 | 7 | class UserItem : BaseObservable() { 8 | var mUserName = "去登录" 9 | get() { 10 | return if (LoginServiceUtils.isLogin()) { 11 | LoginServiceUtils.getUserInfo()?.username!! 12 | } else { 13 | "去登录" 14 | } 15 | } 16 | 17 | var mBtnIsShow = false 18 | get() { 19 | return LoginServiceUtils.isLogin() 20 | } 21 | 22 | fun refresh() { 23 | notifyPropertyChanged(BR._all) 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /user/src/main/java/com/bbq/user/viewmodel/UserVM.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.user.viewmodel 2 | 3 | import android.app.Application 4 | import androidx.databinding.ObservableField 5 | import androidx.lifecycle.viewModelScope 6 | import com.bbq.base.base.BaseViewModel 7 | import com.bbq.base.rository.StateLiveData 8 | import com.bbq.user.bean.IntegralBean 9 | import com.bbq.user.repo.UserRepo 10 | import kotlinx.coroutines.launch 11 | 12 | class UserVM(application: Application, val repo: UserRepo) : BaseViewModel(application) { 13 | 14 | val mInterData = StateLiveData() 15 | fun getInterData() { 16 | viewModelScope.launch { 17 | repo.getInterData(mInterData) 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /user/src/main/res/drawable/ic_user_arrow_right.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /user/src/main/res/drawable/ic_user_collect.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /user/src/main/res/drawable/ic_user_un_authen.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /user/src/main/res/drawable/shape_theme_bg_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /user/src/test/java/com/bbq/user/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.user 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /webview/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /webview/build.gradle: -------------------------------------------------------------------------------- 1 | import com.sss.plugin.BuildVersion 2 | import com.sss.plugin.Deps 3 | 4 | plugins { 5 | id 'com.android.library' 6 | id 'kotlin-android' 7 | id 'kotlin-kapt' 8 | } 9 | kapt { 10 | arguments { 11 | arg("AROUTER_MODULE_NAME", project.getName()) 12 | } 13 | } 14 | android { 15 | compileSdkVersion BuildVersion.compileSdkVersion 16 | buildToolsVersion BuildVersion.buildToolsVersion 17 | 18 | defaultConfig { 19 | minSdkVersion BuildVersion.minSdkVersion 20 | targetSdkVersion BuildVersion.targetSdkVersion 21 | versionCode 1 22 | versionName "1.0" 23 | 24 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 25 | consumerProguardFiles "consumer-rules.pro" 26 | } 27 | 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | compileOptions { 35 | sourceCompatibility JavaVersion.VERSION_1_8 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | } 38 | kotlinOptions { 39 | jvmTarget = '1.8' 40 | } 41 | buildFeatures { 42 | dataBinding = true 43 | } 44 | } 45 | 46 | dependencies { 47 | implementation project(":base") 48 | implementation Deps.agentweb 49 | kapt Deps.aroute_processor 50 | } -------------------------------------------------------------------------------- /webview/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/consumer-rules.pro -------------------------------------------------------------------------------- /webview/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 | 23 | -keep class com.just.agentweb.** { 24 | *; 25 | } 26 | -dontwarn com.just.agentweb.** -------------------------------------------------------------------------------- /webview/src/androidTest/java/com/bbq/webview/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.webview 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.bbq.webview.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /webview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /webview/src/main/java/com/bbq/webview/api/WebApi.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.webview.api 2 | 3 | import com.bbq.net.model.BaseResult 4 | import retrofit2.http.POST 5 | import retrofit2.http.Path 6 | 7 | interface WebApi { 8 | //收藏站内文章 文章id,拼接在链接中。 9 | @POST("/lg/collect/{id}/json") 10 | suspend fun collect(@Path("id") id: Int?): BaseResult 11 | 12 | //取消收藏 文章列表 文章id,拼接在链接中。 13 | @POST("lg/uncollect_originId/{id}/json") 14 | suspend fun unCollect(@Path("id") id: Int?): BaseResult 15 | } -------------------------------------------------------------------------------- /webview/src/main/java/com/bbq/webview/di/WebModels.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.webview.di 2 | 3 | import com.bbq.net.net.RetrofitManager 4 | import com.bbq.webview.api.WebApi 5 | import com.bbq.webview.repo.WebRepo 6 | import com.bbq.webview.viewmodel.WebViewModel 7 | import org.koin.android.ext.koin.androidApplication 8 | import org.koin.androidx.viewmodel.dsl.viewModel 9 | import org.koin.dsl.module 10 | 11 | 12 | val webModels = module { 13 | single { 14 | RetrofitManager.instance.create(WebApi::class.java) 15 | } 16 | single { 17 | WebRepo(get()) 18 | } 19 | viewModel { WebViewModel(androidApplication(), get()) } 20 | } -------------------------------------------------------------------------------- /webview/src/main/java/com/bbq/webview/repo/WebRepo.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.webview.repo 2 | 3 | import com.bbq.base.rository.BaseRepository 4 | import com.bbq.net.model.ResultState 5 | import com.bbq.webview.api.WebApi 6 | 7 | class WebRepo(val webApi: WebApi) : BaseRepository() { 8 | suspend fun collect(id: Int?): Boolean { 9 | val result = callRequest { handleResponse(webApi.collect(id)) } 10 | return result is ResultState.Success 11 | } 12 | 13 | suspend fun unCollect(id: Int?): Boolean { 14 | val result = callRequest { handleResponse(webApi.unCollect(id)) } 15 | return result is ResultState.Success 16 | } 17 | } -------------------------------------------------------------------------------- /webview/src/main/java/com/bbq/webview/route/WebServiceImpl.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.webview.route 2 | 3 | import android.content.Context 4 | import com.alibaba.android.arouter.facade.annotation.Route 5 | import com.bbq.base.route.WebService 6 | import com.bbq.webview.ui.WebActivity 7 | 8 | @Route(path = "/web/web") 9 | class WebServiceImpl : WebService { 10 | override fun goWeb(context: Context, title: String, url: String, id: Int?, isCollect: Boolean) { 11 | WebActivity.launch(context, title, url,id, isCollect) 12 | } 13 | 14 | override fun init(context: Context?) { 15 | } 16 | } -------------------------------------------------------------------------------- /webview/src/main/java/com/bbq/webview/viewmodel/WebViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.webview.viewmodel 2 | 3 | import android.app.Application 4 | import androidx.lifecycle.MutableLiveData 5 | import com.bbq.base.base.BaseViewModel 6 | import com.bbq.base.utils.getDrawable 7 | import com.bbq.base.view.FabViewModel 8 | import com.bbq.base.view.TitleViewModel 9 | import com.bbq.webview.R 10 | import com.bbq.webview.repo.WebRepo 11 | import com.hjq.toast.ToastUtils 12 | 13 | class WebViewModel(application: Application, val repo: WebRepo) : BaseViewModel(application) { 14 | val mScrollToTop = MutableLiveData(false) 15 | val mFabVM = FabViewModel( 16 | onClick = { 17 | mScrollToTop.value = true 18 | } 19 | ) 20 | 21 | val mIsFinish = MutableLiveData(false) 22 | val mTitleVM = TitleViewModel( 23 | leftAction = { 24 | mIsFinish.postValue(true) 25 | }, 26 | title = "", 27 | rightAction = { 28 | 29 | } 30 | ) 31 | 32 | fun setCollectState(collect: Boolean) { 33 | mTitleVM.mRightDrawable.set( 34 | if (collect) R.drawable.collect_red.getDrawable() 35 | else R.drawable.sc_white_stroke_ico.getDrawable() 36 | ) 37 | } 38 | 39 | fun setTitle(title: String) { 40 | mTitleVM.mTitle.set(title) 41 | } 42 | 43 | 44 | suspend fun collect(id: Int?): Boolean { 45 | return repo.collect(id) 46 | } 47 | 48 | suspend fun unCollect(id: Int?): Boolean { 49 | return repo.unCollect(id) 50 | } 51 | } -------------------------------------------------------------------------------- /webview/src/main/res/drawable-xxhdpi/collect_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/src/main/res/drawable-xxhdpi/collect_gray.png -------------------------------------------------------------------------------- /webview/src/main/res/drawable-xxhdpi/collect_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/src/main/res/drawable-xxhdpi/collect_red.png -------------------------------------------------------------------------------- /webview/src/main/res/drawable-xxhdpi/sc_white_stroke_ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/src/main/res/drawable-xxhdpi/sc_white_stroke_ico.png -------------------------------------------------------------------------------- /webview/src/main/res/drawable-xxhdpi/snail_1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/src/main/res/drawable-xxhdpi/snail_1.webp -------------------------------------------------------------------------------- /webview/src/main/res/drawable-xxhdpi/snail_2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/src/main/res/drawable-xxhdpi/snail_2.webp -------------------------------------------------------------------------------- /webview/src/main/res/drawable-xxhdpi/snail_3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/src/main/res/drawable-xxhdpi/snail_3.webp -------------------------------------------------------------------------------- /webview/src/main/res/drawable-xxhdpi/snail_4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/src/main/res/drawable-xxhdpi/snail_4.webp -------------------------------------------------------------------------------- /webview/src/main/res/drawable-xxhdpi/snail_5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidBBQ/WanAndroid-jetpack/ddeeda67837c5b183f8af430e0371f82bc552e74/webview/src/main/res/drawable-xxhdpi/snail_5.webp -------------------------------------------------------------------------------- /webview/src/main/res/drawable/animation_snail_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /webview/src/main/res/drawable/layer_snail_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /webview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webview/src/test/java/com/bbq/webview/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.bbq.webview 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } --------------------------------------------------------------------------------