1 Star 1 Fork 0

liu-bluesky/BottomNavigationF

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

bottomNavigationF

这个组件提供类似flutter的scaffold小部件的解决方案 提供了 顶部导航 导航点击事件以及 底部切换点击事件

安装

<!-- https://mvnrepository.com/artifact/com.gitee.blueskyliu/BottomNavigationF -->
<dependency>
    <groupId>com.gitee.blueskyliu</groupId>
    <artifactId>BottomNavigationF</artifactId>
    <version>0.0.2</version>
</dependency>

方法

工具类RouterUtil

  • 跳转 Ability页参数配置
方法名 参数 选填参数
navigate AbilitySlice abilitySlice 当前页, Class classTo 目标页,Map<String,Object> map Map<String,Object> map
  • 跳转 AbilitySlice 页参数配置 即 跳转页面
方法名 参数 选填参数
navigate AbilitySlice abilitySlice当前页 , AbilitySlice abilitySliceTo 目标页,Map<String,Object> map Map<String,Object> map

tabbar工具方法

  • 获取方法 Scaffold new出的对象 掉用 getFractionUtil 获取工具 示例代码仅供参考
 Scaffold init = new Scaffold((((FractionAbility) getAbility())),appBar, body, bottomNavigation).init();
        Component scaffold = init.getScaffold();
        FractionUtil fractionUtil = init.getFractionUtil();
        fractionUtil.show(1);//打开底部导航索引为1

使用案例

红色框圈起来的都可以点击 有监听事件

  • bottomNavigationF - 这个组件提供类似flutter的scaffold小部件的解决方案

准备

  1. fractionPage页面
  2. BottomNavViewModel的类里面的数据模型
  3. 修改 MainAbility 继承类为FractionAbility

初始化实例

根据实际情况修改你们的需求

   DirectionalLayout parse =(DirectionalLayout) LayoutScatter.getInstance(getContext()).parse(ResourceTable.Layout_ability_main, null, false);
        AppBar appBar = new AppBar();
        appBar.setTitle("自定义导航");
        appBar.setLeadingId(ResourceTable.Media_arrow_left);
       
        BottomNavigation bottomNavigation = new BottomNavigation();
        BottomNavViewModel bottomNavViewModel = new BottomNavViewModel();
        bottomNavigation.setBottomNavItems(bottomNavViewModel.initBottomNavFractions());
        List<Fraction> fractions = bottomNavViewModel.initBottomNavFractionsBody(this);
        Body body = new Body();
        body.setFractions(fractions);
//        appBar
        Scaffold init = new Scaffold((((FractionAbility) getAbility())),appBar, body, bottomNavigation).init();
        Component scaffold = init.getScaffold();
        parse.addComponent(scaffold);
        init.setOnNavClickListener(new OnNavClickListener() {
            @Override
            public void onLeading() {
                LogUtil.info("ontapNav", "点击了");
            }
        });
        init.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onTap(int index) {
                LogUtil.info("自定义监听", Integer.toString(index));
            }
        });
        setUIContent(parse);

当前项目遇到的问题

问题文件 package com.llt.bottomnavigationf 包 中的Scaffold类

        /**
         * 初始化 数据 fraction 这里放到 asyncDispatch异步线程中 就没问题不会出现闪退问题
         */
//问题原因是 FractionUtil类中的 initTabberPage方法 submit操作导致的 
        abilitySlice.getUITaskDispatcher().asyncDispatch(new Runnable() {
            @Override
            public void run() {
                fractionUtil=new FractionUtil(
                        body.getFractions(),
                        currentSaveIndex,
                        abilitySlice,
                        ResourceTable.Id_scaffold_main_content);
            }
        });

谁知道具体原因的可以联系我 如果方便 群号 953344438

MIT License Copyright (c) 2021 liu-bluesky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

是一个开源项目 lg 是公司项目缩写 但是跟公司项目没关系 只是名字 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/blueskyliu/BottomNavigationF.git
git@gitee.com:blueskyliu/BottomNavigationF.git
blueskyliu
BottomNavigationF
BottomNavigationF
master

搜索帮助

Cb406eda 1850385 E526c682 1850385