COCOFrame

来源:互联网 发布:输入法 for mac 编辑:程序博客网 时间:2024/06/04 19:11

COCOFrame是一个轻量级的开发框架,分FAT包和mini包.分别为400K,及200K

1. Jar包大小:166K

2. 下载地址:http://download.csdn.net/detail/landehuxi/7673747

3. 解压缩,项目导入COCOFrame.jar

4. 直接在代码中使用S,F,U三个类即可.

(一)S 工具服务-service

 初始化:S.init(this); //如果继承自BaseActivity则不用初始化.

 S.SDCardService SD卡服务(获取SD卡路径,获取SD卡容量,)

 S.SMService 短信服务(编辑发送短信,静默发送短信)

 S.AppService 应用级别服务 (应用启动启动Activity,杀死线程,获取包名,获取版本)

 S.EncryptService 加密服务(MD5加密, DES加密/解密,RES加密解密)

 S.DBService 数据库服务

 S.DisplayService 显示相关服务(屏幕宽高,像素,dp转换调节屏幕亮度)

 S.EmailService 邮件服务(静默发送邮件用户编辑邮件带附件的邮件)

 S.HttpService 网络服务,目前为空,直接采用F类的网络请求方法即可.

 S.ImgService 图片服务(滤镜,灰度,获取Bitmap,水印,放大缩小图片)

 S.IOService 本地存储服务(asset存储,SD卡存储,SP存储)

 S.KeyBoradService(隐藏软键盘,打开软键盘,查看键盘状态)

 S.PhoneService(获取手机型号,获取SIM卡信息,获取电量,获取内存大小,获取手机品牌)

 S.ClearService 内存释放清空服务(关闭流,回收Bitmap,回收Map,List,关闭数据库游标)

 S.StringService 字符串服务(集成TextUtils,数字转文件体积,常用正则等)

 S.GPService 地理位置服务.(当前用户所在国家,,,,街道,邮编,经纬度,经纬度计算)

 S.NetworkService 网络服务(网络类型,是否有网络,应用的上行流量,下行流量)

 S.BatteryService 电池服务(电量,USB或直流电,电压,温度,电池品牌)

(二)F 极速开发-fast

初始化

F=new F(this); //如果继承自BaseActivity可直接使用F

 基本使用方式

1.初始化控件,绑定监听器

F.id(R.id.btnLogin).clicked(listener)

F.id(R.id.btnLogin).clicked(this, "loginMethod");

F.id(R.id.textView).text(“test”);//设置文字

F.id(R.id.imgView).image(Bitmap);//设置图片.

F.id(R.id.imgView).image(“http://www.test.com/test.png”);//设置图片.相同地址的图片不会重复下载

F.id(R.id.imgView).image(“sdcard/test/test.png”);//设置图片.

F.id(R.id.imgView).image(Drawable);//设置图片.

F.id(R.id.imgView).image(id);//设置图片.

F.id(R.id.imgView).image(File);//设置图片.

F.id(R.id.ImageView).image(file, 300);//设置图片宽是300像素. 减少此宽度可有效减少图片内存占用.

F.id(R.id.imgView).image(url,false,false,50,50,bitmpaHolder,0,1.5f);//设置图片-多参数模式

图片下载地址

忽略

是否缓存

图片高度(决定了图片大小,0为原图大小)

忽略

站位图片,如果图片因为某种错误没显示,则用此图代替.(:Bitmap bitmpaHolder=F.getCachedImage(android.R.drawable.star_on))

图片出现时的效果(例如:F.FADE_IN)

宽高比率,同时决定了图片整体宽高比

图片压缩处理:

ImageOptions options = new ImageOptions();
options.ratio = 1;//质量比率
options.anchor = 1.0;   //部分显示图片来达到缩小内存效果.  1.0显示图片顶端,  0显示图片中间,  -1.0显示图片底部  AQuery.ANCHOR_DYNAMIC动态
F.id(R.id.image).image(imageUrl, options);

2.发送网络请求

F.progress(U.Dialog(this));//网络请求增加等待效果

F.progress(F.id(R.id.Process)).download()//文件下载增加进度条.

AjaxCallback.setTimeout(15);//设置timeout,单位秒

覆盖AjaxCallbacktimeout方法可以实现自己的网络超时动作,如读取缓存,友好提示等

发送网络请求

(1)带参数,不使用缓存,不使用映射.

HashMap < String,String > params = new HashMap < String,String > ();

params.put("formMap.USER_CODE", editName.getText().toString());

params.put("formMap.PASSWORD", editPassword.getText().toString());

F.progress(U.ViewWait(this).showWait()).ajax(URL_LOGIN, params, JSONObject.class, new AjaxCallback < JSONObject > () {@Override public void callback(String url, JSONObject json, AjaxStatus status) {

        try {

            String result = json.getString("result");

            String key = json.getString("key");

            JSONObject userinfo = json.getJSONObject("userinfo");

            if ("1000".equals(result)) {

                Toast.makeText(LoginActivity.this,"SthWrong!", Toast.LENGTH_LONG).show();

            } else {

                S.AppService.startAcvitity(LoginActivity.this, MainActivity.class);

                finish();

            }

        } catch(JSONException e) {

            e.printStackTrace();

        }

    }

});

}

 

