Simple Android UI&IO Utility
Latest commit 7bac06c Dec 17, 2015 @jinjinyun jinjinyun 备份防丢
Failed to load latest commit information.
libs 备份防丢 Dec 17, 2015
res move to root Feb 21, 2014
.classpath api update Oct 6, 2014
.gitignore add junit test case Feb 21, 2014
.project api update Oct 6, 2014
build.xml 备份防丢 Dec 17, 2015
lint.xml move to root Feb 21, 2014 move to root Feb 21, 2014
proguard-project.txt move to root Feb 21, 2014 optimize key value storage Apr 12, 2014

Resource && Example

     cd  web 
     node start


Http Request && Cache && schedule automatic

    //the http request will be canceled after activity finished
    //and auto paused after the activity is paused when the task is pauseable.
    //and auto resume after the activity is resume again.
    Cancelable task = UIO.get(new Callback<MyClass>(){
        //http stream will be auto parsed and mapping to you standard javabean object.
         public void callback(MyClass javabean){
         public void error(Throwable ex, boolean callbackError){
    // and you can cancel it any time by yourself
    // task.cancel();

    // double callback (cache first show and update on need)
    Cancelable task = UIO.get(new CacheCallback<MyClass>(){
         public boolean cache(MyClass javabean){
            //TODO: on cache parsed!
            //return true, means cache data is accept. http request is ignored(callback is called with null arguments)
            return true;
         public void callback(MyClass javabean){
            //TODO: on new network result(null for not modified data)
         public void error(Throwable ex, boolean callbackError){

    // post file
    Cancelable task = Callback<MyClass>(){
         public void callback(MyClass javabean){
            //TODO: upload success!
         public void error(Throwable ex, boolean callbackError){
    }, url, fileName, file);

Image Bind

    //the image url will auto load and parse and set as the drawable for the imageView 
    //if the image url is a animated gif,then it is show as a movie!

    //you can set the drawableFactory for the image loading(getLoadingDrawable) and process(such as radious, shawdown....)
    //and set the fallback drawable for the action

    //you can set the callback for the bind action(callback on image load(or cached) and bind to image view)
    UIO.bind(imageView, imageUrl,drawableFactory,fallbackResourceId,  callback);//Callback<Drawable> 


  • KeyValueStorage

    Replace the SharePreferences interface. the keyValueStroage is a dsl for typed key value stroage.

        // defined kevaluestorage
        public interface GlobalSetting extends KeyValueStorage<GlobalsConfig>{
             * 设置名为age,类型为int属性,默认值为0 
            public int getAge();
            public void setAge(int age);

             * 设置一个默认值为1024的属性 
            public int getCacheLength();
            public GlobalSetting setCacheLength(int value);

             * 设置一个bool值,setter 可以返回 当前对象,方便连续调用, 如: 
             * myStorage.beginTransaction().setCacheLength(65536).setCacheEnable(false).commit();
            public boolean getCacheEnable();
            public GlobalSetting setCacheEnable(boolean b);

     // use the key value storage

         //return the same instance anywhere!!
         GlobalSetting globalSetting = UIO.getKeyValueStorage(GlobalSetting.class);
         int age = globalSetting.getAge()    
  • SQLiteMapping

    a simple ormapping.

  • Network State
    • network state getter
        * UIO.isInternetConnected()
        * UIO.isWifiConnected()
        * UIO.getMobileGeneration()
  • and listener register

    * UIO.Ext.addWifiCallback(Callback<Boolean> wifiAvaliableCallback);
    * UIO.Ext.addNetworkCallback(Callback<Boolean> networkAvaliableCallback);
    * UIO.Ext.removeWifiCallback && UIO.Ext.removeNetworkCallback(callback)
    • other utility
    * UIO.showTips("short show");   //show toast and clear on activity destroyed
    * UIO.showLongTips("long show");    
    * UIO.get???? //others

Other Documents


  • QQ群: 293775669