Git Product home page Git Product logo

Comments (5)

KevinChang007 avatar KevinChang007 commented on July 17, 2024

BaseVmDbFragment 和 BaseVmFragment 也是一样的问题。
没有继承有特殊情况的考虑吗?

from jetpackmvvm.

hegaojian avatar hegaojian commented on July 17, 2024

abstract class BaseVmDbActivity<VM : BaseViewModel, DB : ViewDataBinding> : AppCompatActivity() { 兄弟你是不是看错了,我的BaseVmDbActivity没有继承BaseVmActivity啊,你拉下代码看看

from jetpackmvvm.

KevinChang007 avatar KevinChang007 commented on July 17, 2024

我没写清楚,上面的代码是我改过后的。源代码为什么不继承呢 ?有特殊考虑吗

from jetpackmvvm.

KevinChang007 avatar KevinChang007 commented on July 17, 2024

BaseViewModelExt.kt 中也有较多重复的代码!  ̄□ ̄||

from jetpackmvvm.

hegaojian avatar hegaojian commented on July 17, 2024

因为当时考虑到有些人不想用Databinding,所以写了2种基类,
BaseVmDbActivity支持ViewModel,Databinding的泛型传入
BaseVmActivity仅有ViewModel,将Databinding相关的代码给去掉了
但是经你这么一说,这么写确实显得太low了,BaseVmDbActivity可以直接继承BaseVmActivity就好了,能减少很多重复代码,也好维护了...... 当时可能脑子抽了吧,没想到这一层:satisfied::satisfied::satisfied:

from jetpackmvvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.