5 Star 0 Fork 0

Archermind-TI / MovingButton

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

Moving Button

项目介绍

向八个方向移动的按钮。

效果演示

安装教程

方式一

  1. 下载模块代码添加到自己的工程

  2. 关联使用

dependencies {
implementation project(':library')
……
}

3.在系统的settings.gradle中添加

include ':entry',':library'

方式二:

  1. 在module的build.gradle中添加movingbutton的依赖
   dependencies {
       implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
       ……
       implementation 'com.gitee.archermind-ti:movingbutton:1.0.0'
   }
  1. 在project的build.gradle中添加mavenCentral()的引用
   allprojects {
       repositories {
           ……
           mavenCentral()
       }
   }

使用说明

监听:

    public interface OnPositionChangedListener {
        // returns MotionEvent action and changed button position
        void onPositionChanged(int action, ButtonPosition position);
    }

    movingButton.setOnPositionChangedListener(new MovingButton.OnPositionChangedListener() {
        @Override
        public void onPositionChanged(int action, ButtonPosition position) {
            //your code here
        }
    });

xml 引用:

<com.thefinestartist.library.movingbutton_ohos.MovingButton
    ohos:id="$+id:moving_button"
    xmlns:app="http://schemas.huawei.com/apk/res/ohos"
    ohos:height="40vp"
    ohos:width="110vp"
    ohos:auto_font_size="false"
    ohos:background_element="#FF0C0B0B"
    ohos:bottom_margin="30vp"
    ohos:layout_alignment="vertical_center"
    ohos:left_margin="125vp"
    ohos:text="move"
    ohos:text_color="#FFFFFF"
    ohos:text_size="16vp"
    ohos:top_margin="15vp"
    app:mb_event_volume="50"
    app:mb_move_direction="all"
    app:mb_movement="10vp"
    app:mb_vibration_duration="20"
/>
    // Move Direction
    movingButton.getMoveDirection();
    movingButton.setMoveDirection(MoveDirection.ALL);

    // Movement (in Pixel dimension)
    movingButton.getMovement();
    movingButton.setMovement(10);
    movingButton.getMovementLeft();
    movingButton.setMovementLeft(10);
    movingButton.getMovementRight();
    movingButton.setMovementRight(10);
    movingButton.getMovementTop();
    movingButton.setMovementTop(10);
    movingButton.getMovementBottom();
    movingButton.setMovementBottom(10);

    // Offset (in Pixel dimension)
    movingButton.getOffSetInner();
    movingButton.setOffSetInner(10);
    movingButton.getOffSetOuter();
    movingButton.setOffSetOuter(10);

    // Vibration
    movingButton.getVibrationDuration();
    movingButton.setVibrationDuration(20);

    // Volume
    movingButton.getEventVolume();
    movingButton.setEventVolume(50);

    // Current Position
    movingButton.getCurrentPosition();

版本迭代

  • v1.0.0

License

The MIT License (MIT)

Copyright (c) 2015 TheFinestArtist

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.
The MIT License (MIT) Copyright (c) 2015 TheFinestArtist 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.

简介

可向八个方向移动的按钮 展开 收起
Java
MIT
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/archermind-ti/MovingButton.git
git@gitee.com:archermind-ti/MovingButton.git
archermind-ti
MovingButton
MovingButton
master

搜索帮助