Home

Awesome

中文版文档

Jcenter Status Build Status MethodCount

LessCode

less code, more efficient for android, for the best android tools library!

Overview

Gradle

implementation 'com.jayfeng:lesscode-core:2.4.2'

Features

源码备注
ActivityLessActivity相关辅助类:去标题,全屏,两次退出提示,优化Overdraw背景等
AdapterLess打造通用的BaseAdapter,PagerAdapter,RecyclerView.Adapter等
AlarmLess定时器相关
AppLess获取应用版本,名称,签名,清理缓存等
BitmapLessBitmap处理相关
CacheLess缓存网络请求返回的json
DeviceLess获取设备信息,比如mac
DisplayLess屏幕相关,比如dp和px的转换,状态栏或者标题栏的高度,dpi判断
DrawableLess通用的着色方案
EncodeLessmd5加密
FileLess文件处理相关
HttpLess简单的Http工具类,如果是专业用途还是用其他更强大的第三方库吧
ImageLess图片相关
KeyBoardLess输入法的弹出或隐藏
LogLess强大的Log库
NetworkLess网络判断
ResourceLess根据资源名获取ID
SerializeLess序列化和反序列化
SharedPreferenceLess简化和增强SharedPreference的操作
StorageLess手机存储相关,包括:手机内存,内置存储卡(Sdcard),外置存储卡(ExtSdcard)
ToastLess简化Toast的使用
UpdateLess/UpdateService简单但完整的自动更新实现,无缝对接(已分离到LessCode-Update项目)
ViewLess简化繁琐的findViewById和强制转换

Usage

####Config

$.getInstance()
 .context(getApplicationContext())
 .build();
$.getInstance()
 .context(getApplicationContext())
 .log(BuildConfig.DEBUG, "LESSCODE") // LogLess - debug, tag
 .update(null, 5) // UpdateLess - null means the default value, 5 is the notification frequent, default is 5
 .http(5000, 5000) // HttpLess - default connect and read timeout
 .build();

####Android VS LessCode

// 强制转化View类型
// Before
ListView listView = (ListView) findViewById(R.id.list);
// After
ListView listView = ViewLess.$(this, R.id.list);
// 无标题全屏
// Before
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
// After
ActivityLess.$noTitle(this);
ActivityLess.$fullScreen(this);

Proguard

-dontwarn com.jayfeng.lesscode.**

See more details on the Wiki

Alternative libraries

Author

Author weibo:<a href="http://weibo.com/xiaofengjian" target="_blank">冯建V</a>    mail:673592063@qq.com    QQ:673592063

License

Copyright (C)  LessCode Open Source Project

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

http://www.apache.org/licenses/LICENSE-2.0

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.