5 Star 2 Fork 0

HarmonyOS-TPC / lock-screen

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

Lock Screen

Introduction

Simple and beautiful Lock Screen library to set an check pin code.

Easily secure your app with Lock Screen library as easy as starting an intent.

Set Pin:

Check Pin:

Lock Screen gets a 4 digit pin code from user at first running time. After that every time that you start the intent, It asks for pin code.

Usage Instruction

Add EnterPinAbility.class to MainAbility

addActionRoute("action.transit", EnterPinAbility.class.getName());

And intent can be Started as

Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ABILITY_NEW_MISSION);
               Operation operation = new Intent.OperationBuilder()
                       .withBundleName("com.amirarcane.sample")
                       .withAbilityName("com.amirarcane.sample.MainAbility")
                       .withAction("action.transit")
                       .build();
               intent.setOperation(operation);
               startAbility(intent);

First it checks Pin was entered before or not if the pin was set then it will as for entering pin else it asks for setting pin. If need to set pin again Start the intent like below.

     Intent intent = new EnterPinAbility().getIntent(MainAbilitySlice.this,SET_PIN);
                intent.addFlags(Intent.FLAG_ABILITY_NEW_MISSION);
                Operation operation = new Intent.OperationBuilder()
                        .withBundleName("com.amirarcane.sample")
                        .withAbilityName("com.amirarcane.sample.MainAbility")
                        .withAction("action.transit")
                        .build();
                intent.setOperation(operation);
                startAbility(intent);

SET_PIN is boolean make it true.

Customization

If font is needed to set for the library try below:

First: put the font in resources Example:put in path "\entry\src\main\resources\rawfile"

Second:Pass the name of the Font in FONT_TEXT and FONT_NUMBERS. Example:FONT_TEXT = "ALEAWB.TTF",FONT_NUMBER = "BLKCHCRY.TTF"

Intent intent = new EnterPinAbility().getIntent(MainAbilitySlice.this,FONT_TEXT,FONT_NUMBER);
                intent.addFlags(Intent.FLAG_ABILITY_NEW_MISSION);
                Operation operation = new Intent.OperationBuilder()
                        .withBundleName("com.amirarcane.sample")
                        .withAbilityName("com.amirarcane.sample.MainAbility")
                        .withAction("action.transit")
                        .build();
                intent.setOperation(operation);
                startAbility(intent);

If setting pin and setting font both are required then try below:

Intent intent = new EnterPinAbility().getIntent(MainAbilitySlice.this,SET_PIN,FONT_TEXT,FONT_NUMBER);
              intent.addFlags(Intent.FLAG_ABILITY_NEW_MISSION);
              Operation operation = new Intent.OperationBuilder()
                      .withBundleName("com.amirarcane.sample")
                      .withAbilityName("com.amirarcane.sample.MainAbility")
                      .withAction("action.transit")
                      .build();
              intent.setOperation(operation);
              startAbility(intent);

Installation instruction

Method 1: Generate the .har package through the library and add the .har package to the libs folder. Add the following code to the entry gradle:

    implementation fileTree  (dir: 'libs', include: ['*.jar', '*.har'])

Method 2: In project level build.gradle:

    allprojects{
        repositories{
            mavenCentral()
        }
    }

Add the following code to the entry gradle:

    implementation 'io.openharmony.tpc.thirdlib:lock-screen:1.0.2'
The MIT License (MIT) Copyright (c) 2015 Amirhossein Naghshzan 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.

简介

Simple and beautiful Lock Screen library to set an check pin code. 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/HarmonyOS-tpc/lock-screen.git
git@gitee.com:HarmonyOS-tpc/lock-screen.git
HarmonyOS-tpc
lock-screen
lock-screen
master

搜索帮助