(2)不带参数,不缓存,映射本地方法jsonCallBack:

public void asyncJson(){

  String url="http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";

  aq.ajax(url, JSONObject.class, this, "jsonCallback");       

}  

public void jsonCallback(String url, JSONObject json, AjaxStatus status){

  if(json != null){

      //successful ajax call

  }else{

      //ajax error

  }

}

(3)使用缓存

参数说明:
F.CACHE_TIME_1H;//缓存一小时
F.CACHE_TIME_24H;//缓存一天
F.CACHE_TIME_30M;//缓存30分钟
F.CACHE_TIME_DEFALUT;//框架默认
F.CACHE_TIME_UPDATA;//马上更新
可自行设置时间,单位毫秒.
//例如缓存1小时,则接口首次请求成功后返回的data将被存储,1小时内无论有无网络,应用重启,开关机等都将正常返回data,不会再次发送网络请求.如果想马上更新数据,可设置时间为F.CACHE_TIME_UPDATA.会马上获取最新的接口数据.

F.ajax(url, params,JSONObject.class, F.CACHE_TIME_1H, new AjaxCallback<JSONObject>() {

          @Override

          public void callback(String url, JSONObject json, AjaxStatus status) {

              swipeRefreshLayout.setRefreshing(false);

              Debug.out(json);

          }

      });

(4)下载文件-无进度条

F.download(url,file,new AjaxCallback<File>() {

@Override

public void callback(String url, File file,

AjaxStatus status) {

//文件下载完毕的处理

}

});

 

(5)下载文件-有进度条

F.progress(F.id(R.id.process_DownApk).getProgressBar()).download(

URL_APK, apkFile, AjaxCallback<File>() {

@Override

public void callback(String url, File file,

AjaxStatus status) {

//文件下载完毕的处理

}

});

(6)上传文件

String url = "http://www.test.com/upLoadFile.do";
Map<String, Object> params = new HashMap<String, Object>();
byte[] data = new byte[1000];
params.put("source", data);

File file = new File("test.png");

params.put("source", file);

F.ajax(url, params, JSONObject.class, this, "method");//method为上传成功后,调用的方法

Asynchronous Network
Permission
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Code
Supported Types

  • JSONObject
  • JSONArray
  • String (HTML, XML)
  • XmlDom (XML parsing)
  • XmlPullParser (Large XML files)
  • byte array
  • User defined custom type (Transformer)
  • Bitmap
