├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ └── styles.xml
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ └── layout
│ │ │ └── activity_main.xml
│ │ ├── java
│ │ └── com
│ │ │ └── snicesoft
│ │ │ ├── androidkit
│ │ │ ├── MainActivity.java
│ │ │ └── KitApplication.java
│ │ │ └── net
│ │ │ ├── api
│ │ │ └── API.java
│ │ │ └── data
│ │ │ └── Result.java
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── bitmap
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── java
│ │ └── com
│ │ │ └── lidroid
│ │ │ └── xutils
│ │ │ ├── bitmap
│ │ │ ├── callback
│ │ │ │ ├── BitmapLoadFrom.java
│ │ │ │ ├── BitmapSetter.java
│ │ │ │ └── DefaultBitmapLoadCallBack.java
│ │ │ ├── factory
│ │ │ │ └── BitmapFactory.java
│ │ │ ├── BitmapCacheListener.java
│ │ │ ├── core
│ │ │ │ └── BitmapSize.java
│ │ │ └── download
│ │ │ │ └── Downloader.java
│ │ │ ├── cache
│ │ │ ├── FileNameGenerator.java
│ │ │ └── MD5FileNameGenerator.java
│ │ │ ├── task
│ │ │ ├── Priority.java
│ │ │ ├── PriorityObject.java
│ │ │ ├── TaskHandler.java
│ │ │ ├── PriorityRunnable.java
│ │ │ └── PriorityExecutor.java
│ │ │ └── util
│ │ │ └── IOUtils.java
│ │ └── AndroidManifest.xml
└── proguard-rules.pro
├── basekit
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── java
│ │ └── com
│ │ │ └── snicesoft
│ │ │ └── basekit
│ │ │ ├── http
│ │ │ ├── Charset.java
│ │ │ ├── ContentType.java
│ │ │ ├── HttpError.java
│ │ │ └── HttpCallBack.java
│ │ │ ├── HttpKit.java
│ │ │ ├── BitmapKit.java
│ │ │ ├── bitmap
│ │ │ ├── BitmapLoadListener.java
│ │ │ └── BitmapConfig.java
│ │ │ ├── util
│ │ │ ├── MathUtils.java
│ │ │ ├── DialogUtil.java
│ │ │ ├── NetworkUtil.java
│ │ │ ├── ViewTools.java
│ │ │ ├── AppUtils.java
│ │ │ ├── CommonUtils.java
│ │ │ ├── UpdateUtil.java
│ │ │ ├── DownloadUtils.java
│ │ │ └── ObjectUtils.java
│ │ │ ├── IBitmapKit.java
│ │ │ ├── IHttpKit.java
│ │ │ └── controller
│ │ │ └── Controller.java
│ │ └── AndroidManifest.xml
└── proguard-rules.pro
├── http.volley
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── android
│ │ └── volley
│ │ ├── TimeoutError.java
│ │ ├── toolbox
│ │ ├── MimeKit.java
│ │ ├── Authenticator.java
│ │ ├── NoCache.java
│ │ ├── HttpStack.java
│ │ └── ClearCacheRequest.java
│ │ ├── ServerError.java
│ │ ├── NoConnectionError.java
│ │ ├── ParseError.java
│ │ ├── Network.java
│ │ ├── NetworkError.java
│ │ ├── ResponseDelivery.java
│ │ ├── RetryPolicy.java
│ │ ├── VolleyError.java
│ │ └── AuthFailureError.java
└── proguard-rules.pro
├── library
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── java
│ │ └── com
│ │ │ ├── snicesoft
│ │ │ ├── basekit
│ │ │ │ ├── http
│ │ │ │ │ ├── Charset.java
│ │ │ │ │ ├── ContentType.java
│ │ │ │ │ ├── HttpError.java
│ │ │ │ │ └── HttpCallBack.java
│ │ │ │ ├── HttpKit.java
│ │ │ │ ├── BitmapKit.java
│ │ │ │ ├── bitmap
│ │ │ │ │ ├── BitmapLoadListener.java
│ │ │ │ │ └── BitmapConfig.java
│ │ │ │ ├── util
│ │ │ │ │ ├── MathUtils.java
│ │ │ │ │ ├── DialogUtil.java
│ │ │ │ │ ├── NetworkUtil.java
│ │ │ │ │ ├── ViewTools.java
│ │ │ │ │ ├── AppUtils.java
│ │ │ │ │ ├── CommonUtils.java
│ │ │ │ │ ├── UpdateUtil.java
│ │ │ │ │ ├── DownloadUtils.java
│ │ │ │ │ └── ObjectUtils.java
│ │ │ │ ├── net
│ │ │ │ │ └── api
│ │ │ │ │ │ ├── APIUtils.java
│ │ │ │ │ │ ├── TestConfig.java
│ │ │ │ │ │ ├── ProductConfig.java
│ │ │ │ │ │ ├── Config.java
│ │ │ │ │ │ ├── ConfigFactory.java
│ │ │ │ │ │ └── APIConfig.java
│ │ │ │ ├── IBitmapKit.java
│ │ │ │ ├── IHttpKit.java
│ │ │ │ └── controller
│ │ │ │ │ └── Controller.java
│ │ │ ├── viewbind
│ │ │ │ ├── pluginmgr
│ │ │ │ │ └── Proxy.java
│ │ │ │ ├── base
│ │ │ │ │ ├── IAv.java
│ │ │ │ │ ├── LayoutUtils.java
│ │ │ │ │ ├── AvFragment.java
│ │ │ │ │ ├── AvActivity.java
│ │ │ │ │ └── AvFragmentActivity.java
│ │ │ │ ├── annotation
│ │ │ │ │ ├── Layout.java
│ │ │ │ │ ├── DataType.java
│ │ │ │ │ ├── Id.java
│ │ │ │ │ └── DataBind.java
│ │ │ │ ├── rule
│ │ │ │ │ ├── RecyclerHolder.java
│ │ │ │ │ └── IHolder.java
│ │ │ │ ├── ViewFinder.java
│ │ │ │ └── widget
│ │ │ │ │ ├── MultViewAdapter.java
│ │ │ │ │ └── AvAdapter.java
│ │ │ └── framework
│ │ │ │ ├── BaseActivity.java
│ │ │ │ ├── ActivityMgr.java
│ │ │ │ ├── FragmentUtil.java
│ │ │ │ └── BaseFragmentActivity.java
│ │ │ ├── lidroid
│ │ │ └── xutils
│ │ │ │ ├── bitmap
│ │ │ │ ├── callback
│ │ │ │ │ ├── BitmapLoadFrom.java
│ │ │ │ │ ├── BitmapSetter.java
│ │ │ │ │ └── DefaultBitmapLoadCallBack.java
│ │ │ │ ├── factory
│ │ │ │ │ └── BitmapFactory.java
│ │ │ │ ├── BitmapCacheListener.java
│ │ │ │ ├── core
│ │ │ │ │ └── BitmapSize.java
│ │ │ │ └── download
│ │ │ │ │ └── Downloader.java
│ │ │ │ ├── cache
│ │ │ │ ├── FileNameGenerator.java
│ │ │ │ └── MD5FileNameGenerator.java
│ │ │ │ ├── task
│ │ │ │ ├── Priority.java
│ │ │ │ ├── TaskHandler.java
│ │ │ │ ├── PriorityObject.java
│ │ │ │ ├── PriorityRunnable.java
│ │ │ │ └── PriorityExecutor.java
│ │ │ │ ├── db
│ │ │ │ ├── sqlite
│ │ │ │ │ ├── ColumnDbType.java
│ │ │ │ │ └── FinderLazyLoader.java
│ │ │ │ ├── annotation
│ │ │ │ │ ├── NoAutoIncrement.java
│ │ │ │ │ ├── Finder.java
│ │ │ │ │ ├── Transient.java
│ │ │ │ │ ├── Id.java
│ │ │ │ │ ├── Foreign.java
│ │ │ │ │ ├── NotNull.java
│ │ │ │ │ ├── Unique.java
│ │ │ │ │ ├── Column.java
│ │ │ │ │ ├── Table.java
│ │ │ │ │ └── Check.java
│ │ │ │ ├── converter
│ │ │ │ │ ├── ColumnConverter.java
│ │ │ │ │ ├── ByteArrayColumnConverter.java
│ │ │ │ │ ├── StringColumnConverter.java
│ │ │ │ │ ├── LongColumnConverter.java
│ │ │ │ │ ├── ByteColumnConverter.java
│ │ │ │ │ ├── FloatColumnConverter.java
│ │ │ │ │ ├── ShortColumnConverter.java
│ │ │ │ │ ├── DoubleColumnConverter.java
│ │ │ │ │ ├── IntegerColumnConverter.java
│ │ │ │ │ ├── CharColumnConverter.java
│ │ │ │ │ ├── DateColumnConverter.java
│ │ │ │ │ ├── SqlDateColumnConverter.java
│ │ │ │ │ └── BooleanColumnConverter.java
│ │ │ │ └── table
│ │ │ │ │ ├── KeyValue.java
│ │ │ │ │ └── Finder.java
│ │ │ │ ├── exception
│ │ │ │ ├── DbException.java
│ │ │ │ └── BaseException.java
│ │ │ │ └── util
│ │ │ │ └── IOUtils.java
│ │ │ └── android
│ │ │ └── volley
│ │ │ ├── TimeoutError.java
│ │ │ ├── toolbox
│ │ │ ├── MimeKit.java
│ │ │ ├── Authenticator.java
│ │ │ ├── NoCache.java
│ │ │ ├── HttpStack.java
│ │ │ └── ClearCacheRequest.java
│ │ │ ├── kit
│ │ │ ├── VolleyBitmapCache.java
│ │ │ └── VolleyImageLoader.java
│ │ │ ├── ServerError.java
│ │ │ ├── NoConnectionError.java
│ │ │ ├── ParseError.java
│ │ │ ├── Network.java
│ │ │ ├── NetworkError.java
│ │ │ ├── ResponseDelivery.java
│ │ │ ├── RetryPolicy.java
│ │ │ ├── VolleyError.java
│ │ │ └── AuthFailureError.java
│ │ └── AndroidManifest.xml
└── proguard-rules.pro
├── viewbind
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── java
│ │ └── com
│ │ │ └── snicesoft
│ │ │ ├── viewbind
│ │ │ ├── pluginmgr
│ │ │ │ └── Proxy.java
│ │ │ ├── base
│ │ │ │ ├── IAv.java
│ │ │ │ ├── LayoutUtils.java
│ │ │ │ ├── AvFragment.java
│ │ │ │ ├── AvActivity.java
│ │ │ │ └── AvFragmentActivity.java
│ │ │ ├── annotation
│ │ │ │ ├── Layout.java
│ │ │ │ ├── DataType.java
│ │ │ │ ├── Id.java
│ │ │ │ └── DataBind.java
│ │ │ ├── rule
│ │ │ │ ├── RecyclerHolder.java
│ │ │ │ └── IHolder.java
│ │ │ ├── ViewFinder.java
│ │ │ └── widget
│ │ │ │ ├── MultViewAdapter.java
│ │ │ │ └── AvAdapter.java
│ │ │ └── framework
│ │ │ ├── BaseActivity.java
│ │ │ ├── ActivityMgr.java
│ │ │ ├── FragmentUtil.java
│ │ │ └── BaseFragmentActivity.java
│ │ └── AndroidManifest.xml
└── proguard-rules.pro
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
└── AndroidKit.iml
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/bitmap/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/basekit/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/http.volley/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/viewbind/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':viewbind', ':basekit', ':bitmap', ':http.volley', ':library'
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidKit
3 |
4 |
--------------------------------------------------------------------------------
/basekit/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BaseKit
3 |
4 |
--------------------------------------------------------------------------------
/bitmap/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Bitmap
3 |
4 |
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Library
3 |
4 |
--------------------------------------------------------------------------------
/viewbind/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ViewBind
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angebagui/AndroidKit/master/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/http.volley/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Http.Volley
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angebagui/AndroidKit/master/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angebagui/AndroidKit/master/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angebagui/AndroidKit/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angebagui/AndroidKit/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angebagui/AndroidKit/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/http/Charset.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.http;
2 |
3 | public interface Charset {
4 | String UTF_8 = "UTF-8";
5 | String GBK = "GBK";
6 | }
7 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/http/Charset.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.http;
2 |
3 | public interface Charset {
4 | String UTF_8 = "UTF-8";
5 | String GBK = "GBK";
6 | }
7 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/pluginmgr/Proxy.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.pluginmgr;
2 |
3 | public interface Proxy {
4 | public static final String PROXY_ACTIVITY = "androidx.pluginmgr.PluginActivity";
5 | }
6 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/pluginmgr/Proxy.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.pluginmgr;
2 |
3 | public interface Proxy {
4 | public static final String PROXY_ACTIVITY = "androidx.pluginmgr.PluginActivity";
5 | }
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/bitmap/callback/BitmapLoadFrom.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap.callback;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 13-11-1
6 | * Time: 下午8:17
7 | */
8 | public enum BitmapLoadFrom {
9 | MEMORY_CACHE, DISK_CACHE, URI
10 | }
11 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/cache/FileNameGenerator.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.cache;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 14-5-16
6 | * Time: 上午11:25
7 | */
8 | public interface FileNameGenerator {
9 | public String generate(String key);
10 | }
11 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Oct 10 09:15:52 CST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/bitmap/callback/BitmapLoadFrom.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap.callback;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 13-11-1
6 | * Time: 下午8:17
7 | */
8 | public enum BitmapLoadFrom {
9 | MEMORY_CACHE, DISK_CACHE, URI
10 | }
11 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/cache/FileNameGenerator.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.cache;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 14-5-16
6 | * Time: 上午11:25
7 | */
8 | public interface FileNameGenerator {
9 | public String generate(String key);
10 | }
11 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/HttpKit.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit;
2 |
3 | public abstract class HttpKit implements IHttpKit {
4 | protected static HttpKit instance;
5 |
6 | public synchronized static HttpKit getInstance() {
7 | return instance;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/HttpKit.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit;
2 |
3 | public abstract class HttpKit implements IHttpKit {
4 | protected static HttpKit instance;
5 |
6 | public synchronized static HttpKit getInstance() {
7 | return instance;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/BitmapKit.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit;
2 |
3 | public abstract class BitmapKit implements IBitmapKit {
4 | protected static BitmapKit instance;
5 |
6 | public synchronized static BitmapKit getInstance() {
7 | return instance;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/BitmapKit.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit;
2 |
3 | public abstract class BitmapKit implements IBitmapKit {
4 | protected static BitmapKit instance;
5 |
6 | public synchronized static BitmapKit getInstance() {
7 | return instance;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/http/ContentType.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.http;
2 |
3 | public interface ContentType {
4 | String HTML = "text/html";
5 | String TXT = "text/plain";
6 | String XML = "text/xml";
7 | String JSON = "application/json;charset=UTF-8";
8 | String PDF = "application/pdf";
9 | }
10 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/http/ContentType.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.http;
2 |
3 | public interface ContentType {
4 | String HTML = "text/html";
5 | String TXT = "text/plain";
6 | String XML = "text/xml";
7 | String JSON = "application/json;charset=UTF-8";
8 | String PDF = "application/pdf";
9 | }
10 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/task/Priority.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 14-5-16
6 | * Time: 上午11:25
7 | */
8 | public enum Priority {
9 | UI_TOP,
10 | UI_NORMAL,
11 | UI_LOW,
12 | DEFAULT,
13 | BG_TOP,
14 | BG_NORMAL,
15 | BG_LOW;
16 | }
17 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/task/Priority.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 14-5-16
6 | * Time: 上午11:25
7 | */
8 | public enum Priority {
9 | UI_TOP,
10 | UI_NORMAL,
11 | UI_LOW,
12 | DEFAULT,
13 | BG_TOP,
14 | BG_NORMAL,
15 | BG_LOW;
16 | }
17 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/base/IAv.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | interface IAv {
4 | public H newHolder();
5 |
6 | public D newData();
7 |
8 | public H getHolder();
9 |
10 | public D getData();
11 |
12 | public void dataBindAll();
13 |
14 | public void dataBindTo(String fieldName);
15 | }
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/base/IAv.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | interface IAv {
4 | public H newHolder();
5 |
6 | public D newData();
7 |
8 | public H getHolder();
9 |
10 | public D getData();
11 |
12 | public void dataBindAll();
13 |
14 | public void dataBindTo(String fieldName);
15 | }
--------------------------------------------------------------------------------
/basekit/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bitmap/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/viewbind/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/http.volley/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/http/HttpError.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.http;
2 |
3 | public class HttpError {
4 | private String message;
5 |
6 | public HttpError(String msg) {
7 | this.message = msg;
8 | }
9 |
10 | public String getMessage() {
11 | return message;
12 | }
13 |
14 | public void setMessage(String message) {
15 | this.message = message;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/http/HttpError.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.http;
2 |
3 | public class HttpError {
4 | private String message;
5 |
6 | public HttpError(String msg) {
7 | this.message = msg;
8 | }
9 |
10 | public String getMessage() {
11 | return message;
12 | }
13 |
14 | public void setMessage(String message) {
15 | this.message = message;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/bitmap/factory/BitmapFactory.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap.factory;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * Created with IntelliJ IDEA.
7 | * User: wyouflf
8 | * Date: 14-05-20
9 | * Time: 下午4:26
10 | */
11 | public interface BitmapFactory {
12 |
13 | BitmapFactory cloneNew();
14 |
15 | Bitmap createBitmap(Bitmap rawBitmap);
16 | }
17 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/bitmap/factory/BitmapFactory.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap.factory;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * Created with IntelliJ IDEA.
7 | * User: wyouflf
8 | * Date: 14-05-20
9 | * Time: 下午4:26
10 | */
11 | public interface BitmapFactory {
12 |
13 | BitmapFactory cloneNew();
14 |
15 | Bitmap createBitmap(Bitmap rawBitmap);
16 | }
17 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/bitmap/BitmapLoadListener.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.bitmap;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.drawable.Drawable;
5 | import android.view.View;
6 |
7 | public interface BitmapLoadListener {
8 | public void onLoadCompleted(V container, Bitmap bitmap);
9 | public void onLoadFailed(V container, Drawable drawable);
10 | }
11 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/bitmap/BitmapLoadListener.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.bitmap;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.drawable.Drawable;
5 | import android.view.View;
6 |
7 | public interface BitmapLoadListener {
8 | public void onLoadCompleted(V container, Bitmap bitmap);
9 | public void onLoadFailed(V container, Drawable drawable);
10 | }
11 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/MathUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import java.text.DecimalFormat;
4 |
5 | public class MathUtils {
6 | public static String getPercent(double x, double total) {
7 | String result = "";// 接受百分比的值
8 | double tempresult = x / total;
9 | DecimalFormat df1 = new DecimalFormat("0%"); // ##.00%
10 | result = df1.format(tempresult);
11 | return result;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/MathUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import java.text.DecimalFormat;
4 |
5 | public class MathUtils {
6 | public static String getPercent(double x, double total) {
7 | String result = "";// 接受百分比的值
8 | double tempresult = x / total;
9 | DecimalFormat df1 = new DecimalFormat("0%"); // ##.00%
10 | result = df1.format(tempresult);
11 | return result;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/annotation/Layout.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ ElementType.TYPE })
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface Layout {
11 | public int value() default 0;
12 | }
13 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/annotation/Layout.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ ElementType.TYPE })
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface Layout {
11 | public int value() default 0;
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/task/PriorityObject.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 14-5-16
6 | * Time: 上午11:25
7 | */
8 | public class PriorityObject {
9 |
10 | public final Priority priority;
11 | public final E obj;
12 |
13 | public PriorityObject(Priority priority, E obj) {
14 | this.priority = priority == null ? Priority.DEFAULT : priority;
15 | this.obj = obj;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/task/TaskHandler.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Time: 2014/05/23
6 | */
7 | public interface TaskHandler {
8 |
9 | boolean supportPause();
10 |
11 | boolean supportResume();
12 |
13 | boolean supportCancel();
14 |
15 | void pause();
16 |
17 | void resume();
18 |
19 | void cancel();
20 |
21 | boolean isPaused();
22 |
23 | boolean isCancelled();
24 | }
25 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/task/TaskHandler.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Time: 2014/05/23
6 | */
7 | public interface TaskHandler {
8 |
9 | boolean supportPause();
10 |
11 | boolean supportResume();
12 |
13 | boolean supportCancel();
14 |
15 | void pause();
16 |
17 | void resume();
18 |
19 | void cancel();
20 |
21 | boolean isPaused();
22 |
23 | boolean isCancelled();
24 | }
25 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/task/PriorityObject.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 14-5-16
6 | * Time: 上午11:25
7 | */
8 | public class PriorityObject {
9 |
10 | public final Priority priority;
11 | public final E obj;
12 |
13 | public PriorityObject(Priority priority, E obj) {
14 | this.priority = priority == null ? Priority.DEFAULT : priority;
15 | this.obj = obj;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/task/PriorityRunnable.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 14-5-16
6 | * Time: 上午11:25
7 | */
8 | public class PriorityRunnable extends PriorityObject implements Runnable {
9 |
10 | public PriorityRunnable(Priority priority, Runnable obj) {
11 | super(priority, obj);
12 | }
13 |
14 | @Override
15 | public void run() {
16 | this.obj.run();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/task/PriorityRunnable.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 14-5-16
6 | * Time: 上午11:25
7 | */
8 | public class PriorityRunnable extends PriorityObject implements Runnable {
9 |
10 | public PriorityRunnable(Priority priority, Runnable obj) {
11 | super(priority, obj);
12 | }
13 |
14 | @Override
15 | public void run() {
16 | this.obj.run();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/sqlite/ColumnDbType.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.sqlite;
2 |
3 | /**
4 | * Created by wyouflf on 14-2-20.
5 | */
6 | public enum ColumnDbType {
7 |
8 | INTEGER("INTEGER"), REAL("REAL"), TEXT("TEXT"), BLOB("BLOB");
9 |
10 | private String value;
11 |
12 | ColumnDbType(String value) {
13 | this.value = value;
14 | }
15 |
16 | @Override
17 | public String toString() {
18 | return value;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/rule/RecyclerHolder.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.rule;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 |
6 | import com.snicesoft.viewbind.AVKit;
7 | import com.snicesoft.viewbind.ViewFinder;
8 |
9 | public class RecyclerHolder extends RecyclerView.ViewHolder {
10 |
11 | public RecyclerHolder(View itemView) {
12 | super(itemView);
13 | AVKit.initHolder(this, new ViewFinder(itemView));
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/rule/RecyclerHolder.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.rule;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 |
6 | import com.snicesoft.viewbind.AVKit;
7 | import com.snicesoft.viewbind.ViewFinder;
8 |
9 | public class RecyclerHolder extends RecyclerView.ViewHolder {
10 |
11 | public RecyclerHolder(View itemView) {
12 | super(itemView);
13 | AVKit.initHolder(this, new ViewFinder(itemView));
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/NoAutoIncrement.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Author: wyouflf
10 | * Date: 13-9-24
11 | * Time: 上午9:33
12 | */
13 | @Target(ElementType.FIELD)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface NoAutoIncrement {
16 | }
17 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/annotation/DataType.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.annotation;
2 |
3 | /**
4 | * @author zhu zhe
5 | * @since 2015年4月15日 下午12:39:04
6 | * @version V1.0
7 | */
8 | public enum DataType {
9 | /**
10 | * 字符串,setText()
11 | */
12 | STRING,
13 | /**
14 | * 网页代码
15 | */
16 | HTML,
17 | /**
18 | * isChecked
19 | */
20 | CHECK,
21 | /**
22 | * 图片
23 | */
24 | IMG,
25 | /**
26 | * 适配器
27 | */
28 | ADAPTER,
29 | /**
30 | *
31 | */
32 | NULL
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/annotation/DataType.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.annotation;
2 |
3 | /**
4 | * @author zhu zhe
5 | * @since 2015年4月15日 下午12:39:04
6 | * @version V1.0
7 | */
8 | public enum DataType {
9 | /**
10 | * 字符串,setText()
11 | */
12 | STRING,
13 | /**
14 | * 网页代码
15 | */
16 | HTML,
17 | /**
18 | * isChecked
19 | */
20 | CHECK,
21 | /**
22 | * 图片
23 | */
24 | IMG,
25 | /**
26 | * 适配器
27 | */
28 | ADAPTER,
29 | /**
30 | *
31 | */
32 | NULL
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/base/LayoutUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | import com.snicesoft.viewbind.annotation.Layout;
4 |
5 | class LayoutUtils {
6 | public static int getLayoutId(Class> clazz) {
7 | int layoutId = 0;
8 | Layout layout = clazz.getAnnotation(Layout.class);
9 | if (layout != null && layout.value() != 0) {
10 | layoutId = layout.value();
11 | } else {
12 | layoutId = 0;
13 | System.err.println("@Layout not find.");
14 | }
15 | return layoutId;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/base/LayoutUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | import com.snicesoft.viewbind.annotation.Layout;
4 |
5 | class LayoutUtils {
6 | public static int getLayoutId(Class> clazz) {
7 | int layoutId = 0;
8 | Layout layout = clazz.getAnnotation(Layout.class);
9 | if (layout != null && layout.value() != 0) {
10 | layoutId = layout.value();
11 | } else {
12 | layoutId = 0;
13 | System.err.println("@Layout not find.");
14 | }
15 | return layoutId;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/bitmap/callback/BitmapSetter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap.callback;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.drawable.Drawable;
5 | import android.view.View;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-1
10 | * Time: 下午11:05
11 | */
12 | public interface BitmapSetter {
13 | void setBitmap(T container, Bitmap bitmap);
14 |
15 | void setDrawable(T container, Drawable drawable);
16 |
17 | Drawable getDrawable(T container);
18 | }
19 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/bitmap/callback/BitmapSetter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap.callback;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.drawable.Drawable;
5 | import android.view.View;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-1
10 | * Time: 下午11:05
11 | */
12 | public interface BitmapSetter {
13 | void setBitmap(T container, Bitmap bitmap);
14 |
15 | void setDrawable(T container, Drawable drawable);
16 |
17 | Drawable getDrawable(T container);
18 | }
19 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/Finder.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Author: wyouflf
10 | * Date: 13-9-10
11 | * Time: 下午6:44
12 | */
13 | @Target(ElementType.FIELD)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface Finder {
16 |
17 | String valueColumn();
18 |
19 | String targetColumn();
20 | }
21 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/net/api/APIUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.net.api;
2 |
3 | /**
4 | * Created by zhuzhe on 15/10/10.
5 | */
6 | class APIUtils {
7 | public static String getUrl(String SCHEME, String IP, int PORT) {
8 | return SCHEME + IP + ((PORT == 80 || PORT <= 0) ? "" : ":" + PORT) + "/";
9 | }
10 |
11 | public static String getUrl(String SCHEME, String IP, int PORT, String apiBaseName) {
12 | return SCHEME + IP + ((PORT == 80 || PORT <= 0) ? "" : ":" + PORT) + "/" + apiBaseName;
13 | }
14 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/snicesoft/androidkit/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.androidkit;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.snicesoft.basekit.LogKit;
7 | import com.snicesoft.net.api.API;
8 |
9 | public class MainActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_main);
15 | LogKit.d(API.User.USER);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/ColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
5 |
6 | /**
7 | * Author: wyouflf
8 | * Date: 13-11-4
9 | * Time: 下午8:57
10 | */
11 | public interface ColumnConverter {
12 |
13 | T getFieldValue(final Cursor cursor, int index);
14 |
15 | T getFieldValue(String fieldStringValue);
16 |
17 | Object fieldValue2ColumnValue(T fieldValue);
18 |
19 | ColumnDbType getColumnDbType();
20 | }
21 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/net/api/TestConfig.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.net.api;
2 |
3 | class TestConfig extends Config {
4 |
5 | @Override
6 | public String getScheme() {
7 | return APIConfig.Test.scheme;
8 | }
9 |
10 | @Override
11 | public String getIP() {
12 | return APIConfig.Test.ip;
13 | }
14 |
15 | @Override
16 | public String getApiBaseName() {
17 | return APIConfig.Test.apiBaseName;
18 | }
19 |
20 | @Override
21 | public int getPort() {
22 | return APIConfig.Test.port;
23 | }
24 | }
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/framework/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.framework;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.snicesoft.viewbind.base.AvActivity;
6 | import com.snicesoft.viewbind.rule.IHolder;
7 |
8 | public class BaseActivity extends AvActivity {
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | ActivityMgr.addActivity(this);
13 | }
14 |
15 | @Override
16 | protected void onDestroy() {
17 | super.onDestroy();
18 | ActivityMgr.removeActivity(this);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/framework/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.framework;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.snicesoft.viewbind.base.AvActivity;
6 | import com.snicesoft.viewbind.rule.IHolder;
7 |
8 | public class BaseActivity extends AvActivity {
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | ActivityMgr.addActivity(this);
13 | }
14 |
15 | @Override
16 | protected void onDestroy() {
17 | super.onDestroy();
18 | ActivityMgr.removeActivity(this);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/annotation/Id.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * @author zhu zhe
10 | * @since 2015年4月15日 上午10:17:13
11 | * @version V1.0
12 | */
13 | @Target(ElementType.FIELD)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface Id {
16 | public int value() default 0;
17 |
18 | public int background() default 0;
19 |
20 | public int backgroundColor() default 0;
21 |
22 | public int src() default 0;
23 | }
24 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/annotation/Id.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * @author zhu zhe
10 | * @since 2015年4月15日 上午10:17:13
11 | * @version V1.0
12 | */
13 | @Target(ElementType.FIELD)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface Id {
16 | public int value() default 0;
17 |
18 | public int background() default 0;
19 |
20 | public int backgroundColor() default 0;
21 |
22 | public int src() default 0;
23 | }
24 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/net/api/ProductConfig.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.net.api;
2 |
3 | /**
4 | * 正式环境接口配置
5 | *
6 | * @author zhuzhe
7 | */
8 | class ProductConfig extends Config {
9 | @Override
10 | public String getScheme() {
11 | return APIConfig.Product.scheme;
12 | }
13 |
14 | @Override
15 | public String getIP() {
16 | return APIConfig.Product.ip;
17 | }
18 |
19 | @Override
20 | public String getApiBaseName() {
21 | return APIConfig.Product.apiBaseName;
22 | }
23 |
24 | @Override
25 | public int getPort() {
26 | return APIConfig.Product.port;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/ViewFinder.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 |
6 | /**
7 | * @author zhu zhe
8 | * @since 2015年4月15日 上午10:48:05
9 | * @version V1.0 参考xUtils
10 | */
11 | public class ViewFinder {
12 | private View parent;
13 |
14 | public ViewFinder(View view) {
15 | this.parent = view;
16 | }
17 |
18 | public ViewFinder(Activity activity) {
19 | this.parent = activity.getWindow().getDecorView();
20 | }
21 |
22 | public View getParent() {
23 | return parent;
24 | }
25 |
26 | public View findViewById(int vId) {
27 | return parent.findViewById(vId);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/ViewFinder.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 |
6 | /**
7 | * @author zhu zhe
8 | * @since 2015年4月15日 上午10:48:05
9 | * @version V1.0 参考xUtils
10 | */
11 | public class ViewFinder {
12 | private View parent;
13 |
14 | public ViewFinder(View view) {
15 | this.parent = view;
16 | }
17 |
18 | public ViewFinder(Activity activity) {
19 | this.parent = activity.getWindow().getDecorView();
20 | }
21 |
22 | public View getParent() {
23 | return parent;
24 | }
25 |
26 | public View findViewById(int vId) {
27 | return parent.findViewById(vId);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/snicesoft/net/api/API.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.net.api;
2 |
3 | import com.snicesoft.basekit.net.api.Config;
4 | import com.snicesoft.basekit.net.api.ConfigFactory;
5 |
6 | public final class API {
7 | private static Config config;
8 |
9 | public final static class User {
10 | public static String USER;
11 | public static String USER_LOGIN;
12 | }
13 |
14 | private API() {
15 | }
16 |
17 | public static void init(ConfigFactory.Mode mode) {
18 | config = ConfigFactory.create(mode);
19 | User.USER = config.baseUrl() + "mobile/user";
20 | User.USER_LOGIN = config.baseUrl() + "mobile/user/login";
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/net/api/Config.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.net.api;
2 |
3 | public abstract class Config {
4 | public interface Scheme {
5 | String HTTP = "http://";
6 | String HTTPS = "https://";
7 | }
8 |
9 | abstract String getScheme();
10 |
11 | abstract String getIP();
12 |
13 | abstract String getApiBaseName();
14 |
15 | abstract int getPort();
16 |
17 | public final String baseUrl() {
18 | return APIUtils.getUrl(getScheme(), getIP(), getPort(), getApiBaseName());
19 | }
20 |
21 | public final String schemeUrl() {
22 | return APIUtils.getUrl(getScheme(), getIP(), getPort());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/IBitmapKit.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit;
2 |
3 | import android.view.View;
4 |
5 | import com.snicesoft.basekit.bitmap.BitmapConfig;
6 | import com.snicesoft.basekit.bitmap.BitmapLoadListener;
7 |
8 | interface IBitmapKit {
9 | public void display(V v, String url);
10 |
11 | public void display(V v, String url, BitmapConfig config);
12 |
13 | public void display(V v, String url, final BitmapLoadListener listener);
14 |
15 | public void clearMemoryCache();
16 |
17 | public void clearDiskCache();
18 |
19 | public void pause();
20 |
21 | public void resume();
22 |
23 | public void cancel();
24 | }
25 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/IBitmapKit.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit;
2 |
3 | import android.view.View;
4 |
5 | import com.snicesoft.basekit.bitmap.BitmapConfig;
6 | import com.snicesoft.basekit.bitmap.BitmapLoadListener;
7 |
8 | interface IBitmapKit {
9 | public void display(V v, String url);
10 |
11 | public void display(V v, String url, BitmapConfig config);
12 |
13 | public void display(V v, String url, final BitmapLoadListener listener);
14 |
15 | public void clearMemoryCache();
16 |
17 | public void clearDiskCache();
18 |
19 | public void pause();
20 |
21 | public void resume();
22 |
23 | public void cancel();
24 | }
25 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/bitmap/BitmapConfig.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.bitmap;
2 |
3 | public class BitmapConfig {
4 | private int loadingRes;
5 | private int failRes;
6 |
7 | public BitmapConfig() {
8 | super();
9 | }
10 |
11 | public BitmapConfig(int loadingRes, int failRes) {
12 | super();
13 | this.loadingRes = loadingRes;
14 | this.failRes = failRes;
15 | }
16 |
17 | public int getLoadingRes() {
18 | return loadingRes;
19 | }
20 |
21 | public void setLoadingRes(int loadingRes) {
22 | this.loadingRes = loadingRes;
23 | }
24 |
25 | public int getFailRes() {
26 | return failRes;
27 | }
28 |
29 | public void setFailRes(int failRes) {
30 | this.failRes = failRes;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/bitmap/BitmapConfig.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.bitmap;
2 |
3 | public class BitmapConfig {
4 | private int loadingRes;
5 | private int failRes;
6 |
7 | public BitmapConfig() {
8 | super();
9 | }
10 |
11 | public BitmapConfig(int loadingRes, int failRes) {
12 | super();
13 | this.loadingRes = loadingRes;
14 | this.failRes = failRes;
15 | }
16 |
17 | public int getLoadingRes() {
18 | return loadingRes;
19 | }
20 |
21 | public void setLoadingRes(int loadingRes) {
22 | this.loadingRes = loadingRes;
23 | }
24 |
25 | public int getFailRes() {
26 | return failRes;
27 | }
28 |
29 | public void setFailRes(int failRes) {
30 | this.failRes = failRes;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/bitmap/BitmapCacheListener.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap;
2 |
3 | /**
4 | * Created with IntelliJ IDEA.
5 | * User: wyouflf
6 | * Date: 13-10-16
7 | * Time: 下午4:26
8 | */
9 | public interface BitmapCacheListener {
10 | void onInitMemoryCacheFinished();
11 |
12 | void onInitDiskFinished();
13 |
14 | void onClearCacheFinished();
15 |
16 | void onClearMemoryCacheFinished();
17 |
18 | void onClearDiskCacheFinished();
19 |
20 | void onClearCacheFinished(String uri);
21 |
22 | void onClearMemoryCacheFinished(String uri);
23 |
24 | void onClearDiskCacheFinished(String uri);
25 |
26 | void onFlushCacheFinished();
27 |
28 | void onCloseCacheFinished();
29 | }
30 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/bitmap/BitmapCacheListener.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap;
2 |
3 | /**
4 | * Created with IntelliJ IDEA.
5 | * User: wyouflf
6 | * Date: 13-10-16
7 | * Time: 下午4:26
8 | */
9 | public interface BitmapCacheListener {
10 | void onInitMemoryCacheFinished();
11 |
12 | void onInitDiskFinished();
13 |
14 | void onClearCacheFinished();
15 |
16 | void onClearMemoryCacheFinished();
17 |
18 | void onClearDiskCacheFinished();
19 |
20 | void onClearCacheFinished(String uri);
21 |
22 | void onClearMemoryCacheFinished(String uri);
23 |
24 | void onClearDiskCacheFinished(String uri);
25 |
26 | void onFlushCacheFinished();
27 |
28 | void onCloseCacheFinished();
29 | }
30 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhuzhe/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/snicesoft/net/data/Result.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.net.data;
2 |
3 | public class Result {
4 | private String msg;
5 | private int status;
6 | private T data;
7 |
8 | public String getMsg() {
9 | return msg;
10 | }
11 |
12 | public void setMsg(String msg) {
13 | this.msg = msg;
14 | }
15 |
16 | public int getStatus() {
17 | return status;
18 | }
19 |
20 | public void setStatus(int status) {
21 | this.status = status;
22 | }
23 |
24 | public void setData(T data) {
25 | this.data = data;
26 | }
27 |
28 | public T getData() {
29 | return data;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "Result [msg=" + msg + ", status=" + status + ", data=" + data + "]";
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/basekit/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhuzhe/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/bitmap/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhuzhe/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhuzhe/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/viewbind/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhuzhe/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/http.volley/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhuzhe/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/widget/MultViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.widget;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.snicesoft.viewbind.rule.IHolder;
7 |
8 | @SuppressWarnings("rawtypes")
9 | public abstract class MultViewAdapter extends BaseAdapter {
10 | public MultViewAdapter(Context context) {
11 | super(context);
12 | }
13 |
14 | public MultViewAdapter(Context context, int layoutRes) {
15 | super(context, layoutRes);
16 | }
17 |
18 | public abstract int getItemViewType(int position);
19 |
20 | public abstract int getViewTypeCount();
21 |
22 | @Override
23 | final View newView(int position) {
24 | return View.inflate(getContext(), getItemViewType(position), null);
25 | }
26 | }
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/widget/MultViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.widget;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.snicesoft.viewbind.rule.IHolder;
7 |
8 | @SuppressWarnings("rawtypes")
9 | public abstract class MultViewAdapter extends BaseAdapter {
10 | public MultViewAdapter(Context context) {
11 | super(context);
12 | }
13 |
14 | public MultViewAdapter(Context context, int layoutRes) {
15 | super(context, layoutRes);
16 | }
17 |
18 | public abstract int getItemViewType(int position);
19 |
20 | public abstract int getViewTypeCount();
21 |
22 | @Override
23 | final View newView(int position) {
24 | return View.inflate(getContext(), getItemViewType(position), null);
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/IHttpKit.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit;
2 |
3 |
4 | import com.snicesoft.basekit.http.HttpCallBack;
5 | import com.snicesoft.basekit.http.HttpRequest;
6 |
7 | @SuppressWarnings("rawtypes")
8 | interface IHttpKit {
9 | public void get(HttpRequest request, HttpCallBack callBack);
10 |
11 | public void post(HttpRequest request, HttpCallBack callBack);
12 |
13 | public void put(HttpRequest request, HttpCallBack callBack);
14 |
15 | public void delete(HttpRequest request, HttpCallBack callBack);
16 |
17 | public void postFile(HttpRequest request, HttpCallBack callBack);
18 |
19 | public void postJSON(HttpRequest request, HttpCallBack callBack);
20 |
21 | public void cancel(HttpRequest request);
22 |
23 | public void cancelAll();
24 | }
25 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/IHttpKit.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit;
2 |
3 |
4 | import com.snicesoft.basekit.http.HttpCallBack;
5 | import com.snicesoft.basekit.http.HttpRequest;
6 |
7 | @SuppressWarnings("rawtypes")
8 | interface IHttpKit {
9 | public void get(HttpRequest request, HttpCallBack callBack);
10 |
11 | public void post(HttpRequest request, HttpCallBack callBack);
12 |
13 | public void put(HttpRequest request, HttpCallBack callBack);
14 |
15 | public void delete(HttpRequest request, HttpCallBack callBack);
16 |
17 | public void postFile(HttpRequest request, HttpCallBack callBack);
18 |
19 | public void postJSON(HttpRequest request, HttpCallBack callBack);
20 |
21 | public void cancel(HttpRequest request);
22 |
23 | public void cancelAll();
24 | }
25 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/net/api/ConfigFactory.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.net.api;
2 |
3 | import com.snicesoft.basekit.LogKit;
4 |
5 | public class ConfigFactory {
6 | public enum Mode {
7 | TEST, PRODUCT
8 | }
9 |
10 | private ConfigFactory() {
11 | }
12 |
13 | private static Config testServerConfig = new TestConfig();
14 | private static Config productServerConfig = new ProductConfig();
15 |
16 | public static Config create(Mode mode) {
17 | if (mode == Mode.TEST) {
18 | LogKit.d("API init [TEST].");
19 | return testServerConfig;
20 | } else if (mode == Mode.PRODUCT) {
21 | LogKit.d("API init [PRODUCT].");
22 | return productServerConfig;
23 | } else {
24 | return testServerConfig;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/rule/IHolder.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.rule;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * @author zhe
7 | * @since 2015年4月15日 上午9:54:17
8 | * @version V1.0
9 | */
10 | public abstract class IHolder {
11 | public abstract void initViewParams();
12 |
13 | private int position = -1;
14 | private D tag;
15 | private View parent;
16 |
17 | public final void setTag(D tag) {
18 | this.tag = tag;
19 | }
20 |
21 | public final D getTag() {
22 | return tag;
23 | }
24 |
25 | public final void setPosition(int position) {
26 | this.position = position;
27 | }
28 |
29 | public final int getPosition() {
30 | return position;
31 | }
32 |
33 | public final View getParent() {
34 | return parent;
35 | }
36 |
37 | public final void setParent(View parent) {
38 | this.parent = parent;
39 | }
40 | }
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/rule/IHolder.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.rule;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * @author zhe
7 | * @since 2015年4月15日 上午9:54:17
8 | * @version V1.0
9 | */
10 | public abstract class IHolder {
11 | public abstract void initViewParams();
12 |
13 | private int position = -1;
14 | private D tag;
15 | private View parent;
16 |
17 | public final void setTag(D tag) {
18 | this.tag = tag;
19 | }
20 |
21 | public final D getTag() {
22 | return tag;
23 | }
24 |
25 | public final void setPosition(int position) {
26 | this.position = position;
27 | }
28 |
29 | public final int getPosition() {
30 | return position;
31 | }
32 |
33 | public final View getParent() {
34 | return parent;
35 | }
36 |
37 | public final void setParent(View parent) {
38 | this.parent = parent;
39 | }
40 | }
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/DialogUtil.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.AlertDialog;
5 | import android.app.ProgressDialog;
6 | import android.content.Context;
7 |
8 | @SuppressLint("NewApi")
9 | public class DialogUtil {
10 | public static AlertDialog.Builder getAlertBuilder(Context context) {
11 | AlertDialog.Builder builder = new AlertDialog.Builder(context);
12 | if (android.os.Build.VERSION.SDK_INT > 10)
13 | builder = new AlertDialog.Builder(context, 0x3);
14 | return builder;
15 | }
16 |
17 | public static ProgressDialog getProgressDialog(Context context) {
18 | ProgressDialog progressDialog = new ProgressDialog(context);
19 | if (android.os.Build.VERSION.SDK_INT > 10)
20 | progressDialog = new ProgressDialog(context, 0x3);
21 | return progressDialog;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/DialogUtil.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.AlertDialog;
5 | import android.app.ProgressDialog;
6 | import android.content.Context;
7 |
8 | @SuppressLint("NewApi")
9 | public class DialogUtil {
10 | public static AlertDialog.Builder getAlertBuilder(Context context) {
11 | AlertDialog.Builder builder = new AlertDialog.Builder(context);
12 | if (android.os.Build.VERSION.SDK_INT > 10)
13 | builder = new AlertDialog.Builder(context, 0x3);
14 | return builder;
15 | }
16 |
17 | public static ProgressDialog getProgressDialog(Context context) {
18 | ProgressDialog progressDialog = new ProgressDialog(context);
19 | if (android.os.Build.VERSION.SDK_INT > 10)
20 | progressDialog = new ProgressDialog(context, 0x3);
21 | return progressDialog;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/NetworkUtil.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 |
7 | public class NetworkUtil {
8 | public static boolean isConnect(Context context) {
9 | // 获取手机所有连接管理对象(包括对wi-fi,net等连接的管理)
10 | try {
11 | ConnectivityManager connectivity = (ConnectivityManager) context
12 | .getSystemService(Context.CONNECTIVITY_SERVICE);
13 | if (connectivity != null) {
14 | // 获取网络连接管理的对象
15 | NetworkInfo info = connectivity.getActiveNetworkInfo();
16 | if (info != null && info.isConnected()) {
17 | // 判断当前网络是否已经连接
18 | if (info.getState() == NetworkInfo.State.CONNECTED) {
19 | return true;
20 | }
21 | }
22 | }
23 | } catch (Exception e) {
24 | // TODO: handle exception
25 | }
26 | return false;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/NetworkUtil.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 |
7 | public class NetworkUtil {
8 | public static boolean isConnect(Context context) {
9 | // 获取手机所有连接管理对象(包括对wi-fi,net等连接的管理)
10 | try {
11 | ConnectivityManager connectivity = (ConnectivityManager) context
12 | .getSystemService(Context.CONNECTIVITY_SERVICE);
13 | if (connectivity != null) {
14 | // 获取网络连接管理的对象
15 | NetworkInfo info = connectivity.getActiveNetworkInfo();
16 | if (info != null && info.isConnected()) {
17 | // 判断当前网络是否已经连接
18 | if (info.getState() == NetworkInfo.State.CONNECTED) {
19 | return true;
20 | }
21 | }
22 | }
23 | } catch (Exception e) {
24 | // TODO: handle exception
25 | }
26 | return false;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.0"
6 |
7 | defaultConfig {
8 | applicationId "com.snicesoft.androidkit"
9 | minSdkVersion 10
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | compile 'com.android.support:appcompat-v7:23.0.1'
25 | compile project(':library')
26 | compile 'com.squareup.okhttp:okhttp:2.5.0'
27 | compile 'com.squareup.okio:okio:1.6.0'
28 | compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
29 | }
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/TimeoutError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Indicates that the connection or the socket timed out.
21 | */
22 | @SuppressWarnings("serial")
23 | public class TimeoutError extends VolleyError { }
24 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/toolbox/MimeKit.java:
--------------------------------------------------------------------------------
1 | package com.android.volley.toolbox;
2 |
3 | import java.io.File;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | import android.annotation.SuppressLint;
8 |
9 | @SuppressLint("DefaultLocale")
10 | public class MimeKit {
11 | private static Map sFileTypeMap = new HashMap();
12 |
13 | static {
14 | sFileTypeMap.put("JPG", "image/jpeg");
15 | sFileTypeMap.put("JPEG", "image/jpeg");
16 | sFileTypeMap.put("GIF", "image/gif");
17 | sFileTypeMap.put("PNG", "image/png");
18 | sFileTypeMap.put("BMP", "image/x-ms-bmp");
19 | sFileTypeMap.put("WBMP", "image/vnd.wap.wbmp");
20 | }
21 |
22 | public static String getFileType(File f) {
23 | int lastDot = f.getPath().lastIndexOf(".");
24 | if (lastDot < 0)
25 | return null;
26 | return sFileTypeMap.get(f.getPath().substring(lastDot + 1).toUpperCase());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/ByteArrayColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
5 |
6 | /**
7 | * Author: wyouflf
8 | * Date: 13-11-4
9 | * Time: 下午10:51
10 | */
11 | public class ByteArrayColumnConverter implements ColumnConverter {
12 | @Override
13 | public byte[] getFieldValue(final Cursor cursor, int index) {
14 | return cursor.isNull(index) ? null : cursor.getBlob(index);
15 | }
16 |
17 | @Override
18 | public byte[] getFieldValue(String fieldStringValue) {
19 | return null;
20 | }
21 |
22 | @Override
23 | public Object fieldValue2ColumnValue(byte[] fieldValue) {
24 | return fieldValue;
25 | }
26 |
27 | @Override
28 | public ColumnDbType getColumnDbType() {
29 | return ColumnDbType.BLOB;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/TimeoutError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Indicates that the connection or the socket timed out.
21 | */
22 | @SuppressWarnings("serial")
23 | public class TimeoutError extends VolleyError { }
24 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/toolbox/MimeKit.java:
--------------------------------------------------------------------------------
1 | package com.android.volley.toolbox;
2 |
3 | import java.io.File;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | import android.annotation.SuppressLint;
8 |
9 | @SuppressLint("DefaultLocale")
10 | public class MimeKit {
11 | private static Map sFileTypeMap = new HashMap();
12 |
13 | static {
14 | sFileTypeMap.put("JPG", "image/jpeg");
15 | sFileTypeMap.put("JPEG", "image/jpeg");
16 | sFileTypeMap.put("GIF", "image/gif");
17 | sFileTypeMap.put("PNG", "image/png");
18 | sFileTypeMap.put("BMP", "image/x-ms-bmp");
19 | sFileTypeMap.put("WBMP", "image/vnd.wap.wbmp");
20 | }
21 |
22 | public static String getFileType(File f) {
23 | int lastDot = f.getPath().lastIndexOf(".");
24 | if (lastDot < 0)
25 | return null;
26 | return sFileTypeMap.get(f.getPath().substring(lastDot + 1).toUpperCase());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/StringColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
5 |
6 | /**
7 | * Author: wyouflf
8 | * Date: 13-11-4
9 | * Time: 下午10:51
10 | */
11 | public class StringColumnConverter implements ColumnConverter {
12 | @Override
13 | public String getFieldValue(final Cursor cursor, int index) {
14 | return cursor.isNull(index) ? null : cursor.getString(index);
15 | }
16 |
17 | @Override
18 | public String getFieldValue(String fieldStringValue) {
19 | return fieldStringValue;
20 | }
21 |
22 | @Override
23 | public Object fieldValue2ColumnValue(String fieldValue) {
24 | return fieldValue;
25 | }
26 |
27 | @Override
28 | public ColumnDbType getColumnDbType() {
29 | return ColumnDbType.TEXT;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/widget/AvAdapter.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.widget;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.snicesoft.viewbind.annotation.Layout;
7 | import com.snicesoft.viewbind.rule.IHolder;
8 |
9 | /**
10 | * @author zhu zhe
11 | * @since 2015年4月15日 上午9:52:57
12 | * @version V1.0
13 | */
14 | @SuppressWarnings("rawtypes")
15 | public abstract class AvAdapter extends BaseAdapter {
16 |
17 | public AvAdapter(Context context) {
18 | super(context);
19 | Layout layout = getClass().getAnnotation(Layout.class);
20 | if (layout != null && layout.value() != 0) {
21 | this.resource = layout.value();
22 | }
23 | }
24 |
25 | public AvAdapter(Context context, int layoutRes) {
26 | super(context, layoutRes);
27 | }
28 |
29 | @Override
30 | View newView(int position) {
31 | return View.inflate(getContext(), resource, null);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/widget/AvAdapter.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.widget;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.snicesoft.viewbind.annotation.Layout;
7 | import com.snicesoft.viewbind.rule.IHolder;
8 |
9 | /**
10 | * @author zhu zhe
11 | * @since 2015年4月15日 上午9:52:57
12 | * @version V1.0
13 | */
14 | @SuppressWarnings("rawtypes")
15 | public abstract class AvAdapter extends BaseAdapter {
16 |
17 | public AvAdapter(Context context) {
18 | super(context);
19 | Layout layout = getClass().getAnnotation(Layout.class);
20 | if (layout != null && layout.value() != 0) {
21 | this.resource = layout.value();
22 | }
23 | }
24 |
25 | public AvAdapter(Context context, int layoutRes) {
26 | super(context, layoutRes);
27 | }
28 |
29 | @Override
30 | View newView(int position) {
31 | return View.inflate(getContext(), resource, null);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/http/HttpCallBack.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.http;
2 |
3 | import java.lang.reflect.ParameterizedType;
4 | import java.lang.reflect.Type;
5 |
6 | import com.google.gson.internal.$Gson$Types;
7 |
8 | public abstract class HttpCallBack {
9 | public Type mType;
10 |
11 | public HttpCallBack() {
12 | mType = getSuperclassTypeParameter(getClass());
13 | }
14 |
15 | static Type getSuperclassTypeParameter(Class> subclass) {
16 | Type superclass = subclass.getGenericSuperclass();
17 | if (superclass instanceof Class) {
18 | throw new RuntimeException("Missing type parameter.");
19 | }
20 | ParameterizedType parameterized = (ParameterizedType) superclass;
21 | return $Gson$Types.canonicalize(parameterized.getActualTypeArguments()[0]);
22 | }
23 |
24 | public abstract void onSuccess(T t);
25 |
26 | public void onLoading(long count, long current) {
27 | }
28 |
29 | public abstract void onError(HttpError error);
30 | }
31 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/http/HttpCallBack.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.http;
2 |
3 | import java.lang.reflect.ParameterizedType;
4 | import java.lang.reflect.Type;
5 |
6 | import com.google.gson.internal.$Gson$Types;
7 |
8 | public abstract class HttpCallBack {
9 | public Type mType;
10 |
11 | public HttpCallBack() {
12 | mType = getSuperclassTypeParameter(getClass());
13 | }
14 |
15 | static Type getSuperclassTypeParameter(Class> subclass) {
16 | Type superclass = subclass.getGenericSuperclass();
17 | if (superclass instanceof Class) {
18 | throw new RuntimeException("Missing type parameter.");
19 | }
20 | ParameterizedType parameterized = (ParameterizedType) superclass;
21 | return $Gson$Types.canonicalize(parameterized.getActualTypeArguments()[0]);
22 | }
23 |
24 | public abstract void onSuccess(T t);
25 |
26 | public void onLoading(long count, long current) {
27 | }
28 |
29 | public abstract void onError(HttpError error);
30 | }
31 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/kit/VolleyBitmapCache.java:
--------------------------------------------------------------------------------
1 | package com.android.volley.kit;
2 |
3 | import android.graphics.Bitmap;
4 | import android.support.v4.util.LruCache;
5 |
6 | import com.android.volley.toolbox.ImageLoader;
7 |
8 | /**
9 | * Created by zhuzhe on 15/9/25.
10 | */
11 | public class VolleyBitmapCache implements ImageLoader.ImageCache {
12 |
13 | private LruCache cache;
14 |
15 | public VolleyBitmapCache() {
16 | cache = new LruCache(8 * 1024 * 1024) {
17 | @Override
18 | protected int sizeOf(String key, Bitmap bitmap) {
19 | return bitmap.getRowBytes() * bitmap.getHeight();
20 | }
21 | };
22 | }
23 |
24 | @Override
25 | public Bitmap getBitmap(String url) {
26 | return cache.get(url);
27 | }
28 |
29 | @Override
30 | public void putBitmap(String url, Bitmap bitmap) {
31 | cache.put(url, bitmap);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/annotation/DataBind.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * @author zhu zhe
10 | * @since 2015年4月15日 上午9:52:28
11 | * @version V1.0
12 | */
13 | @Target(ElementType.FIELD)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface DataBind {
16 | public int id();
17 |
18 | public DataType dataType() default DataType.STRING;
19 |
20 | public int loadingResId() default 0;
21 |
22 | public int failResId() default 0;
23 |
24 | /**
25 | * 前缀
26 | *
27 | * @return
28 | */
29 | public String prefix() default "";
30 |
31 | /**
32 | * 后缀
33 | *
34 | * @return
35 | */
36 | public String suffix() default "";
37 |
38 | /**
39 | * 格式化Date
40 | *
41 | * @return
42 | */
43 | public String pattern() default "";
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/annotation/DataBind.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * @author zhu zhe
10 | * @since 2015年4月15日 上午9:52:28
11 | * @version V1.0
12 | */
13 | @Target(ElementType.FIELD)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface DataBind {
16 | public int id();
17 |
18 | public DataType dataType() default DataType.STRING;
19 |
20 | public int loadingResId() default 0;
21 |
22 | public int failResId() default 0;
23 |
24 | /**
25 | * 前缀
26 | *
27 | * @return
28 | */
29 | public String prefix() default "";
30 |
31 | /**
32 | * 后缀
33 | *
34 | * @return
35 | */
36 | public String suffix() default "";
37 |
38 | /**
39 | * 格式化Date
40 | *
41 | * @return
42 | */
43 | public String pattern() default "";
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/table/KeyValue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.table;
17 |
18 | public class KeyValue {
19 | public final String key;
20 | public final Object value;
21 |
22 | public KeyValue(String key, Object value) {
23 | this.key = key;
24 | this.value = value;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AndroidKit.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/LongColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class LongColumnConverter implements ColumnConverter {
13 | @Override
14 | public Long getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : cursor.getLong(index);
16 | }
17 |
18 | @Override
19 | public Long getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return Long.valueOf(fieldStringValue);
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(Long fieldValue) {
26 | return fieldValue;
27 | }
28 |
29 | @Override
30 | public ColumnDbType getColumnDbType() {
31 | return ColumnDbType.INTEGER;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/ByteColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class ByteColumnConverter implements ColumnConverter {
13 | @Override
14 | public Byte getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : (byte) cursor.getInt(index);
16 | }
17 |
18 | @Override
19 | public Byte getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return Byte.valueOf(fieldStringValue);
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(Byte fieldValue) {
26 | return fieldValue;
27 | }
28 |
29 | @Override
30 | public ColumnDbType getColumnDbType() {
31 | return ColumnDbType.INTEGER;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/FloatColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class FloatColumnConverter implements ColumnConverter {
13 | @Override
14 | public Float getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : cursor.getFloat(index);
16 | }
17 |
18 | @Override
19 | public Float getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return Float.valueOf(fieldStringValue);
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(Float fieldValue) {
26 | return fieldValue;
27 | }
28 |
29 | @Override
30 | public ColumnDbType getColumnDbType() {
31 | return ColumnDbType.REAL;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/ShortColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class ShortColumnConverter implements ColumnConverter {
13 | @Override
14 | public Short getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : cursor.getShort(index);
16 | }
17 |
18 | @Override
19 | public Short getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return Short.valueOf(fieldStringValue);
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(Short fieldValue) {
26 | return fieldValue;
27 | }
28 |
29 | @Override
30 | public ColumnDbType getColumnDbType() {
31 | return ColumnDbType.INTEGER;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/DoubleColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class DoubleColumnConverter implements ColumnConverter {
13 | @Override
14 | public Double getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : cursor.getDouble(index);
16 | }
17 |
18 | @Override
19 | public Double getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return Double.valueOf(fieldStringValue);
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(Double fieldValue) {
26 | return fieldValue;
27 | }
28 |
29 | @Override
30 | public ColumnDbType getColumnDbType() {
31 | return ColumnDbType.REAL;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/IntegerColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class IntegerColumnConverter implements ColumnConverter {
13 | @Override
14 | public Integer getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : cursor.getInt(index);
16 | }
17 |
18 | @Override
19 | public Integer getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return Integer.valueOf(fieldStringValue);
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(Integer fieldValue) {
26 | return fieldValue;
27 | }
28 |
29 | @Override
30 | public ColumnDbType getColumnDbType() {
31 | return ColumnDbType.INTEGER;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/Transient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.annotation;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | @Target(ElementType.FIELD)
24 | @Retention(RetentionPolicy.RUNTIME)
25 | public @interface Transient {
26 | }
27 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/framework/ActivityMgr.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.framework;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.app.Activity;
7 |
8 | public class ActivityMgr {
9 | private ActivityMgr() {
10 | }
11 |
12 | static {
13 | activities = new ArrayList();
14 | }
15 |
16 | private static List activities;
17 |
18 | public static void addActivity(Activity activity) {
19 | activities.add(activity);
20 | }
21 |
22 | public static void removeActivity(Activity activity) {
23 | if (activities.contains(activity)) {
24 | activities.remove(activity);
25 | }
26 | }
27 |
28 | public static void finishActivity(Class> activity) {
29 | for (Activity act : activities) {
30 | if (act.getClass() == activity) {
31 | act.finish();
32 | break;
33 | }
34 | }
35 | }
36 |
37 | public static void exitApp() {
38 | for (Activity activity : activities) {
39 | activity.finish();
40 | }
41 | android.os.Process.killProcess(android.os.Process.myPid());
42 | System.exit(0);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/framework/ActivityMgr.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.framework;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.app.Activity;
7 |
8 | public class ActivityMgr {
9 | private ActivityMgr() {
10 | }
11 |
12 | static {
13 | activities = new ArrayList();
14 | }
15 |
16 | private static List activities;
17 |
18 | public static void addActivity(Activity activity) {
19 | activities.add(activity);
20 | }
21 |
22 | public static void removeActivity(Activity activity) {
23 | if (activities.contains(activity)) {
24 | activities.remove(activity);
25 | }
26 | }
27 |
28 | public static void finishActivity(Class> activity) {
29 | for (Activity act : activities) {
30 | if (act.getClass() == activity) {
31 | act.finish();
32 | break;
33 | }
34 | }
35 | }
36 |
37 | public static void exitApp() {
38 | for (Activity activity : activities) {
39 | activity.finish();
40 | }
41 | android.os.Process.killProcess(android.os.Process.myPid());
42 | System.exit(0);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/Id.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.annotation;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | @Target(ElementType.FIELD)
24 | @Retention(RetentionPolicy.RUNTIME)
25 | public @interface Id {
26 | String column() default "";
27 | }
28 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/CharColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class CharColumnConverter implements ColumnConverter {
13 | @Override
14 | public Character getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : (char) cursor.getInt(index);
16 | }
17 |
18 | @Override
19 | public Character getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return fieldStringValue.charAt(0);
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(Character fieldValue) {
26 | if (fieldValue == null) return null;
27 | return (int) fieldValue;
28 | }
29 |
30 | @Override
31 | public ColumnDbType getColumnDbType() {
32 | return ColumnDbType.INTEGER;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/ServerError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Indicates that the server responded with an error response.
21 | */
22 | @SuppressWarnings("serial")
23 | public class ServerError extends VolleyError {
24 | public ServerError(NetworkResponse networkResponse) {
25 | super(networkResponse);
26 | }
27 |
28 | public ServerError() {
29 | super();
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/ServerError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Indicates that the server responded with an error response.
21 | */
22 | @SuppressWarnings("serial")
23 | public class ServerError extends VolleyError {
24 | public ServerError(NetworkResponse networkResponse) {
25 | super(networkResponse);
26 | }
27 |
28 | public ServerError() {
29 | super();
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/util/IOUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.util;
17 |
18 | import java.io.Closeable;
19 |
20 | /**
21 | * Author: wyouflf Date: 13-8-26 Time: 下午6:02
22 | */
23 | public class IOUtils {
24 |
25 | private IOUtils() {
26 | }
27 |
28 | public static void closeQuietly(Closeable closeable) {
29 | if (closeable != null) {
30 | try {
31 | closeable.close();
32 | } catch (Throwable e) {
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/Foreign.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.annotation;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | @Target(ElementType.FIELD)
24 | @Retention(RetentionPolicy.RUNTIME)
25 | public @interface Foreign {
26 |
27 | String column() default "";
28 |
29 | String foreign();
30 | }
31 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/NoConnectionError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Error indicating that no connection could be established when performing a Volley request.
21 | */
22 | @SuppressWarnings("serial")
23 | public class NoConnectionError extends NetworkError {
24 | public NoConnectionError() {
25 | super();
26 | }
27 |
28 | public NoConnectionError(Throwable reason) {
29 | super(reason);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/NoConnectionError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Error indicating that no connection could be established when performing a Volley request.
21 | */
22 | @SuppressWarnings("serial")
23 | public class NoConnectionError extends NetworkError {
24 | public NoConnectionError() {
25 | super();
26 | }
27 |
28 | public NoConnectionError(Throwable reason) {
29 | super(reason);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/NotNull.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.annotation;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * Author: wyouflf
25 | * Date: 13-8-20
26 | * Time: 上午9:42
27 | */
28 | @Target(ElementType.FIELD)
29 | @Retention(RetentionPolicy.RUNTIME)
30 | public @interface NotNull {
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/Unique.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.annotation;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * Author: wyouflf
25 | * Date: 13-8-20
26 | * Time: 上午9:41
27 | */
28 | @Target(ElementType.FIELD)
29 | @Retention(RetentionPolicy.RUNTIME)
30 | public @interface Unique {
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/DateColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | import java.util.Date;
8 |
9 | /**
10 | * Author: wyouflf
11 | * Date: 13-11-4
12 | * Time: 下午10:51
13 | */
14 | public class DateColumnConverter implements ColumnConverter {
15 | @Override
16 | public Date getFieldValue(final Cursor cursor, int index) {
17 | return cursor.isNull(index) ? null : new Date(cursor.getLong(index));
18 | }
19 |
20 | @Override
21 | public Date getFieldValue(String fieldStringValue) {
22 | if (TextUtils.isEmpty(fieldStringValue)) return null;
23 | return new Date(Long.valueOf(fieldStringValue));
24 | }
25 |
26 | @Override
27 | public Object fieldValue2ColumnValue(Date fieldValue) {
28 | if (fieldValue == null) return null;
29 | return fieldValue.getTime();
30 | }
31 |
32 | @Override
33 | public ColumnDbType getColumnDbType() {
34 | return ColumnDbType.INTEGER;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/Column.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.annotation;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | @Target(ElementType.FIELD)
24 | @Retention(RetentionPolicy.RUNTIME)
25 | public @interface Column {
26 |
27 | String column() default "";
28 |
29 | String defaultValue() default "";
30 | }
31 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/Table.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.annotation;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | @Target(ElementType.TYPE)
24 | @Retention(RetentionPolicy.RUNTIME)
25 | public @interface Table {
26 |
27 | String name() default "";
28 |
29 | String execAfterTableCreated() default "";
30 | }
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/ParseError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Indicates that the server's response could not be parsed.
21 | */
22 | @SuppressWarnings("serial")
23 | public class ParseError extends VolleyError {
24 | public ParseError() { }
25 |
26 | public ParseError(NetworkResponse networkResponse) {
27 | super(networkResponse);
28 | }
29 |
30 | public ParseError(Throwable cause) {
31 | super(cause);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/ParseError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Indicates that the server's response could not be parsed.
21 | */
22 | @SuppressWarnings("serial")
23 | public class ParseError extends VolleyError {
24 | public ParseError() { }
25 |
26 | public ParseError(NetworkResponse networkResponse) {
27 | super(networkResponse);
28 | }
29 |
30 | public ParseError(Throwable cause) {
31 | super(cause);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/annotation/Check.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.db.annotation;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * Author: wyouflf
25 | * Date: 13-8-20
26 | * Time: 上午9:44
27 | */
28 | @Target(ElementType.FIELD)
29 | @Retention(RetentionPolicy.RUNTIME)
30 | public @interface Check {
31 | String value();
32 | }
33 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/SqlDateColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class SqlDateColumnConverter implements ColumnConverter {
13 | @Override
14 | public java.sql.Date getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : new java.sql.Date(cursor.getLong(index));
16 | }
17 |
18 | @Override
19 | public java.sql.Date getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return new java.sql.Date(Long.valueOf(fieldStringValue));
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(java.sql.Date fieldValue) {
26 | if (fieldValue == null) return null;
27 | return fieldValue.getTime();
28 | }
29 |
30 | @Override
31 | public ColumnDbType getColumnDbType() {
32 | return ColumnDbType.INTEGER;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/converter/BooleanColumnConverter.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.converter;
2 |
3 | import android.database.Cursor;
4 | import android.text.TextUtils;
5 | import com.lidroid.xutils.db.sqlite.ColumnDbType;
6 |
7 | /**
8 | * Author: wyouflf
9 | * Date: 13-11-4
10 | * Time: 下午10:51
11 | */
12 | public class BooleanColumnConverter implements ColumnConverter {
13 | @Override
14 | public Boolean getFieldValue(final Cursor cursor, int index) {
15 | return cursor.isNull(index) ? null : cursor.getInt(index) == 1;
16 | }
17 |
18 | @Override
19 | public Boolean getFieldValue(String fieldStringValue) {
20 | if (TextUtils.isEmpty(fieldStringValue)) return null;
21 | return fieldStringValue.length() == 1 ? "1".equals(fieldStringValue) : Boolean.valueOf(fieldStringValue);
22 | }
23 |
24 | @Override
25 | public Object fieldValue2ColumnValue(Boolean fieldValue) {
26 | if (fieldValue == null) return null;
27 | return fieldValue ? 1 : 0;
28 | }
29 |
30 | @Override
31 | public ColumnDbType getColumnDbType() {
32 | return ColumnDbType.INTEGER;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/net/api/APIConfig.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.net.api;
2 |
3 | /**
4 | * Created by zhuzhe on 15/10/10.
5 | */
6 | public class APIConfig {
7 | public static void initTest(String scheme, String ip, int port, String apiBaseName) {
8 | Test.scheme = scheme;
9 | Test.ip = ip;
10 | Test.port = port;
11 | Test.apiBaseName = apiBaseName;
12 | }
13 |
14 | public static void initProduct(String scheme, String ip, int port, String apiBaseName) {
15 | Product.scheme = scheme;
16 | Product.ip = ip;
17 | Product.port = port;
18 | Product.apiBaseName = apiBaseName;
19 | }
20 |
21 | static class Test {
22 | public static String scheme = Config.Scheme.HTTP;
23 | public static String ip = "0.0.0.0";
24 | public static String apiBaseName = "";
25 | public static int port = 0;
26 | }
27 |
28 | static class Product {
29 | public static String scheme = Config.Scheme.HTTP;
30 | public static String ip = "0.0.0.0";
31 | public static String apiBaseName = "";
32 | public static int port = 0;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/Network.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * An interface for performing requests.
21 | */
22 | public interface Network {
23 | /**
24 | * Performs the specified request.
25 | * @param request Request to process
26 | * @return A {@link NetworkResponse} with data and caching metadata; will never be null
27 | * @throws VolleyError on errors
28 | */
29 | public NetworkResponse performRequest(Request> request) throws VolleyError;
30 | }
31 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/Network.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * An interface for performing requests.
21 | */
22 | public interface Network {
23 | /**
24 | * Performs the specified request.
25 | * @param request Request to process
26 | * @return A {@link NetworkResponse} with data and caching metadata; will never be null
27 | * @throws VolleyError on errors
28 | */
29 | public NetworkResponse performRequest(Request> request) throws VolleyError;
30 | }
31 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/NetworkError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Indicates that there was a network error when performing a Volley request.
21 | */
22 | @SuppressWarnings("serial")
23 | public class NetworkError extends VolleyError {
24 | public NetworkError() {
25 | super();
26 | }
27 |
28 | public NetworkError(Throwable cause) {
29 | super(cause);
30 | }
31 |
32 | public NetworkError(NetworkResponse networkResponse) {
33 | super(networkResponse);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/NetworkError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Indicates that there was a network error when performing a Volley request.
21 | */
22 | @SuppressWarnings("serial")
23 | public class NetworkError extends VolleyError {
24 | public NetworkError() {
25 | super();
26 | }
27 |
28 | public NetworkError(Throwable cause) {
29 | super(cause);
30 | }
31 |
32 | public NetworkError(NetworkResponse networkResponse) {
33 | super(networkResponse);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/bitmap/core/BitmapSize.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap.core;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 13-11-7
6 | * Time: 下午1:20
7 | */
8 | public class BitmapSize {
9 |
10 | public static final BitmapSize ZERO = new BitmapSize(0, 0);
11 |
12 | private final int width;
13 | private final int height;
14 |
15 | public BitmapSize(int width, int height) {
16 | this.width = width;
17 | this.height = height;
18 | }
19 |
20 | /**
21 | * Scales down dimensions in sampleSize times. Returns new object.
22 | */
23 | public BitmapSize scaleDown(int sampleSize) {
24 | return new BitmapSize(width / sampleSize, height / sampleSize);
25 | }
26 |
27 | /**
28 | * Scales dimensions according to incoming scale. Returns new object.
29 | */
30 | public BitmapSize scale(float scale) {
31 | return new BitmapSize((int) (width * scale), (int) (height * scale));
32 | }
33 |
34 | public int getWidth() {
35 | return width;
36 | }
37 |
38 | public int getHeight() {
39 | return height;
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | return "_" + width + "_" + height;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/bitmap/core/BitmapSize.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.bitmap.core;
2 |
3 | /**
4 | * Author: wyouflf
5 | * Date: 13-11-7
6 | * Time: 下午1:20
7 | */
8 | public class BitmapSize {
9 |
10 | public static final BitmapSize ZERO = new BitmapSize(0, 0);
11 |
12 | private final int width;
13 | private final int height;
14 |
15 | public BitmapSize(int width, int height) {
16 | this.width = width;
17 | this.height = height;
18 | }
19 |
20 | /**
21 | * Scales down dimensions in sampleSize times. Returns new object.
22 | */
23 | public BitmapSize scaleDown(int sampleSize) {
24 | return new BitmapSize(width / sampleSize, height / sampleSize);
25 | }
26 |
27 | /**
28 | * Scales dimensions according to incoming scale. Returns new object.
29 | */
30 | public BitmapSize scale(float scale) {
31 | return new BitmapSize((int) (width * scale), (int) (height * scale));
32 | }
33 |
34 | public int getWidth() {
35 | return width;
36 | }
37 |
38 | public int getHeight() {
39 | return height;
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | return "_" + width + "_" + height;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/exception/DbException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.exception;
17 |
18 | public class DbException extends BaseException {
19 | private static final long serialVersionUID = 1L;
20 |
21 | public DbException() {
22 | }
23 |
24 | public DbException(String detailMessage) {
25 | super(detailMessage);
26 | }
27 |
28 | public DbException(String detailMessage, Throwable throwable) {
29 | super(detailMessage, throwable);
30 | }
31 |
32 | public DbException(Throwable throwable) {
33 | super(throwable);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/cache/MD5FileNameGenerator.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.cache;
2 |
3 | import java.security.MessageDigest;
4 | import java.security.NoSuchAlgorithmException;
5 |
6 | /**
7 | * Author: wyouflf
8 | * Date: 14-5-16
9 | * Time: 上午11:25
10 | */
11 | public class MD5FileNameGenerator implements FileNameGenerator {
12 | public MD5FileNameGenerator() {
13 | }
14 |
15 | public String generate(String key) {
16 | String cacheKey;
17 | try {
18 | final MessageDigest mDigest = MessageDigest.getInstance("MD5");
19 | mDigest.update(key.getBytes());
20 | cacheKey = bytesToHexString(mDigest.digest());
21 | } catch (NoSuchAlgorithmException e) {
22 | cacheKey = String.valueOf(key.hashCode());
23 | }
24 | return cacheKey;
25 | }
26 |
27 | private String bytesToHexString(byte[] bytes) {
28 | StringBuilder sb = new StringBuilder();
29 | for (int i = 0; i < bytes.length; i++) {
30 | String hex = Integer.toHexString(0xFF & bytes[i]);
31 | if (hex.length() == 1) {
32 | sb.append('0');
33 | }
34 | sb.append(hex);
35 | }
36 | return sb.toString();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/cache/MD5FileNameGenerator.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.cache;
2 |
3 | import java.security.MessageDigest;
4 | import java.security.NoSuchAlgorithmException;
5 |
6 | /**
7 | * Author: wyouflf
8 | * Date: 14-5-16
9 | * Time: 上午11:25
10 | */
11 | public class MD5FileNameGenerator implements FileNameGenerator {
12 | public MD5FileNameGenerator() {
13 | }
14 |
15 | public String generate(String key) {
16 | String cacheKey;
17 | try {
18 | final MessageDigest mDigest = MessageDigest.getInstance("MD5");
19 | mDigest.update(key.getBytes());
20 | cacheKey = bytesToHexString(mDigest.digest());
21 | } catch (NoSuchAlgorithmException e) {
22 | cacheKey = String.valueOf(key.hashCode());
23 | }
24 | return cacheKey;
25 | }
26 |
27 | private String bytesToHexString(byte[] bytes) {
28 | StringBuilder sb = new StringBuilder();
29 | for (int i = 0; i < bytes.length; i++) {
30 | String hex = Integer.toHexString(0xFF & bytes[i]);
31 | if (hex.length() == 1) {
32 | sb.append('0');
33 | }
34 | sb.append(hex);
35 | }
36 | return sb.toString();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/toolbox/Authenticator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley.toolbox;
18 |
19 | import com.android.volley.AuthFailureError;
20 |
21 | /**
22 | * An interface for interacting with auth tokens.
23 | */
24 | public interface Authenticator {
25 | /**
26 | * Synchronously retrieves an auth token.
27 | *
28 | * @throws AuthFailureError If authentication did not succeed
29 | */
30 | public String getAuthToken() throws AuthFailureError;
31 |
32 | /**
33 | * Invalidates the provided auth token.
34 | */
35 | public void invalidateAuthToken(String authToken);
36 | }
37 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/toolbox/Authenticator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley.toolbox;
18 |
19 | import com.android.volley.AuthFailureError;
20 |
21 | /**
22 | * An interface for interacting with auth tokens.
23 | */
24 | public interface Authenticator {
25 | /**
26 | * Synchronously retrieves an auth token.
27 | *
28 | * @throws AuthFailureError If authentication did not succeed
29 | */
30 | public String getAuthToken() throws AuthFailureError;
31 |
32 | /**
33 | * Invalidates the provided auth token.
34 | */
35 | public void invalidateAuthToken(String authToken);
36 | }
37 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/exception/BaseException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.exception;
17 |
18 | /**
19 | * Author: wyouflf
20 | * Date: 13-7-24
21 | * Time: 下午3:00
22 | */
23 | public class BaseException extends Exception {
24 | private static final long serialVersionUID = 1L;
25 |
26 | public BaseException() {
27 | }
28 |
29 | public BaseException(String detailMessage) {
30 | super(detailMessage);
31 | }
32 |
33 | public BaseException(String detailMessage, Throwable throwable) {
34 | super(detailMessage, throwable);
35 | }
36 |
37 | public BaseException(Throwable throwable) {
38 | super(throwable);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/ViewTools.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import android.os.Handler;
4 | import android.view.View;
5 | import android.widget.ScrollView;
6 |
7 | public class ViewTools {
8 |
9 | public static void scrollToBottom(final ScrollView scroll, final View inner) {
10 | Handler mHandler = new Handler();
11 | mHandler.post(new Runnable() {
12 | public void run() {
13 | if (scroll == null || inner == null) {
14 | return;
15 | }
16 |
17 | int offset = inner.getMeasuredHeight() - scroll.getHeight();
18 | if (offset < 0) {
19 | offset = 0;
20 | }
21 | scroll.smoothScrollTo(0, offset);
22 | }
23 | });
24 | }
25 |
26 | public static int getHeigth(View v) {
27 | if (v == null)
28 | return 0;
29 | int w = View.MeasureSpec.makeMeasureSpec(0,
30 | View.MeasureSpec.UNSPECIFIED);
31 | int h = View.MeasureSpec.makeMeasureSpec(0,
32 | View.MeasureSpec.UNSPECIFIED);
33 | v.measure(w, h);
34 | return v.getMeasuredHeight();
35 | }
36 |
37 | public static int getWidth(View v) {
38 | if (v == null)
39 | return 0;
40 | int w = View.MeasureSpec.makeMeasureSpec(0,
41 | View.MeasureSpec.UNSPECIFIED);
42 | int h = View.MeasureSpec.makeMeasureSpec(0,
43 | View.MeasureSpec.UNSPECIFIED);
44 | v.measure(w, h);
45 | return v.getMeasuredWidth();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/ViewTools.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import android.os.Handler;
4 | import android.view.View;
5 | import android.widget.ScrollView;
6 |
7 | public class ViewTools {
8 |
9 | public static void scrollToBottom(final ScrollView scroll, final View inner) {
10 | Handler mHandler = new Handler();
11 | mHandler.post(new Runnable() {
12 | public void run() {
13 | if (scroll == null || inner == null) {
14 | return;
15 | }
16 |
17 | int offset = inner.getMeasuredHeight() - scroll.getHeight();
18 | if (offset < 0) {
19 | offset = 0;
20 | }
21 | scroll.smoothScrollTo(0, offset);
22 | }
23 | });
24 | }
25 |
26 | public static int getHeigth(View v) {
27 | if (v == null)
28 | return 0;
29 | int w = View.MeasureSpec.makeMeasureSpec(0,
30 | View.MeasureSpec.UNSPECIFIED);
31 | int h = View.MeasureSpec.makeMeasureSpec(0,
32 | View.MeasureSpec.UNSPECIFIED);
33 | v.measure(w, h);
34 | return v.getMeasuredHeight();
35 | }
36 |
37 | public static int getWidth(View v) {
38 | if (v == null)
39 | return 0;
40 | int w = View.MeasureSpec.makeMeasureSpec(0,
41 | View.MeasureSpec.UNSPECIFIED);
42 | int h = View.MeasureSpec.makeMeasureSpec(0,
43 | View.MeasureSpec.UNSPECIFIED);
44 | v.measure(w, h);
45 | return v.getMeasuredWidth();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/kit/VolleyImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.android.volley.kit;
2 |
3 | import android.content.Context;
4 | import android.widget.ImageView;
5 |
6 | import com.android.volley.RequestQueue;
7 | import com.android.volley.toolbox.ImageLoader;
8 | import com.android.volley.toolbox.Volley;
9 |
10 | /**
11 | * Created by zhuzhe on 15/9/25.
12 | */
13 | public class VolleyImageLoader {
14 | RequestQueue mQueue;
15 | ImageLoader imageLoader;
16 |
17 | private VolleyImageLoader(Context context) {
18 | mQueue = Volley.newRequestQueue(context);
19 | imageLoader = new ImageLoader(mQueue, new VolleyBitmapCache());
20 |
21 | }
22 |
23 | private static VolleyImageLoader loader;
24 |
25 | public static void init(Context context) {
26 | if (loader == null) {
27 | loader = new VolleyImageLoader(context);
28 | }
29 | }
30 |
31 | public static VolleyImageLoader getInstance() {
32 | return loader;
33 | }
34 |
35 | public void displayImageView(ImageView view, String url, int loading, int faild) {
36 | ImageLoader.ImageListener listener = ImageLoader.getImageListener(view, loading, faild);
37 | imageLoader.get(url, listener);
38 | //指定图片允许的最大宽度和高度
39 | //imageLoader.get("http://developer.android.com/images/home/aw_dac.png",listener, 200, 200);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/AppUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import java.io.File;
4 |
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.pm.PackageManager.NameNotFoundException;
8 | import android.net.Uri;
9 |
10 | public class AppUtils {
11 | /**
12 | * 获得版本号
13 | */
14 | public static int getVersionCode(Context context) {
15 | int verCode = -1;
16 | try {
17 | verCode = context.getPackageManager().getPackageInfo(
18 | context.getPackageName(), 0).versionCode;
19 | } catch (NameNotFoundException e) {
20 | verCode = -1;
21 | }
22 | return verCode;
23 | }
24 |
25 | public static String getVersion(Context context) {
26 | String verName = "";
27 | try {
28 | verName = context.getPackageManager().getPackageInfo(
29 | context.getPackageName(), 0).versionName;
30 | } catch (NameNotFoundException e) {
31 | verName = "";
32 | }
33 | return verName;
34 | }
35 |
36 | public static void installApk(Context context, String filename) {
37 | File file = new File(filename);
38 | Intent intent = new Intent();
39 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
40 | intent.setAction(Intent.ACTION_VIEW);
41 | String type = "application/vnd.android.package-archive";
42 | intent.setDataAndType(Uri.fromFile(file), type);
43 | context.startActivity(intent);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/ResponseDelivery.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | public interface ResponseDelivery {
20 | /**
21 | * Parses a response from the network or cache and delivers it.
22 | */
23 | public void postResponse(Request> request, Response> response);
24 |
25 | /**
26 | * Parses a response from the network or cache and delivers it. The provided
27 | * Runnable will be executed after delivery.
28 | */
29 | public void postResponse(Request> request, Response> response, Runnable runnable);
30 |
31 | /**
32 | * Posts an error for the given request.
33 | */
34 | public void postError(Request> request, VolleyError error);
35 | }
36 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/AppUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import java.io.File;
4 |
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.pm.PackageManager.NameNotFoundException;
8 | import android.net.Uri;
9 |
10 | public class AppUtils {
11 | /**
12 | * 获得版本号
13 | */
14 | public static int getVersionCode(Context context) {
15 | int verCode = -1;
16 | try {
17 | verCode = context.getPackageManager().getPackageInfo(
18 | context.getPackageName(), 0).versionCode;
19 | } catch (NameNotFoundException e) {
20 | verCode = -1;
21 | }
22 | return verCode;
23 | }
24 |
25 | public static String getVersion(Context context) {
26 | String verName = "";
27 | try {
28 | verName = context.getPackageManager().getPackageInfo(
29 | context.getPackageName(), 0).versionName;
30 | } catch (NameNotFoundException e) {
31 | verName = "";
32 | }
33 | return verName;
34 | }
35 |
36 | public static void installApk(Context context, String filename) {
37 | File file = new File(filename);
38 | Intent intent = new Intent();
39 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
40 | intent.setAction(Intent.ACTION_VIEW);
41 | String type = "application/vnd.android.package-archive";
42 | intent.setDataAndType(Uri.fromFile(file), type);
43 | context.startActivity(intent);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/ResponseDelivery.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | public interface ResponseDelivery {
20 | /**
21 | * Parses a response from the network or cache and delivers it.
22 | */
23 | public void postResponse(Request> request, Response> response);
24 |
25 | /**
26 | * Parses a response from the network or cache and delivers it. The provided
27 | * Runnable will be executed after delivery.
28 | */
29 | public void postResponse(Request> request, Response> response, Runnable runnable);
30 |
31 | /**
32 | * Posts an error for the given request.
33 | */
34 | public void postError(Request> request, VolleyError error);
35 | }
36 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/toolbox/NoCache.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley.toolbox;
18 |
19 | import com.android.volley.Cache;
20 |
21 | /**
22 | * A cache that doesn't.
23 | */
24 | public class NoCache implements Cache {
25 | @Override
26 | public void clear() {
27 | }
28 |
29 | @Override
30 | public Entry get(String key) {
31 | return null;
32 | }
33 |
34 | @Override
35 | public void put(String key, Entry entry) {
36 | }
37 |
38 | @Override
39 | public void invalidate(String key, boolean fullExpire) {
40 | }
41 |
42 | @Override
43 | public void remove(String key) {
44 | }
45 |
46 | @Override
47 | public void initialize() {
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/toolbox/NoCache.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley.toolbox;
18 |
19 | import com.android.volley.Cache;
20 |
21 | /**
22 | * A cache that doesn't.
23 | */
24 | public class NoCache implements Cache {
25 | @Override
26 | public void clear() {
27 | }
28 |
29 | @Override
30 | public Entry get(String key) {
31 | return null;
32 | }
33 |
34 | @Override
35 | public void put(String key, Entry entry) {
36 | }
37 |
38 | @Override
39 | public void invalidate(String key, boolean fullExpire) {
40 | }
41 |
42 | @Override
43 | public void remove(String key) {
44 | }
45 |
46 | @Override
47 | public void initialize() {
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/util/IOUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.util;
17 |
18 | import android.database.Cursor;
19 |
20 | import java.io.Closeable;
21 |
22 | /**
23 | * Author: wyouflf Date: 13-8-26 Time: 下午6:02
24 | */
25 | public class IOUtils {
26 |
27 | private IOUtils() {
28 | }
29 |
30 | public static void closeQuietly(Closeable closeable) {
31 | if (closeable != null) {
32 | try {
33 | closeable.close();
34 | } catch (Throwable e) {
35 | }
36 | }
37 | }
38 | public static void closeQuietly(Cursor closeable) {
39 | if (closeable != null) {
40 | try {
41 | closeable.close();
42 | } catch (Throwable e) {
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/framework/FragmentUtil.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.framework;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentTransaction;
6 |
7 | import java.util.List;
8 |
9 | public class FragmentUtil {
10 | public static void openFragment(int id, Fragment fragment,
11 | FragmentManager fragmentManager) {
12 | try {
13 | FragmentTransaction transaction = fragmentManager
14 | .beginTransaction();
15 | List list = fragmentManager.getFragments();
16 | if (list == null || list.size() == 0) {
17 | transaction.add(id, fragment).commit();
18 | } else {
19 | if (list.contains(fragment)) {
20 | for (Fragment f : list) {
21 | if (fragment == f) {
22 | transaction.show(f);
23 | } else {
24 | transaction.hide(f);
25 | }
26 | }
27 | transaction.commit();
28 | } else {
29 | for (Fragment f : list) {
30 | transaction.hide(f);
31 | }
32 | transaction.add(id, fragment).commit();
33 | }
34 | }
35 | } catch (Exception e) {
36 | }
37 | }
38 |
39 | public static void replaceFragment(int id, Fragment fragment,
40 | FragmentManager fragmentManager, boolean backStack) {
41 | FragmentTransaction transaction = fragmentManager.beginTransaction();
42 | transaction.replace(id, fragment);
43 | if (backStack)
44 | transaction.addToBackStack(null);
45 | transaction.commit();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/framework/FragmentUtil.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.framework;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentTransaction;
6 |
7 | import java.util.List;
8 |
9 | public class FragmentUtil {
10 | public static void openFragment(int id, Fragment fragment,
11 | FragmentManager fragmentManager) {
12 | try {
13 | FragmentTransaction transaction = fragmentManager
14 | .beginTransaction();
15 | List list = fragmentManager.getFragments();
16 | if (list == null || list.size() == 0) {
17 | transaction.add(id, fragment).commit();
18 | } else {
19 | if (list.contains(fragment)) {
20 | for (Fragment f : list) {
21 | if (fragment == f) {
22 | transaction.show(f);
23 | } else {
24 | transaction.hide(f);
25 | }
26 | }
27 | transaction.commit();
28 | } else {
29 | for (Fragment f : list) {
30 | transaction.hide(f);
31 | }
32 | transaction.add(id, fragment).commit();
33 | }
34 | }
35 | } catch (Exception e) {
36 | }
37 | }
38 |
39 | public static void replaceFragment(int id, Fragment fragment,
40 | FragmentManager fragmentManager, boolean backStack) {
41 | FragmentTransaction transaction = fragmentManager.beginTransaction();
42 | transaction.replace(id, fragment);
43 | if (backStack)
44 | transaction.addToBackStack(null);
45 | transaction.commit();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/RetryPolicy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Retry policy for a request.
21 | */
22 | public interface RetryPolicy {
23 |
24 | /**
25 | * Returns the current timeout (used for logging).
26 | */
27 | public int getCurrentTimeout();
28 |
29 | /**
30 | * Returns the current retry count (used for logging).
31 | */
32 | public int getCurrentRetryCount();
33 |
34 | /**
35 | * Prepares for the next retry by applying a backoff to the timeout.
36 | * @param error The error code of the last attempt.
37 | * @throws VolleyError In the event that the retry could not be performed (for example if we
38 | * ran out of attempts), the passed in error is thrown.
39 | */
40 | public void retry(VolleyError error) throws VolleyError;
41 | }
42 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/RetryPolicy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Retry policy for a request.
21 | */
22 | public interface RetryPolicy {
23 |
24 | /**
25 | * Returns the current timeout (used for logging).
26 | */
27 | public int getCurrentTimeout();
28 |
29 | /**
30 | * Returns the current retry count (used for logging).
31 | */
32 | public int getCurrentRetryCount();
33 |
34 | /**
35 | * Prepares for the next retry by applying a backoff to the timeout.
36 | * @param error The error code of the last attempt.
37 | * @throws VolleyError In the event that the retry could not be performed (for example if we
38 | * ran out of attempts), the passed in error is thrown.
39 | */
40 | public void retry(VolleyError error) throws VolleyError;
41 | }
42 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/controller/Controller.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.controller;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 |
6 | import com.snicesoft.basekit.util.DialogUtil;
7 | import com.snicesoft.basekit.util.NetworkUtil;
8 |
9 | public class Controller {
10 | public interface CallBack{}
11 | private Context context;
12 | protected C callback;
13 | private ProgressDialog progressDialog;
14 |
15 | public void setCallback(C callback) {
16 | this.callback = callback;
17 | }
18 |
19 | public Controller(Context context) {
20 | this.context = context;
21 | progressDialog = DialogUtil.getProgressDialog(context);
22 | }
23 |
24 | protected Context getContext() {
25 | return context;
26 | }
27 |
28 | protected boolean checkNext() {
29 | return NetworkUtil.isConnect(getContext());
30 | }
31 |
32 | /**
33 | *
34 | * @param message
35 | * @param flag
36 | * 0 setCancelable 1 setCanceledOnTouchOutside
37 | */
38 | protected void showDialog(CharSequence message, boolean... flag) {
39 | if (flag != null) {
40 | if (flag.length > 0)
41 | progressDialog.setCancelable(flag[0]);
42 | if (flag.length > 1)
43 | progressDialog.setCanceledOnTouchOutside(flag[1]);
44 | }
45 | progressDialog.setMessage(message);
46 | if (!progressDialog.isShowing())
47 | progressDialog.show();
48 | }
49 |
50 | protected void closeDialog() {
51 | if (progressDialog.isShowing())
52 | progressDialog.dismiss();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/controller/Controller.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.controller;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 |
6 | import com.snicesoft.basekit.util.DialogUtil;
7 | import com.snicesoft.basekit.util.NetworkUtil;
8 |
9 | public class Controller {
10 | public interface CallBack{}
11 | private Context context;
12 | protected C callback;
13 | private ProgressDialog progressDialog;
14 |
15 | public void setCallback(C callback) {
16 | this.callback = callback;
17 | }
18 |
19 | public Controller(Context context) {
20 | this.context = context;
21 | progressDialog = DialogUtil.getProgressDialog(context);
22 | }
23 |
24 | protected Context getContext() {
25 | return context;
26 | }
27 |
28 | protected boolean checkNext() {
29 | return NetworkUtil.isConnect(getContext());
30 | }
31 |
32 | /**
33 | *
34 | * @param message
35 | * @param flag
36 | * 0 setCancelable 1 setCanceledOnTouchOutside
37 | */
38 | protected void showDialog(CharSequence message, boolean... flag) {
39 | if (flag != null) {
40 | if (flag.length > 0)
41 | progressDialog.setCancelable(flag[0]);
42 | if (flag.length > 1)
43 | progressDialog.setCanceledOnTouchOutside(flag[1]);
44 | }
45 | progressDialog.setMessage(message);
46 | if (!progressDialog.isShowing())
47 | progressDialog.show();
48 | }
49 |
50 | protected void closeDialog() {
51 | if (progressDialog.isShowing())
52 | progressDialog.dismiss();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/CommonUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.os.Environment;
7 | import android.widget.Toast;
8 |
9 | public class CommonUtils {
10 | public static void openActivity(Context context, Class> clazz,
11 | Bundle... bundles) {
12 | Intent intent = new Intent(context, clazz);
13 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
14 | if (bundles != null && bundles.length > 0) {
15 | intent.putExtras(bundles[0]);
16 | }
17 | context.startActivity(intent);
18 | }
19 |
20 | public static void showToast(Context context, int resId, int... duration) {
21 | if (duration.length > 0)
22 | showToast(context, context.getString(resId), duration[0]);
23 | else
24 | showToast(context, context.getString(resId));
25 | }
26 |
27 | public static void showToast(Context context, String tip, int... duration) {
28 | int du = Toast.LENGTH_SHORT;
29 | if (duration.length > 0)
30 | du = duration[0];
31 | Toast.makeText(context, tip, du).show();
32 | }
33 |
34 | /**
35 | * 检查是否存在SDCard
36 | *
37 | * @return
38 | */
39 | public static boolean hasSdcard() {
40 | String state = Environment.getExternalStorageState();
41 | if (state.equals(Environment.MEDIA_MOUNTED)) {
42 | return true;
43 | } else {
44 | return false;
45 | }
46 | }
47 |
48 | public static int dip2px(Context context, float dipValue) {
49 | final float scale = context.getResources().getDisplayMetrics().density;
50 | return (int) (dipValue * scale + 0.5f);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/CommonUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.os.Environment;
7 | import android.widget.Toast;
8 |
9 | public class CommonUtils {
10 | public static void openActivity(Context context, Class> clazz,
11 | Bundle... bundles) {
12 | Intent intent = new Intent(context, clazz);
13 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
14 | if (bundles != null && bundles.length > 0) {
15 | intent.putExtras(bundles[0]);
16 | }
17 | context.startActivity(intent);
18 | }
19 |
20 | public static void showToast(Context context, int resId, int... duration) {
21 | if (duration.length > 0)
22 | showToast(context, context.getString(resId), duration[0]);
23 | else
24 | showToast(context, context.getString(resId));
25 | }
26 |
27 | public static void showToast(Context context, String tip, int... duration) {
28 | int du = Toast.LENGTH_SHORT;
29 | if (duration.length > 0)
30 | du = duration[0];
31 | Toast.makeText(context, tip, du).show();
32 | }
33 |
34 | /**
35 | * 检查是否存在SDCard
36 | *
37 | * @return
38 | */
39 | public static boolean hasSdcard() {
40 | String state = Environment.getExternalStorageState();
41 | if (state.equals(Environment.MEDIA_MOUNTED)) {
42 | return true;
43 | } else {
44 | return false;
45 | }
46 | }
47 |
48 | public static int dip2px(Context context, float dipValue) {
49 | final float scale = context.getResources().getDisplayMetrics().density;
50 | return (int) (dipValue * scale + 0.5f);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/UpdateUtil.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import java.io.File;
4 |
5 | import android.annotation.SuppressLint;
6 | import android.app.AlertDialog;
7 | import android.app.AlertDialog.Builder;
8 | import android.content.Context;
9 | import android.content.DialogInterface;
10 | import android.os.Environment;
11 | import android.widget.Toast;
12 |
13 | public class UpdateUtil {
14 | @SuppressLint("NewApi")
15 | public static void showDialog(final Context context, String message,
16 | final String httpApkPath) {
17 | File file = new File(Environment.getExternalStorageDirectory()
18 | + "/snicesoft/apk/");
19 | if (!file.exists()) {
20 | file.mkdirs();
21 | }
22 | Builder builder = null;
23 | if (android.os.Build.VERSION.SDK_INT < 11) {
24 | builder = new Builder(context);
25 | } else {
26 | builder = new Builder(context, 0x3);
27 | }
28 | builder.setTitle("软件更新");
29 | builder.setMessage("更新说明:\r\n" + message);
30 | builder.setNegativeButton("更新", new DialogInterface.OnClickListener() {
31 | @Override
32 | public void onClick(DialogInterface dialog, int which) {
33 | if (CommonUtils.hasSdcard()) {
34 | DownloadUtils.download(context, httpApkPath, "apk",
35 | "snicesoft.apk");
36 | } else {
37 | Toast.makeText(context, "请插入SD卡,才能下载", Toast.LENGTH_SHORT)
38 | .show();
39 | }
40 | }
41 | });
42 | builder.setPositiveButton("暂不更新",
43 | new DialogInterface.OnClickListener() {
44 | @Override
45 | public void onClick(DialogInterface dialog, int which) {
46 |
47 | }
48 | });
49 | builder.create().show();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/UpdateUtil.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import java.io.File;
4 |
5 | import android.annotation.SuppressLint;
6 | import android.app.AlertDialog;
7 | import android.app.AlertDialog.Builder;
8 | import android.content.Context;
9 | import android.content.DialogInterface;
10 | import android.os.Environment;
11 | import android.widget.Toast;
12 |
13 | public class UpdateUtil {
14 | @SuppressLint("NewApi")
15 | public static void showDialog(final Context context, String message,
16 | final String httpApkPath) {
17 | File file = new File(Environment.getExternalStorageDirectory()
18 | + "/snicesoft/apk/");
19 | if (!file.exists()) {
20 | file.mkdirs();
21 | }
22 | Builder builder = null;
23 | if (android.os.Build.VERSION.SDK_INT < 11) {
24 | builder = new Builder(context);
25 | } else {
26 | builder = new Builder(context, 0x3);
27 | }
28 | builder.setTitle("软件更新");
29 | builder.setMessage("更新说明:\r\n" + message);
30 | builder.setNegativeButton("更新", new DialogInterface.OnClickListener() {
31 | @Override
32 | public void onClick(DialogInterface dialog, int which) {
33 | if (CommonUtils.hasSdcard()) {
34 | DownloadUtils.download(context, httpApkPath, "apk",
35 | "snicesoft.apk");
36 | } else {
37 | Toast.makeText(context, "请插入SD卡,才能下载", Toast.LENGTH_SHORT)
38 | .show();
39 | }
40 | }
41 | });
42 | builder.setPositiveButton("暂不更新",
43 | new DialogInterface.OnClickListener() {
44 | @Override
45 | public void onClick(DialogInterface dialog, int which) {
46 |
47 | }
48 | });
49 | builder.create().show();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/db/sqlite/FinderLazyLoader.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.db.sqlite;
2 |
3 | import com.lidroid.xutils.db.table.ColumnUtils;
4 | import com.lidroid.xutils.db.table.Finder;
5 | import com.lidroid.xutils.db.table.Table;
6 | import com.lidroid.xutils.exception.DbException;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Author: wyouflf
12 | * Date: 13-9-10
13 | * Time: 下午10:50
14 | */
15 | public class FinderLazyLoader {
16 | private final Finder finderColumn;
17 | private final Object finderValue;
18 |
19 | public FinderLazyLoader(Finder finderColumn, Object value) {
20 | this.finderColumn = finderColumn;
21 | this.finderValue = ColumnUtils.convert2DbColumnValueIfNeeded(value);
22 | }
23 |
24 | public List getAllFromDb() throws DbException {
25 | List entities = null;
26 | Table table = finderColumn.getTable();
27 | if (table != null) {
28 | entities = table.db.findAll(
29 | Selector.from(finderColumn.getTargetEntityType()).
30 | where(finderColumn.getTargetColumnName(), "=", finderValue)
31 | );
32 | }
33 | return entities;
34 | }
35 |
36 | public T getFirstFromDb() throws DbException {
37 | T entity = null;
38 | Table table = finderColumn.getTable();
39 | if (table != null) {
40 | entity = table.db.findFirst(
41 | Selector.from(finderColumn.getTargetEntityType()).
42 | where(finderColumn.getTargetColumnName(), "=", finderValue)
43 | );
44 | }
45 | return entity;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/snicesoft/androidkit/KitApplication.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.androidkit;
2 |
3 | import android.app.Application;
4 |
5 | import com.android.volley.kit.VolleyHttpKit;
6 | import com.android.volley.kit.VolleyImageLoader;
7 | import com.lidroid.xutils.XUtilsBitmapKit;
8 | import com.snicesoft.androidkit.otherkit.bitmap.UILBitmapKit;
9 | import com.snicesoft.androidkit.otherkit.http.OkhttpKit;
10 | import com.snicesoft.basekit.LogKit;
11 | import com.snicesoft.basekit.net.api.APIConfig;
12 | import com.snicesoft.basekit.net.api.Config;
13 | import com.snicesoft.basekit.net.api.ConfigFactory;
14 | import com.snicesoft.net.api.API;
15 |
16 | /**
17 | * Created by zhuzhe on 15/10/10.
18 | */
19 | public class KitApplication extends Application {
20 | @Override
21 | public void onCreate() {
22 | super.onCreate();
23 | LogKit.customTagPrefix = "Kit_";
24 | //======初始化Bitmap组件======
25 |
26 | //bitmap组件之xutils_bitmap
27 | XUtilsBitmapKit.getInstance(getApplicationContext());
28 | //bitmap组件之VolleyImageLoader
29 | //VolleyImageLoader.init(getApplicationContext());
30 | //bitmap组件之universal-image-loader
31 | //UILBitmapKit.getInstance(getApplicationContext());
32 |
33 | //======初始化Http组件======
34 |
35 | //1:http组件之volley
36 | VolleyHttpKit.getInstance(getApplicationContext());
37 | //2:http组件之Okhttp
38 | //OkhttpKit.getInstance();
39 |
40 | //======初始化API======
41 | APIConfig.initTest(Config.Scheme.HTTPS, "192.168.0.122", 0, "userinfo/");
42 | APIConfig.initProduct(Config.Scheme.HTTPS, "89.23.78.345", 0, "userinfo/");
43 | API.init(ConfigFactory.Mode.TEST);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/toolbox/HttpStack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley.toolbox;
18 |
19 | import com.android.volley.AuthFailureError;
20 | import com.android.volley.Request;
21 |
22 | import org.apache.http.HttpResponse;
23 |
24 | import java.io.IOException;
25 | import java.util.Map;
26 |
27 | /**
28 | * An HTTP stack abstraction.
29 | */
30 | public interface HttpStack {
31 | /**
32 | * Performs an HTTP request with the given parameters.
33 | *
34 | *
A GET request is sent if request.getPostBody() == null. A POST request is sent otherwise,
35 | * and the Content-Type header is set to request.getPostBodyContentType().
36 | *
37 | * @param request the request to perform
38 | * @param additionalHeaders additional headers to be sent together with
39 | * {@link Request#getHeaders()}
40 | * @return the HTTP response
41 | */
42 | public HttpResponse performRequest(Request> request, Map additionalHeaders)
43 | throws IOException, AuthFailureError;
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/framework/BaseFragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.framework;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 |
6 | import com.snicesoft.viewbind.base.AvFragment;
7 | import com.snicesoft.viewbind.base.AvFragmentActivity;
8 | import com.snicesoft.viewbind.rule.IHolder;
9 |
10 | public class BaseFragmentActivity extends AvFragmentActivity {
11 | protected AvFragment, ?, ?> curFragment;
12 |
13 | public void openFragment(int id, AvFragment, ?, ?> fragment) {
14 | if (curFragment != null && curFragment == fragment)
15 | return;
16 | FragmentUtil.openFragment(id, fragment, getSupportFragmentManager());
17 | curFragment = fragment;
18 | }
19 |
20 | public void replaceFragment(int id, AvFragment, ?, ?> fragment, boolean backStack) {
21 | FragmentUtil.replaceFragment(id, fragment, getSupportFragmentManager(), backStack);
22 | curFragment = fragment;
23 | }
24 |
25 | /**
26 | * click时间是否传递到Fragment
27 | *
28 | * @return
29 | */
30 | public boolean isClickFragment() {
31 | return true;
32 | }
33 |
34 | @Override
35 | public void onClick(View v) {
36 | super.onClick(v);
37 | if (curFragment != null && isClickFragment()) {
38 | curFragment.onClick(v);
39 | }
40 | }
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | ActivityMgr.addActivity(this);
46 | }
47 |
48 | @Override
49 | protected void onDestroy() {
50 | super.onDestroy();
51 | ActivityMgr.removeActivity(this);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/framework/BaseFragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.framework;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 |
6 | import com.snicesoft.viewbind.base.AvFragment;
7 | import com.snicesoft.viewbind.base.AvFragmentActivity;
8 | import com.snicesoft.viewbind.rule.IHolder;
9 |
10 | public class BaseFragmentActivity extends AvFragmentActivity {
11 | protected AvFragment, ?, ?> curFragment;
12 |
13 | public void openFragment(int id, AvFragment, ?, ?> fragment) {
14 | if (curFragment != null && curFragment == fragment)
15 | return;
16 | FragmentUtil.openFragment(id, fragment, getSupportFragmentManager());
17 | curFragment = fragment;
18 | }
19 |
20 | public void replaceFragment(int id, AvFragment, ?, ?> fragment, boolean backStack) {
21 | FragmentUtil.replaceFragment(id, fragment, getSupportFragmentManager(), backStack);
22 | curFragment = fragment;
23 | }
24 |
25 | /**
26 | * click时间是否传递到Fragment
27 | *
28 | * @return
29 | */
30 | public boolean isClickFragment() {
31 | return true;
32 | }
33 |
34 | @Override
35 | public void onClick(View v) {
36 | super.onClick(v);
37 | if (curFragment != null && isClickFragment()) {
38 | curFragment.onClick(v);
39 | }
40 | }
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | ActivityMgr.addActivity(this);
46 | }
47 |
48 | @Override
49 | protected void onDestroy() {
50 | super.onDestroy();
51 | ActivityMgr.removeActivity(this);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/toolbox/HttpStack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley.toolbox;
18 |
19 | import com.android.volley.AuthFailureError;
20 | import com.android.volley.Request;
21 |
22 | import org.apache.http.HttpResponse;
23 |
24 | import java.io.IOException;
25 | import java.util.Map;
26 |
27 | /**
28 | * An HTTP stack abstraction.
29 | */
30 | public interface HttpStack {
31 | /**
32 | * Performs an HTTP request with the given parameters.
33 | *
34 | *
A GET request is sent if request.getPostBody() == null. A POST request is sent otherwise,
35 | * and the Content-Type header is set to request.getPostBodyContentType().
36 | *
37 | * @param request the request to perform
38 | * @param additionalHeaders additional headers to be sent together with
39 | * {@link Request#getHeaders()}
40 | * @return the HTTP response
41 | */
42 | public HttpResponse performRequest(Request> request, Map additionalHeaders)
43 | throws IOException, AuthFailureError;
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/DownloadUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import java.io.File;
4 |
5 | import android.annotation.SuppressLint;
6 | import android.app.DownloadManager;
7 | import android.app.DownloadManager.Request;
8 | import android.content.Context;
9 | import android.net.Uri;
10 | import android.os.Environment;
11 | import android.widget.Toast;
12 |
13 | /**
14 | * @author zhu zhe
15 | * @since 2015年3月5日 下午10:40:21
16 | * @version V1.0
17 | */
18 | @SuppressLint("NewApi")
19 | public class DownloadUtils {
20 | private static String dirType = "snicesoft";
21 |
22 | /**
23 | * 使用系统下载器下载文件
24 | *
25 | * @param context
26 | * 上下文
27 | * @param httpFile
28 | * 网络地址
29 | * @param subType
30 | * 子文件目录
31 | * @param fileName
32 | * 文件后缀名
33 | */
34 | public static void download(Context context, String httpFile,
35 | String subType, String fileName) {
36 | DownloadManager downloadManager = (DownloadManager) context
37 | .getSystemService(Context.DOWNLOAD_SERVICE);
38 | Uri uri = Uri.parse(httpFile);
39 | Request request = new Request(uri);
40 | request.setAllowedNetworkTypes(Request.NETWORK_MOBILE
41 | | Request.NETWORK_WIFI);
42 | File file = new File(Environment.getExternalStorageDirectory() + "/"
43 | + dirType + "/" + subType + "/");
44 | if (!file.exists()) {
45 | file.mkdirs();
46 | }
47 | String subPath = subType + "/" + fileName;
48 | request.setDestinationInExternalPublicDir(dirType, subPath);
49 | request.setVisibleInDownloadsUi(true);
50 | request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
51 | downloadManager.enqueue(request);
52 | Toast.makeText(context, "正在下载", Toast.LENGTH_SHORT).show();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/DownloadUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | import java.io.File;
4 |
5 | import android.annotation.SuppressLint;
6 | import android.app.DownloadManager;
7 | import android.app.DownloadManager.Request;
8 | import android.content.Context;
9 | import android.net.Uri;
10 | import android.os.Environment;
11 | import android.widget.Toast;
12 |
13 | /**
14 | * @author zhu zhe
15 | * @since 2015年3月5日 下午10:40:21
16 | * @version V1.0
17 | */
18 | @SuppressLint("NewApi")
19 | public class DownloadUtils {
20 | private static String dirType = "snicesoft";
21 |
22 | /**
23 | * 使用系统下载器下载文件
24 | *
25 | * @param context
26 | * 上下文
27 | * @param httpFile
28 | * 网络地址
29 | * @param subType
30 | * 子文件目录
31 | * @param fileName
32 | * 文件后缀名
33 | */
34 | public static void download(Context context, String httpFile,
35 | String subType, String fileName) {
36 | DownloadManager downloadManager = (DownloadManager) context
37 | .getSystemService(Context.DOWNLOAD_SERVICE);
38 | Uri uri = Uri.parse(httpFile);
39 | Request request = new Request(uri);
40 | request.setAllowedNetworkTypes(Request.NETWORK_MOBILE
41 | | Request.NETWORK_WIFI);
42 | File file = new File(Environment.getExternalStorageDirectory() + "/"
43 | + dirType + "/" + subType + "/");
44 | if (!file.exists()) {
45 | file.mkdirs();
46 | }
47 | String subPath = subType + "/" + fileName;
48 | request.setDestinationInExternalPublicDir(dirType, subPath);
49 | request.setVisibleInDownloadsUi(true);
50 | request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
51 | downloadManager.enqueue(request);
52 | Toast.makeText(context, "正在下载", Toast.LENGTH_SHORT).show();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/base/AvFragment.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentActivity;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.snicesoft.viewbind.AVKit;
11 | import com.snicesoft.viewbind.ViewFinder;
12 | import com.snicesoft.viewbind.rule.IHolder;
13 |
14 | @SuppressWarnings({ "unchecked", "rawtypes" })
15 | public class AvFragment extends Fragment
16 | implements IAv, View.OnClickListener {
17 | private ViewFinder finder;
18 | protected D _data;
19 | protected H _holder;
20 |
21 | @Override
22 | public final D getData() {
23 | return _data;
24 | }
25 |
26 | @Override
27 | public final H getHolder() {
28 | return _holder;
29 | }
30 |
31 | @Override
32 | public final void dataBindAll() {
33 | AVKit.dataBind(_data, finder);
34 | }
35 |
36 | @Override
37 | public final void dataBindTo(String fieldName) {
38 | AVKit.dataBindTo(_data, finder, fieldName);
39 | }
40 |
41 | public final FA fa() {
42 | return (FA) getActivity();
43 | }
44 |
45 | @Override
46 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
47 | View root = inflater.inflate(LayoutUtils.getLayoutId(getClass()), null);
48 | _holder = newHolder();
49 | _data = newData();
50 | finder = new ViewFinder(root);
51 | AVKit.initHolder(_holder, finder);
52 | dataBindAll();
53 | return root;
54 | }
55 |
56 | @Override
57 | public D newData() {
58 | return null;
59 | }
60 |
61 | @Override
62 | public H newHolder() {
63 | return null;
64 | }
65 |
66 | @Override
67 | public void onClick(View view) {
68 |
69 | }
70 | }
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/base/AvFragment.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentActivity;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.snicesoft.viewbind.AVKit;
11 | import com.snicesoft.viewbind.ViewFinder;
12 | import com.snicesoft.viewbind.rule.IHolder;
13 |
14 | @SuppressWarnings({ "unchecked", "rawtypes" })
15 | public class AvFragment extends Fragment
16 | implements IAv, View.OnClickListener {
17 | private ViewFinder finder;
18 | protected D _data;
19 | protected H _holder;
20 |
21 | @Override
22 | public final D getData() {
23 | return _data;
24 | }
25 |
26 | @Override
27 | public final H getHolder() {
28 | return _holder;
29 | }
30 |
31 | @Override
32 | public final void dataBindAll() {
33 | AVKit.dataBind(_data, finder);
34 | }
35 |
36 | @Override
37 | public final void dataBindTo(String fieldName) {
38 | AVKit.dataBindTo(_data, finder, fieldName);
39 | }
40 |
41 | public final FA fa() {
42 | return (FA) getActivity();
43 | }
44 |
45 | @Override
46 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
47 | View root = inflater.inflate(LayoutUtils.getLayoutId(getClass()), null);
48 | _holder = newHolder();
49 | _data = newData();
50 | finder = new ViewFinder(root);
51 | AVKit.initHolder(_holder, finder);
52 | dataBindAll();
53 | return root;
54 | }
55 |
56 | @Override
57 | public D newData() {
58 | return null;
59 | }
60 |
61 | @Override
62 | public H newHolder() {
63 | return null;
64 | }
65 |
66 | @Override
67 | public void onClick(View view) {
68 |
69 | }
70 | }
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/VolleyError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Exception style class encapsulating Volley errors
21 | */
22 | @SuppressWarnings("serial")
23 | public class VolleyError extends Exception {
24 | public final NetworkResponse networkResponse;
25 | private long networkTimeMs;
26 |
27 | public VolleyError() {
28 | networkResponse = null;
29 | }
30 |
31 | public VolleyError(NetworkResponse response) {
32 | networkResponse = response;
33 | }
34 |
35 | public VolleyError(String exceptionMessage) {
36 | super(exceptionMessage);
37 | networkResponse = null;
38 | }
39 |
40 | public VolleyError(String exceptionMessage, Throwable reason) {
41 | super(exceptionMessage, reason);
42 | networkResponse = null;
43 | }
44 |
45 | public VolleyError(Throwable cause) {
46 | super(cause);
47 | networkResponse = null;
48 | }
49 |
50 | /* package */ void setNetworkTimeMs(long networkTimeMs) {
51 | this.networkTimeMs = networkTimeMs;
52 | }
53 |
54 | public long getNetworkTimeMs() {
55 | return networkTimeMs;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/VolleyError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | /**
20 | * Exception style class encapsulating Volley errors
21 | */
22 | @SuppressWarnings("serial")
23 | public class VolleyError extends Exception {
24 | public final NetworkResponse networkResponse;
25 | private long networkTimeMs;
26 |
27 | public VolleyError() {
28 | networkResponse = null;
29 | }
30 |
31 | public VolleyError(NetworkResponse response) {
32 | networkResponse = response;
33 | }
34 |
35 | public VolleyError(String exceptionMessage) {
36 | super(exceptionMessage);
37 | networkResponse = null;
38 | }
39 |
40 | public VolleyError(String exceptionMessage, Throwable reason) {
41 | super(exceptionMessage, reason);
42 | networkResponse = null;
43 | }
44 |
45 | public VolleyError(Throwable cause) {
46 | super(cause);
47 | networkResponse = null;
48 | }
49 |
50 | /* package */ void setNetworkTimeMs(long networkTimeMs) {
51 | this.networkTimeMs = networkTimeMs;
52 | }
53 |
54 | public long getNetworkTimeMs() {
55 | return networkTimeMs;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/AuthFailureError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | import android.content.Intent;
20 |
21 | /**
22 | * Error indicating that there was an authentication failure when performing a Request.
23 | */
24 | @SuppressWarnings("serial")
25 | public class AuthFailureError extends VolleyError {
26 | /** An intent that can be used to resolve this exception. (Brings up the password dialog.) */
27 | private Intent mResolutionIntent;
28 |
29 | public AuthFailureError() { }
30 |
31 | public AuthFailureError(Intent intent) {
32 | mResolutionIntent = intent;
33 | }
34 |
35 | public AuthFailureError(NetworkResponse response) {
36 | super(response);
37 | }
38 |
39 | public AuthFailureError(String message) {
40 | super(message);
41 | }
42 |
43 | public AuthFailureError(String message, Exception reason) {
44 | super(message, reason);
45 | }
46 |
47 | public Intent getResolutionIntent() {
48 | return mResolutionIntent;
49 | }
50 |
51 | @Override
52 | public String getMessage() {
53 | if (mResolutionIntent != null) {
54 | return "User needs to (re)enter credentials.";
55 | }
56 | return super.getMessage();
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/http.volley/src/main/java/com/android/volley/AuthFailureError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley;
18 |
19 | import android.content.Intent;
20 |
21 | /**
22 | * Error indicating that there was an authentication failure when performing a Request.
23 | */
24 | @SuppressWarnings("serial")
25 | public class AuthFailureError extends VolleyError {
26 | /** An intent that can be used to resolve this exception. (Brings up the password dialog.) */
27 | private Intent mResolutionIntent;
28 |
29 | public AuthFailureError() { }
30 |
31 | public AuthFailureError(Intent intent) {
32 | mResolutionIntent = intent;
33 | }
34 |
35 | public AuthFailureError(NetworkResponse response) {
36 | super(response);
37 | }
38 |
39 | public AuthFailureError(String message) {
40 | super(message);
41 | }
42 |
43 | public AuthFailureError(String message, Exception reason) {
44 | super(message, reason);
45 | }
46 |
47 | public Intent getResolutionIntent() {
48 | return mResolutionIntent;
49 | }
50 |
51 | @Override
52 | public String getMessage() {
53 | if (mResolutionIntent != null) {
54 | return "User needs to (re)enter credentials.";
55 | }
56 | return super.getMessage();
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/base/AvActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.view.View.OnClickListener;
7 |
8 | import com.snicesoft.viewbind.AVKit;
9 | import com.snicesoft.viewbind.ViewFinder;
10 | import com.snicesoft.viewbind.pluginmgr.Proxy;
11 | import com.snicesoft.viewbind.rule.IHolder;
12 |
13 | /**
14 | *
15 | * @author zhe
16 | *
17 | * @param
18 | * @param
19 | */
20 | @SuppressWarnings("rawtypes")
21 | public class AvActivity extends Activity implements IAv, OnClickListener {
22 | private ViewFinder finder;
23 | protected D _data;
24 | protected H _holder;
25 |
26 | @Override
27 | public final D getData() {
28 | return _data;
29 | }
30 |
31 | @Override
32 | public final H getHolder() {
33 | return _holder;
34 | }
35 |
36 | @Override
37 | public final void dataBindAll() {
38 | AVKit.dataBind(_data, finder);
39 | }
40 |
41 | @Override
42 | public final void dataBindTo(String fieldName) {
43 | AVKit.dataBindTo(_data, finder, fieldName);
44 | }
45 |
46 | @Override
47 | protected void onCreate(Bundle savedInstanceState) {
48 | super.onCreate(savedInstanceState);
49 | setContentView(LayoutUtils.getLayoutId(getThisClass()));
50 | _holder = newHolder();
51 | _data = newData();
52 | finder = new ViewFinder(this);
53 | AVKit.initHolder(_holder, finder);
54 | dataBindAll();
55 | }
56 |
57 | public Class> getThisClass() {
58 | Class> clazz = getClass();
59 | if (Proxy.PROXY_ACTIVITY.equals(clazz.getName())) {
60 | clazz = getClass().getSuperclass();
61 | }
62 | return clazz;
63 | }
64 |
65 | @Override
66 | public D newData() {
67 | return null;
68 | }
69 |
70 | @Override
71 | public H newHolder() {
72 | return null;
73 | }
74 |
75 | @Override
76 | public void onClick(View v) {
77 | if (v == null)
78 | return;
79 | }
80 | }
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/base/AvActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.view.View.OnClickListener;
7 |
8 | import com.snicesoft.viewbind.AVKit;
9 | import com.snicesoft.viewbind.ViewFinder;
10 | import com.snicesoft.viewbind.pluginmgr.Proxy;
11 | import com.snicesoft.viewbind.rule.IHolder;
12 |
13 | /**
14 | *
15 | * @author zhe
16 | *
17 | * @param
18 | * @param
19 | */
20 | @SuppressWarnings("rawtypes")
21 | public class AvActivity extends Activity implements IAv, OnClickListener {
22 | private ViewFinder finder;
23 | protected D _data;
24 | protected H _holder;
25 |
26 | @Override
27 | public final D getData() {
28 | return _data;
29 | }
30 |
31 | @Override
32 | public final H getHolder() {
33 | return _holder;
34 | }
35 |
36 | @Override
37 | public final void dataBindAll() {
38 | AVKit.dataBind(_data, finder);
39 | }
40 |
41 | @Override
42 | public final void dataBindTo(String fieldName) {
43 | AVKit.dataBindTo(_data, finder, fieldName);
44 | }
45 |
46 | @Override
47 | protected void onCreate(Bundle savedInstanceState) {
48 | super.onCreate(savedInstanceState);
49 | setContentView(LayoutUtils.getLayoutId(getThisClass()));
50 | _holder = newHolder();
51 | _data = newData();
52 | finder = new ViewFinder(this);
53 | AVKit.initHolder(_holder, finder);
54 | dataBindAll();
55 | }
56 |
57 | public Class> getThisClass() {
58 | Class> clazz = getClass();
59 | if (Proxy.PROXY_ACTIVITY.equals(clazz.getName())) {
60 | clazz = getClass().getSuperclass();
61 | }
62 | return clazz;
63 | }
64 |
65 | @Override
66 | public D newData() {
67 | return null;
68 | }
69 |
70 | @Override
71 | public H newHolder() {
72 | return null;
73 | }
74 |
75 | @Override
76 | public void onClick(View v) {
77 | if (v == null)
78 | return;
79 | }
80 | }
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/task/PriorityExecutor.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | import java.util.concurrent.*;
4 | import java.util.concurrent.atomic.AtomicInteger;
5 |
6 | /**
7 | * Author: wyouflf
8 | * Date: 14-5-16
9 | * Time: 上午11:25
10 | */
11 | public class PriorityExecutor implements Executor {
12 |
13 | private static final int CORE_POOL_SIZE = 5;
14 | private static final int MAXIMUM_POOL_SIZE = 256;
15 | private static final int KEEP_ALIVE = 1;
16 |
17 | private static final ThreadFactory sThreadFactory = new ThreadFactory() {
18 | private final AtomicInteger mCount = new AtomicInteger(1);
19 |
20 | @Override
21 | public Thread newThread(Runnable r) {
22 | return new Thread(r, "PriorityExecutor #" + mCount.getAndIncrement());
23 | }
24 | };
25 |
26 | private final BlockingQueue mPoolWorkQueue = new PriorityObjectBlockingQueue();
27 | private final ThreadPoolExecutor mThreadPoolExecutor;
28 |
29 | public PriorityExecutor() {
30 | this(CORE_POOL_SIZE);
31 | }
32 |
33 | public PriorityExecutor(int poolSize) {
34 | mThreadPoolExecutor = new ThreadPoolExecutor(
35 | poolSize,
36 | MAXIMUM_POOL_SIZE,
37 | KEEP_ALIVE,
38 | TimeUnit.SECONDS,
39 | mPoolWorkQueue,
40 | sThreadFactory);
41 | }
42 |
43 | public int getPoolSize() {
44 | return mThreadPoolExecutor.getCorePoolSize();
45 | }
46 |
47 | public void setPoolSize(int poolSize) {
48 | if (poolSize > 0) {
49 | mThreadPoolExecutor.setCorePoolSize(poolSize);
50 | }
51 | }
52 |
53 | public boolean isBusy() {
54 | return mThreadPoolExecutor.getActiveCount() >= mThreadPoolExecutor.getCorePoolSize();
55 | }
56 |
57 | @Override
58 | public void execute(final Runnable r) {
59 | mThreadPoolExecutor.execute(r);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/task/PriorityExecutor.java:
--------------------------------------------------------------------------------
1 | package com.lidroid.xutils.task;
2 |
3 | import java.util.concurrent.*;
4 | import java.util.concurrent.atomic.AtomicInteger;
5 |
6 | /**
7 | * Author: wyouflf
8 | * Date: 14-5-16
9 | * Time: 上午11:25
10 | */
11 | public class PriorityExecutor implements Executor {
12 |
13 | private static final int CORE_POOL_SIZE = 5;
14 | private static final int MAXIMUM_POOL_SIZE = 256;
15 | private static final int KEEP_ALIVE = 1;
16 |
17 | private static final ThreadFactory sThreadFactory = new ThreadFactory() {
18 | private final AtomicInteger mCount = new AtomicInteger(1);
19 |
20 | @Override
21 | public Thread newThread(Runnable r) {
22 | return new Thread(r, "PriorityExecutor #" + mCount.getAndIncrement());
23 | }
24 | };
25 |
26 | private final BlockingQueue mPoolWorkQueue = new PriorityObjectBlockingQueue();
27 | private final ThreadPoolExecutor mThreadPoolExecutor;
28 |
29 | public PriorityExecutor() {
30 | this(CORE_POOL_SIZE);
31 | }
32 |
33 | public PriorityExecutor(int poolSize) {
34 | mThreadPoolExecutor = new ThreadPoolExecutor(
35 | poolSize,
36 | MAXIMUM_POOL_SIZE,
37 | KEEP_ALIVE,
38 | TimeUnit.SECONDS,
39 | mPoolWorkQueue,
40 | sThreadFactory);
41 | }
42 |
43 | public int getPoolSize() {
44 | return mThreadPoolExecutor.getCorePoolSize();
45 | }
46 |
47 | public void setPoolSize(int poolSize) {
48 | if (poolSize > 0) {
49 | mThreadPoolExecutor.setCorePoolSize(poolSize);
50 | }
51 | }
52 |
53 | public boolean isBusy() {
54 | return mThreadPoolExecutor.getActiveCount() >= mThreadPoolExecutor.getCorePoolSize();
55 | }
56 |
57 | @Override
58 | public void execute(final Runnable r) {
59 | mThreadPoolExecutor.execute(r);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/viewbind/base/AvFragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.os.Bundle;
5 | import android.support.v4.app.FragmentActivity;
6 | import android.view.View;
7 | import android.view.View.OnClickListener;
8 |
9 | import com.snicesoft.viewbind.AVKit;
10 | import com.snicesoft.viewbind.ViewFinder;
11 | import com.snicesoft.viewbind.pluginmgr.Proxy;
12 | import com.snicesoft.viewbind.rule.IHolder;
13 |
14 | /**
15 | * FragmentActivity基类
16 | *
17 | * @author zhe
18 | *
19 | * @param
20 | * @param
21 | */
22 | @SuppressWarnings("rawtypes")
23 | @SuppressLint("NewApi")
24 | public class AvFragmentActivity extends FragmentActivity implements IAv, OnClickListener {
25 | private ViewFinder finder;
26 | protected D _data;
27 | protected H _holder;
28 |
29 | @Override
30 | public final D getData() {
31 | return _data;
32 | }
33 |
34 | @Override
35 | public final H getHolder() {
36 | return _holder;
37 | }
38 |
39 | @Override
40 | public final void dataBindAll() {
41 | AVKit.dataBind(_data, finder);
42 | }
43 |
44 | @Override
45 | public final void dataBindTo(String fieldName) {
46 | AVKit.dataBindTo(_data, finder, fieldName);
47 | }
48 |
49 | @Override
50 | protected void onCreate(Bundle savedInstanceState) {
51 | super.onCreate(savedInstanceState);
52 | setContentView(LayoutUtils.getLayoutId(getThisClass()));
53 | _holder = newHolder();
54 | _data = newData();
55 | finder = new ViewFinder(this);
56 | AVKit.initHolder(_holder, finder);
57 | dataBindAll();
58 | }
59 |
60 | public Class> getThisClass() {
61 | Class> clazz = getClass();
62 | if (Proxy.PROXY_ACTIVITY.equals(clazz.getName())) {
63 | clazz = getClass().getSuperclass();
64 | }
65 | return clazz;
66 | }
67 |
68 | @Override
69 | public D newData() {
70 | return null;
71 | }
72 |
73 | @Override
74 | public H newHolder() {
75 | return null;
76 | }
77 |
78 | @Override
79 | public void onClick(View v) {
80 | if (v == null)
81 | return;
82 | }
83 | }
--------------------------------------------------------------------------------
/viewbind/src/main/java/com/snicesoft/viewbind/base/AvFragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.viewbind.base;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.os.Bundle;
5 | import android.support.v4.app.FragmentActivity;
6 | import android.view.View;
7 | import android.view.View.OnClickListener;
8 |
9 | import com.snicesoft.viewbind.AVKit;
10 | import com.snicesoft.viewbind.ViewFinder;
11 | import com.snicesoft.viewbind.pluginmgr.Proxy;
12 | import com.snicesoft.viewbind.rule.IHolder;
13 |
14 | /**
15 | * FragmentActivity基类
16 | *
17 | * @author zhe
18 | *
19 | * @param
20 | * @param
21 | */
22 | @SuppressWarnings("rawtypes")
23 | @SuppressLint("NewApi")
24 | public class AvFragmentActivity extends FragmentActivity implements IAv, OnClickListener {
25 | private ViewFinder finder;
26 | protected D _data;
27 | protected H _holder;
28 |
29 | @Override
30 | public final D getData() {
31 | return _data;
32 | }
33 |
34 | @Override
35 | public final H getHolder() {
36 | return _holder;
37 | }
38 |
39 | @Override
40 | public final void dataBindAll() {
41 | AVKit.dataBind(_data, finder);
42 | }
43 |
44 | @Override
45 | public final void dataBindTo(String fieldName) {
46 | AVKit.dataBindTo(_data, finder, fieldName);
47 | }
48 |
49 | @Override
50 | protected void onCreate(Bundle savedInstanceState) {
51 | super.onCreate(savedInstanceState);
52 | setContentView(LayoutUtils.getLayoutId(getThisClass()));
53 | _holder = newHolder();
54 | _data = newData();
55 | finder = new ViewFinder(this);
56 | AVKit.initHolder(_holder, finder);
57 | dataBindAll();
58 | }
59 |
60 | public Class> getThisClass() {
61 | Class> clazz = getClass();
62 | if (Proxy.PROXY_ACTIVITY.equals(clazz.getName())) {
63 | clazz = getClass().getSuperclass();
64 | }
65 | return clazz;
66 | }
67 |
68 | @Override
69 | public D newData() {
70 | return null;
71 | }
72 |
73 | @Override
74 | public H newHolder() {
75 | return null;
76 | }
77 |
78 | @Override
79 | public void onClick(View v) {
80 | if (v == null)
81 | return;
82 | }
83 | }
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/bitmap/callback/DefaultBitmapLoadCallBack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.bitmap.callback;
17 |
18 | import android.graphics.Bitmap;
19 | import android.graphics.drawable.Drawable;
20 | import android.view.View;
21 | import android.view.animation.Animation;
22 | import com.lidroid.xutils.bitmap.BitmapDisplayConfig;
23 |
24 | import java.lang.reflect.Method;
25 |
26 | public class DefaultBitmapLoadCallBack extends BitmapLoadCallBack {
27 |
28 | @Override
29 | public void onLoadCompleted(T container, String uri, Bitmap bitmap, BitmapDisplayConfig config, BitmapLoadFrom from) {
30 | this.setBitmap(container, bitmap);
31 | Animation animation = config.getAnimation();
32 | if (animation != null) {
33 | animationDisplay(container, animation);
34 | }
35 | }
36 |
37 | @Override
38 | public void onLoadFailed(T container, String uri, Drawable drawable) {
39 | this.setDrawable(container, drawable);
40 | }
41 |
42 | private void animationDisplay(T container, Animation animation) {
43 | try {
44 | Method cloneMethod = Animation.class.getDeclaredMethod("clone");
45 | cloneMethod.setAccessible(true);
46 | container.startAnimation((Animation) cloneMethod.invoke(animation));
47 | } catch (Throwable e) {
48 | container.startAnimation(animation);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/bitmap/callback/DefaultBitmapLoadCallBack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.bitmap.callback;
17 |
18 | import android.graphics.Bitmap;
19 | import android.graphics.drawable.Drawable;
20 | import android.view.View;
21 | import android.view.animation.Animation;
22 | import com.lidroid.xutils.bitmap.BitmapDisplayConfig;
23 |
24 | import java.lang.reflect.Method;
25 |
26 | public class DefaultBitmapLoadCallBack extends BitmapLoadCallBack {
27 |
28 | @Override
29 | public void onLoadCompleted(T container, String uri, Bitmap bitmap, BitmapDisplayConfig config, BitmapLoadFrom from) {
30 | this.setBitmap(container, bitmap);
31 | Animation animation = config.getAnimation();
32 | if (animation != null) {
33 | animationDisplay(container, animation);
34 | }
35 | }
36 |
37 | @Override
38 | public void onLoadFailed(T container, String uri, Drawable drawable) {
39 | this.setDrawable(container, drawable);
40 | }
41 |
42 | private void animationDisplay(T container, Animation animation) {
43 | try {
44 | Method cloneMethod = Animation.class.getDeclaredMethod("clone");
45 | cloneMethod.setAccessible(true);
46 | container.startAnimation((Animation) cloneMethod.invoke(animation));
47 | } catch (Throwable e) {
48 | container.startAnimation(animation);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/bitmap/src/main/java/com/lidroid/xutils/bitmap/download/Downloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.bitmap.download;
17 |
18 | import android.content.Context;
19 | import com.lidroid.xutils.BitmapUtils;
20 |
21 | import java.io.OutputStream;
22 |
23 | public abstract class Downloader {
24 |
25 | /**
26 | * Download bitmap to outputStream by uri.
27 | *
28 | * @param uri
29 | * @param outputStream
30 | * @return The expiry time stamp or -1 if failed to download.
31 | */
32 | public abstract long downloadToStream(String uri, OutputStream outputStream, final BitmapUtils.BitmapLoadTask> task);
33 |
34 | private Context context;
35 | private long defaultExpiry;
36 | private int defaultConnectTimeout;
37 | private int defaultReadTimeout;
38 |
39 | public Context getContext() {
40 | return context;
41 | }
42 |
43 | public void setContext(Context context) {
44 | this.context = context;
45 | }
46 |
47 | public void setDefaultExpiry(long expiry) {
48 | this.defaultExpiry = expiry;
49 | }
50 |
51 | public long getDefaultExpiry() {
52 | return this.defaultExpiry;
53 | }
54 |
55 | public int getDefaultConnectTimeout() {
56 | return defaultConnectTimeout;
57 | }
58 |
59 | public void setDefaultConnectTimeout(int defaultConnectTimeout) {
60 | this.defaultConnectTimeout = defaultConnectTimeout;
61 | }
62 |
63 | public int getDefaultReadTimeout() {
64 | return defaultReadTimeout;
65 | }
66 |
67 | public void setDefaultReadTimeout(int defaultReadTimeout) {
68 | this.defaultReadTimeout = defaultReadTimeout;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/library/src/main/java/com/lidroid/xutils/bitmap/download/Downloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013. wyouflf (wyouflf@gmail.com)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.lidroid.xutils.bitmap.download;
17 |
18 | import android.content.Context;
19 | import com.lidroid.xutils.BitmapUtils;
20 |
21 | import java.io.OutputStream;
22 |
23 | public abstract class Downloader {
24 |
25 | /**
26 | * Download bitmap to outputStream by uri.
27 | *
28 | * @param uri
29 | * @param outputStream
30 | * @return The expiry time stamp or -1 if failed to download.
31 | */
32 | public abstract long downloadToStream(String uri, OutputStream outputStream, final BitmapUtils.BitmapLoadTask> task);
33 |
34 | private Context context;
35 | private long defaultExpiry;
36 | private int defaultConnectTimeout;
37 | private int defaultReadTimeout;
38 |
39 | public Context getContext() {
40 | return context;
41 | }
42 |
43 | public void setContext(Context context) {
44 | this.context = context;
45 | }
46 |
47 | public void setDefaultExpiry(long expiry) {
48 | this.defaultExpiry = expiry;
49 | }
50 |
51 | public long getDefaultExpiry() {
52 | return this.defaultExpiry;
53 | }
54 |
55 | public int getDefaultConnectTimeout() {
56 | return defaultConnectTimeout;
57 | }
58 |
59 | public void setDefaultConnectTimeout(int defaultConnectTimeout) {
60 | this.defaultConnectTimeout = defaultConnectTimeout;
61 | }
62 |
63 | public int getDefaultReadTimeout() {
64 | return defaultReadTimeout;
65 | }
66 |
67 | public void setDefaultReadTimeout(int defaultReadTimeout) {
68 | this.defaultReadTimeout = defaultReadTimeout;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/basekit/src/main/java/com/snicesoft/basekit/util/ObjectUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | /**
4 | * @author zhu zhe
5 | * @since 2015年3月17日 上午11:44:41
6 | * @version V1.0
7 | */
8 | public class ObjectUtils {
9 | private ObjectUtils() {
10 | throw new AssertionError();
11 | }
12 |
13 | public static boolean isEquals(Object actual, Object expected) {
14 | return actual == expected
15 | || (actual == null ? expected == null : actual.equals(expected));
16 | }
17 |
18 | public static String nullStrToEmpty(Object str) {
19 | return (str == null ? "" : (str instanceof String ? (String) str : str
20 | .toString()));
21 | }
22 |
23 | /**
24 | * convert long array to Long array
25 | *
26 | * @param source
27 | * @return
28 | */
29 | public static Long[] transformLongArray(long[] source) {
30 | Long[] destin = new Long[source.length];
31 | for (int i = 0; i < source.length; i++) {
32 | destin[i] = source[i];
33 | }
34 | return destin;
35 | }
36 |
37 | /**
38 | * convert Long array to long array
39 | *
40 | * @param source
41 | * @return
42 | */
43 | public static long[] transformLongArray(Long[] source) {
44 | long[] destin = new long[source.length];
45 | for (int i = 0; i < source.length; i++) {
46 | destin[i] = source[i];
47 | }
48 | return destin;
49 | }
50 |
51 | /**
52 | * convert int array to Integer array
53 | *
54 | * @param source
55 | * @return
56 | */
57 | public static Integer[] transformIntArray(int[] source) {
58 | Integer[] destin = new Integer[source.length];
59 | for (int i = 0; i < source.length; i++) {
60 | destin[i] = source[i];
61 | }
62 | return destin;
63 | }
64 |
65 | /**
66 | * convert Integer array to int array
67 | *
68 | * @param source
69 | * @return
70 | */
71 | public static int[] transformIntArray(Integer[] source) {
72 | int[] destin = new int[source.length];
73 | for (int i = 0; i < source.length; i++) {
74 | destin[i] = source[i];
75 | }
76 | return destin;
77 | }
78 |
79 | /**
80 | * compare two object
81 | *
82 | * @param v1
83 | * @param v2
84 | * @return
85 | */
86 | @SuppressWarnings({ "unchecked", "rawtypes" })
87 | public static int compare(V v1, V v2) {
88 | return v1 == null ? (v2 == null ? 0 : -1) : (v2 == null ? 1
89 | : ((Comparable) v1).compareTo(v2));
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/library/src/main/java/com/snicesoft/basekit/util/ObjectUtils.java:
--------------------------------------------------------------------------------
1 | package com.snicesoft.basekit.util;
2 |
3 | /**
4 | * @author zhu zhe
5 | * @since 2015年3月17日 上午11:44:41
6 | * @version V1.0
7 | */
8 | public class ObjectUtils {
9 | private ObjectUtils() {
10 | throw new AssertionError();
11 | }
12 |
13 | public static boolean isEquals(Object actual, Object expected) {
14 | return actual == expected
15 | || (actual == null ? expected == null : actual.equals(expected));
16 | }
17 |
18 | public static String nullStrToEmpty(Object str) {
19 | return (str == null ? "" : (str instanceof String ? (String) str : str
20 | .toString()));
21 | }
22 |
23 | /**
24 | * convert long array to Long array
25 | *
26 | * @param source
27 | * @return
28 | */
29 | public static Long[] transformLongArray(long[] source) {
30 | Long[] destin = new Long[source.length];
31 | for (int i = 0; i < source.length; i++) {
32 | destin[i] = source[i];
33 | }
34 | return destin;
35 | }
36 |
37 | /**
38 | * convert Long array to long array
39 | *
40 | * @param source
41 | * @return
42 | */
43 | public static long[] transformLongArray(Long[] source) {
44 | long[] destin = new long[source.length];
45 | for (int i = 0; i < source.length; i++) {
46 | destin[i] = source[i];
47 | }
48 | return destin;
49 | }
50 |
51 | /**
52 | * convert int array to Integer array
53 | *
54 | * @param source
55 | * @return
56 | */
57 | public static Integer[] transformIntArray(int[] source) {
58 | Integer[] destin = new Integer[source.length];
59 | for (int i = 0; i < source.length; i++) {
60 | destin[i] = source[i];
61 | }
62 | return destin;
63 | }
64 |
65 | /**
66 | * convert Integer array to int array
67 | *
68 | * @param source
69 | * @return
70 | */
71 | public static int[] transformIntArray(Integer[] source) {
72 | int[] destin = new int[source.length];
73 | for (int i = 0; i < source.length; i++) {
74 | destin[i] = source[i];
75 | }
76 | return destin;
77 | }
78 |
79 | /**
80 | * compare two object
81 | *
82 | * @param v1
83 | * @param v2
84 | * @return
85 | */
86 | @SuppressWarnings({ "unchecked", "rawtypes" })
87 | public static int compare(V v1, V v2) {
88 | return v1 == null ? (v2 == null ? 0 : -1) : (v2 == null ? 1
89 | : ((Comparable) v1).compareTo(v2));
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/library/src/main/java/com/android/volley/toolbox/ClearCacheRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.volley.toolbox;
18 |
19 | import com.android.volley.Cache;
20 | import com.android.volley.NetworkResponse;
21 | import com.android.volley.Request;
22 | import com.android.volley.Response;
23 |
24 | import android.os.Handler;
25 | import android.os.Looper;
26 |
27 | /**
28 | * A synthetic request used for clearing the cache.
29 | */
30 | public class ClearCacheRequest extends Request