GithubHelp home page GithubHelp logo

androiduio's Introduction

Resource && Example

     cd  web 
     node start

Description

####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){
             //TODO:...
         }
         public void error(Throwable ex, boolean callbackError){
             //TODO:....
         }
    },url);
    // 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){
            //TODO:....
         }
    },url);
    
    // post file
    Cancelable task = UIO.post(new Callback<MyClass>(){
         public void callback(MyClass javabean){
            //TODO: upload success!
         }
         public void error(Throwable ex, boolean callbackError){
            //TODO:....
         }
    }, 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!
    UIO.bind(imageView,imageUrl);
    
    //you can set the drawableFactory for the image loading(getLoadingDrawable) and process(such as radious, shawdown....)
    //and set the fallback drawable for the action
    UIO.bind(imageView,imageUrl,drawableFactory,fallbackResourceId);
    
    
    //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> 

Utility


  • 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的属性 
    		 */
    		@DefaultValue(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()	 
         //启用事物,减少文件读写次数
         globalSetting.beginTransaction().setCacheLength(65536).setCacheEnable(false).commit();
         //也可以偷懒
         globalSetting.setCacheLength(65536).setCacheEnable(false)
      .......
  • SQLiteMapping

    a simple ormapping.

  • Network State

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

    • UIO.Ext.addWifiCallback(Callback wifiAvaliableCallback);
    • UIO.Ext.addNetworkCallback(Callback 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


Contact

  • QQ群: 293775669

androiduio's People

Contributors

jindw avatar jinjinyun avatar wanygan83 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.