JSON
public void asyncJson(){
       
        //perform a Google search in just a few lines of code
       
        String url= "http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";
       
        aq.ajax(url,JSONObject.class,new AjaxCallback<JSONObject>(){
                @Override
                publicvoid callback(String url,JSONObject json,AjaxStatus status){
                       
                       
                        if(json!= null){
                               
                                //successful ajax call, show status code and json content
                                Toast.makeText(aq.getContext(), status.getCode()+ ":"+ json.toString(),Toast.LENGTH_LONG).show();
                       
                        }else{
                               
                                //ajax error, show error code
                                Toast.makeText(aq.getContext(),"Error:" + status.getCode(),Toast.LENGTH_LONG).show();
                        }
                }
        });
       
}
JSON (activity as callback)
public void asyncJson(){
       
        //perform a Google search in just a few lines of code
       
        String url= "http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";                     aq
        aq.ajax(url,JSONObject.class,this, "jsonCallback");
       
}
public void jsonCallback(String url,JSONObject json,AjaxStatus status){
       
        if(json!= null){                              
                //successful ajax call          
        }else{                         
                //ajax error
        }
       
}
HTML/XML
//fetch Google's homepage in html
String url ="http://www.google.com";
aq.ajax(url,String.class,new AjaxCallback<String>(){
        @Override
        publicvoid callback(String url,String html,AjaxStatus status){
               
        }
       
});
XML Dom
public void xml_ajax(){                
        String url= "https://picasaweb.google.com/data/feed/base/featured?max-results=8";                      aq
        aq.ajax(url,XmlDom.class,this, "picasaCb");          
}
public void picasaCb(String url,XmlDom xml,AjaxStatus status){
        List<XmlDom> entries= xml.tags("entry");                      
        List<String> titles= newArrayList<String>();
       
        String imageUrl= null;
       
        for(XmlDom entry: entries){
                titles.add(entry.text("title"));
                imageUrl = entry.tag("content","type","image/jpeg").attr("src");
        }
               
        aq.id(R.id.image).image(imageUrl);
       
}
XmlPullParser
public void callback(String url,XmlPullParser xpp,AjaxStatus status){
       
        Map<String,String> images= newLinkedHashMap<String,String>();
        String currentTitle= null;
       
        try{
       
        int eventType= xpp.getEventType();
        while(eventType!= XmlPullParser.END_DOCUMENT){
         
                if(eventType== XmlPullParser.START_TAG){
                       
                        String tag= xpp.getName();
                       
                        if("title".equals(tag)){
                                currentTitle = xpp.nextText();
                        }elseif("content".equals(tag)){
                                String imageUrl= xpp.getAttributeValue(0);
                                images.put(currentTitle, imageUrl);
                        }
                }
                eventType = xpp.next();
        }
       
        }catch(Exception e){
                AQUtility.report(e);
        }
       
        showResult(images, status);
       
}
bytes
//fetch a remote resource in raw bytes
String url ="http://www.vikispot.com/z/images/vikispot/android-w.png";
aq.ajax(url,byte[].class,new AjaxCallback<byte[]>(){
        @Override
        publicvoid callback(String url,byte[]object,AjaxStatus status){
                Toast.makeText(aq.getContext(),"bytes array:" +object.length,Toast.LENGTH_LONG).show();
        }
});
Bitmap
//fetch a remote resource in raw bitmap
String url ="http://www.vikispot.com/z/images/vikispot/android-w.png";
aq.ajax(url,Bitmap.class,new AjaxCallback<Bitmap>(){
        @Override
        publicvoid callback(String url,Bitmap object,AjaxStatus status){
               
        }
});
File
String url ="https://picasaweb.google.com/data/feed/base/featured?max-results=8";              aq
aq.progress(R.id.progress).ajax(url,File.class,new AjaxCallback<File>(){
       
        publicvoid callback(String url,File file,AjaxStatus status){
               
                if(file!= null){
                        showResult("File:"+ file.length()+ ":"+ file, status);
                }else{
                        showResult("Failed", status);
                }
        }
       
});
File Download
String url ="https://picasaweb.google.com/data/feed/base/featured?max-results=16";            
File ext =Environment.getExternalStorageDirectory();
File target =new File(ext,"aquery/myfolder/photos.xml");              aq
aq.progress(R.id.progress).download(url, target, newAjaxCallback<File>(){
       
        publicvoid callback(String url,File file,AjaxStatus status){
               
                if(file!= null){
                        showResult("File:"+ file.length()+ ":"+ file, status);
                }else{
                        showResult("Failed", status);
                }
        }
       
});
InputStream
String url ="https://picasaweb.google.com/data/feed/base/featured?max-results=8";              aq
aq.progress(R.id.progress).ajax(url,InputStream.class,new AjaxCallback<InputStream>(){
       
        publicvoid callback(String url,InputStream is,AjaxStatus status){
               
                if(is!= null){
                        showResult("InputStream:"+ is, status);
                }else{
                        showResult("Failed", status);
                }
        }
       
});
Custom Type
private staticclass Profile{
        publicString id;
        publicString name;            
}
private staticclass GsonTransformerimplements Transformer{
        public<T> T transform(String url,Class<T> type,String encoding,byte[] data,AjaxStatus status){                                   
                Gson g= newGson();
                return g.fromJson(newString(data), type);
        }
}
public void async_transformer(){
       
        String url= "https://graph.facebook.com/205050232863343";                     
        GsonTransformer t= newGsonTransformer();
       
        aq.transformer(t).progress(R.id.progress).ajax(url,Profile.class,new AjaxCallback<Profile>(){                                
                publicvoid callback(String url,Profile profile,AjaxStatus status){                         
                        Gson gson= newGson();
                        showResult("GSON Object:"+ gson.toJson(profile), status);                             
                }                              
        });
   
}
Custom Type (Static Transformer)
  1. Native
  1. instance transformer()
  1. static setTransformer()
