登录 立即注册
安币:

安卓巴士 - 安卓开发 - Android开发 - 安卓 - 移动互联网门户

苹果锁屏的android源码

[复制链接]
来自: chino 分类: Android精品源码 上传时间: 2016-3-25 14:17:53
立即下载
收藏

项目介绍:

BlurLockView

  


Lock view with blur effect. Easy to customise.


中文文档

Note



Demo

Try demo here:

Download from Fir

Download from Github



You can get all about BlurLockView from the demo.





Gradle

Add this to build.gradle:  


dependencies {
    ...
    compile 'com.nightonke:blurlockview:1.0.0'
    ...
}


Easy to Use

Add the xml code:  


    android:id="@+id/blurlockview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />


Notice that you should set the BlurLockView to cover the view than need to be blured.


Add this to initialize the BlurLockView:  


// Set the view that need to be blurred
blurLockView.setBlurredView(imageView1);

// Set the password
blurLockView.setCorrectPassword(getIntent().getStringExtra("PASSWORD"));


Show and Hide

You can choose duration, direction and ease type to show or hide the BlurLockView.
For instance, the gif at the start of readme shows as
[Java] 查看源文件 复制代码
ShowType.FADE_IN
with 1000ms and
[Java] 查看源文件 复制代码
HideType.FADE_OUT
with 1000ms.
You can check all the directions and ease types in the demo above.  


  


Listeners

BlurLockView.OnPasswordInputListener  


@Override
public void correct(String inputPassword) {
    // the input password is correct
    // you can hide the BlurLockView, for example
}

@Override
public void incorrect(String inputPassword) {
    // the input password is incorrect
}

@Override
public void input(String inputPassword) {
    // the password is being input
}


BlurLockView.OnLeftButtonClickListener  


@Override
public void onClick() {
    // The left button is being clicked
}


Implements the listeners above and then:  


blurLockView.setOnLeftButtonClickListener(this);
blurLockView.setOnPasswordInputListener(this);


Notice that the right button is set as "Backspace" usually, so there is not OnRightButtonClickListener.  


Blur Effect

You can set the effect of blur with 3 parameters.

1. DownsampleFactor, with
[Java] 查看源文件 复制代码
setDownsampleFactor(int downsampleFactor)
, the smaller, the clearer.

2. BlurRadius, with
[Java] 查看源文件 复制代码
setBlurRadius(int blurRadius)
, the smaller, the clearer.

3. OverlayColor, with
[Java] 查看源文件 复制代码
setOverlayColor(int color)
, to change the overlay color of BlurLockView.


Examples:









Keyboard

You can use different keyboard to get different password.  


setType(Password type, boolean smoothly);


Choose
[Java] 查看源文件 复制代码
Password.NUMBER
(default) or
[Java] 查看源文件 复制代码
Password.TEXT
and whether change password type smoothly.
Notice that the password with text is case-insensitive(I will improve this).  





Text


  • Set the text of title with
    [Java] 查看源文件 复制代码
    setTitle(String string)
    .
  • Set the text of left button with
    [Java] 查看源文件 复制代码
    setLeftButton(String string)
    .
  • Set the text of right button with
    [Java] 查看源文件 复制代码
    setRightButton(String string)
    .


Font

You can set all the font of text with
[Java] 查看源文件 复制代码
setTypeface(Typeface typeface)
.


Style

1. Set the background of buttons in Password.TEXT with
[Java] 查看源文件 复制代码
setSmallButtonViewsBackground(int id)
. The default resource drawable is:  




   
        

        

   

   
        
            
            
        

   

   
        
            
            
        

   




2. Set the click effect of buttons in Password.TEXT with
[Java] 查看源文件 复制代码
setBigButtonViewsClickEffect(int id)
. The default resource drawable is:  




   
        
            
        

   




3. When you click the buttoms in Password.TEXT, the effect above will disappear and you can set the duration by
[Java] 查看源文件 复制代码
setSmallButtonViewsClickEffectDuration(int duration)
.


4. Similarly, you can set the 3 styles of buttons in Password.NUMBER like above with
[Java] 查看源文件 复制代码
setBigButtonViewsBackground(int id)
,
[Java] 查看源文件 复制代码
setBigButtonViewsClickEffect(int id)
and
[Java] 查看源文件 复制代码
setBigButtonViewsClickEffectDuration(int duration)
.


5. Try to set the color of all the text with
[Java] 查看源文件 复制代码
setTextColor(int color)
.


6. You can get the widgets in BlurLockView by:

1.
[Java] 查看源文件 复制代码
public TextView getTitle() {return title;}
to get the title.

2.
[Java] 查看源文件 复制代码
public TextView getLeftButton() {return leftButton;}
to get the left button.

3.
[Java] 查看源文件 复制代码
public TextView getRightButton() {return rightButton;}
to get the right button.

4.
[Java] 查看源文件 复制代码
public BigButtonView[] getBigButtonViews() {return bigButtonViews;}
to get the 10 number buttons in array.

5.
[Java] 查看源文件 复制代码
public SmallButtonView[][] getSmallButtonViews() {return smallButtonViews;}
to get all the text buttons in array. Notice that some buttons in the array is null. you can find all the real buttons by this:  


private final char CHARS[][] = {
        {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'},
        {'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'},
        {   'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L'  },
        {        'Z', 'X', 'C', 'V', 'B', 'N', 'M'       }
};


Incorrect Password

BlurLockView counts for incorrect input times. You can use
[Java] 查看源文件 复制代码
getIncorrectInputTimes()
to get the times and use
[Java] 查看源文件 复制代码
setIncorrectInputTimes(int incorrectInputTimes)
to reset the times.


Versions

1.0.0

Todo


  • More animations.
  • Change the Password.TEXT to case-sensitive with other signals.


License

[Java] 查看源文件 复制代码
Copyright 2016 Nightonke

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   [url=http://www.apache.org/licenses/LICENSE-2.0]http://www.apache.org/licenses/LICENSE-2.0[/url]

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

相关源码推荐:

我来说两句
所有评论(29)
chino 2016-3-25 14:18:38
楼主用心了,内容非常精彩。
回复
机动型买水前锋 2016-3-25 19:11:40
学习学习!
回复
wangyetongsss 2016-3-28 10:11:25
看着学习一下
回复
huaiyu008 2016-6-6 23:37:00

感谢分享,安卓巴士有你更精彩:)
回复
fangcong1994 2016-6-13 17:15:31
很好
回复
豪逍遥 2016-6-26 15:44:42
精华内容,楼主V5!
回复
豪逍遥 2016-6-26 15:45:48
楼主威武啊,安卓巴士有你更给力!
回复
1234下一页
上传代码
查看数:1474 收藏数:12 下载数:18 点赞数:0
状态:已购或VIP 售价:10(原价:10)金钱 下载权限:初级码农 
代码贡献英雄榜
用户名 下载数
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,769657487

如何获得代码达人称号

如何成为签约作者

联系我们
关闭
合作电话:
15618560077
Email:
805941275@qq.com
商务市场合作/投稿
问题反馈及帮助
联系我们

广告投放| 下载客户端|申请友链|手机版|站点统计|安卓巴士 ( 粤ICP备15117877号 )

快速回复 返回顶部 返回列表