Less code, more efficient for android
Author weibo:冯建V mail:673592063@qq.com QQ:673592063
- support more effective methods than android
- high performence
- easy integration
- small size (less than 100k, only 60k+ now)
- open source
core version:
compile('com.jayfeng:lesscode-core:0.6.4') {
// exclusion for update the android support jar (for example, you can use the appcompat-v7 in your project)
exclude group: 'com.android.support', module: 'support-v4'
}
####Config
- Required
$.getInstance()
.context(getApplicationContext())
.build();
- Optional
$.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
- ViewLess
// 强制转化View类型
// Before
ListView listView = (ListView) findViewById(R.id.list);
// After
ListView listView = ViewLess.$(this, R.id.list);
- ActivityLess
// 无标题全屏
// 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);
See more details on the WIKI