//set the static transformer when application starts
GsonTransformer t =new GsonTransformer();
AjaxCallback.setTransformer(t);
//any subsequent ajax calls will use the static transformer for custom types
String url ="https://graph.facebook.com/205050232863343";
aq.ajax(url,Profile.class,this, "callback");
Http POST
public void async_post(){
       
    //do a twiiter search with a http post
       
    String url= "http://search.twitter.com/search.json";
       
    Map<String,Object>params =new HashMap<String,Object>();
    params.put("q","androidquery");
       
    aq.ajax(url,params,JSONObject.class,new AjaxCallback<JSONObject>(){
        @Override
        publicvoid callback(String url,JSONObject json,AjaxStatus status){
               
            showResult(json);
           
        }
    });
       
}
Http POST (Multipart)
private void aync_multipart(){
       
        String url= "https://graph.facebook.com/me/photos";
       
        Map<String,Object>params =new HashMap<String,Object>();
        params.put("message","Message");
       
        //Simply put a byte[] to the params, AQuery will detect it and treat it as a multi-part post
        byte[] data= getImageData();
        params.put("source", data);
       
        //Alternatively, put a File or InputStream instead of byte[]
        //File file = getImageFile();          
        //params.put("source", file);
       
        AQuery aq= newAQuery(getApplicationContext());
        aq.auth(handle).ajax(url,params,JSONObject.class,this, "photoCb");
       
}
Http POST (Custom Entity)
public void async_post_entity()throws UnsupportedEncodingException{
       
    String url= "http://search.twitter.com/search.json";
       
    List<NameValuePair> pairs= newArrayList<NameValuePair>();
        pairs.add(newBasicNameValuePair("q","androidquery"));                                
        HttpEntity entity= newUrlEncodedFormEntity(pairs,"UTF-8");
   
        Map<String,Object>params =new HashMap<String,Object>();
        params.put(AQuery.POST_ENTITY, entity);
   
    aq.progress(R.id.progress).ajax(url,params,JSONObject.class,new AjaxCallback<JSONObject>(){
        @Override
        publicvoid callback(String url,JSONObject json,AjaxStatus status){
           
            showResult(json, status);
           
        }
    });
}
Long URL (2000+ length)
Caching
String url ="http://www.google.com";
//return a cached copy if the data is recently fetched within 15 minutes
long expire =15 *60 *1000;
aq.ajax(url,String.class, expire,new AjaxCallback<String>(){
    @Override
    public void callback(String url,String html,AjaxStatus status){                showResult
        showResult(html);
    }
       
});
Refresh Content
String url ="http://www.google.com";
long expire =-1;
aq.ajax(url,String.class, expire,new AjaxCallback<String>(){
    @Override
    public void callback(String url,String html,AjaxStatus status){                showResult
        showResult(html);
    }
       
});
Invalidating Cache
public void callback(String url,JSONObject json,AjaxStatus status){
   
        if(json!= null){
                if("1".equals(json.optString("status"))){
                        //do something
                }else{
                        //we believe the request is a failure, don't cache it
                        status.invalidate();
                }
        }
}
Progress
String url ="http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";                aq
aq.progress(R.id.progress).ajax(url,JSONObject.class,this, "jsonCb");
ProgressDialog dialog =new ProgressDialog(this);
dialog.setIndeterminate(true);
dialog.setCancelable(true);
dialog.setInverseBackgroundForced(false);
dialog.setCanceledOnTouchOutside(true);
dialog.setTitle("Sending...");
String url ="http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";                aq
aq.progress(dialog).ajax(url,JSONObject.class,this, "jsonCb");
//Use activity's setProgressBarIndeterminateVisibility(show);
//Remember to call this before setContentView(): requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
String url ="http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";          aq
aq.progress(this).ajax(url,JSONObject.class,this, "jsonCb");  
Activity Finished Detection
//using the activity as context will ensure no callback is called when activity is finished
AQuery aq =new AQuery(activity);
//using the application context will ensure the callback to be called as long as the application is running
AQuery aq =new AQuery(getApplicationContext());
Synchronous Call (Block)
String url ="http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";
       
