Elf Framework:简化Android开发过程Android框架。(elfbar电子烟)

网友投稿 809 2022-10-12

Elf Framework:简化Android开发过程Android框架。(elfbar电子烟)

Elf Framework:简化Android开发过程Android框架。(elfbar电子烟)

Efl is an Android Framework to simplify the android development process. It has many commonly used features like annotation binding, fast http connection wrappers, file utils, simple data caching, etc.

Current Features

Annotation Based Binding (View, Event Listener, Intent Extra, etc)Http Request (Simple, Lightweight, Support Multipart Request Body)Preferences StorageSimple Session Storage (Object Caching)Secure Session Storage (Encrypted)Extended Widget (TextView, EditText, Button, Checkbox, RadioButton)Form ValidationCommon Utils (MD5, File Utils, etc)

Upcoming Features

Bitmap CacheAsychronous JSON and XML Request

How to Use

You can import this library to your project by adding following dependency to your build.gradle :

repositories { jcenter()}dependencies { compile 'com.fenlisproject.elf:core:0.2.5'}

Basic Setup

Extends BaseApplication

First step to use this library is to Make your Application class extend BaseApplication.

public class SampleApplication extends BaseApplication { @Override public void onCreate() { super.onCreate(); }}

Don't forget change application name in your manifest

...

Extends BaseActivity

In you want to utilize Binding feature, you must extends your Activity with BaseActivity. BaseActivity itself extends from AppCompatActivity which use Android Support Fragment (appcompatv7). Define content view by @ContentView annotation. It will call setContentView for you at Runtime. Method onContentViewCreated is called right before onCreate finish. You you can treat this method same as onCreate method. Do what you usually do in onCreate in this method.

@ContentView(R.layout.activity_main)public class MainActivity extends BaseActivity { @ViewId(R.id.textview1) private TextView textView1; @Override protected void onContentViewCreated() { // Yo can safely access to textView1 in this method without call findViewById(). That's the magic textView1.setText("Hello Elf"); }}

Extends BaseFragment

If you use Fragment, then you can extend your fragment with BaseFragment. And the other steps are same as when you use Activity.

@ContentView(R.layout.fragment_home)public class HomeFragment extends BaseFragment { @Override protected void onContentViewCreated() { // Treat this method as onCreateView() without inflate the layout } @OnClick(R.id.button1) public void onButton1Clicked() { // You can even bind button click listener without store it as variable. }}

Documentation

For more detailed documentation, please visit Wiki Page.

Release Notes

Please refer to Release Notes to see what's recently changed.

License

Copyright 2015 Steven LewiLicensed 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://apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:UNIX系统下删除老旧Maven依赖包的方法
下一篇:开源硬件介绍
相关文章

 发表评论

暂时没有评论,来抢沙发吧~