Skip to content

yanjingxia/android-common

 
 

Repository files navigation

Trineaandroid-common-lib

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

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

####示例APK:
本地下载
####一. 缓存类 主要特性:(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

#####2. 滑动一页(一个Item)的Gallery 使用及实现原理:滑动一页(一个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常用工具类

####5.新增加库部分 (1)cn.pedant.SweetAlert [Android版的SweetAlert,清新文艺,快意灵动的甜心弹框] (https://github.com/pedant/sweet-alert-dialog/blob/master/README.zh.md)

(2)com.dd.circular-progress-button [Android上圆形的进度条按钮] (https://github.com/dmytrodanylyk/circular-progress-button)

(3)com.jfeinstein.jazzyviewpager [支持各种切换动画的ViewPager] (https://github.com/jfeinstein10/JazzyViewPager)

(4)com.nineoldandroids.animation [Android属性动画,支持到3.0以前的版本] (https://github.com/JakeWharton/NineOldAndroids)

(5)com.pnikosis.materialishprogress [Material Design风格的进度条] (https://github.com/pnikosis/materialish-progress)

(6)com.viewpagerindicator [ViewPage的各种指示器] (https://github.com/JakeWharton/ViewPagerIndicator)

(7)me.drakeet.library [仿IOS风格支持按下效果和背景定制的Button、ImageView] (https://github.com/drakeet/AndroidUIView)

(8)se.emilsjolander.stickylistheaders [固定头部的listview] (https://github.com/emilsjolander/StickyListHeaders)

(9)uk.co.senab.photoview [支持缩放的ImageView] (https://github.com/chrisbanes/PhotoView)

(10)com.kyleduo.switchbutton [切换状态的仿Switch的Button] (https://github.com/kyleduo/SwitchButton)

(11)com.klinker.android.link_builder [易于创建可点击链接的textview] (https://github.com/klinker24/Android-TextView-LinkBuilder)

(12)com.daimajia.androidanimations [android上各种动画的实现效果] (https://github.com/daimajia/AndroidViewAnimations)

(13)com.orhanobut.logger [android pretty logger] (https://github.com/orhanobut/logger)

(14)glide [图片加载库] (https://github.com/bumptech/glide)

(15)retrofit [网络请求库,注解的方式] (https://github.com/square/retrofit)

####6 新增加自定义view (1)BorderScrollView [支持滚动到顶部和底部回调的scrollview] (2)ChangeColorIconWithText [仿微信底部导航栏支持颜色渐变的view]
(3)CustomButton [自定义普通按钮,支持正常和按下背景颜色的定制] (4)CustomEditText [自定义文本输入框,增加清空按钮] (5)CustomImageButton [自定义图片按钮,支持正常和按下背景图片的定制] (6)CustomRippleButton [自定义Ripple按钮] (7)DropDownListView [支持下来刷新和底部加载更多的listview] (8)FlowLayout [浮动布局,例如各种热门标签的排列] (9)HackyViewPager[修复触摸bug导致崩溃的viewpager] (10)HorizontalListView [水平滚动的listview] (11)RoundedImageView [支持圆角或圆形边框的ImageView] (12)SideBar [仿通讯录右边的字母导航栏] (13)SlideOnePageGallery [支持滑动页的Gallery,已废弃]

Proguard

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

Download

Maven:

<dependency>
    <groupId>cn.trinea.android.common</groupId>
    <artifactId>trinea-android-common</artifactId>
    <version>4.2.15</version>
</dependency>

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.

About

Android common lib, include ImageCache, HttpCache, DropDownListView, DownloadManager, Utils and so on

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 100.0%