AjaxCallback<JSONObject> cb= newAjaxCallback<JSONObject>();           cb
cb.url(url).type(JSONObject.class);                     aq
       
aq.sync(cb);
       
JSONObject jo = cb.getResult();
AjaxStatus status = cb.getStatus();
Ajax Status
public void callback(String url,JSONObject json,AjaxStatus status){
   
    int source= status.getSource();
    int responseCode= status.getCode();
    long duration= status.getDuration();
    Date fetchedTime= status.getTime();
    String message= status.getMessage();
    String redirect= status.getRedirect();
    DefaultHttpClient client= status.getClient();
    //returns the html response when response code is not 2xx
    String errorResponse= status.getError();  
}
Advance
String url ="http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";
AjaxCallback<JSONObject> cb= newAjaxCallback<JSONObject>();        cb
cb.url(url).type(JSONObject.class).weakHandler(this,"jsonCb").fileCache(true).expire(0);
aq.ajax(cb);
Http Headers
String url ="http://www.google.com";
AjaxCallback<String> cb= newAjaxCallback<String>();        cb
cb.url(url).type(String.class).weakHandler(this,"stringCb");
cb.header("Referer","http://code.google.com/p/android-query/");
cb.header("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2");
aq.ajax(cb);
Http Cookies
String url ="http://www.androidquery.com/p/doNothing";
AjaxCallback<JSONObject> cb= newAjaxCallback<JSONObject>();           cb
cb.url(url).type(JSONObject.class).weakHandler(this,"cookieCb");
cb.cookie("hello","world").cookie("foo","bar");               aq
aq.ajax(cb);
Http Response Headers
status.getHeaders()
Http Response Cookies
status.getCookies();
Encoding (BETA)
       
//Using String.class type will attempt to detect the encoding of a page and transform it to utf-8
               
String url ="http://114.xixik.com/gb2312_big5/";
aq.progress(R.id.progress).ajax(url,String.class,0, this, "encodingCb");
               
       
Maintenance
Clean Up
Simple
protected void onDestroy(){
       
        super.onDestroy();
       
        //clean the file cache when root activity exit
        //the resulting total cache size will be less than 3M  
        if(isTaskRoot()){
                AQUtility.cleanCacheAsync(this);
        }
}
Advance
protected void onDestroy(){
       
        super.onDestroy();
       
        if(isTaskRoot()){
                //clean the file cache with advance option
                long triggerSize= 3000000;//starts cleaning when cache size is larger than 3M
                long targetSize= 2000000;      //remove the least recently used files until cache size is less than 2M
                AQUtility.cleanCacheAsync(this, triggerSize, targetSize);
        }
       
}

Make sure the following permission is included in your manifest.

WRITE_EXTERNAL_STORAGE is required for temporary caching for large response types.

Asynchronous AJAX or RPC calls are simple with AQuery.

AQuery transform the data automatically base on the class type passed in the ajax method.

Supported types:

If there are native Android data types (without third party dependency) you want AQuery to support, please send us feedback.

Note that AQuery uses a weak reference to hold the handler for this method. This is to make sure an activity won't be memory leaked when it's terminated before the AJAX request finishes.

AQuery provide a light weight XML parser called XmlDom. javadoc

XmlDom is a specialized class for simple and easy XML parsing. It's designed to be used in basic Android api 4+ runtime without any dependency.

Example to parse Picasa's featured photos feed:

Related Blog: XML Parsing

For large XML response that cannot fit in memory, the XMLPullParser can be used to avoid memory issue.

If you can specify where to store the downloaded file with the download() method. Note that these files will not be deleted like cached files.

AQuery by default supports types that are native to Android. For app specific data types, you can assign a custom Transformer to the ajax call and convert the raw data to a desired type. The benefit of transformer is that it's run under the background thread (similar to the natively supported types), therefore minimizing CPU cycles and avoid blocking on the UI thread.

This example show how to use Gson to transform raw data to user defined types.

A stateless static default transformer can also be set with AjaxCallback.setTransformer().

