AndroidCommon

Project Url: Trinea/AndroidCommon
Introduction: Android 公共库
Other: 包括:a. ImageCache 图片缓存,包含内存和 Sdcard 缓存
https://www.trinea.cn/android/android-imagecache/
特点:(1)支持预取新图片,支持等待队列
(2)包含二级缓存,可自定义文件名保存规则
(3)可选择多种缓存算法(FIFO、LIFO、LRU、MRU、LFU、MFU 等 13 种)或自定义缓存算法
(4)可方便的保存及初始化恢复数据
(5)支持不同类型网络处理
(6)可根据系统配置初始化缓存等
More: Author   ReportBugs   DemoAPK   Doc
Tags:

已停止维护

关于我,欢迎关注
微博:Trinea    主页:codekk.com    邮箱:trinea.cn#gmail.com    微信:codek2

主要包括缓存(图片缓存、预取缓存、网络缓存)、公共 View(下拉及底部加载更多 ListView、底部加载更多 ScrollView、滑动一页 Gallery)及Android 常用工具类(网络、下载、Android 资源操作、shell、文件、Json、随机数、Collection 等等)。
示例源码:TrineaAndroidDemo
使        用:拉取代码导入 IDE,右击你的工程->properties->Android,在 library 中选择 TrineaAndroidCommon。
Api Guide:TrineaAndroidCommon API Guide

Dev Tools App

The Dev Tools App is a powerful android development tool that can help you improve efficiency greatly, It can be used to view the latest open source projects, view activity history, view manifest, decompile, color picker, extract apk or so, view app info, open or close the options in the developer options quickly, and more.

You can download it from DevTools@Google Play.

一. 缓存类

主要特性:(1).使用简单 (2).轻松获取及预取取新图片 (3).包含二级缓存 (4).可选择多种缓存算法(FIFO、LIFO、LRU、MRU、LFU、MFU 等 13 种)或自定义缓存算法 (5).可方便的保存及初始化恢复数据 (6).省流量性能佳(有且仅有一个线程获取图片) (7).支持 http 请求 header 设置及不同类型网络处理(8).可根据系统配置初始化缓存 (9).扩展性强 (10).支持等待队列 (11)包含 map 的大多数接口。

1. 图片缓存

使用见:图片缓存的使用
适用:获取图片较多且图片使用频繁的应用,包含二级缓存,如新浪微博、twitter、微信头像、美丽说、蘑菇街、花瓣、淘宝等等。效果图如下:
ImageCahe

2. 图片 SD 卡缓存

使用见:图片 SD 卡缓存的使用
适用:应用中获取图片较多且图片较大的情况。需要二级缓存及 ListView 或 GridView 图片加载推荐使用上面的ImageCache。效果图如下:
ImageSDCardCache

3. 网络缓存

使用见:Android 网络缓存
适用:网络获取内容不大的应用,尤其是 api 接口数据,如新浪微博、twitter 的 timeline、微信公众账号发送的内容等等。效果图如下:
HttpCache

4. 预取数据缓存

使用见:预取数据缓存
缓存类关系图如下:其中 HttpCache 为后续计划的 http 缓存 Image Cache

二. 公用的 view

1. 下拉刷新及滚动到底部加载更多的 Listview

使用: 下拉刷新及滚动到底部加载更多 listview 的使用
实现原理: http://trinea.iteye.com/blog/1562281。效果图如下:
DropDownListView

使用及实现原理:滑动一页(一个 Item)的 Gallery 的使用。效果图如下:
ViewPager1 ViewPager2

3. 滑动到底部或顶部响应的 ScrollView

使用及实现原理: 滚动到底部或顶部响应的 ScrollView 使用。效果图如下:
ScrollView

三. 工具类

具体介绍可见:Android 常用工具类
目前包括 HttpUtils、DownloadManagerProShellUtilsPackageUtils、PreferencesUtils、JSONUtils、FileUtils、ResourceUtils、StringUtils、ParcelUtils、RandomUtils、ArrayUtils、ImageUtils、ListUtils、MapUtils、ObjectUtils、SerializeUtils、SystemUtils、TimeUtils。

1. Android 系统下载管理 DownloadManager 使用

使用示例:Android 系统下载管理 DownloadManager 功能介绍及使用示例
功能扩展:Android 下载管理 DownloadManager 功能扩展和 bug 修改 效果图如下:
downloadManagerDemo

2. Android APK root 权限静默安装

使用示例:Android APK root 权限静默安装

3. Android root 权限

直接调用ShellUtils.execCommand方法

4. 图片工具类

(1)Drawable、Bitmap、byte 数组相互转换; (2)根据 url 获得 InputStream、Drawable、Bitmap
更多工具类介绍见Android 常用工具类

Proguard

-keep class cn.trinea.android.** { *; }
-keepclassmembers class cn.trinea.android.** { *; }
-dontwarn cn.trinea.android.**

Download

Gradle:

compile 'cn.trinea.android.common:trinea-android-common:4.2.15'

License

Copyright 2013 trinea.cn

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools