diff --git a/README.md b/README.md
index 80d3ffe7a..0176b362b 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
> - [Flap 接入文档](https://www.yuque.com/cxyfy/blog/ghsc4b);
> - [Flap 更新日志](https://www.yuque.com/cxyfy/blog/ehnxdy);
-> - [Flap 设计理念](https://www.yuque.com/cxyfy/blog/ehnxdy);
+> - [Flap 设计理念](https://www.yuque.com/cxyfy/blog/gsi2b8);
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index be7e47cbf..b468487e6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -23,7 +23,6 @@
-
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/DifferActivity.java b/app/src/main/java/me/yifeiyuan/flapdev/DifferActivity.java
deleted file mode 100644
index dbc371e48..000000000
--- a/app/src/main/java/me/yifeiyuan/flapdev/DifferActivity.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package me.yifeiyuan.flapdev;
-
-import android.os.Bundle;
-import android.os.Handler;
-
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.recyclerview.widget.RecyclerView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import me.yifeiyuan.flapdev.components.SimpleTextModel;
-
-/**
- * Testing for DifferFlapAdapter
- */
-public class DifferActivity extends AppCompatActivity {
-
- private static final String TAG = "DifferActivity";
-
-// private FlapDiffAdapter flapAdapter;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_differ);
-
- RecyclerView recyclerView = findViewById(R.id.rv_items);
-
-// flapAdapter = new FlapDiffAdapter<>(new DiffUtil.ItemCallback() {
-// @Override
-// public boolean areItemsTheSame(@NonNull final SimpleTextModel simpleTextModel, @NonNull final SimpleTextModel t1) {
-// return true;
-// }
-//
-// @Override
-// public boolean areContentsTheSame(@NonNull final SimpleTextModel simpleTextModel, @NonNull final SimpleTextModel t1) {
-// Log.d(TAG, "areContentsTheSame() called with: simpleTextModel = [" + simpleTextModel + "], t1 = [" + t1 + "]");
-// return false;
-// }
-//
-// @Nullable
-// @Override
-// public Object getChangePayload(@NonNull final SimpleTextModel oldItem, @NonNull final SimpleTextModel newItem) {
-// return newItem.content;
-// }
-// });
-
- List models = new ArrayList<>();
-
- for (int i = 0; i < 20; i++) {
- models.add(new SimpleTextModel("Android :" + i));
- }
-
-// flapAdapter.submitList(models);
-// recyclerView.setAdapter(flapAdapter);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- changeModels();
-// testClear();
- }
-
- private void testClear() {
- new Handler().postDelayed(new Runnable() {
-
- @Override
- public void run() {
-// flapAdapter.getData().clear(); will throw UnsupportedOperationException
-// flapAdapter.setData(new ArrayList<>());
- }
- }, 3000);
- }
-
- private void changeModels() {
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- List newModels = new ArrayList<>();
-
- for (int i = 0; i < 6; i++) {
-// newModels.add(new SimpleTextModel("Android :" + i));
- newModels.add(new SimpleTextModel("Android :" + (i % 2 == 0 ? i : (666))));
- }
-
-// flapAdapter.submitList(newModels, () -> Log.d(TAG, "submitList run() called"));
-// flapAdapter.notifyItemChanged(3,"ssssss ");
- }
- }, 2000);
- }
-
-// private void changeModels2() {
-// new Handler().postDelayed(new Runnable() {
-// @Override
-// public void run() {
-//
-// for (SimpleTextModel datum : flapAdapter.getData()) {
-// datum.content = "asdf";
-// }
-//
-// flapAdapter.notifyDataSetChanged();
-////
-//// List newModels = new ArrayList<>();
-////
-//// for (int i = 0; i < 20; i++) {
-////// newModels.add(new SimpleTextModel("Android :" + i));
-//// newModels.add(new SimpleTextModel("Android :" + (i % 2 == 0 ? i : (666))));
-//// }
-////
-//// flapAdapter.setData(newModels);
-// }
-// }, 2000);
-// }
-}
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/FlapApplication.kt b/app/src/main/java/me/yifeiyuan/flapdev/FlapApplication.kt
index 53c8f0e93..80ccd62d5 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/FlapApplication.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/FlapApplication.kt
@@ -38,7 +38,7 @@ class FlapApplication : MultiDexApplication() {
TestClickComponentAdapterDelegate(),
TestBinderComponentAdapterDelegate(),
TestAllComponentAdapterDelegate(),
- SimpleDataBindingComponentAdapterDelegate(),
+ DataBindingComponentAdapterDelegate(),
DiffComponentAdapterDelegate(),
)
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/MainActivity.kt b/app/src/main/java/me/yifeiyuan/flapdev/MainActivity.kt
index 33f08a7a9..dedf2d868 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/MainActivity.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/MainActivity.kt
@@ -44,7 +44,7 @@ class MainActivity : AppCompatActivity() {
subtitle = "多 itemViewType"
replace(MultiTypeTestcase::class.java)
}
- R.id.nav_prefetch -> {
+ R.id.nav_preload -> {
title = "预加载"
subtitle = "在滑动到底部之前预先加载"
replace(PreloadTestcase::class.java)
@@ -65,7 +65,9 @@ class MainActivity : AppCompatActivity() {
replace(ViewPager2Testcase::class.java)
}
R.id.nav_diff -> {
- replace(DiffAdapterTestcase::class.java)
+ title = "FlapDifferAdapter"
+ subtitle = "修改数据后,下拉刷新观察"
+ replace(FlapDifferAdapterTestcase::class.java)
}
R.id.nav_clicks -> {
subtitle = "点击、长按事件功能测试"
@@ -113,15 +115,4 @@ class MainActivity : AppCompatActivity() {
private fun replace(fragmentClass: Class, args: Bundle? = null) {
supportFragmentManager.beginTransaction().replace(R.id.container, fragmentClass, args).commitAllowingStateLoss()
}
-
-// private fun createAdvanceTestCase(recyclerView: RecyclerView) {
-// val models = mockModels()
-// val adapter: FlapAdapter = ShowcaseAdapter()
-// adapter.setUseComponentPool(true)
-// .setLifecycleEnable(true)
-// .setLifecycleOwner(this)
-// .data = models
-// recyclerView.adapter = adapter
-// }
-
}
\ No newline at end of file
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/Mocks.kt b/app/src/main/java/me/yifeiyuan/flapdev/Mocks.kt
index e37583b71..7c53fb311 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/Mocks.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/Mocks.kt
@@ -1,9 +1,8 @@
package me.yifeiyuan.flapdev
-import me.yifeiyuan.flap.FlapAdapter
import me.yifeiyuan.flap.ktmodule.KtComponentModel
import me.yifeiyuan.flapdev.components.*
-import me.yifeiyuan.flapdev.components.databindingsample.SimpleDataBindingModel
+import me.yifeiyuan.flapdev.components.SimpleDataBindingModel
import me.yifeiyuan.flapdev.components.generictest.GenericModel
import me.yifeiyuan.ktx.foundation.othermodule.JavaModuleModel
import me.yifeiyuan.ktx.foundation.othermodule.vb.ViewBindingModel
@@ -13,14 +12,6 @@ import java.util.*
* Created by 程序亦非猿 on 2021/9/28.
*/
-fun FlapAdapter.mockData() {
- setData(mockMultiTypeModels())
-}
-
-fun FlapAdapter.appendMockData() {
- appendData(mockMultiTypeModels())
-}
-
/**
* 测试多类型数据
*/
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/components/CustomViewTypeComponent.kt b/app/src/main/java/me/yifeiyuan/flapdev/components/CustomViewTypeComponent.kt
index f871a2bef..06479762c 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/components/CustomViewTypeComponent.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/components/CustomViewTypeComponent.kt
@@ -38,8 +38,4 @@ class CustomViewTypeComponentDelegate : AdapterDelegate(binding.getRoot()) {
+
+ override fun onBind(model: SimpleDataBindingModel?) {
+ binding.model = model
+ binding.executePendingBindings()
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/components/DiffComponent.kt b/app/src/main/java/me/yifeiyuan/flapdev/components/DiffComponent.kt
index 11a2e86cd..6522e1eb9 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/components/DiffComponent.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/components/DiffComponent.kt
@@ -51,38 +51,13 @@ class DiffComponent(view: View) : Component(view) {
override fun onBind(model: TestDiffModel, position: Int, payloads: List, adapter: FlapAdapter, delegate: AdapterDelegate<*, *>) {
- if (payloads.isNotEmpty()) {
- bindTextView(R.id.content) {
- text = "展示 content :${payloads.get(0)}"
- }
-
- //当 payloads 更新时,事件点击需要重新设置
- bindButton(R.id.modifyContent) {
- setOnClickListener {
- model.content = "修改后 Content:" + (SystemClock.uptimeMillis() % 10000).toInt().toString()
- adapter.notifyItemChanged(position)
- }
- }
-
- bindButton(R.id.modifyId) {
- setOnClickListener {
- model.id = (SystemClock.uptimeMillis() % 10000).toInt()
- adapter.notifyItemChanged(position)
- }
+ //当 payloads 更新时,事件点击需要重新设置
+ bindButton(R.id.modifyContent) {
+ setOnClickListener {
+ model.content = "修改后 Content:" + (SystemClock.uptimeMillis() % 10000).toInt().toString()
+ adapter.notifyItemChanged(position, model.content)//不会闪
+// adapter.notifyItemChanged(position)//会闪
}
- return
- }
-
- bindTextView(R.id.content) {
- text = "展示 content :${model.content}"
- }
-
- bindTextView(R.id.id) {
- text = "展示 ID :${model.id}"
- }
-
- bindTextView(R.id.desc) {
- text = "展示 desc :${model.desc}"
}
bindButton(R.id.modifyId) {
@@ -92,10 +67,21 @@ class DiffComponent(view: View) : Component(view) {
}
}
- bindButton(R.id.modifyContent) {
- setOnClickListener {
- model.content = "修改后 Content:" + (SystemClock.uptimeMillis() % 10000).toInt().toString()
- adapter.notifyItemChanged(position)
+ if (payloads.isNotEmpty()) {
+ bindTextView(R.id.content) {
+ text = "展示 content :${payloads.get(0)}"
+ }
+ } else {
+ bindTextView(R.id.content) {
+ text = "展示 content :${model.content}"
+ }
+
+ bindTextView(R.id.id) {
+ text = "展示 ID :${model.id}"
+ }
+
+ bindTextView(R.id.desc) {
+ text = "展示 desc :${model.desc}"
}
}
}
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/components/databindingsample/SimpleDataBindingComponent.java b/app/src/main/java/me/yifeiyuan/flapdev/components/databindingsample/SimpleDataBindingComponent.java
deleted file mode 100644
index 4e629e065..000000000
--- a/app/src/main/java/me/yifeiyuan/flapdev/components/databindingsample/SimpleDataBindingComponent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package me.yifeiyuan.flapdev.components.databindingsample;
-
-import androidx.annotation.NonNull;
-
-import me.yifeiyuan.flap.Component;
-import me.yifeiyuan.flap.annotations.Delegate;
-import me.yifeiyuan.flapdev.databinding.FlapItemSimpleDatabindingBinding;
-
-/**
- * Flap Github: https://github.com/AlanCheen/Flap
- *
- * @author 程序亦非猿 [Follow me]( https://github.com/AlanCheen)
- * @since 2020/3/26 3:28 PM
- * @since 1.0
- */
-//@Delegate(layoutId = R.layout.flap_item_simple_databinding, useDataBinding = true)
-@Delegate(layoutName ="flap_item_simple_databinding", useDataBinding = true)
-public class SimpleDataBindingComponent extends Component {
-
- private FlapItemSimpleDatabindingBinding binding;
-
- public SimpleDataBindingComponent(@NonNull final FlapItemSimpleDatabindingBinding binding) {
- super(binding.getRoot());
- this.binding = binding;
- }
-
- @Override
- public void onBind(SimpleDataBindingModel model) {
- binding.setModel(model);
- binding.executePendingBindings();
- }
-}
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/components/databindingsample/SimpleDataBindingModel.java b/app/src/main/java/me/yifeiyuan/flapdev/components/databindingsample/SimpleDataBindingModel.java
deleted file mode 100644
index ca4bf56d7..000000000
--- a/app/src/main/java/me/yifeiyuan/flapdev/components/databindingsample/SimpleDataBindingModel.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package me.yifeiyuan.flapdev.components.databindingsample;
-
-/**
- * Flap Github: https://github.com/AlanCheen/Flap
- *
- * @author 程序亦非猿 [Follow me]( https://github.com/AlanCheen)
- * @since 2020/3/26 3:28 PM
- * @since 1.5
- */
-public class SimpleDataBindingModel {
-
- public String text = "该 Component 使用了 DataBinding";
-}
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/showcase/DiffAdapterTestcase.kt b/app/src/main/java/me/yifeiyuan/flapdev/showcase/FlapDifferAdapterTestcase.kt
similarity index 95%
rename from app/src/main/java/me/yifeiyuan/flapdev/showcase/DiffAdapterTestcase.kt
rename to app/src/main/java/me/yifeiyuan/flapdev/showcase/FlapDifferAdapterTestcase.kt
index 2471bc5ca..9eea02b01 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/showcase/DiffAdapterTestcase.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/showcase/FlapDifferAdapterTestcase.kt
@@ -16,12 +16,15 @@ import java.util.ArrayList
/**
+ * 测试 FlapDifferAdapter 功能
*
* 测试说明,点击按钮后,再下拉刷新,只有被修改了的数据才会有刷新动画
*
+ * @see FlapDifferAdapter
+ *
* Created by 程序亦非猿 on 2022/8/1.
*/
-class DiffAdapterTestcase : BaseTestcaseFragment() {
+class FlapDifferAdapterTestcase : BaseTestcaseFragment() {
//如果不测试 header footer,就注释掉 onViewCreated
// override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -58,10 +61,6 @@ class DiffAdapterTestcase : BaseTestcaseFragment() {
}
}
- override fun onInit(view: View) {
- super.onInit(view)
- }
-
override fun createRefreshData(size: Int): MutableList {
val list = mutableListOf()
repeat(20) {
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/showcase/FlapRecyclerViewTestcase.kt b/app/src/main/java/me/yifeiyuan/flapdev/showcase/FlapRecyclerViewTestcase.kt
index f09ec77b3..a4a467ac9 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/showcase/FlapRecyclerViewTestcase.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/showcase/FlapRecyclerViewTestcase.kt
@@ -66,7 +66,8 @@ class FlapRecyclerViewTestcase : BaseTestcaseFragment() {
override fun createRefreshData(size: Int): MutableList {
return super.createRefreshData(size).apply {
- add(0, ZeroHeightModel())
+ // 测试第一个 item 是 高度=0 的组件是否影响下拉刷新,结果应该是:依然能够下拉刷新。
+// add(0, ZeroHeightModel())
}
}
@@ -81,7 +82,7 @@ class FlapRecyclerViewTestcase : BaseTestcaseFragment() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.emptyData -> {
- flapRecyclerView.setData(createRefreshData(0))
+ flapRecyclerView.setData(mutableListOf())
}
R.id.resetData -> {
flapRecyclerView.setData(createRefreshData(30))
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/showcase/LayoutDelegateDSLTestcase.kt b/app/src/main/java/me/yifeiyuan/flapdev/showcase/LayoutDelegateDSLTestcase.kt
index cd4bc6b9a..e65022a7a 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/showcase/LayoutDelegateDSLTestcase.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/showcase/LayoutDelegateDSLTestcase.kt
@@ -44,11 +44,11 @@ class LayoutDelegateDSLTestcase : BaseTestcaseFragment() {
}
onViewAttachedToWindow {
- Log.d(TAG, "simpleTextDelegate onViewAttachedToWindow() called $position")
+ Log.d(TAG, "simpleTextDelegate onViewAttachedToWindow() called ,position=$position")
}
onViewDetachedFromWindow {
- Log.d(TAG, "simpleTextDelegate onViewDetachedFromWindow() called $position")
+ Log.d(TAG, "simpleTextDelegate onViewDetachedFromWindow() called ,position=$position")
}
onViewRecycled {
@@ -97,11 +97,11 @@ class LayoutDelegateDSLTestcase : BaseTestcaseFragment() {
}
onViewAttachedToWindow {
- Log.d(TAG, "testAllDelegate onViewAttachedToWindow() called $position")
+ Log.d(TAG, "testAllDelegate onViewAttachedToWindow() called ,position=$position")
}
onViewDetachedFromWindow {
- Log.d(TAG, "testAllDelegate onViewDetachedFromWindow() called $position")
+ Log.d(TAG, "testAllDelegate onViewDetachedFromWindow() called ,position=$position")
}
onViewRecycled {
diff --git a/app/src/main/java/me/yifeiyuan/flapdev/showcase/ViewPager2Testcase.kt b/app/src/main/java/me/yifeiyuan/flapdev/showcase/ViewPager2Testcase.kt
index 829575b4c..0ddf8dfea 100644
--- a/app/src/main/java/me/yifeiyuan/flapdev/showcase/ViewPager2Testcase.kt
+++ b/app/src/main/java/me/yifeiyuan/flapdev/showcase/ViewPager2Testcase.kt
@@ -47,7 +47,7 @@ class ViewPager2Testcase : Fragment(), Scrollable {
* java.lang.IllegalStateException: Pages must fill the whole ViewPager2 (use match_parent)
* at androidx.viewpager2.widget.ViewPager2$4.onChildViewAttachedToWindow(ViewPager2.java:270)
*/
- doOnCreateViewHolderEnd { delegate, viewType, component ->
+ doOnCreateViewHolderEnd { adapter, delegate, viewType, component ->
component.itemView.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
}
diff --git a/app/src/main/res/layout/activity_differ.xml b/app/src/main/res/layout/activity_differ.xml
deleted file mode 100644
index 939c5ea69..000000000
--- a/app/src/main/res/layout/activity_differ.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/flap_item_simple_databinding.xml b/app/src/main/res/layout/flap_item_simple_databinding.xml
index 21c835366..6a892bc1d 100644
--- a/app/src/main/res/layout/flap_item_simple_databinding.xml
+++ b/app/src/main/res/layout/flap_item_simple_databinding.xml
@@ -5,7 +5,7 @@
+ type="me.yifeiyuan.flapdev.components.SimpleDataBindingModel" />
diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml
index ec34b82c0..11598e1aa 100644
--- a/app/src/main/res/menu/activity_main_drawer.xml
+++ b/app/src/main/res/menu/activity_main_drawer.xml
@@ -10,12 +10,12 @@
android:icon="@drawable/ic_menu_send"
android:title="多类型" />
+ android:title="FlapDifferAdapter" />
diff --git a/assets/flap-simple-showcase.png b/assets/flap-simple-showcase.png
index bcc61f602..d2f914094 100644
Binary files a/assets/flap-simple-showcase.png and b/assets/flap-simple-showcase.png differ
diff --git a/assets/personal-wechat.JPG b/assets/personal-wechat.JPG
deleted file mode 100644
index 2cdf31fa7..000000000
Binary files a/assets/personal-wechat.JPG and /dev/null differ
diff --git a/assets/public-wechat.jpeg b/assets/public-wechat.jpeg
deleted file mode 100644
index 2cfc4c6c1..000000000
Binary files a/assets/public-wechat.jpeg and /dev/null differ
diff --git a/build.gradle b/build.gradle
index ca49e9692..5c7e98358 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,13 +15,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
-
- //jcenter 时代用的
-// classpath "guru.stefma.bintrayrelease:bintrayrelease:1.1.1"
-// classpath 'com.novoda:bintray-release:0.9'
- //jcenter 时代用的
}
}
diff --git a/flap-annotations/build.gradle b/flap-annotations/build.gradle
index 469796c2c..4c0369be6 100644
--- a/flap-annotations/build.gradle
+++ b/flap-annotations/build.gradle
@@ -9,16 +9,4 @@ dependencies {
}
sourceCompatibility = "7"
-targetCompatibility = "7"
-
-
-//apply plugin: 'com.novoda.bintray-release'
-//
-//publish {
-// userOrg = 'alancheen'
-// groupId = 'me.yifeiyuan.flap'
-// artifactId = 'flap-annotations'
-// publishVersion = '2.2.0'
-// desc = 'flap annotations'
-// website = 'https://github.com/AlanCheen/Flap'
-//}
\ No newline at end of file
+targetCompatibility = "7"
\ No newline at end of file
diff --git a/flap-compiler/build.gradle b/flap-compiler/build.gradle
index e656c30c2..98cb066bf 100644
--- a/flap-compiler/build.gradle
+++ b/flap-compiler/build.gradle
@@ -15,15 +15,4 @@ dependencies {
}
sourceCompatibility = "7"
-targetCompatibility = "7"
-//
-//apply plugin: 'com.novoda.bintray-release'
-//
-//publish {
-// userOrg = 'alancheen'
-// groupId = 'me.yifeiyuan.flap'
-// artifactId = 'flap-compiler'
-// publishVersion = '2.2.0'
-// desc = 'flap annotations'
-// website = 'https://github.com/AlanCheen/Flap'
-//}
\ No newline at end of file
+targetCompatibility = "7"
\ No newline at end of file
diff --git a/flap-gradle-plugin/build.gradle b/flap-gradle-plugin/build.gradle
index d5142f946..dd4fcb89e 100644
--- a/flap-gradle-plugin/build.gradle
+++ b/flap-gradle-plugin/build.gradle
@@ -19,34 +19,4 @@ targetCompatibility = "1.8"
repositories {
mavenCentral()
-}
-
-//publishing {
-//
-// publications {
-//
-// mavenJava(MavenPublication) {
-// artifactId = 'plugin'
-// groupId = 'me.yifeiyuan.flap'
-// from components.java
-// version = '1.0.2'
-// }
-// }
-//
-// repositories {
-// maven {
-// url = "$rootProject.projectDir/repos"
-// }
-// }
-//}
-//
-//apply plugin: 'com.novoda.bintray-release'
-//
-//publish {
-// userOrg = 'alancheen'
-// groupId = 'me.yifeiyuan.flap'
-// artifactId = 'plugin'
-// publishVersion = '1.1.0-test'
-// desc = 'flap plugin'
-// website = 'https://github.com/AlanCheen/Flap'
-//}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/flap/build.gradle b/flap/build.gradle
index e2051e60e..5180ff8a4 100644
--- a/flap/build.gradle
+++ b/flap/build.gradle
@@ -38,21 +38,4 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation project(':flap-annotations')
-}
-
-//apply plugin: "guru.stefma.bintrayrelease"
-//
-//version = "3.0.0"
-//group = "me.yifeiyuan.flap"
-//androidArtifact {
-// artifactId = "flap"
-//}
-//publish {
-// userOrg = 'alancheen'
-// dryRun = false
-// desc = 'Flap'
-// website = 'https://github.com/AlanCheen/Flap'
-//}
-//repositories {
-// mavenCentral()
-//}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/flap/src/main/java/me/yifeiyuan/flap/Component.kt b/flap/src/main/java/me/yifeiyuan/flap/Component.kt
index f0dfb83f9..fc91e7ae4 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/Component.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/Component.kt
@@ -1,3 +1,5 @@
+@file:Suppress("MemberVisibilityCanBePrivate")
+
package me.yifeiyuan.flap
import android.content.Context
diff --git a/flap/src/main/java/me/yifeiyuan/flap/Flap.kt b/flap/src/main/java/me/yifeiyuan/flap/Flap.kt
index 762f1467c..11bac3872 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/Flap.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/Flap.kt
@@ -1,13 +1,12 @@
package me.yifeiyuan.flap
-import android.app.Application
import android.content.ComponentCallbacks2
import android.content.Context
import android.content.res.Configuration
import me.yifeiyuan.flap.delegate.AdapterDelegate
import me.yifeiyuan.flap.delegate.FallbackAdapterDelegate
-import me.yifeiyuan.flap.hook.AdapterHook
import me.yifeiyuan.flap.ext.FlapComponentPool
+import me.yifeiyuan.flap.hook.AdapterHook
/**
* Flap Github: https://github.com/AlanCheen/Flap
diff --git a/flap/src/main/java/me/yifeiyuan/flap/FlapAdapter.kt b/flap/src/main/java/me/yifeiyuan/flap/FlapAdapter.kt
index 75251808f..ebec3f13a 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/FlapAdapter.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/FlapAdapter.kt
@@ -1,4 +1,4 @@
-@file:Suppress("MemberVisibilityCanBePrivate")
+@file:Suppress("MemberVisibilityCanBePrivate","unused")
package me.yifeiyuan.flap
@@ -58,7 +58,7 @@ open class FlapAdapter : RecyclerView.Adapter>(), IRegistry {
private val adapterDelegates: MutableList> = mutableListOf()
- private val hooks: MutableList = mutableListOf()
+ private val hooks: MutableList = mutableListOf()
/**
* RecyclerView 滑动到底部触发预加载
diff --git a/flap/src/main/java/me/yifeiyuan/flap/FlapDebug.kt b/flap/src/main/java/me/yifeiyuan/flap/FlapDebug.kt
index be79738d2..3f8e94d6b 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/FlapDebug.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/FlapDebug.kt
@@ -20,7 +20,7 @@ object FlapDebug {
var isDebug = false
- fun e(tag: String, msg: String?, tr: Throwable?=null) {
+ fun e(tag: String, msg: String?, tr: Throwable? = null) {
if (isDebug) {
Log.e("$TAG-$tag", msg, tr)
}
@@ -32,9 +32,4 @@ object FlapDebug {
}
}
- fun w(tag: String, msg: String?) {
- if (isDebug) {
- Log.w("$TAG-$tag", msg)
- }
- }
}
\ No newline at end of file
diff --git a/flap/src/main/java/me/yifeiyuan/flap/delegate/AdapterDelegate.kt b/flap/src/main/java/me/yifeiyuan/flap/delegate/AdapterDelegate.kt
index 0f6984357..792438a98 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/delegate/AdapterDelegate.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/delegate/AdapterDelegate.kt
@@ -2,7 +2,6 @@ package me.yifeiyuan.flap.delegate
import android.view.LayoutInflater
import android.view.ViewGroup
-import androidx.annotation.CallSuper
import androidx.recyclerview.widget.RecyclerView
import me.yifeiyuan.flap.Component
import me.yifeiyuan.flap.FlapAdapter
diff --git a/flap/src/main/java/me/yifeiyuan/flap/delegate/FallbackAdapterDelegate.kt b/flap/src/main/java/me/yifeiyuan/flap/delegate/FallbackAdapterDelegate.kt
index 7170c582b..b5194d17c 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/delegate/FallbackAdapterDelegate.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/delegate/FallbackAdapterDelegate.kt
@@ -17,8 +17,8 @@ import me.yifeiyuan.flap.FlapDebug
*
* 开发者也可以自己定义自己的 FallbackAdapterDelegate。
*
- * @see Flap.globalDefaultAdapterDelegate
- * @see FlapAdapter.defaultAdapterDelegate
+ * @see me.yifeiyuan.flap.Flap.globalDefaultAdapterDelegate
+ * @see me.yifeiyuan.flap.FlapAdapter.defaultAdapterDelegate
* @see FallbackComponent
*
* Created by 程序亦非猿 on 2021/9/22.
diff --git a/flap/src/main/java/me/yifeiyuan/flap/delegate/LayoutAdapterDelegate.kt b/flap/src/main/java/me/yifeiyuan/flap/delegate/LayoutAdapterDelegate.kt
index 3e27794db..bdb3b138a 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/delegate/LayoutAdapterDelegate.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/delegate/LayoutAdapterDelegate.kt
@@ -29,7 +29,7 @@ import me.yifeiyuan.flap.R
*/
class LayoutAdapterDelegate> : AdapterDelegate {
- var config: LayoutAdapterDelegateConfig = LayoutAdapterDelegateConfig()
+ private var config: LayoutAdapterDelegateConfig = LayoutAdapterDelegateConfig()
/**
* 最简单的构造,只关心简单的 onBind
@@ -107,6 +107,22 @@ class LayoutAdapterDelegate> : AdapterDelegate {
super.onViewRecycled(adapter, component)
config.onViewRecycled?.invoke(component as Component, adapter)
}
+
+ internal fun componentOnResume(component: Component<*>, owner: LifecycleOwner) {
+ config.onResume?.invoke(component as Component)
+ }
+
+ internal fun componentOnPause(component: Component<*>, owner: LifecycleOwner) {
+ config.onPause?.invoke(component as Component)
+ }
+
+ internal fun componentOnStop(component: Component<*>, owner: LifecycleOwner) {
+ config.onStop?.invoke(component as Component)
+ }
+
+ internal fun componentOnDestroy(component: Component<*>, owner: LifecycleOwner) {
+ config.onDestroy?.invoke(component as Component)
+ }
}
class LayoutComponent(view: View) : Component(view) {
@@ -116,22 +132,22 @@ class LayoutComponent(view: View) : Component(view) {
override fun onResume(owner: LifecycleOwner) {
super.onResume(owner)
- getLayoutAdapterDelegateByTag()?.config?.onResume?.invoke(this as Component)
+ getLayoutAdapterDelegateByTag()?.componentOnResume(this, owner)
}
override fun onPause(owner: LifecycleOwner) {
super.onPause(owner)
- getLayoutAdapterDelegateByTag()?.config?.onPause?.invoke(this as Component)
+ getLayoutAdapterDelegateByTag()?.componentOnPause(this, owner)
}
override fun onStop(owner: LifecycleOwner) {
super.onStop(owner)
- getLayoutAdapterDelegateByTag()?.config?.onStop?.invoke(this as Component)
+ getLayoutAdapterDelegateByTag()?.componentOnStop(this, owner)
}
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
- getLayoutAdapterDelegateByTag()?.config?.onDestroy?.invoke(this as Component)
+ getLayoutAdapterDelegateByTag()?.componentOnDestroy(this, owner)
}
private fun getLayoutAdapterDelegateByTag(): LayoutAdapterDelegate<*, *>? {
@@ -141,7 +157,7 @@ class LayoutComponent(view: View) : Component(view) {
class LayoutAdapterDelegateConfig {
- var modelClass: Class<*>? = null
+ var modelClass: Class? = null
/**
* 资源文件 layout id
@@ -163,11 +179,10 @@ class LayoutAdapterDelegateConfig {
var onViewAttachedToWindow: (Component.() -> Unit)? = null
var onViewDetachedFromWindow: (Component.() -> Unit)? = null
- //TODO 为什么不能使用 Component.() -> Unit? Required Nothing but xx?
- var onResume: (Component<*>.() -> Unit)? = null
- var onPause: (Component<*>.() -> Unit)? = null
- var onStop: (Component<*>.() -> Unit)? = null
- var onDestroy: (Component<*>.() -> Unit)? = null
+ var onResume: (Component.() -> Unit)? = null
+ var onPause: (Component.() -> Unit)? = null
+ var onStop: (Component.() -> Unit)? = null
+ var onDestroy: (Component.() -> Unit)? = null
var onViewRecycled: (Component.(adapter: FlapAdapter) -> Unit)? = null
var onFailedToRecycleView: (Component.(adapter: FlapAdapter) -> Boolean)? = null
@@ -181,5 +196,4 @@ class LayoutAdapterDelegateConfig {
* 长按事件
*/
var onLongClickListener: (Component.(model: T, position: Int, adapter: FlapAdapter) -> Boolean)? = null
-
}
\ No newline at end of file
diff --git a/flap/src/main/java/me/yifeiyuan/flap/delegate/LayoutAdapterDelegateDSL.kt b/flap/src/main/java/me/yifeiyuan/flap/delegate/LayoutAdapterDelegateDSL.kt
index 4a2db4811..60a2724a9 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/delegate/LayoutAdapterDelegateDSL.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/delegate/LayoutAdapterDelegateDSL.kt
@@ -1,3 +1,5 @@
+@file:Suppress("unused")
+
package me.yifeiyuan.flap.delegate
import androidx.recyclerview.widget.RecyclerView
@@ -16,6 +18,7 @@ import me.yifeiyuan.flap.FlapAdapter
*
* @param modelClass 要代理的模型类
* @param layoutId 布局id
+ * @since 3.0.0
*/
class LayoutAdapterDelegateBuilder(private var modelClass: Class, var layoutId: Int = 0) {
@@ -36,10 +39,10 @@ class LayoutAdapterDelegateBuilder(private var modelClass: Class, var layo
private var onViewRecycled: (Component.(adapter: FlapAdapter) -> Unit)? = null
private var onFailedToRecycleView: (Component.(adapter: FlapAdapter) -> Boolean)? = null
- private var onResume: (Component<*>.() -> Unit)? = null
- private var onPause: (Component<*>.() -> Unit)? = null
- private var onStop: (Component<*>.() -> Unit)? = null
- private var onDestroy: (Component<*>.() -> Unit)? = null
+ private var onResume: (Component.() -> Unit)? = null
+ private var onPause: (Component.() -> Unit)? = null
+ private var onStop: (Component.() -> Unit)? = null
+ private var onDestroy: (Component.() -> Unit)? = null
/**
* 单击事件
@@ -89,19 +92,19 @@ class LayoutAdapterDelegateBuilder(private var modelClass: Class, var layo
onFailedToRecycleView = block
}
- fun onResume(block: (Component<*>.() -> Unit)) {
+ fun onResume(block: (Component.() -> Unit)) {
onResume = block
}
- fun onPause(block: (Component<*>.() -> Unit)) {
+ fun onPause(block: (Component.() -> Unit)) {
onPause = block
}
- fun onStop(block: (Component<*>.() -> Unit)) {
+ fun onStop(block: (Component.() -> Unit)) {
onStop = block
}
- fun onDestroy(block: (Component<*>.() -> Unit)) {
+ fun onDestroy(block: (Component.() -> Unit)) {
onDestroy = block
}
@@ -127,5 +130,5 @@ class LayoutAdapterDelegateBuilder(private var modelClass: Class, var layo
}
inline fun makeDelegate(layoutId: Int, builder: LayoutAdapterDelegateBuilder.() -> Unit): LayoutAdapterDelegate> {
- return LayoutAdapterDelegateBuilder(T::class.java, layoutId).apply(builder).build()
+ return LayoutAdapterDelegateBuilder(T::class.java, layoutId).apply(builder).build()
}
\ No newline at end of file
diff --git a/flap/src/main/java/me/yifeiyuan/flap/differ/FlapDifferAdapter.kt b/flap/src/main/java/me/yifeiyuan/flap/differ/FlapDifferAdapter.kt
index d3a32e11a..515535d5e 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/differ/FlapDifferAdapter.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/differ/FlapDifferAdapter.kt
@@ -1,3 +1,4 @@
+@file:Suppress("unused")
package me.yifeiyuan.flap.differ
import android.annotation.SuppressLint
@@ -18,7 +19,7 @@ import java.util.*
* Flap Github: https://github.com/AlanCheen/Flap
* @author 程序亦非猿 [Follow me]( https://github.com/AlanCheen)
* @since 2020/9/22
- * @since 3.0
+ * @since 3.0.0
*/
class FlapDifferAdapter : FlapAdapter {
@@ -38,7 +39,7 @@ class FlapDifferAdapter : FlapAdapter {
if (oldItem is IDiffer) {
return oldItem.areContentsTheSame(newItem)
}
- return oldItem.equals(newItem)
+ return oldItem == newItem
}
override fun getChangePayload(oldItem: T, newItem: T): Any? {
diff --git a/flap/src/main/java/me/yifeiyuan/flap/ext/Extendtions.kt b/flap/src/main/java/me/yifeiyuan/flap/ext/Extendtions.kt
index 5dfa1e684..200e5c997 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/ext/Extendtions.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/ext/Extendtions.kt
@@ -1,3 +1,5 @@
+@file:Suppress("unused")
+
package me.yifeiyuan.flap.ext
import me.yifeiyuan.flap.Component
@@ -12,38 +14,57 @@ import me.yifeiyuan.flap.hook.AdapterHook
* @since 3.0.0
*/
-fun FlapAdapter.doOnCreateViewHolderStart(block: (delegate: AdapterDelegate<*, *>, viewType: Int) -> Unit) {
+/**
+ * 在 onCreateViewHolder 之前回调
+ * @see doOnCreateViewHolderEnd
+ */
+fun FlapAdapter.doOnCreateViewHolderStart(block: (adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, viewType: Int) -> Unit) {
registerAdapterHook(object : AdapterHook {
override fun onCreateViewHolderStart(adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, viewType: Int) {
- block.invoke(delegate, viewType)
+ block.invoke(adapter, delegate, viewType)
}
})
}
-fun FlapAdapter.doOnCreateViewHolderEnd(block: (delegate: AdapterDelegate<*, *>, viewType: Int, component: Component<*>) -> Unit) {
+/**
+ * 在 onCreateViewHolder 之后回调
+ * @see doOnCreateViewHolderStart
+ */
+fun FlapAdapter.doOnCreateViewHolderEnd(block: (adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, viewType: Int, component: Component<*>) -> Unit) {
registerAdapterHook(object : AdapterHook {
override fun onCreateViewHolderEnd(adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, viewType: Int, component: Component<*>) {
- block.invoke(delegate, viewType, component)
+ block.invoke(adapter, delegate, viewType, component)
}
})
}
-fun FlapAdapter.doOnBindViewHolderStart(block: (delegate: AdapterDelegate<*, *>, component: Component<*>, data: Any, position: Int, payloads: MutableList) -> Unit) {
+/**
+ * 在 onBindViewHolder 之前回调
+ * @see doOnBindViewHolderEnd
+ */
+fun FlapAdapter.doOnBindViewHolderStart(block: (adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, component: Component<*>, data: Any, position: Int, payloads: MutableList) -> Unit) {
registerAdapterHook(object : AdapterHook {
override fun onBindViewHolderStart(adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, component: Component<*>, data: Any, position: Int, payloads: MutableList) {
- block.invoke(delegate, component, data, position, payloads)
+ block.invoke(adapter, delegate, component, data, position, payloads)
}
})
}
-fun FlapAdapter.doOnBindViewHolderEnd(block: (delegate: AdapterDelegate<*, *>, component: Component<*>, data: Any, position: Int, payloads: MutableList) -> Unit) {
+/**
+ * 在 onBindViewHolder 之后回调
+ * @see doOnBindViewHolderStart
+ */
+fun FlapAdapter.doOnBindViewHolderEnd(block: (adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, component: Component<*>, data: Any, position: Int, payloads: MutableList) -> Unit) {
registerAdapterHook(object : AdapterHook {
override fun onBindViewHolderEnd(adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, component: Component<*>, data: Any, position: Int, payloads: MutableList) {
- block.invoke(delegate, component, data, position, payloads)
+ block.invoke(adapter, delegate, component, data, position, payloads)
}
})
}
+/**
+ * @see doOnViewAttachedFromWindow
+ */
fun FlapAdapter.doOnViewDetachedFromWindow(block: (adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, component: Component<*>) -> Unit) {
registerAdapterHook(object : AdapterHook {
override fun onViewDetachedFromWindow(adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, component: Component<*>) {
@@ -52,6 +73,9 @@ fun FlapAdapter.doOnViewDetachedFromWindow(block: (adapter: FlapAdapter, delegat
})
}
+/**
+ * @see doOnViewDetachedFromWindow
+ */
fun FlapAdapter.doOnViewAttachedFromWindow(block: (adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, component: Component<*>) -> Unit) {
registerAdapterHook(object : AdapterHook {
override fun onViewAttachedToWindow(adapter: FlapAdapter, delegate: AdapterDelegate<*, *>, component: Component<*>) {
diff --git a/flap/src/main/java/me/yifeiyuan/flap/ext/FlapComponentPool.kt b/flap/src/main/java/me/yifeiyuan/flap/ext/FlapComponentPool.kt
index b9617341b..8d023ef20 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/ext/FlapComponentPool.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/ext/FlapComponentPool.kt
@@ -2,7 +2,6 @@ package me.yifeiyuan.flap.ext
import android.content.ComponentCallbacks2
import android.content.res.Configuration
-import android.util.Log
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.RecycledViewPool
import me.yifeiyuan.flap.FlapDebug
diff --git a/flap/src/main/java/me/yifeiyuan/flap/ext/HeaderFooterAdapter.kt b/flap/src/main/java/me/yifeiyuan/flap/ext/HeaderFooterAdapter.kt
index cd023a31b..0275d39ed 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/ext/HeaderFooterAdapter.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/ext/HeaderFooterAdapter.kt
@@ -1,10 +1,8 @@
package me.yifeiyuan.flap.ext
-import android.util.Log
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
-import me.yifeiyuan.flap.FlapDebug
const val ITEM_VIEW_TYPE_HEADER = 2123321000
const val ITEM_VIEW_TYPE_FOOTER = 2123321001
@@ -13,8 +11,6 @@ class HeaderViewHolder(view: View) : RecyclerView.ViewHolder(view)
class FooterViewHolder(view: View) : RecyclerView.ViewHolder(view)
-private const val TAG = "HeaderFooterAdapter"
-
/**
* 一个支持设置 header 和 footer 的包装类 Adapter
*
@@ -33,27 +29,22 @@ class HeaderFooterAdapter createTimeCostThreshold) {
onCreateAlarm(adapter, delegate, viewType, component, cost)
diff --git a/flap/src/main/java/me/yifeiyuan/flap/widget/FlapRecyclerView.kt b/flap/src/main/java/me/yifeiyuan/flap/widget/FlapRecyclerView.kt
index dca463844..912c21d07 100644
--- a/flap/src/main/java/me/yifeiyuan/flap/widget/FlapRecyclerView.kt
+++ b/flap/src/main/java/me/yifeiyuan/flap/widget/FlapRecyclerView.kt
@@ -1,8 +1,9 @@
+@file:Suppress("LeakingThis", "unused", "CascadeIf")
+
package me.yifeiyuan.flap.widget
import android.content.Context
import android.util.AttributeSet
-import android.view.View
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
@@ -10,10 +11,8 @@ import androidx.lifecycle.OnLifecycleEvent
import androidx.recyclerview.widget.*
import me.yifeiyuan.flap.FlapAdapter
import me.yifeiyuan.flap.R
-import me.yifeiyuan.flap.differ.IDiffer
import me.yifeiyuan.flap.differ.FlapDifferAdapter
-import me.yifeiyuan.flap.ext.OnItemClickListener
-import me.yifeiyuan.flap.ext.OnItemLongClickListener
+import me.yifeiyuan.flap.differ.IDiffer
/**
* 为 Flap 定制的 RecyclerView,和 Flap 的 Adapters 和 LayoutManagers 是深度绑定的。
@@ -116,8 +115,7 @@ open class FlapRecyclerView
}
flapAdapter = if (useDifferAdapter) FlapDifferAdapter() else FlapAdapter()
-
- setAdapter(flapAdapter)
+ adapter = flapAdapter
}
/**
@@ -172,8 +170,7 @@ open class FlapRecyclerView
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
fun onDestroy(owner: LifecycleOwner) {
owner.lifecycle.removeObserver(this)
-// flapAdapter?.onDetachedFromRecyclerView(this)
- setAdapter(null)
+ adapter = null
}
/**
diff --git a/ktmodule/src/main/java/me/yifeiyuan/flap/ktmodule/KtComponentModel.kt b/ktmodule/src/main/java/me/yifeiyuan/flap/ktmodule/KtComponentModel.kt
deleted file mode 100644
index d3b9def6c..000000000
--- a/ktmodule/src/main/java/me/yifeiyuan/flap/ktmodule/KtComponentModel.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package me.yifeiyuan.flap.ktmodule
-
-/**
- * Created by 程序亦非猿 on 2020/9/30.
- */
-class KtComponentModel {
-}
\ No newline at end of file
diff --git a/ktmodule/src/main/java/me/yifeiyuan/flap/ktmodule/KtModuleComponent.kt b/ktmodule/src/main/java/me/yifeiyuan/flap/ktmodule/KtModuleComponent.kt
index 8a5e6e395..a8f5b9c83 100644
--- a/ktmodule/src/main/java/me/yifeiyuan/flap/ktmodule/KtModuleComponent.kt
+++ b/ktmodule/src/main/java/me/yifeiyuan/flap/ktmodule/KtModuleComponent.kt
@@ -10,6 +10,9 @@ import me.yifeiyuan.flap.annotations.Delegate
/**
* Created by 程序亦非猿 on 2020/9/30.
*/
+
+class KtComponentModel
+
@Delegate(layoutName = "kt_module_component")
class KtModuleComponent(itemView: View) : Component(itemView) {
diff --git a/othermodule/src/main/java/me/yifeiyuan/ktx/foundation/othermodule/vb/ViewBindingComponent.kt b/othermodule/src/main/java/me/yifeiyuan/ktx/foundation/othermodule/vb/ViewBindingComponent.kt
index a89d84e83..53e3c9a65 100644
--- a/othermodule/src/main/java/me/yifeiyuan/ktx/foundation/othermodule/vb/ViewBindingComponent.kt
+++ b/othermodule/src/main/java/me/yifeiyuan/ktx/foundation/othermodule/vb/ViewBindingComponent.kt
@@ -14,6 +14,9 @@ import me.yifeiyuan.ktx.foundation.othermodule.databinding.FlapItemVbBinding
* 使用 ViewBinding 的例子
* Created by 程序亦非猿 on 2020/9/30.
*/
+
+class ViewBindingModel
+
@Delegate(layoutName = "flap_item_vb", useViewBinding = true)
class ViewBindingComponent(var binding: FlapItemVbBinding) : Component(binding.root) {
diff --git a/othermodule/src/main/java/me/yifeiyuan/ktx/foundation/othermodule/vb/ViewBindingModel.java b/othermodule/src/main/java/me/yifeiyuan/ktx/foundation/othermodule/vb/ViewBindingModel.java
deleted file mode 100644
index 23c30566c..000000000
--- a/othermodule/src/main/java/me/yifeiyuan/ktx/foundation/othermodule/vb/ViewBindingModel.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package me.yifeiyuan.ktx.foundation.othermodule.vb;
-
-/**
- * Created by 程序亦非猿 on 2020/9/30.
- */
-public class ViewBindingModel {
-}