Skip to content

Commit

Permalink
🎨 cleanup code;转换非必须的 java to kotlin code;减少非必须文件
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCheen committed Aug 9, 2022
1 parent c81be6d commit 6a7081a
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 134 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/me/yifeiyuan/flapdev/FlapApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class FlapApplication : MultiDexApplication() {
TestClickComponentAdapterDelegate(),
TestBinderComponentAdapterDelegate(),
TestAllComponentAdapterDelegate(),
SimpleDataBindingComponentAdapterDelegate(),
DataBindingComponentAdapterDelegate(),
DiffComponentAdapterDelegate(),
)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/me/yifeiyuan/flapdev/Mocks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package me.yifeiyuan.flapdev

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,4 @@ class CustomViewTypeComponentDelegate : AdapterDelegate<CustomViewTypeModel, Cus
override fun getItemViewType(model: Any): Int {
return CustomViewTypeComponent.CUSTOM_ITEM_VIEW_TYPE
}

override fun getItemId(model: Any): Long {
return super.getItemId(model)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package me.yifeiyuan.flapdev.components

import me.yifeiyuan.flap.Component
import me.yifeiyuan.flap.annotations.Delegate
import me.yifeiyuan.flapdev.databinding.FlapItemSimpleDatabindingBinding

/**
* 测试 DataBinding 功能
*
*
* Created by 程序亦非猿 on 2022/8/9.
*/

class SimpleDataBindingModel {
var text = "该 Component 使用了 DataBinding"
}

@Delegate(layoutName = "flap_item_simple_databinding", useDataBinding = true)
class DataBindingComponent(private var binding: FlapItemSimpleDatabindingBinding) : Component<SimpleDataBindingModel?>(binding.getRoot()) {

override fun onBind(model: SimpleDataBindingModel?) {
binding.model = model
binding.executePendingBindings()
}

}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ class DiffAdapterTestcase : BaseTestcaseFragment() {
}
}

override fun onInit(view: View) {
super.onInit(view)
}

override fun createRefreshData(size: Int): MutableList<Any> {
val list = mutableListOf<Any>()
repeat(20) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class FlapRecyclerViewTestcase : BaseTestcaseFragment() {

override fun createRefreshData(size: Int): MutableList<Any> {
return super.createRefreshData(size).apply {
add(0, ZeroHeightModel())
// 测试第一个 item 是 高度=0 的组件是否影响下拉刷新,结果应该是:依然能够下拉刷新。
// add(0, ZeroHeightModel())
}
}

Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/flap_item_simple_databinding.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<variable
name="model"
type="me.yifeiyuan.flapdev.components.databindingsample.SimpleDataBindingModel" />
type="me.yifeiyuan.flapdev.components.SimpleDataBindingModel" />

</data>

Expand Down
6 changes: 0 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 时代用的
}
}

Expand Down
14 changes: 1 addition & 13 deletions flap-annotations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
//}
targetCompatibility = "7"
13 changes: 1 addition & 12 deletions flap-compiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
//}
targetCompatibility = "7"
32 changes: 1 addition & 31 deletions flap-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
//}
}
2 changes: 2 additions & 0 deletions flap/src/main/java/me/yifeiyuan/flap/Component.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("MemberVisibilityCanBePrivate", "MemberVisibilityCanBePrivate", "MemberVisibilityCanBePrivate", "MemberVisibilityCanBePrivate", "MemberVisibilityCanBePrivate", "MemberVisibilityCanBePrivate", "MemberVisibilityCanBePrivate", "MemberVisibilityCanBePrivate")

package me.yifeiyuan.flap

import android.content.Context
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<KtComponentModel>(itemView) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ViewBindingModel>(binding.root) {

Expand Down

This file was deleted.

0 comments on commit 6a7081a

Please sign in to comment.