Android快速开发框架LoonAndroid

1、源码简介:


主要有以下模块:

 (1) 自动注入框架(只需要继承框架内的application既可) 

 (2) 图片加载框架(多重缓存,自动回收,最大限度保证内存的安全性)

 (3) 网络请求模块(继承了基本上现在所有的http请求) 

 (4) eventbus(集成一个开源的框架)

 (5) 验证框架(集成开源框架)

 (6) json解析(支持解析成集合或者对象)

 (7) 数据库(不知道是哪位写的 忘记了)

 (8) 多线程断点下载(自动判断是否支持多线程,判断是否是重定向)

 (9) 自动更新模块 

 (10) 一系列工具类


2、代码片段

[java]  view plain copy
  1. <span style="font-size:18px;">  
  2. public class Handler_Network {  
  3.     /** 
  4.      * 检测手机是否开启GPRS网络,需要调用ConnectivityManager,TelephonyManager 服务. 
  5.      *  
  6.      * @param context 
  7.      * @return boolean 
  8.      */  
  9.     public static boolean checkGprsNetwork(Context context) {  
  10.         boolean has = false;  
  11.         ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);  
  12.         TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);  
  13.         NetworkInfo info = connectivity.getActiveNetworkInfo();  
  14.         int netType = info.getType();  
  15.         int netSubtype = info.getSubtype();  
  16.         if (netType == ConnectivityManager.TYPE_MOBILE && netSubtype == TelephonyManager.NETWORK_TYPE_UMTS && !mTelephony.isNetworkRoaming()) {  
  17.             has = info.isConnected();  
  18.         }  
  19.         return has;  
  20.    
  21.     }  
  22.    
  23.     /** 
  24.      * 检测手机是否开启WIFI网络,需要调用ConnectivityManager服务. 
  25.      *  
  26.      * @param context 
  27.      * @return boolean 
  28.      */  
  29.     public static boolean checkWifiNetwork(Context context) {  
  30.         boolean has = false;  
  31.         ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);  
  32.         NetworkInfo info = connectivity.getActiveNetworkInfo();  
  33.         int netType = info.getType();  
  34.         int netSubtype = info.getSubtype();  
  35.         if (netType == ConnectivityManager.TYPE_WIFI) {  
  36.             has = info.isConnected();  
  37.         }  
  38.         return has;  
  39.     }  
  40.    
  41.     /** 
  42.      * 检测当前手机是否联网 
  43.      *  
  44.      * @param context 
  45.      * @return boolean 
  46.      */  
  47.     public static boolean isNetworkAvailable(Context context) {  
  48.         ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);  
  49.         if (connectivity == null) {  
  50.             return false;  
  51.         } else {  
  52.             NetworkInfo[] info = connectivity.getAllNetworkInfo();  
  53.             if (info != null) {  
  54.                 for (int i = 0; i < info.length; i++) {  
  55.                     if (info[i].getState() == NetworkInfo.State.CONNECTED) {  
  56.                         return true;  
  57.                     }  
  58.                 }  
  59.             }  
  60.         }  
  61.         return false;  
  62.     }  
  63.    
  64.     /** 
  65.      * 手机是否处在漫游 
  66.      *  
  67.      * @param mCm 
  68.      * @return boolean 
  69.      */  
  70.     public boolean isNetworkRoaming(Context mCm) {  
  71.         ConnectivityManager connectivity = (ConnectivityManager) mCm.getSystemService(Context.CONNECTIVITY_SERVICE);  
  72.         if (connectivity == null) {  
  73.             return false;  
  74.         }  
  75.         NetworkInfo info = connectivity.getActiveNetworkInfo();  
  76.         boolean isMobile = (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE);  
  77.         TelephonyManager mTm = (TelephonyManager) mCm.getSystemService(Context.TELEPHONY_SERVICE);  
  78.         boolean isRoaming = isMobile && mTm.isNetworkRoaming();  
  79.         return isRoaming;  
  80.     }  
  81.    
  82. }</span>  


3、下载

http://pan.baidu.com/s/1i3oqaR7


From: http://www.devstore.cn/code/info/74.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值