- Notifications
You must be signed in to change notification settings - Fork6
this is the databinding framework of android . help to binding data to the view.
License
LightSun/android-databinding
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
this lib will not uphold. if you are interested in 'Data-Binding' please move toData-Mediator.
这个库将不再维护。如果你对数据绑定感兴趣。推荐你去Data-Mediator. 这个库更加强大.
this framework is now can be used in your app. By test and test,by find bug and fix i think it is now can work with well. it helps you fast bind data and event.Plugin and xml schema file for this framework can be used now.如果你熟悉汉语, 请点击看中文版
before build the sample project,you need to import the xml schema file of this databind framework, see it below.see[How to use plugin and xml schema ?]
at google-io-2015. android databindingnow can be used, it have some problem, even if this is not the reason. because i think the engineer of google's is one of the best of the world. so it can be better and better i believe. I absolutely can not be compared with them. but i don't like to writing databinding expression in android layout file(in javaweb I hate it too ). so I developedthis framework.
android studio plugin and the xml schema of config file which are used for android-databinding framework is now available .
- you can apply image property (round,borderColor,borderWidth,circle) by you like now.so to apply image property you must call like this.
DataBindingFactory.setImagePropertyApplier(newVolleyImageApplier());//here i just use volley to load
supported by plugin and xml schema file.
support for bind data and event handler by xml. but you must call bind method in java code.
support for notify data change.
Support for custom attr and listener
support for bind adapter for any child of Adapter view or RecyclerView( contains multi items and multi select mode of adapter )
support for bind image (like round/borderColor/borderWith/placeHolder/errorResId),see it bellow.
The common support attrs:
//event nameStringON_CLICK ="onClick";StringON_LONG_CLICK ="onLongClick";StringTEXT_CHANGE_BEFORE ="textChange_before";StringTEXT_CHANGE ="textChange";StringTEXT_CHANGE_AFTER ="textChange_after";StringON_FOCUS_CHANGE ="onFocusChange";StringON_TOUCH ="onTouch";//common nameStringBACKGROUND ="background";//drawable /color / res idStringBACKGROUND_COLOR ="backgroundColor";StringBACKGROUND_RES ="background_res";StringTEXT ="text";StringTEXT_RES ="text_res";StringTEXT_COLOR ="textColor";StringTEXT_COLOR_RES ="textColor_res";StringTEXT_COLOR_STATE ="textColor_state";StringTEXT_COLOR_STATE_RES ="textColor_stateRes";StringTEXT_SIZE ="textSize";StringTEXT_SIZE_RES ="textSize_res";StringVISIBILITY ="visibility";//imageStringIMGAE_URL ="img_url";StringIMGAE_BITMAP ="img_bitmap";StringIMGAE_DRAWABLE ="img_drawable";//ps: and also support self-attrs
Support multi expressions. eg: java calling expression (only nested ternary expression is not support),android resource reference expression {@drawable/ic_default} or R.drawable.ic_default , dp and sp like "15dp",and color like "#ff0000" and so on.
the image full config was supported now (round/circle/borderWith/borderColor/placeHolder).
here is the demo:<bindid="eniv2"> <propertyname="onClick"referVariable="eventHandler" >eventHandler.onClickImage()</property> <imagePropertytype="round"referVariable="imageParam"> <!--round /circle /oval --> <roundSize>{@dimen/corner_size}</roundSize> <borderWidth>5dp</borderWidth> <borderColor>#ff0000</borderColor> <url>imageParam.link</url> <default>{@drawable/ic_default}</default> <!--supportdrawable ,bitmap,resourceid --> <errorResId>R.drawable.ic_error</errorResId> <!--onlysupportresourceid --> </imageProperty> </bind>
the more to see in sample/RoundImageBindTest Activity.
blog and pdf is at the bottom of this page.
####How to use plugin and xml schema ?
1, clickhere to donwload the zip. It contains a xml schema file and a jar of android-databinding plugin.
2 , Add the xml schema file (android_databinding.xsd )to android studio.and the URI must be 'http://schemas.android.com/heaven7/android-databinding/1'. And the xsd file can be found in the downloaded zip .

3, install the plugin 'android_databinding_plugin'. step:in android studio click file-> setting->plugins -> install plugin from diskand select the file android_databinding_plugin.jar which can be found in the downloaded zip file.
4, at the res directory of android studio, right-click and select android-databinding then follow it.and then you can enjoy the android-databinding framework.


gradle config:
dependencies {compile'com.heaven7.databinding:android-databinding:1.1.5'}
The explanation of usage is moved to child directory. click to see it.Usage Detail
if you are a chinese developer or know chinese. please clickhere to see more easier.chinese pdf
see ithere. this currently only have chinese doc.
- support gesture image (also nested in viewpager)
- support generate relative code.
- add demo for fragment .
- optimize the plugin to use easier.
- this framework i will try my best to uphold , and if you have a good suggestion about this, please tell me. Thanks!
- heaven7
- email:donshine723@gmail.com or978136772@qq.com
i like technology. especially the open-source technology.And previous i didn't contribute to it caused by i am a little lazy, but now i really want to do some for the open-source. So i hope to share and communicate with the all of you.
Copyright 2015 heaven7(donshine723@gmail.com)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.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.About
this is the databinding framework of android . help to binding data to the view.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.


