Giter VIP home page Giter VIP logo

Comments (11)

qii avatar qii commented on May 12, 2024 1

https://github.com/bytedance/scene/blob/master/library/scene/src/main/java/com/bytedance/scene/NavigationSceneUtility.java#L89

用 rootSceneComponentFactory,拦截创建个新的 Scene,把你的 Object 通过构造方法传入

from scene.

qii avatar qii commented on May 12, 2024 1

返回true就是强制支持销毁恢复,只允许序列化的对象传递,不允许Scene有其他其他的构造方法

from scene.

qii avatar qii commented on May 12, 2024 1

是的

from scene.

chachako avatar chachako commented on May 12, 2024

感谢

from scene.

chachako avatar chachako commented on May 12, 2024

那么当在 Scene 中 Push 另一个 Scene 时需要传输对象时呢?应该如何做

from scene.

qii avatar qii commented on May 12, 2024

你要支持销毁恢复吗?(就是那个 supportResotre),不支持的话(就是返回false),直接把你的对象放入构造方法参数呗,支持的话(就是返回true),写个 XXXXXScene.newIntance(YYY),只能把支持序列化的对象放入 Scene.setArguments

from scene.

chachako avatar chachako commented on May 12, 2024

你要支持销毁恢复吗?(就是那个 supportResotre),不支持的话(就是返回false),直接把你的对象放入构造方法参数呗,支持的话(就是返回true),写个 XXXXXScene.newIntance(YYY),只能把支持序列化的对象放入 Scene.setArguments

是这样吗

        oneScene.requireNavigationScene().push(`TwoScene(obj, obj1)`, PushOptions.Builder().setAnimation(
            SharedElementSceneTransitionExecutor(
                map,
                Slide()
            )
        ).build())

TwoScene(obj, obj1) 但是好像会出错,昨天晚上好像是看到说不允许有参数,请问有示例代码吗@qii

from scene.

qii avatar qii commented on May 12, 2024
class MainActivity : SceneActivity() {
    override fun getHomeSceneClass(): Class<out Scene> {
        return MainScene::class.java
    }

    override fun supportRestore(): Boolean {
        return false //这里返回false
    }
}

from scene.

chachako avatar chachako commented on May 12, 2024

@qii 另外,Activity 或 Fragment 如何与 Scene 通信

例如 Activity 有一个下载任务,下载完后我需要通知 Scene 已经下载完成

from scene.

qii avatar qii commented on May 12, 2024

在同个Activity内吗?如果是,用 ViewModel+LiveData,如果不是,用类似 EventBus 这种,订阅一个单例,下载完成的地方给这个单例发消息

from scene.

chachako avatar chachako commented on May 12, 2024

ViewModel+LiveData

是指 Activity 与 Scene 使用同一个 ViewModel 吗

activity:

ViewModelProviders.of(this).get(MyViewModel::class.java)

scene:

ViewModelProviders.of(activity).get(MyViewModel::class.java)

from scene.

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.