├── baseAF ├── .gitignore ├── consumer-rules.pro ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── foundation │ │ └── app │ │ └── arc │ │ ├── app │ │ └── BaseVMApplication.kt │ │ ├── utils │ │ ├── param │ │ │ ├── BundleParams.kt │ │ │ └── ParamsUtils.kt │ │ ├── ext │ │ │ ├── Ext.kt │ │ │ ├── AFViewModelLazy.kt │ │ │ ├── ActivityViewBindingDelegate.kt │ │ │ ├── FragmentViewDelegate.kt │ │ │ ├── LiveDataExt.kt │ │ │ └── FragmentViewBindingDelegate.kt │ │ └── FragmentSwitchHelper.kt │ │ ├── activity │ │ ├── BaseParamsActivity.kt │ │ ├── BaseFragmentManagerActivity.kt │ │ └── BaseVMVBActivity.kt │ │ └── fragment │ │ ├── BaseParamsFragment.kt │ │ ├── BaseFragmentManagerFragment.kt │ │ ├── BaseViewBindingFragment.kt │ │ ├── BaseViewBindingFragmentInJava.kt │ │ ├── InternalBasicFragment.kt │ │ ├── BaseVMFragment.kt │ │ └── BaseVisibilityFragment.kt ├── proguard-rules.pro └── build.gradle.kts ├── simple ├── .gitignore ├── test.jks ├── src │ └── main │ │ ├── res │ │ ├── drawable │ │ │ ├── girl.webp │ │ │ ├── avatar.webp │ │ │ ├── netoff.webp │ │ │ ├── old_man.webp │ │ │ ├── img_skeleton_screen.png │ │ │ ├── sp_loading_content_bg.xml │ │ │ ├── dw_loading.xml │ │ │ └── ic_loading_svg.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── values │ │ │ ├── styles.xml │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── themes.xml │ │ ├── animator │ │ │ ├── animator_shrug.xml │ │ │ └── anim_scale.xml │ │ ├── layout │ │ │ ├── act_multi_fragment_visible_test.xml │ │ │ ├── act_single_fragment_visible_test.xml │ │ │ ├── vb_child.xml │ │ │ ├── fail.xml │ │ │ ├── act_vb_test.xml │ │ │ ├── frag_user_info.xml │ │ │ ├── frag_fragment_manager_visible.xml │ │ │ ├── frag_view_pager_visible.xml │ │ │ ├── frag_view_pager2_visible.xml │ │ │ ├── act_vb.xml │ │ │ ├── item_news.xml │ │ │ ├── act_user_info.xml │ │ │ ├── act_sticky.xml │ │ │ ├── act_home_wanandroid.xml │ │ │ └── activity_loading.xml │ │ ├── values-v23 │ │ │ └── themes.xml │ │ └── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ └── com │ │ │ └── foundation │ │ │ └── app │ │ │ └── simple │ │ │ ├── demo │ │ │ ├── net │ │ │ │ ├── api │ │ │ │ │ ├── ApiUrl.kt │ │ │ │ │ └── WanAndroidService.kt │ │ │ │ ├── WanAndroidResException.kt │ │ │ │ ├── RetrofitFactory.kt │ │ │ │ └── WanAndroidNetStateHandler.kt │ │ │ ├── home │ │ │ │ ├── data │ │ │ │ │ ├── NewsFeedInfo.kt │ │ │ │ │ ├── BannerEntity.kt │ │ │ │ │ └── PageInfo.kt │ │ │ │ ├── HomeRepo.kt │ │ │ │ ├── NewsAdapter.kt │ │ │ │ ├── HomeVM.kt │ │ │ │ └── HomeActivity.kt │ │ │ └── base │ │ │ │ ├── BaseApiResponse.kt │ │ │ │ └── BaseWanAndroidVM.kt │ │ │ ├── vm │ │ │ ├── Test.java │ │ │ ├── AppVM.kt │ │ │ └── ReflectionTest.kt │ │ │ ├── utils │ │ │ └── Utils.kt │ │ │ ├── ui │ │ │ ├── fragment │ │ │ │ ├── visible │ │ │ │ │ ├── EmptyVisibleTestFragment.kt │ │ │ │ │ ├── FragmentManagerVisibleTestFragment.kt │ │ │ │ │ ├── ViewPager2VisibleTestFragment.kt │ │ │ │ │ ├── ViewPagerVisibleTestFragment.kt │ │ │ │ │ └── AbstractVisibleTestFragment.kt │ │ │ │ └── SkillListFragment.kt │ │ │ ├── SkillListActivity.kt │ │ │ ├── data │ │ │ │ ├── BundleProducer.java │ │ │ │ └── UserData.kt │ │ │ ├── adapter │ │ │ │ ├── BaseFragmentPagerAdapter.kt │ │ │ │ ├── BaseFragmentStatePagerAdapter.kt │ │ │ │ └── ViewPager2FragmentAdapter.kt │ │ │ ├── EmptyActivity.kt │ │ │ ├── UserInfoFragment.java │ │ │ ├── MultiFragmentVisibleTestActivity.kt │ │ │ ├── StickyLiveDataActivity.kt │ │ │ ├── ParcelableActivity.kt │ │ │ ├── SerializableActivity.kt │ │ │ └── UserInfoActivity.kt │ │ │ ├── architecture │ │ │ ├── BaseActivity.kt │ │ │ ├── BaseFragment.kt │ │ │ └── BaseFragmentWithLayoutId.kt │ │ │ ├── CustomApplication.kt │ │ │ ├── VBIncludeTestActivity.kt │ │ │ ├── Ext.kt │ │ │ ├── kcp │ │ │ ├── PermissionCallback.kt │ │ │ ├── PermissionExt.kt │ │ │ ├── PermissionFragment.kt │ │ │ └── KPermission.kt │ │ │ └── backup │ │ │ └── ActVbBindingCopy.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle.kts ├── settings.gradle.kts ├── images └── uml.jpg ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── encodings.xml ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── compiler.xml ├── kotlinc.xml ├── kotlinScripting.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jarRepositories.xml └── misc.xml ├── common.gradle ├── gradle.properties ├── LICENSE ├── .gitignore ├── ActVbBindingCopy.java ├── gradlew.bat ├── README.md └── gradlew /baseAF/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /simple/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /baseAF/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | include(":baseAF") 2 | include(":simple") 3 | -------------------------------------------------------------------------------- /images/uml.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/images/uml.jpg -------------------------------------------------------------------------------- /simple/test.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/test.jks -------------------------------------------------------------------------------- /baseAF/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /simple/src/main/res/drawable/girl.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/drawable/girl.webp -------------------------------------------------------------------------------- /simple/src/main/res/drawable/avatar.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/drawable/avatar.webp -------------------------------------------------------------------------------- /simple/src/main/res/drawable/netoff.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/drawable/netoff.webp -------------------------------------------------------------------------------- /simple/src/main/res/drawable/old_man.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/drawable/old_man.webp -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple/src/main/res/drawable/img_skeleton_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/drawable/img_skeleton_screen.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /simple/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Western-parotia/AndroidBaseArchitecture/HEAD/simple/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /simple/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /simple/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | baseAf 3 | 海词词典,最权威的学习词典,专业出版无版权的英文,最权威的学习词典,专业出版无版权的英文,无版权翻译最权威的学习词典,专业出版无版权的英文,,无版权英语怎么说等详细讲解。海词词典:学习变容易,记忆很深刻。 4 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/demo/net/api/ApiUrl.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.demo.net.api 2 | 3 | /** 4 | * create by zhusw on 5/20/21 15:37 5 | */ 6 | object ApiUrl { 7 | const val wanandroid_base_url = "https://www.wanandroid.com" 8 | } -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/demo/net/WanAndroidResException.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.demo.net 2 | 3 | /** 4 | * create by zhusw on 5/24/21 20:20 5 | */ 6 | class WanAndroidResException(val code: Int, val msg: String) : Throwable() { 7 | 8 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Feb 08 14:08:48 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip 7 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/vm/Test.java: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.vm; 2 | 3 | /** 4 | * create by zhusw on 5/21/21 15:04 5 | */ 6 | public class Test { 7 | public static int work() { 8 | int i = 1; 9 | return i + 1; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /simple/src/main/res/drawable/sp_loading_content_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/vm/AppVM.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.vm 2 | import androidx.lifecycle.MutableLiveData 3 | import androidx.lifecycle.ViewModel 4 | 5 | /** 6 | *-模拟粘性事件 7 | *create by zhusw on 5/18/21 11:02 8 | */ 9 | class AppVM : ViewModel() { 10 | val data: MutableLiveData = MutableLiveData() 11 | 12 | } -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/demo/home/data/NewsFeedInfo.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.demo.home.data 2 | 3 | /** 4 | * create by zhusw on 5/27/21 15:11 5 | */ 6 | data class NewsFeedInfo( 7 | val title: String = "", 8 | val author: String = "", 9 | val shareUser: String = "", 10 | val niceShareDate: String = "", 11 | val link: String = "", 12 | ) -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/demo/home/data/BannerEntity.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.demo.home.data 2 | 3 | data class BannerEntity( 4 | val desc: String = "", 5 | val id: Int = 0, 6 | val imagePath: String? = null, 7 | val isVisible: Int = 0, 8 | val order: Int = 0, 9 | val title: String = "", 10 | val type: Int = 0, 11 | val url: String? = null 12 | ) -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/utils/Utils.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.utils 2 | 3 | import android.app.Application 4 | 5 | /** 6 | * create by zhusw on 5/24/21 17:20 7 | */ 8 | object Utils { 9 | 10 | private var _application: Application? = null 11 | val app: Application get() = _application!! 12 | fun init(app: Application) { 13 | _application = app 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/demo/home/HomeRepo.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.demo.home 2 | 3 | import com.foundation.app.simple.demo.net.api.WanAndroidService 4 | import com.foundation.service.net.NetManager 5 | import com.foundation.service.net.getApiService 6 | 7 | /** 8 | * create by zhusw on 5/24/21 09:58 9 | */ 10 | class HomeRepo { 11 | val homeApi = NetManager.getApiService() 12 | } -------------------------------------------------------------------------------- /.idea/kotlinScripting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 2147483647 6 | true 7 | 8 | 9 | -------------------------------------------------------------------------------- /simple/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /simple/src/main/res/animator/animator_shrug.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /simple/src/main/res/layout/act_multi_fragment_visible_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /simple/src/main/res/layout/act_single_fragment_visible_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/ui/fragment/visible/EmptyVisibleTestFragment.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.ui.fragment.visible 2 | 3 | import android.view.View 4 | import android.widget.TextView 5 | 6 | class EmptyVisibleTestFragment : 7 | AbstractVisibleTestFragment(0) { 8 | override fun onSwitchFragment(index: Int) { 9 | } 10 | 11 | override fun getBtnOpenNewPage(): View? = null 12 | override fun getTvFragmentTitle(): TextView? = null 13 | override fun getBtnClickSwitch(): View? = null 14 | } 15 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/demo/home/data/PageInfo.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.demo.home.data 2 | 3 | /** 4 | * create by zhusw on 5/27/21 15:15 5 | */ 6 | data class PageInfo( 7 | val datas: List, 8 | val curPage: Int = 0, 9 | val offset: Int = 0, 10 | val over: Boolean = false, 11 | val pageCount: Int = 0, 12 | val size: Int = 0, 13 | val total: Int = 0, 14 | //test 字段 15 | val testString: String, 16 | val testInt: Int, 17 | val testBoolean: Boolean, 18 | val testLong: Long 19 | ) -------------------------------------------------------------------------------- /simple/src/main/res/layout/vb_child.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/demo/base/BaseApiResponse.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.demo.base 2 | 3 | /** 4 | * create by zhusw on 5/20/21 14:20 5 | */ 6 | class BaseApiResponse { 7 | object Code { 8 | const val CODE_NORMAL = -123456 9 | const val CODE_SUCCESS = 0 10 | } 11 | /* { 12 | "data": ..., 13 | "errorCode": 0, 14 | "errorMsg": "" 15 | }*/ 16 | val data: T? = null 17 | val errorCode: Int = Code.CODE_NORMAL 18 | val errorMsg: String = "" 19 | 20 | } -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/ui/SkillListActivity.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.ui 2 | 3 | import android.os.Bundle 4 | import com.foundation.app.simple.architecture.BaseActivity 5 | import com.foundation.app.simple.ui.fragment.SkillListFragment 6 | 7 | /** 8 | *create by zhusw on 5/11/21 14:42 9 | */ 10 | class SkillListActivity : BaseActivity() { 11 | 12 | override fun init(savedInstanceState: Bundle?) { 13 | switchFragment(SkillListFragment(), android.R.id.content) 14 | } 15 | 16 | override fun bindData() { 17 | 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/architecture/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.architecture 2 | 3 | import android.os.Bundle 4 | import com.foundation.app.arc.activity.BaseFragmentManagerActivity 5 | 6 | /** 7 | *create by zhusw on 5/18/21 18:38 8 | */ 9 | abstract class BaseActivity : BaseFragmentManagerActivity() { 10 | override fun beforeSuperOnCreate(savedInstanceState: Bundle?) { 11 | 12 | } 13 | 14 | override fun afterSuperOnCreate(savedInstanceState: Bundle?) { 15 | 16 | } 17 | 18 | override fun initViewModel() { 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/architecture/BaseFragment.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.architecture 2 | 3 | import android.os.Bundle 4 | import androidx.viewbinding.ViewBinding 5 | import com.foundation.app.arc.fragment.BaseViewBindingFragmentInJava 6 | 7 | /** 8 | *create by zhusw on 5/18/21 18:38 9 | */ 10 | open class BaseFragment : BaseViewBindingFragmentInJava() { 11 | override fun initViewModel() { 12 | 13 | } 14 | 15 | override fun init(savedInstanceState: Bundle?) { 16 | 17 | } 18 | 19 | override fun bindData() { 20 | 21 | } 22 | } -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/architecture/BaseFragmentWithLayoutId.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.architecture 2 | 3 | import android.os.Bundle 4 | import androidx.annotation.LayoutRes 5 | import com.foundation.app.arc.fragment.BaseViewBindingFragment 6 | 7 | /** 8 | *create by zhusw on 5/18/21 18:38 9 | */ 10 | open class BaseFragmentWithLayoutId(@LayoutRes id: Int) : BaseViewBindingFragment(id) { 11 | override fun initViewModel() { 12 | 13 | } 14 | 15 | override fun init(savedInstanceState: Bundle?) { 16 | 17 | } 18 | 19 | override fun bindData() { 20 | } 21 | } -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/CustomApplication.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple 2 | 3 | import com.foundation.app.arc.app.BaseVMApplication 4 | import com.foundation.app.simple.demo.net.RetrofitFactory 5 | import com.foundation.app.simple.utils.Utils 6 | import com.foundation.service.net.NetManager 7 | 8 | /** 9 | *create by zhusw on 5/18/21 11:26 10 | */ 11 | class CustomApplication : BaseVMApplication() { 12 | 13 | override fun onCreate() { 14 | super.onCreate() 15 | Utils.init(this) 16 | NetManager.init(RetrofitFactory.create(), this, BuildConfig.DEBUG) 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /simple/src/main/res/animator/anim_scale.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 14 | 15 | -------------------------------------------------------------------------------- /baseAF/src/main/java/com/foundation/app/arc/app/BaseVMApplication.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.arc.app 2 | 3 | import android.app.Application 4 | import androidx.lifecycle.ViewModelStore 5 | import androidx.lifecycle.ViewModelStoreOwner 6 | import com.foundation.app.arc.utils.ext.lazyAtomic 7 | 8 | /** 9 | *- 你并不一定要继承[BaseVMApplication] ,仅需要实现[ViewModelStoreOwner] 10 | *create by zhusw on 5/17/21 14:19 11 | */ 12 | open class BaseVMApplication : Application(), ViewModelStoreOwner { 13 | private val vmStore: ViewModelStore by lazyAtomic { 14 | ViewModelStore() 15 | } 16 | 17 | override fun getViewModelStore(): ViewModelStore = vmStore 18 | } -------------------------------------------------------------------------------- /simple/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/ui/data/BundleProducer.java: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple.ui.data; 2 | import android.os.Bundle; 3 | 4 | /** 5 | * @Desc: - 6 | * - 测试java 基本参数类型 7 | * create by zhusw on 5/18/21 10:39 8 | */ 9 | public class BundleProducer { 10 | public static Bundle create() { 11 | Bundle bundle = new Bundle(); 12 | bundle.putInt("userId", 100001); 13 | bundle.putString("userName", "张三"); 14 | UserAddress address = new UserAddress("inJava", 1); 15 | UserDesc desc = new UserDesc("inJava", 1); 16 | bundle.putParcelable("address", address); 17 | bundle.putParcelable("desc", desc); 18 | return bundle; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /simple/src/main/res/values-v23/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | -------------------------------------------------------------------------------- /baseAF/src/main/java/com/foundation/app/arc/utils/param/BundleParams.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.arc.utils.param 2 | 3 | /** 4 | * activity,fragment 自动初始化参数注解 5 | * 6 | * 支持类型: 7 | * String 8 | * 全部基础数据类型(兼容kotlin与java) 9 | * Parcelable 10 | * 不支持类型:Serializable 11 | * create by zhusw on 5/17/21 16:26 12 | */ 13 | @Target(AnnotationTarget.FIELD) 14 | @Retention(AnnotationRetention.RUNTIME) 15 | annotation class BundleParams(val value: String) 16 | 17 | /** 18 | * 强制使用Serializable 19 | */ 20 | @Target(AnnotationTarget.FIELD) 21 | @Retention(AnnotationRetention.RUNTIME) 22 | annotation class BundleParamsUseSerializable() 23 | 24 | /*在java中需要显式的赋值 key 字段 25 | annotation class BundleParams(val key: String = "") { 26 | 27 | }*/ 28 | -------------------------------------------------------------------------------- /simple/src/main/res/drawable/dw_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 13 | 16 | 19 | -------------------------------------------------------------------------------- /common.gradle: -------------------------------------------------------------------------------- 1 | import com.buildsrc.kts.AndroidConfig 2 | import com.buildsrc.kts.Publish 3 | 4 | apply plugin: 'com.android.library' 5 | 6 | android { 7 | compileSdkVersion AndroidConfig.compileSdkVersion 8 | defaultConfig { 9 | minSdkVersion AndroidConfig.minSdkVersion 10 | targetSdkVersion AndroidConfig.targetSdkVersion 11 | versionCode = Publish.Version.versionCode 12 | versionName = Publish.Version.versionName 13 | } 14 | 15 | 16 | compileOptions { 17 | sourceCompatibility = AndroidConfig.Language.sourceCompatibility 18 | targetCompatibility = AndroidConfig.Language.targetCompatibility 19 | } 20 | kotlinOptions { 21 | jvmTarget = AndroidConfig.Language.jvmTarget 22 | } 23 | } -------------------------------------------------------------------------------- /baseAF/src/main/java/com/foundation/app/arc/utils/ext/Ext.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.arc.utils.ext 2 | 3 | import androidx.annotation.MainThread 4 | import com.foundation.app.arc.BuildConfig 5 | 6 | /** 7 | *create by zhusw on 5/11/21 14:24 8 | */ 9 | private const val TAG = "baseAF" 10 | internal fun String.log(secTag: String = "") { 11 | if (BuildConfig.DEBUG) { 12 | println("$TAG $secTag $this") 13 | } 14 | } 15 | 16 | internal object UNINIT_VALUE 17 | 18 | /** 19 | * 无锁开销的单例加载 20 | * 多线程场景下保证返回首次创建的实例 21 | */ 22 | fun lazyAtomic(initializer: () -> T) = lazy(LazyThreadSafetyMode.PUBLICATION, initializer) 23 | 24 | @MainThread 25 | fun lazyOnUI(initializer: () -> T) = lazy(LazyThreadSafetyMode.NONE, initializer) 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /simple/src/main/java/com/foundation/app/simple/VBIncludeTestActivity.kt: -------------------------------------------------------------------------------- 1 | package com.foundation.app.simple 2 | 3 | import android.os.Bundle 4 | import com.foundation.app.simple.architecture.BaseActivity 5 | import com.foundation.app.simple.databinding.ActVbTestBinding 6 | 7 | /** 8 | * create by zhusw on 6/10/21 17:47 9 | */ 10 | class VBIncludeTestActivity : BaseActivity() { 11 | val vb by lazyAndSetRoot() 12 | override fun init(savedInstanceState: Bundle?) { 13 | vb.include1.tvChild.setOnClickListener { 14 | "click:vb.include1.tvChild".toast() 15 | } 16 | vb.tvParent.setOnClickListener { 17 | "click:vb.tvParent".toast() 18 | } 19 | } 20 | 21 | override fun bindData() { 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /simple/src/main/res/layout/fail.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 |