Thanks to visit codestin.com
Credit goes to gitcode.com

amount-input-text-cj:基于 Cangjie 生态的金额输入组件项目

一款金额输入组件,带有金融业专用版数字键盘

分支2Tags0

amount-input-text-cj

介绍

amount-input-text-cj是一款金额输入组件,带有金融业专用版数字键盘。

特性

  • 简洁: 金额组件自带金额输入键盘,相比于系统键盘更简洁,只保留了金额相关输入键,界面更简单明了;
  • 专业:支持人民币、美元、日元等常用币种的输入,组件根据选择的币种自行配置;
  • 灵活:金额键盘提供了多套模板,满足目前市面上安卓端主流金额输入键盘的样式需求;支持键盘乱序、自定义标题等动态化配置;
  • 安全:数据未进行网络传输及本地存储,所输入的内容不会被捕捉,相比于系统输入法,更加安全

源码目录

|---- amountinputtext
|     |---- entry  # 示例代码文件夹
|     |---- liabamountinput  # amountinput库文件夹
|               |----model # 数据相关
|                   |----AmountInputData # 金额输入数据,包含 0-9. 等
|                   |----CurrencyCode # 常用币种code
|                   |----CurrencyModel # 币种model
|                   |----DialogAttributeModel # 弹框属性
|                   |----KeyboardViewAttributeModel # 键盘常用属性
|                   |----menu_model #键盘按键对象
|               |----utils # 工具类
|                   |----CurrencyManager # 常用币种管理
|               ----AmountInputText # 金额输入组件
|               ----AmountInputDialog # 金额键盘dialog
|               ----AmountInputKeyboardView # 金额键盘View
|               ----AmountInputCallback # 键盘回调
|               ----AmountInputKeyboardTitleView # 键盘标题View
|     |---- README.MD  # 安装使用方法

接口说明

主要类和函数接口说明详见 API

使用说明

  1. 通过 module 引入

    1. 克隆下载项目
    2. 将 amountinputtext 模块拷贝到应用项目下
    3. 修改自身应用 entry 下的 oh-package.json5 文件,在 dependencies 字段添加 "amountinputtext": "file:../amountinputtext"
    {
       "name": "entry",
       "version": "1.0.0",
       "description": "Please describe the basic information.",
       "main": "",
       "author": "",
       "license": "",
      "dependencies": {
          "amountinputtext": "file:../amountinputtext"
      }
    }
    
    1. 修改自身应用 entry/src/main/cangjie 下的 cjpm.toml 文件,在 [dependencies] 字段下添加 amountinputtext = {path = "../../../../amountinputtext/src/main/cangjie", version = "1.0.0"}
      [dependencies]
          amountinputtext = {path = "../../../../amountinputtext/src/main/cangjie", version = "1.0.0"}
      
    2. 在项目中使用 import amountinputtext.* 引用 amountinputtext 项目
      import amountinputtext.*
      
  2. 把 amount-input-text-cj 作为三方库依赖引入

    1. 目标工程把 amount-input-text-cj 依赖库作为 git submodule 引入
    > cd $工程根目录
    > mkdir third-party
    > cd third-party
    > git submodule add "https://gitcode.com/Cangjie-TPC/amount-input-text-cj.git"
    
    1. 修改自身应用 entry/src/main/cangjie 下的 cjpm.toml 文件,添加依赖
    [dependencies]
        amountinputtext = {path = "../../../../third-party//amount-input-text-cj/amountinputtext/src/main/cangjie", version = "1.0.0"}
    
    1. 在项目中使用 amountinputtext 组件
      import amountinputtext.*
      

功能示例

详见 entry

高亮引导组件示例

internal import ohos.base.*
internal import ohos.component.*
internal import ohos.state_manage.*
import ohos.state_macro_manage.*
import amountinputtext.model.*
import amountinputtext.*
import std.collection.*

@Entry
@Component
class EntryView {
    var model: AmountInputTextModel = AmountInputTextModel()

    protected override func aboutToAppear(): Unit {
        this.model.setDefTips("点此输入金额")
        this.model.setCurrency(CurrencyCode.CNY)

        var keyboardModel: KeyboardViewAttributeModel = KeyboardViewAttributeModel()
        keyboardModel.keyboardViewType = KeyboardViewType.NORMAL
        keyboardModel.isShowKeyboardTitle = false
        keyboardModel.isBorderRadius = false
        this.model.setKeyboardModel(keyboardModel)
    }

    func build() {
        Column() {
            Column() {
                Text("金额输入框").width(100.percent).height(30).fontColor(Color(0x222222)).fontSize(20)
                Column() {
                    AmountInputText(model: this.model)
                }.margin(left: 3, top: 5)
            }.padding(top: 10).backgroundColor(Color.WHITE)
        }.width(100.percent).height(100.percent).align(Alignment.Top).backgroundColor(Color(0xf4f4f4))
    }
}

约束与限制

在下述版本验证通过:

DevEco Studio 5.0.1 Release(5.0.5.310) 
DevEco Studio-Cangjie Plugin Beta1 5.0.5.306
Cangjie Compiler: 0.53.17 (cjnative)

开源协议

本项目基于 Apache License 2.0,请自由的享受和参与开源。

参与贡献

欢迎给我们提交 PR,欢迎给我们提交 Issue,欢迎参与任何形式的贡献。

项目介绍

一款金额输入组件,带有金融业专用版数字键盘

定制我的领域