Transformers are selected in the following priority:

AQuery support multipart post such as uploading an image to a service. Simply do a regular POST and put byte array, Inputstream, or File as one of the parameters.

If a custom entity is required, you can use the special AQuery.POST_ENTITY key name to pass in an HttpEntity object.

Url length shouldn't be longer than 2000 characters. (reference)

The http POST method might be used to get around this limit. For example, Google Chart allow a post method for requests that will run over 2000 characters long.

AQuery detects such case and automatically switch from GET to POST method if required.

Caching is easy with ajax requests. Just pass in an expire time as a parameter, and if the data is available, it will be served from the file cache instead of fetching over the network.

Passing expire time as -1 will ensure the content be refreshed immediately and to be file cached.

Calling the invalidate method of the AjaxStatus object will invalidate the url content so that it will not be cached. It's useful when http status is 200 but the object returned is invalid.

We can show the loading progress by using the progress() method. Pass in the progress bar id, or any other view id to the progress method, and the view will be shown or hide to display ajax progress.

AQuery will examine the initialization context and skip the ajax callback if an activity is already stopped before the aync task is completed. This behavior avoid unnecessary work and avoid modifying ui states that could be illegal (such as showing a dialog when an activity is not longer active).

If the ajax call is run outside of main thread, the sync() method can be used to block the calling thread until the ajax call is completed (or until it's timed out).

Fetch result synchronously:

Note that this will block the thread until the result is returned. The actual work will be done in another thread pool. Calling this method in Main/UI thread will cause an exception.

An AjaxStatus object is returned with any callback. This object holds some meta information regarding the aync task performed.

javadoc

The AQuery object provide various commonly used "ajax" methods. For more advanced (but less commonly used) features such as http header and authentication, AjaxCallback can be used directly to customize the requests.

Note: url and type are required parameters.

Use the header method to configure http request headers.

Use the cookie method to set http cookies.

Returns a list of headers. If the request is cached or a http multipart post, this method returns an empty list.

Returns a list of cookies. If the request is cached or a http multipart post, this method returns an empty list.

The default ajax callback uses UTF-8 to transform the object. If type String is specified and the content is html, AQuery will make a best-effort attempt to detect the encoding by inspecting the response header and the inline html META tag. If file cache is enabled, the content will be stored as UTF-8 bytes and subsequent read will not require encoding detection again.

If custom encoding is needed, uses the encoding() method to fix the encoding.

AQuery provides few utility functions to help you control ajax and caching behavior.

If you use file cache for images, regularly clean the cache dir when the application exits.


(三)U 界面控件-ui

出现等待效果: U.Dialog().showWait();

取消等待效果: U.Dialog().cancelWait();

获取能显示GIFView: U.View_Gif();

获取颜色选择器: U.View_SelectColor();

获取图片滤镜: U.ImageView_filter();//使图片变暗,变亮,饱和度变化,彩色变黑白

为指定控件添加摇一摇监听器: U.ListenShake(context, onShakeListener);

为图片增加手指缩放效果: U.ImageView_zoomTouch(view);

为控件增加点击效果(不需要图片,浅色图效果不明显): U.View_click(view);

为控件增加闪烁效果: U.view_toggle(view);

ListView增加下拉刷新效果:(需要COCOBuildcreateFolder任务支持)

1.<android.support.v4.widget.SwipeRefreshLayout

 android:id="@+id/coco_ListRefresh" 

 android:layout_width="match_parent"

 android:layout_height="match_parent" > 

2.implements OnRefreshListener;

3.SwipeRefreshLayout sp=U.Effect_pullRefresh(this,this);

4.sp.setRefreshing(false);

显示确认Dialog: U.Dialog().showMakeSure();

显示选择Dialog: U.Dialog().showSelect();

采用反射强制Dialog能否退出:U.Dialog().cancelAble(boolean);

实现了多个View之间的滑动切换U.View_RLFlippe();

1. View_RLFlippe views=U.View_RLFlippe(Context);

2. views.addView(view1);

3. views.addView(view2);

4. views.addView(view3);

view1,view2,view3之间即可手机滑动切换.


时间有限,以上只粗略列出了COCOFrame小部分功能,使用方式很简单,可自行下载jar包使用.

此贴将持续更新.

下载地址:http://download.csdn.net/detail/landehuxi/7673747

2 0
原创粉丝点击