Code Monkey home page Code Monkey logo

Comments (3)

shifujun avatar shifujun commented on June 11, 2024

dialog或者其他view,如果是宿主提供的,它所需的资源也在宿主中,就应该让宿主inflate出来再交给插件使用。

要注意宿主和插件的多对多版本关系。如果不是通过稳定的Java接口相互调用,比如在插件中直接访问宿主的资源。那么可能在宿主的不同版本中这个资源就发生变化了。对于xml中依赖的资源id来说,就更不稳定了。所以插件inflate宿主的view在多对多版本模型下是不可行的。

from shadow.

Zjoke08 avatar Zjoke08 commented on June 11, 2024

dialog的layout以及其中的drawable均是宿主的。插件中仅调用了dialog.show()。Layout的Inflate是宿主创建的,并且能够创建成功,但是其宿主的Layout中如果使用了宿主的drawable,则会Resources$NotFoundException。
总结就是
宿主:
MDialog、Layout、Drawable。
插件:
仅调用new MDialog(ShadowContext).show()

按照你的说法,我需要单独实现一个接口,该接口调用宿主的弹窗创建能力?但是我的Context使用容器的Context还是哪个?

另外,我有一点不明白的是,Mdialog的Layout我能正确infalte成功(如果布局里面不设置宿主的Drawable),但是加上宿主的Drawable就失败。Drawable只是示例,dimen也是一样的问题。

from shadow.

Zjoke08 avatar Zjoke08 commented on June 11, 2024

我在创建Resource时,将宿主的sourceDir添加到插件的AssetManager中。

from shadow.

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.