Android 常用开源库

You deserve to be able to cooperate openly and freely with other people who use software.You deserve to be able to learn how the software works, and to teach your students with it.You deserve to be able to hire your favorite programmer to fix it when it breaks. You deserve free software.
你可以公开、自由地与其他软件使用者合作,你有权了解软件的工作原理,并将其传授给你的学生,当软件发生问题时你完全可以雇用你所喜爱的程序员对它进行完善。 你理应得到自由的软件。 ——Richard Matthew Stallman(理查·马修·斯托曼,自由软件运动的精神领袖)

选择开源框架的原则

本部分引用自:编写高质量代码之Java 秦小波 著 建议139:大胆采用开源工具
1. 普适性原则:选择一个工具或框架就必须考虑项目成员的整体技术水平,不能有太大的跨度或跳跃性,要确保大部分项目成员对工具都比较熟悉,若一个项目中的成员大部分是新员工,那么在持久层框架的选择上
2. 唯一性原则:相同的工具只选择一个或一种,不要让多种相同或相似职能的工具共存
3. “大树纳凉”原则:选择大的开源项目
4. 精而专原则
5. 高热度原则
一个开源项目的热度越高,更新得就越频繁,使用的人群就越广,Bug的曝光率就越快,修复效率也就越高,这对我们项目的稳定性来说是非常重要的。有很多开源项目可能已经很长时间没有更新了,或者是已经非常成熟了,或者是濒于关闭了,这我们不能要求太高,毕竟开源项目已经共享出了他人的精力和智力,我们在享受他人提供的成果的同时,也应该珍惜他人的劳动,最低的标准是不要诋毁开源项目。

1.网络

  • volley

volley https://github.com/google/volley
缺点:上传文件 、session 处理、大数据量处理不适合使用

  • async-http

async-http

https://github.com/loopj/android-async-http

处理cookie

 public static  void post(String url,RequestParams params,JsonHttpResponseHandler responseHandler){

        AsyncHttpClient client = new AsyncHttpClient();
        //保存cookie,自动保存到了shareprefercece
        PersistentCookieStore myCookieStore = new PersistentCookieStore(Application.mInstance);
        client.setCookieStore(myCookieStore);

        if(params == null){
            params =  new RequestParams();
        }    
            List<Cookie> cookies = myCookieStore.getCookies();
            int  size =cookies.size();
            if(size>0){
                BasicCookieStore bcs = new BasicCookieStore();
                bcs.addCookies(cookies.toArray(
                        new Cookie[cookies.size()]));
                client.setCookieStore(bcs);
            }
        try {
            client.post(url, params, responseHandler);
        } catch (Exception e) {
            e.printStackTrace();
            responseHandler.onFailure(-1, new Header[]{}, new Throwable(e.getMessage()), new JSONObject());
        }
    }

上传图片:

   List<File> images
        if (images != null) {
            for (int i = 0; i < images.size(); i++) {
                File file = images.get(i);
                try {
                    params.put("img_file[" + i + "]", file, "image/png");
                } catch (FileNotFoundException e) {
                    failuredListener.onRespone("file not found", -1);
                    return;
                }
            }
        }
  • okhttp

https://github.com/square/okhttp

2.导航指示器

3.跑马灯

俗名:可垂直跑、可水平跑的跑马灯;学名:可垂直翻、可水平翻的翻页公告

https://github.com/sfsheng0322/MarqueeView

4.侧滑菜单

slidingMenu_library

https://github.com/jfeinstein10/SlidingMenu

5.黄油刀

butterknife

https://github.com/JakeWharton/butterknife

6.dialog

  • material-dialogs

https://github.com/afollestad/material-dialogs

  • sweet-alert-dialog

https://github.com/pedant/sweet-alert-dialog

7.EventBu

EventBu

https://github.com/greenrobot/EventBus

8.图片

  • glide

https://github.com/bumptech/glide

  • Android-Universal-Image-Loader

https://github.com/nostra13/Android-Universal-Image-Loader

9.扫码

BGAQRCode-Android
https://github.com/bingoogolapple/BGAQRCode-Android

10.轮播图

android-auto-scroll-view-pager
https://github.com/Trinea/android-auto-scroll-view-pager/

11.Json解析

  • fastjson

https://github.com/alibaba/fastjson

  • gson

https://github.com/google/gson

12.下拉刷新

13.数据库

LitePal

https://github.com/LitePalFramework/LitePal

14.logger

logger

https://github.com/orhanobut/logger

15.内存泄漏检测

leakcanary

https://github.com/square/leakcanary

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值