-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
235 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Quick/src/main/java/com/wpf/app/quick/activity/QuickBindingFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.wpf.app.quick.activity | ||
|
||
import androidx.annotation.LayoutRes | ||
import androidx.databinding.ViewDataBinding | ||
import com.wpf.app.quick.activity.viewmodel.QuickVBModel | ||
|
||
/** | ||
* Created by 王朋飞 on 2024/01/09 | ||
* | ||
*/ | ||
abstract class QuickBindingFragment<VB : ViewDataBinding> @JvmOverloads constructor( | ||
@LayoutRes layoutId: Int = 0, | ||
titleName: String = "" | ||
) : QuickVBFragment<QuickVBModel<VB>, VB>(layoutId, titleName = titleName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 3 additions & 11 deletions
14
app/src/main/java/com/wpf/app/quick/demo/RequestTestActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
package com.wpf.app.quick.demo | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import com.wpf.app.quick.activity.QuickVBActivity | ||
import com.wpf.app.quick.annotations.getclass.GetClass | ||
import com.wpf.app.quick.demo.databinding.ActivityRequestTestBinding | ||
import com.wpf.app.quick.demo.viewmodel.RequestTestModel | ||
import com.wpf.app.quickbind.quickview.helper.GotoThis | ||
|
||
@GetClass | ||
class RequestTestActivity : QuickVBActivity<RequestTestModel, ActivityRequestTestBinding>( | ||
R.layout.activity_request_test, | ||
titleName = "接口测试页" | ||
) { | ||
class GotoRequestTest( | ||
mContext: Context, | ||
attributeSet: AttributeSet? = null, | ||
): GotoThis( | ||
mContext, attributeSet, "接口请求测试", RequestTestActivity::class.java | ||
) | ||
} | ||
) |
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/wpf/app/quick/demo/ShadowViewTestActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.wpf.app.quick.demo | ||
|
||
import android.annotation.SuppressLint | ||
import androidx.core.view.isVisible | ||
import com.wpf.app.quick.activity.QuickBindingActivity | ||
import com.wpf.app.quick.annotations.getclass.GetClass | ||
import com.wpf.app.quick.demo.databinding.ActivityShadowTestBinding | ||
import com.wpf.app.quickutil.TimeDelayHelper | ||
import com.wpf.app.quickutil.other.toColor | ||
|
||
@GetClass | ||
class ShadowViewTestActivity: QuickBindingActivity<ActivityShadowTestBinding>( | ||
R.layout.activity_shadow_test, | ||
titleName = "同步测试页" | ||
) { | ||
@SuppressLint("SetTextI18n") | ||
override fun initView(view: ActivityShadowTestBinding?) { | ||
val colorList = arrayOf( | ||
R.color.black.toColor(requireContext()), | ||
R.color.colorPrimary.toColor(requireContext()), | ||
R.color.white.toColor(requireContext()) | ||
) | ||
var pos = 0 | ||
TimeDelayHelper.registerTimeDelay("1s", 1) { | ||
view?.shadow1?.post { | ||
val index = (pos++) % colorList.size | ||
view.shadow1.text = (index + 1).toString() | ||
val newColor = colorList[index] | ||
view.shadow1.setTextColor(newColor) | ||
view.shadow1.visibility | ||
} | ||
} | ||
view?.shadow6?.setOnCheckedChangeListener { _, isChecked -> | ||
view.shadow8.isVisible = isChecked | ||
} | ||
} | ||
} |
37 changes: 3 additions & 34 deletions
37
app/src/main/java/com/wpf/app/quick/demo/fragment/MainTestFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,10 @@ | ||
package com.wpf.app.quick.demo.fragment | ||
|
||
import android.annotation.SuppressLint | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.core.view.isVisible | ||
import com.wpf.app.quick.activity.QuickVBFragment | ||
import com.wpf.app.quick.activity.QuickBindingFragment | ||
import com.wpf.app.quick.demo.R | ||
import com.wpf.app.quick.demo.databinding.FragmentMainTestBinding | ||
import com.wpf.app.quickutil.LogUtil | ||
import com.wpf.app.quickutil.TimeDelayHelper | ||
import com.wpf.app.quickutil.other.toColor | ||
import java.util.Timer | ||
import java.util.TimerTask | ||
import kotlin.random.Random | ||
|
||
class MainTestFragment : QuickVBFragment<MainTestVM, FragmentMainTestBinding>( | ||
class MainTestFragment : QuickBindingFragment<FragmentMainTestBinding>( | ||
R.layout.fragment_main_test, | ||
titleName = "测试场" | ||
) { | ||
@SuppressLint("SetTextI18n") | ||
override fun initView(view: FragmentMainTestBinding?) { | ||
val colorList = arrayOf( | ||
R.color.black.toColor(requireContext()), | ||
R.color.colorPrimary.toColor(requireContext()), | ||
R.color.white.toColor(requireContext()) | ||
) | ||
var pos = 0 | ||
TimeDelayHelper.registerTimeDelay("1s", 1) { | ||
view?.shadow1?.post { | ||
val index = (pos++) % colorList.size | ||
view.shadow1.text = (index + 1).toString() | ||
val newColor = colorList[index] | ||
view.shadow1.setTextColor(newColor) | ||
view.shadow1.visibility | ||
} | ||
} | ||
view?.shadow6?.setOnCheckedChangeListener { _, isChecked -> | ||
view.shadow8.isVisible = isChecked | ||
} | ||
} | ||
} | ||
) |
10 changes: 0 additions & 10 deletions
10
app/src/main/java/com/wpf/app/quick/demo/fragment/MainTestVM.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.