├── CodeFramework ├── .gitignore ├── libs │ ├── gson-2.2.4.jar │ ├── httpmime-4.0.1.jar │ ├── xUtils-2.4.7.jar │ ├── apache-mime4j-0.6.jar │ └── universal-image-loader-1.9.1.jar ├── src │ └── main │ │ ├── ic_launcher-web.png │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── layout │ │ │ └── activity_login.xml │ │ ├── java │ │ └── com │ │ │ └── ecloud │ │ │ └── collection │ │ │ └── clothes │ │ │ ├── utils │ │ │ ├── DialogHelper.java │ │ │ ├── StringHelper.java │ │ │ ├── ToastHelper.java │ │ │ ├── LogHelper.java │ │ │ ├── SharedPreferencesHelper.java │ │ │ └── FileHelper.java │ │ │ ├── app │ │ │ ├── AppSharedPreferencesConfig.java │ │ │ ├── AppUrlConfig.java │ │ │ ├── AppApplication.java │ │ │ └── AppServerConfig.java │ │ │ ├── entity │ │ │ ├── ErrorBaseBean.java │ │ │ └── BaseBean.java │ │ │ ├── parameter │ │ │ └── HttpParameterHelper.java │ │ │ ├── ui │ │ │ ├── BaseActivity.java │ │ │ ├── BaseFragmentActivity.java │ │ │ └── LoginActivity.java │ │ │ ├── gson │ │ │ ├── GsonBaseParse.java │ │ │ ├── GsonParse.java │ │ │ └── GsonErrorParse.java │ │ │ ├── intface │ │ │ └── XHttpRequestDefaultCallBack.java │ │ │ ├── fragment │ │ │ └── BaseFragment.java │ │ │ ├── encryption │ │ │ ├── Md5Encryption.java │ │ │ ├── AesEncryptionHelper.java │ │ │ ├── DesEncryptionHelper.java │ │ │ ├── AesEncryption.java │ │ │ └── Base64Encryption.java │ │ │ ├── thread │ │ │ └── BaseThread.java │ │ │ ├── download │ │ │ ├── DownloadService.java │ │ │ ├── DownloadInfo.java │ │ │ └── DownloadManager.java │ │ │ └── http │ │ │ ├── XHttpHelper.java │ │ │ └── HttpHelper.java │ │ └── AndroidManifest.xml ├── proguard-rules.txt └── build.gradle ├── CodeFrameworkDemo ├── CodeFramework │ ├── .gitignore │ ├── libs │ │ ├── gson-2.2.4.jar │ │ ├── xUtils-2.4.7.jar │ │ ├── httpmime-4.0.1.jar │ │ ├── apache-mime4j-0.6.jar │ │ └── universal-image-loader-1.9.1.jar │ ├── src │ │ └── main │ │ │ ├── ic_launcher-web.png │ │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_login.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── ecloud │ │ │ │ └── androidcodeframework │ │ │ │ └── codeframework │ │ │ │ ├── utils │ │ │ │ ├── DialogHelper.java │ │ │ │ ├── StringHelper.java │ │ │ │ ├── ToastHelper.java │ │ │ │ ├── LogHelper.java │ │ │ │ ├── SharedPreferencesHelper.java │ │ │ │ └── FileHelper.java │ │ │ │ ├── app │ │ │ │ ├── AppSharedPreferencesConfig.java │ │ │ │ ├── AppUrlConfig.java │ │ │ │ ├── AppApplication.java │ │ │ │ └── AppServerConfig.java │ │ │ │ ├── ui │ │ │ │ ├── LoginActivity.java │ │ │ │ ├── BaseActionBarActivity.java │ │ │ │ ├── BaseActivity.java │ │ │ │ └── BaseFragmentActivity.java │ │ │ │ ├── entity │ │ │ │ ├── ErrorBaseBean.java │ │ │ │ └── BaseBean.java │ │ │ │ ├── parameter │ │ │ │ └── HttpParameterHelper.java │ │ │ │ ├── intface │ │ │ │ └── XHttpRequestDefaultCallBack.java │ │ │ │ ├── gson │ │ │ │ ├── GsonBaseParse.java │ │ │ │ ├── GsonParse.java │ │ │ │ └── GsonErrorParse.java │ │ │ │ ├── fragment │ │ │ │ └── BaseFragment.java │ │ │ │ ├── encryption │ │ │ │ ├── Md5Encryption.java │ │ │ │ ├── AesEncryptionHelper.java │ │ │ │ ├── DesEncryptionHelper.java │ │ │ │ ├── AesEncryption.java │ │ │ │ └── Base64Encryption.java │ │ │ │ ├── thread │ │ │ │ ├── GetDataRequestThread.java │ │ │ │ └── BaseThread.java │ │ │ │ ├── download │ │ │ │ ├── DownloadService.java │ │ │ │ └── DownloadInfo.java │ │ │ │ └── http │ │ │ │ ├── XHttpHelper.java │ │ │ │ └── HttpHelper.java │ │ │ └── AndroidManifest.xml │ ├── proguard-rules.txt │ └── build.gradle ├── settings.gradle ├── .gitignore ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── README.md └── .gitignore /CodeFramework/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':CodeFramework' 2 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /CodeFramework/libs/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/libs/gson-2.2.4.jar -------------------------------------------------------------------------------- /CodeFramework/libs/httpmime-4.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/libs/httpmime-4.0.1.jar -------------------------------------------------------------------------------- /CodeFramework/libs/xUtils-2.4.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/libs/xUtils-2.4.7.jar -------------------------------------------------------------------------------- /CodeFramework/libs/apache-mime4j-0.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/libs/apache-mime4j-0.6.jar -------------------------------------------------------------------------------- /CodeFramework/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /CodeFramework/libs/universal-image-loader-1.9.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/libs/universal-image-loader-1.9.1.jar -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/libs/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/libs/gson-2.2.4.jar -------------------------------------------------------------------------------- /CodeFrameworkDemo/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/libs/xUtils-2.4.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/libs/xUtils-2.4.7.jar -------------------------------------------------------------------------------- /CodeFramework/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /CodeFramework/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /CodeFramework/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/libs/httpmime-4.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/libs/httpmime-4.0.1.jar -------------------------------------------------------------------------------- /CodeFramework/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFramework/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/libs/apache-mime4j-0.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/libs/apache-mime4j-0.6.jar -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/libs/universal-image-loader-1.9.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/libs/universal-image-loader-1.9.1.jar -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frank-Zhu/AndroidAppCodeFramework/HEAD/CodeFrameworkDemo/CodeFramework/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CodeFramework/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 7 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 7 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Collection 5 | Hello world! 6 | Settings 7 | 8 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AndroidAppCodeFramework 2 | ======================= 3 | 4 | Android App 代码框架 5 | 6 | 7 | DEMO 8 | 9 | 本代码即是DEMO,您可以下载后选择您喜欢的IDE运行。SDK版本建议使用4.0以上 10 | 11 | Requirements 12 | 13 | 运行在 Android 2.2 + 14 | 15 | Installation 16 | 17 | 直接导入AppCodeFramework项目并作为项目框架 18 | 19 | About me 20 | 21 | E-Cloud Studio from china 22 | Email: zhuwenwu2008@gmail.com -------------------------------------------------------------------------------- /CodeFrameworkDemo/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | mavenCentral() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:0.8.+' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | mavenCentral() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CodeFramework/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # Eclipse project files 19 | .classpath 20 | .project 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Intellij project files 26 | *.iml 27 | *.ipr 28 | *.iws 29 | .idea/ 30 | -------------------------------------------------------------------------------- /CodeFramework/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/utils/DialogHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.utils; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-16 下午5:47 7 | * Description: Dialog 工具类 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-16 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class DialogHelper { 15 | } 16 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppSharedPreferencesConfig.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.app; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-16 下午5:38 7 | * Description: 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-16 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class AppSharedPreferencesConfig { 15 | } 16 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppUrlConfig.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.app; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-15 下午9:01 7 | * Description: 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-15 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class AppUrlConfig { 15 | public final static String HttpBaseUrl = ""; 16 | } 17 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/DialogHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.utils; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-16 下午5:47 7 | * Description: Dialog 工具类 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-16 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class DialogHelper { 15 | } 16 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppSharedPreferencesConfig.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.app; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-16 下午5:38 7 | * Description: 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-16 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class AppSharedPreferencesConfig { 15 | } 16 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/ui/LoginActivity.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.ui; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.ecloud.androidcodeframework.codeframework.R; 6 | import com.ecloud.androidcodeframework.codeframework.utils.LogHelper; 7 | 8 | public class LoginActivity extends BaseActivity { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_login); 13 | LogHelper.d(TAG,"--> onCreate"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppUrlConfig.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.app; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-15 下午9:01 7 | * Description: 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-15 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class AppUrlConfig { 15 | public final static String HttpBaseUrl = ""; 16 | } 17 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/res/layout/activity_login.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /CodeFramework/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:/Android/android-studio/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 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 | #} -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:/Android/android-studio/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 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 | #} -------------------------------------------------------------------------------- /CodeFramework/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "19.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 8 9 | targetSdkVersion 19 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | runProguard false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:support-v4:19.0.1' 23 | compile 'com.android.support:appcompat-v7:19.0.1' 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | compile files('libs/gson-2.2.4.jar') 26 | compile files('libs/universal-image-loader-1.9.1.jar') 27 | } 28 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/ui/BaseActionBarActivity.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.ui; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.ActionBar; 5 | import android.support.v7.app.ActionBarActivity; 6 | 7 | /** 8 | * Created by ZhuWenWu on 14-3-17. 9 | */ 10 | public class BaseActionBarActivity extends ActionBarActivity { 11 | private final String TAG = getClass().getSimpleName(); 12 | 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | super.onCreate(savedInstanceState); 16 | } 17 | 18 | protected void showUpActionBar(){ 19 | ActionBar actionBar = getSupportActionBar(); 20 | actionBar.setDisplayHomeAsUpEnabled(true); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/entity/ErrorBaseBean.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Author: ZhuWenWu 7 | * Version V1.0 8 | * Date: 14-3-15 下午9:57 9 | * Description: 10 | * Modification History: 11 | * Date Author Version Discription 12 | * ----------------------------------------------------------------------------------- 13 | * 14-3-15 ZhuWenWu 1.0 1.0 14 | * Why & What is modified: 15 | */ 16 | public class ErrorBaseBean extends BaseBean implements Serializable { 17 | protected Object data; 18 | 19 | public Object getData() { 20 | return data; 21 | } 22 | 23 | public void setData(Object data) { 24 | this.data = data; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "19.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 8 9 | targetSdkVersion 19 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | runProguard false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:appcompat-v7:+' 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile files('libs/gson-2.2.4.jar') 25 | compile files('libs/httpmime-4.0.1.jar') 26 | compile files('libs/universal-image-loader-1.9.1.jar') 27 | compile files('libs/xUtils-2.4.7.jar') 28 | } 29 | -------------------------------------------------------------------------------- /CodeFramework/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Collection 5 | Hello world! 6 | Settings 7 | 店铺选择 8 | 用户账号 9 | 请输入用户名 10 | 用户密码 11 | 请输入密码 12 | 登录 13 | BaseFragmentActivity 14 | BaseActivity 15 | 账号或密码不能为空 16 | Hello blank fragment 17 | 18 | 19 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/entity/ErrorBaseBean.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Author: ZhuWenWu 7 | * Version V1.0 8 | * Date: 14-3-15 下午9:57 9 | * Description: 10 | * Modification History: 11 | * Date Author Version Discription 12 | * ----------------------------------------------------------------------------------- 13 | * 14-3-15 ZhuWenWu 1.0 1.0 14 | * Why & What is modified: 15 | */ 16 | public class ErrorBaseBean extends BaseBean implements Serializable { 17 | protected Object data; 18 | 19 | public Object getData() { 20 | return data; 21 | } 22 | 23 | public void setData(Object data) { 24 | this.data = data; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Settings specified in this file will override any Gradle settings 5 | # configured through the IDE. 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 -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/parameter/HttpParameterHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.parameter; 2 | 3 | import org.apache.http.message.BasicNameValuePair; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * Author: ZhuWenWu 10 | * Version V1.0 11 | * Date: 14-3-15 下午10:31 12 | * Description: Http 参数生成工具类 13 | * Modification History: 14 | * Date Author Version Discription 15 | * ----------------------------------------------------------------------------------- 16 | * 14-3-15 ZhuWenWu 1.0 1.0 17 | * Why & What is modified: 18 | */ 19 | public class HttpParameterHelper { 20 | /** 21 | *生成Http请求基本参数 22 | * @return List 参数 23 | */ 24 | public static List makeBaseParam() { 25 | return new ArrayList(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/parameter/HttpParameterHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.parameter; 2 | 3 | import org.apache.http.message.BasicNameValuePair; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * Author: ZhuWenWu 10 | * Version V1.0 11 | * Date: 14-3-15 下午10:31 12 | * Description: Http 参数生成工具类 13 | * Modification History: 14 | * Date Author Version Discription 15 | * ----------------------------------------------------------------------------------- 16 | * 14-3-15 ZhuWenWu 1.0 1.0 17 | * Why & What is modified: 18 | */ 19 | public class HttpParameterHelper { 20 | /** 21 | *生成Http请求基本参数 22 | * @return List 参数 23 | */ 24 | public static List makeBaseParam() { 25 | return new ArrayList(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/ui/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.ui; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | import com.nostra13.universalimageloader.core.ImageLoader; 7 | 8 | /** 9 | * Author: ZhuWenWu 10 | * Version V1.0 11 | * Date: 14-3-16 下午2:03 12 | * Description: activity 基类 13 | * Modification History: 14 | * Date Author Version Discription 15 | * ----------------------------------------------------------------------------------- 16 | * 14-3-16 ZhuWenWu 1.0 1.0 17 | * Why & What is modified: 18 | */ 19 | public class BaseActivity extends Activity { 20 | protected String TAG = getClass().getSimpleName(); 21 | protected ImageLoader mImageLoader; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | mImageLoader = ImageLoader.getInstance(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/ui/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.ui; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | import com.nostra13.universalimageloader.core.ImageLoader; 7 | 8 | /** 9 | * Author: ZhuWenWu 10 | * Version V1.0 11 | * Date: 14-3-16 下午2:03 12 | * Description: activity 基类 13 | * Modification History: 14 | * Date Author Version Discription 15 | * ----------------------------------------------------------------------------------- 16 | * 14-3-16 ZhuWenWu 1.0 1.0 17 | * Why & What is modified: 18 | */ 19 | public class BaseActivity extends Activity { 20 | protected String TAG = getClass().getSimpleName(); 21 | protected ImageLoader mImageLoader; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | mImageLoader = ImageLoader.getInstance(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/ui/BaseFragmentActivity.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.ui; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.FragmentActivity; 5 | 6 | import com.nostra13.universalimageloader.core.ImageLoader; 7 | 8 | /** 9 | * Author: ZhuWenWu 10 | * Version V1.0 11 | * Date: 14-3-16 下午2:03 12 | * Description: FragmentActivity 基类 13 | * Modification History: 14 | * Date Author Version Discription 15 | * ----------------------------------------------------------------------------------- 16 | * 14-3-16 ZhuWenWu 1.0 1.0 17 | * Why & What is modified: 18 | */ 19 | public class BaseFragmentActivity extends FragmentActivity { 20 | protected String TAG = getClass().getSimpleName(); 21 | protected ImageLoader mImageLoader; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | mImageLoader = ImageLoader.getInstance(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/ui/BaseFragmentActivity.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.ui; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.FragmentActivity; 5 | 6 | import com.nostra13.universalimageloader.core.ImageLoader; 7 | 8 | /** 9 | * Author: ZhuWenWu 10 | * Version V1.0 11 | * Date: 14-3-16 下午2:03 12 | * Description: FragmentActivity 基类 13 | * Modification History: 14 | * Date Author Version Discription 15 | * ----------------------------------------------------------------------------------- 16 | * 14-3-16 ZhuWenWu 1.0 1.0 17 | * Why & What is modified: 18 | */ 19 | public class BaseFragmentActivity extends FragmentActivity { 20 | protected String TAG = getClass().getSimpleName(); 21 | protected ImageLoader mImageLoader; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | mImageLoader = ImageLoader.getInstance(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/entity/BaseBean.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Author: ZhuWenWu 7 | * Version V1.0 8 | * Date: 14-3-15 下午10:00 9 | * Description: 网络返回数据基类 10 | * Modification History: 11 | * Date Author Version Discription 12 | * ----------------------------------------------------------------------------------- 13 | * 14-3-15 ZhuWenWu 1.0 1.0 14 | * Why & What is modified: 15 | */ 16 | public class BaseBean implements Serializable{ 17 | protected int code; 18 | protected String msg; 19 | protected int total; 20 | 21 | public int getCode() { 22 | return code; 23 | } 24 | 25 | public void setCode(int code) { 26 | this.code = code; 27 | } 28 | 29 | public String getMsg() { 30 | return msg; 31 | } 32 | 33 | public void setMsg(String msg) { 34 | this.msg = msg; 35 | } 36 | 37 | public int getTotal() { 38 | return total; 39 | } 40 | 41 | public void setTotal(int total) { 42 | this.total = total; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/entity/BaseBean.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Author: ZhuWenWu 7 | * Version V1.0 8 | * Date: 14-3-15 下午10:00 9 | * Description: 网络返回数据基类 10 | * Modification History: 11 | * Date Author Version Discription 12 | * ----------------------------------------------------------------------------------- 13 | * 14-3-15 ZhuWenWu 1.0 1.0 14 | * Why & What is modified: 15 | */ 16 | public class BaseBean implements Serializable{ 17 | protected int code; 18 | protected String msg; 19 | protected int total; 20 | 21 | public int getCode() { 22 | return code; 23 | } 24 | 25 | public void setCode(int code) { 26 | this.code = code; 27 | } 28 | 29 | public String getMsg() { 30 | return msg; 31 | } 32 | 33 | public void setMsg(String msg) { 34 | this.msg = msg; 35 | } 36 | 37 | public int getTotal() { 38 | return total; 39 | } 40 | 41 | public void setTotal(int total) { 42 | this.total = total; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /CodeFramework/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonBaseParse.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.gson; 2 | 3 | import com.ecloud.collection.clothes.app.AppServerConfig; 4 | import com.ecloud.collection.clothes.utils.LogHelper; 5 | import com.ecloud.collection.clothes.utils.StringHelper; 6 | 7 | /** 8 | * Author: ZhuWenWu 9 | * Version V1.0 10 | * Date: 14-3-15 下午9:40 11 | * Description: 数据解析基类 12 | * Modification History: 13 | * Date Author Version Discription 14 | * ----------------------------------------------------------------------------------- 15 | * 14-3-15 ZhuWenWu 1.0 1.0 16 | * Why & What is modified: 17 | */ 18 | public abstract class GsonBaseParse { 19 | protected final String TAG = getClass().getSimpleName(); 20 | protected String content; 21 | 22 | public GsonBaseParse(String content){ 23 | this.content = content; 24 | LogHelper.i(TAG,"content--->" + content); 25 | if (StringHelper.isEmptyString(content)) { 26 | this.content = AppServerConfig.HTTP_ERROR_BASE_CONTENT; 27 | } 28 | } 29 | 30 | /** 31 | * 虚拟解析方法 32 | * @param className 返回数据结构类名 33 | * @throws Exception 异常信息 34 | */ 35 | protected abstract void parse(Class className) throws Exception; 36 | } 37 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/intface/XHttpRequestDefaultCallBack.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.intface; 2 | 3 | import com.lidroid.xutils.exception.HttpException; 4 | import com.lidroid.xutils.http.ResponseInfo; 5 | import com.lidroid.xutils.http.callback.RequestCallBack; 6 | 7 | /** 8 | * Author: ZhuWenWu 9 | * Version V1.0 10 | * Date: 14-3-16 下午2:31 11 | * Description: XHttp网络请求默认回调函数适配器 12 | * Modification History: 13 | * Date Author Version Discription 14 | * ----------------------------------------------------------------------------------- 15 | * 14-3-16 ZhuWenWu 1.0 1.0 16 | * Why & What is modified: 17 | */ 18 | public class XHttpRequestDefaultCallBack extends RequestCallBack { 19 | @Override 20 | public void onLoading(long total, long current, boolean isUploading) { 21 | super.onLoading(total, current, isUploading); 22 | } 23 | 24 | @Override 25 | public void onStart() { 26 | super.onStart(); 27 | } 28 | 29 | @Override 30 | public void onStopped() { 31 | super.onStopped(); 32 | } 33 | 34 | @Override 35 | public void onSuccess(ResponseInfo stringResponseInfo) { 36 | 37 | } 38 | 39 | @Override 40 | public void onFailure(HttpException e, String s) { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/intface/XHttpRequestDefaultCallBack.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.intface; 2 | 3 | import com.lidroid.xutils.exception.HttpException; 4 | import com.lidroid.xutils.http.ResponseInfo; 5 | import com.lidroid.xutils.http.callback.RequestCallBack; 6 | 7 | /** 8 | * Author: ZhuWenWu 9 | * Version V1.0 10 | * Date: 14-3-16 下午2:31 11 | * Description: XHttp网络请求默认回调函数适配器 12 | * Modification History: 13 | * Date Author Version Discription 14 | * ----------------------------------------------------------------------------------- 15 | * 14-3-16 ZhuWenWu 1.0 1.0 16 | * Why & What is modified: 17 | */ 18 | public class XHttpRequestDefaultCallBack extends RequestCallBack { 19 | @Override 20 | public void onLoading(long total, long current, boolean isUploading) { 21 | super.onLoading(total, current, isUploading); 22 | } 23 | 24 | @Override 25 | public void onStart() { 26 | super.onStart(); 27 | } 28 | 29 | @Override 30 | public void onStopped() { 31 | super.onStopped(); 32 | } 33 | 34 | @Override 35 | public void onSuccess(ResponseInfo stringResponseInfo) { 36 | 37 | } 38 | 39 | @Override 40 | public void onFailure(HttpException e, String s) { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonBaseParse.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.gson; 2 | 3 | import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; 4 | import com.ecloud.androidcodeframework.codeframework.utils.LogHelper; 5 | import com.ecloud.androidcodeframework.codeframework.utils.StringHelper; 6 | 7 | /** 8 | * Author: ZhuWenWu 9 | * Version V1.0 10 | * Date: 14-3-15 下午9:40 11 | * Description: 数据解析基类 12 | * Modification History: 13 | * Date Author Version Discription 14 | * ----------------------------------------------------------------------------------- 15 | * 14-3-15 ZhuWenWu 1.0 1.0 16 | * Why & What is modified: 17 | */ 18 | public abstract class GsonBaseParse { 19 | protected final String TAG = getClass().getSimpleName(); 20 | protected String content; 21 | 22 | public GsonBaseParse(String content){ 23 | this.content = content; 24 | LogHelper.i(TAG,"content--->" + content); 25 | if (StringHelper.isEmptyString(content)) { 26 | this.content = AppServerConfig.HTTP_ERROR_BASE_CONTENT; 27 | } 28 | } 29 | 30 | /** 31 | * 虚拟解析方法 32 | * @param className 返回数据结构类名 33 | * @throws Exception 异常信息 34 | */ 35 | protected abstract void parse(Class className) throws Exception; 36 | } 37 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/fragment/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | /** 10 | * Author: ZhuWenWu 11 | * Version V1.0 12 | * Date: 14-3-16 下午2:03 13 | * Description: fragment 基类 14 | * Modification History: 15 | * Date Author Version Discription 16 | * ----------------------------------------------------------------------------------- 17 | * 14-3-16 ZhuWenWu 1.0 1.0 18 | * Why & What is modified: 19 | */ 20 | public class BaseFragment extends Fragment { 21 | protected final String TAG = getClass().getSimpleName(); 22 | 23 | @Override 24 | public void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | } 27 | 28 | @Override 29 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 30 | return super.onCreateView(inflater, container, savedInstanceState); 31 | } 32 | 33 | @Override 34 | public void onViewCreated(View view, Bundle savedInstanceState) { 35 | super.onViewCreated(view, savedInstanceState); 36 | } 37 | 38 | @Override 39 | public void onActivityCreated(Bundle savedInstanceState) { 40 | super.onActivityCreated(savedInstanceState); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/encryption/Md5Encryption.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.encryption; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | /** 7 | * Author: ZhuWenWu 8 | * Version V1.0 9 | * Date: 14-3-16 下午4:36 10 | * Description: MD5加密工具类 11 | * Modification History: 12 | * Date Author Version Discription 13 | * ----------------------------------------------------------------------------------- 14 | * 14-3-16 ZhuWenWu 1.0 1.0 15 | * Why & What is modified: 16 | */ 17 | public class Md5Encryption { 18 | /** 19 | * 获取MD5字符串 20 | * @param content 需要转换的字符串 21 | * @return String 22 | */ 23 | public static String getMD5(String content) { 24 | try { 25 | MessageDigest digest = MessageDigest.getInstance("MD5"); 26 | digest.update(content.getBytes()); 27 | return getHashString(digest); 28 | 29 | } catch (NoSuchAlgorithmException e) { 30 | e.printStackTrace(); 31 | } 32 | return null; 33 | } 34 | 35 | private static String getHashString(MessageDigest digest) { 36 | StringBuilder builder = new StringBuilder(); 37 | for (byte b : digest.digest()) { 38 | builder.append(Integer.toHexString((b >> 4) & 0xf)); 39 | builder.append(Integer.toHexString(b & 0xf)); 40 | } 41 | return builder.toString(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/fragment/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | /** 10 | * Author: ZhuWenWu 11 | * Version V1.0 12 | * Date: 14-3-16 下午2:03 13 | * Description: fragment 基类 14 | * Modification History: 15 | * Date Author Version Discription 16 | * ----------------------------------------------------------------------------------- 17 | * 14-3-16 ZhuWenWu 1.0 1.0 18 | * Why & What is modified: 19 | */ 20 | public class BaseFragment extends Fragment { 21 | protected final String TAG = getClass().getSimpleName(); 22 | 23 | @Override 24 | public void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | } 27 | 28 | @Override 29 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 30 | return super.onCreateView(inflater, container, savedInstanceState); 31 | } 32 | 33 | @Override 34 | public void onViewCreated(View view, Bundle savedInstanceState) { 35 | super.onViewCreated(view, savedInstanceState); 36 | } 37 | 38 | @Override 39 | public void onActivityCreated(Bundle savedInstanceState) { 40 | super.onActivityCreated(savedInstanceState); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppApplication.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.app; 2 | 3 | import android.app.Application; 4 | import android.graphics.Bitmap; 5 | 6 | import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; 7 | import com.nostra13.universalimageloader.core.ImageLoader; 8 | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; 9 | import com.nostra13.universalimageloader.utils.StorageUtils; 10 | 11 | import java.io.File; 12 | 13 | /** 14 | * Author: ZhuWenWu 15 | * Version V1.0 16 | * Date: 14-3-16 下午5:39 17 | * Description: 18 | * Modification History: 19 | * Date Author Version Discription 20 | * ----------------------------------------------------------------------------------- 21 | * 14-3-16 ZhuWenWu 1.0 1.0 22 | * Why & What is modified: 23 | */ 24 | public class AppApplication extends Application{ 25 | 26 | @Override 27 | public void onCreate() { 28 | super.onCreate(); 29 | 30 | File cacheDir = StorageUtils.getCacheDirectory(this); 31 | ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) 32 | .discCacheExtraOptions(720, 1024, Bitmap.CompressFormat.PNG, 100, null) 33 | .discCache(new UnlimitedDiscCache(cacheDir)) 34 | .discCacheSize(50 * 1024 * 1024) 35 | .discCacheFileCount(100) 36 | .build(); 37 | ImageLoader.getInstance().init(config); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.app; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-15 下午10:53 7 | * Description: 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-15 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class AppServerConfig { 15 | public static final int CODE_SERVER_ERROR = -1;//服务器错误 16 | public static final int CODE_FAIL = 0;//验证失败 17 | public static final int CODE_SUCCESS = 1;//验证成功 18 | 19 | public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 20 | public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 21 | 22 | /***************网络错误字符串常量定义**********************/ 23 | public static final String NET_404_STR = "请求链接无效,404错误"; 24 | public static final String NET_500_STR = "服务器端程序出错,500错误"; 25 | public static final String NET_900_STR = "网络传输协议出错,900错误"; 26 | public static final String NET_901_STR = "连接超时,901错误"; 27 | public static final String NET_902_STR = "网络中断,902错误"; 28 | public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; 29 | public static final String NET_UNKNOWN_STR = "未知错误"; 30 | public static final String NET_ERROR_STR = "网络错误"; 31 | 32 | public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/encryption/Md5Encryption.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.encryption; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | /** 7 | * Author: ZhuWenWu 8 | * Version V1.0 9 | * Date: 14-3-16 下午4:36 10 | * Description: MD5加密工具类 11 | * Modification History: 12 | * Date Author Version Discription 13 | * ----------------------------------------------------------------------------------- 14 | * 14-3-16 ZhuWenWu 1.0 1.0 15 | * Why & What is modified: 16 | */ 17 | public class Md5Encryption { 18 | /** 19 | * 获取MD5字符串 20 | * @param content 需要转换的字符串 21 | * @return String 22 | */ 23 | public static String getMD5(String content) { 24 | try { 25 | MessageDigest digest = MessageDigest.getInstance("MD5"); 26 | digest.update(content.getBytes()); 27 | return getHashString(digest); 28 | 29 | } catch (NoSuchAlgorithmException e) { 30 | e.printStackTrace(); 31 | } 32 | return null; 33 | } 34 | 35 | private static String getHashString(MessageDigest digest) { 36 | StringBuilder builder = new StringBuilder(); 37 | for (byte b : digest.digest()) { 38 | builder.append(Integer.toHexString((b >> 4) & 0xf)); 39 | builder.append(Integer.toHexString(b & 0xf)); 40 | } 41 | return builder.toString(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/thread/GetDataRequestThread.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.thread; 2 | 3 | import android.os.Handler; 4 | 5 | import com.ecloud.androidcodeframework.codeframework.gson.GsonParse; 6 | 7 | import org.apache.http.message.BasicNameValuePair; 8 | import org.json.JSONException; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Author: ZhuWenWu 14 | * Version V1.0 15 | * Date: 14-3-16 下午7:42 16 | * Description: 17 | * Modification History: 18 | * Date Author Version Discription 19 | * ----------------------------------------------------------------------------------- 20 | * 14-3-16 ZhuWenWu 1.0 1.0 21 | * Why & What is modified: 22 | */ 23 | public class GetDataRequestThread extends BaseThread { 24 | 25 | private Class className; 26 | 27 | public GetDataRequestThread(Handler handler, int what, String url, List param, Class className,boolean isPost) { 28 | super(handler, what); 29 | this.className = className; 30 | setParams(url,param,isPost); 31 | } 32 | 33 | @Override 34 | public void run() { 35 | super.run(); 36 | try { 37 | Object bean = new GsonParse(result).getBean(className); 38 | sendMessageToHandler(bean); 39 | } catch (JSONException e) { 40 | e.printStackTrace(); 41 | } catch (Exception e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppApplication.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.app; 2 | 3 | import android.app.Application; 4 | import android.graphics.Bitmap; 5 | 6 | import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; 7 | import com.nostra13.universalimageloader.core.ImageLoader; 8 | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; 9 | import com.nostra13.universalimageloader.utils.StorageUtils; 10 | 11 | import java.io.File; 12 | 13 | /** 14 | * Author: ZhuWenWu 15 | * Version V1.0 16 | * Date: 14-3-16 下午5:39 17 | * Description: 18 | * Modification History: 19 | * Date Author Version Discription 20 | * ----------------------------------------------------------------------------------- 21 | * 14-3-16 ZhuWenWu 1.0 1.0 22 | * Why & What is modified: 23 | */ 24 | public class AppApplication extends Application{ 25 | 26 | @Override 27 | public void onCreate() { 28 | super.onCreate(); 29 | 30 | File cacheDir = StorageUtils.getCacheDirectory(this); 31 | ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) 32 | .discCacheExtraOptions(720, 1024, Bitmap.CompressFormat.PNG, 100, null) 33 | .discCache(new UnlimitedDiscCache(cacheDir)) 34 | .discCacheSize(50 * 1024 * 1024) 35 | .discCacheFileCount(100) 36 | .build(); 37 | ImageLoader.getInstance().init(config); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.app; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-15 下午10:53 7 | * Description: 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-15 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class AppServerConfig { 15 | public static final int CODE_SERVER_ERROR = -1;//服务器错误 16 | public static final int CODE_FAIL = 0;//验证失败 17 | public static final int CODE_SUCCESS = 1;//验证成功 18 | 19 | public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 20 | public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 21 | 22 | /***************网络错误字符串常量定义**********************/ 23 | public static final String NET_404_STR = "请求链接无效,404错误"; 24 | public static final String NET_500_STR = "服务器端程序出错,500错误"; 25 | public static final String NET_900_STR = "网络传输协议出错,900错误"; 26 | public static final String NET_901_STR = "连接超时,901错误"; 27 | public static final String NET_902_STR = "网络中断,902错误"; 28 | public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; 29 | public static final String NET_UNKNOWN_STR = "未知错误"; 30 | public static final String NET_ERROR_STR = "网络错误"; 31 | 32 | public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonParse.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.gson; 2 | 3 | import com.ecloud.collection.clothes.app.AppServerConfig; 4 | import com.ecloud.collection.clothes.entity.ErrorBaseBean; 5 | import com.google.gson.Gson; 6 | 7 | /** 8 | * Author: ZhuWenWu 9 | * Version V1.0 10 | * Date: 14-3-15 下午9:46 11 | * Description: 数据解析类 12 | * Modification History: 13 | * Date Author Version Discription 14 | * ----------------------------------------------------------------------------------- 15 | * 14-3-15 ZhuWenWu 1.0 1.0 16 | * Why & What is modified: 17 | */ 18 | public class GsonParse extends GsonBaseParse { 19 | 20 | private Object bean; 21 | 22 | public GsonParse(String content) throws Exception { 23 | super(content); 24 | } 25 | 26 | /** 27 | * 数据解析函数 28 | * @param className 返回数据结构类名 29 | * @throws Exception 30 | */ 31 | @Override 32 | protected void parse(Class className) throws Exception { 33 | ErrorBaseBean mErrorBaseBean; 34 | mErrorBaseBean = GsonErrorParse.parse(content); 35 | if(mErrorBaseBean.getCode() == AppServerConfig.CODE_SUCCESS){ 36 | Gson gson = new Gson(); 37 | bean = gson.fromJson(content, className); 38 | }else{ 39 | bean = mErrorBaseBean; 40 | } 41 | } 42 | 43 | /** 44 | * 获取HTTP返回数据结构 45 | * @param className 返回数据结构类名 46 | * @return Object 47 | * @throws Exception 48 | */ 49 | public Object getBean(Class className) throws Exception { 50 | parse(className); 51 | return bean; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/utils/StringHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.utils; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | /** 7 | * Author: ZhuWenWu 8 | * Version V1.0 9 | * Date: 14-3-15 下午7:53 10 | * Description: 字符串相关工具类 11 | * Modification History: 12 | * Date Author Version Discription 13 | * ----------------------------------------------------------------------------------- 14 | * 14-3-15 ZhuWenWu 1.0 1.0 15 | * Why & What is modified: 16 | */ 17 | public class StringHelper { 18 | /** 19 | * Description: 是否为空字符串 20 | * @param string 字符串 21 | * @return boolean 22 | */ 23 | public static boolean isEmptyString(String string){ 24 | return string == null || string.equals("") || string.toLowerCase().equals("null"); 25 | } 26 | 27 | /** 28 | * Description: 字符串不为空串 29 | * @param string 字符串 30 | * @return boolean 31 | */ 32 | public static boolean notEmptyString(String string){ 33 | return !isEmptyString(string); 34 | } 35 | 36 | /** 37 | * 判断字符串中是否有中文字符 38 | * @param str 需要判断的字符串 39 | * @return boolean 40 | */ 41 | public static boolean hasChinese(String str) { 42 | int count = 0; 43 | String regEx = "[\\u4e00-\\u9fa5]"; 44 | Pattern p = Pattern.compile(regEx); 45 | Matcher m = p.matcher(str); 46 | while (m.find()) { 47 | int size = m.groupCount(); 48 | for (int i = 0; i <= size; i++) { 49 | count = count + 1; 50 | } 51 | } 52 | return count > 0; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonErrorParse.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.gson; 2 | 3 | import com.ecloud.collection.clothes.app.AppServerConfig; 4 | import com.ecloud.collection.clothes.entity.ErrorBaseBean; 5 | 6 | import org.json.JSONException; 7 | import org.json.JSONObject; 8 | 9 | /** 10 | * Author: ZhuWenWu 11 | * Version V1.0 12 | * Date: 14-3-15 下午9:50 13 | * Description: 数据请求失败Or成功解析类 14 | * Modification History: 15 | * Date Author Version Discription 16 | * ----------------------------------------------------------------------------------- 17 | * 14-3-15 ZhuWenWu 1.0 1.0 18 | * Why & What is modified: 19 | */ 20 | public class GsonErrorParse { 21 | public static ErrorBaseBean mErrorBaseBean; 22 | 23 | /** 24 | * 解析HTTP返回数据是否成功 25 | * @param content 返回数据字符串 26 | * @return ErrorBaseBean 27 | */ 28 | public static ErrorBaseBean parse(String content){ 29 | mErrorBaseBean = new ErrorBaseBean(); 30 | JSONObject json; 31 | try { 32 | json = new JSONObject(content); 33 | if(json.has("code")){ 34 | mErrorBaseBean.setCode(json.getInt("status")); 35 | }else{ 36 | mErrorBaseBean.setCode(AppServerConfig.CODE_SERVER_ERROR); 37 | } 38 | if(json.has("msg")){ 39 | mErrorBaseBean.setMsg(json.getString("msg")); 40 | }else{ 41 | mErrorBaseBean.setMsg(AppServerConfig.NET_ERROR_STR); 42 | } 43 | } catch (JSONException e) { 44 | e.printStackTrace(); 45 | } 46 | return mErrorBaseBean; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/StringHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.utils; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | /** 7 | * Author: ZhuWenWu 8 | * Version V1.0 9 | * Date: 14-3-15 下午7:53 10 | * Description: 字符串相关工具类 11 | * Modification History: 12 | * Date Author Version Discription 13 | * ----------------------------------------------------------------------------------- 14 | * 14-3-15 ZhuWenWu 1.0 1.0 15 | * Why & What is modified: 16 | */ 17 | public class StringHelper { 18 | /** 19 | * Description: 是否为空字符串 20 | * @param string 字符串 21 | * @return boolean 22 | */ 23 | public static boolean isEmptyString(String string){ 24 | return string == null || string.equals("") || string.toLowerCase().equals("null"); 25 | } 26 | 27 | /** 28 | * Description: 字符串不为空串 29 | * @param string 字符串 30 | * @return boolean 31 | */ 32 | public static boolean notEmptyString(String string){ 33 | return !isEmptyString(string); 34 | } 35 | 36 | /** 37 | * 判断字符串中是否有中文字符 38 | * @param str 需要判断的字符串 39 | * @return boolean 40 | */ 41 | public static boolean hasChinese(String str) { 42 | int count = 0; 43 | String regEx = "[\\u4e00-\\u9fa5]"; 44 | Pattern p = Pattern.compile(regEx); 45 | Matcher m = p.matcher(str); 46 | while (m.find()) { 47 | int size = m.groupCount(); 48 | for (int i = 0; i <= size; i++) { 49 | count = count + 1; 50 | } 51 | } 52 | return count > 0; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonParse.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.gson; 2 | 3 | import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; 4 | import com.ecloud.androidcodeframework.codeframework.entity.ErrorBaseBean; 5 | import com.google.gson.Gson; 6 | 7 | /** 8 | * Author: ZhuWenWu 9 | * Version V1.0 10 | * Date: 14-3-15 下午9:46 11 | * Description: 数据解析类 12 | * Modification History: 13 | * Date Author Version Discription 14 | * ----------------------------------------------------------------------------------- 15 | * 14-3-15 ZhuWenWu 1.0 1.0 16 | * Why & What is modified: 17 | */ 18 | public class GsonParse extends GsonBaseParse { 19 | 20 | private Object bean; 21 | 22 | public GsonParse(String content) throws Exception { 23 | super(content); 24 | } 25 | 26 | /** 27 | * 数据解析函数 28 | * @param className 返回数据结构类名 29 | * @throws Exception 30 | */ 31 | @Override 32 | protected void parse(Class className) throws Exception { 33 | ErrorBaseBean mErrorBaseBean; 34 | mErrorBaseBean = GsonErrorParse.parse(content); 35 | if(mErrorBaseBean.getCode() == AppServerConfig.CODE_SUCCESS){ 36 | Gson gson = new Gson(); 37 | bean = gson.fromJson(content, className); 38 | }else{ 39 | bean = mErrorBaseBean; 40 | } 41 | } 42 | 43 | /** 44 | * 获取HTTP返回数据结构 45 | * @param className 返回数据结构类名 46 | * @return Object 47 | * @throws Exception 48 | */ 49 | public Object getBean(Class className) throws Exception { 50 | parse(className); 51 | return bean; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonErrorParse.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.gson; 2 | 3 | import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; 4 | import com.ecloud.androidcodeframework.codeframework.entity.ErrorBaseBean; 5 | 6 | import org.json.JSONException; 7 | import org.json.JSONObject; 8 | 9 | /** 10 | * Author: ZhuWenWu 11 | * Version V1.0 12 | * Date: 14-3-15 下午9:50 13 | * Description: 数据请求失败Or成功解析类 14 | * Modification History: 15 | * Date Author Version Discription 16 | * ----------------------------------------------------------------------------------- 17 | * 14-3-15 ZhuWenWu 1.0 1.0 18 | * Why & What is modified: 19 | */ 20 | public class GsonErrorParse { 21 | public static ErrorBaseBean mErrorBaseBean; 22 | 23 | /** 24 | * 解析HTTP返回数据是否成功 25 | * @param content 返回数据字符串 26 | * @return ErrorBaseBean 27 | */ 28 | public static ErrorBaseBean parse(String content){ 29 | mErrorBaseBean = new ErrorBaseBean(); 30 | JSONObject json; 31 | try { 32 | json = new JSONObject(content); 33 | if(json.has("code")){ 34 | mErrorBaseBean.setCode(json.getInt("status")); 35 | }else{ 36 | mErrorBaseBean.setCode(AppServerConfig.CODE_SERVER_ERROR); 37 | } 38 | if(json.has("msg")){ 39 | mErrorBaseBean.setMsg(json.getString("msg")); 40 | }else{ 41 | mErrorBaseBean.setMsg(AppServerConfig.NET_ERROR_STR); 42 | } 43 | } catch (JSONException e) { 44 | e.printStackTrace(); 45 | } 46 | return mErrorBaseBean; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/ui/LoginActivity.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.ui; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.widget.Button; 6 | import android.widget.EditText; 7 | import android.widget.Spinner; 8 | 9 | import com.ecloud.collection.clothes.R; 10 | import com.ecloud.collection.clothes.utils.LogHelper; 11 | import com.ecloud.collection.clothes.utils.StringHelper; 12 | import com.ecloud.collection.clothes.utils.ToastHelper; 13 | 14 | public class LoginActivity extends BaseActivity { 15 | 16 | private EditText mLoginAccountEdit; 17 | private EditText mLoginPasswordEdit; 18 | private Button mLoginButton; 19 | private Spinner mStoreSpinner; 20 | private String mLoginAccountStr; 21 | private String mLoginPasswordStr; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_login); 27 | LogHelper.d(TAG,"--> onCreate"); 28 | setUpViewComponent(); 29 | } 30 | 31 | private void setUpViewComponent() { 32 | mLoginAccountEdit = (EditText)findViewById(R.id.et_account); 33 | mLoginPasswordEdit = (EditText)findViewById(R.id.et_password); 34 | mLoginButton = (Button)findViewById(R.id.btn_login); 35 | mStoreSpinner = (Spinner)findViewById(R.id.sp_store_choose); 36 | setUpButtonListener(); 37 | } 38 | 39 | private void setUpButtonListener() { 40 | mLoginButton.setOnClickListener(new View.OnClickListener() { 41 | @Override 42 | public void onClick(View view) { 43 | mLoginAccountStr = mLoginAccountEdit.getText().toString().trim(); 44 | mLoginPasswordStr = mLoginPasswordEdit.getText().toString().trim(); 45 | if(StringHelper.notEmptyString(mLoginAccountStr) 46 | && StringHelper.notEmptyString(mLoginPasswordStr)){ 47 | onLoginAccount(); 48 | }else{ 49 | ToastHelper.showShortToast(getApplicationContext(),R.string.account_password_empty); 50 | } 51 | } 52 | }); 53 | } 54 | 55 | private void onLoginAccount() { 56 | LogHelper.d(TAG, "--> onLoginAccount"); 57 | LogHelper.d(TAG,"mLoginAccountStr = " + mLoginAccountStr); 58 | LogHelper.d(TAG,"mLoginPasswordStr = " + mLoginPasswordStr); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/utils/ToastHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.utils; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | /** 7 | * Author: ZhuWenWu 8 | * Version V1.0 9 | * Date: 14-3-15 下午8:03 10 | * Description: 弹出信息工具类 11 | * 12 | * Modification History: 13 | * Date Author Version Discription 14 | * ----------------------------------------------------------------------------------- 15 | * 14-3-15 ZhuWenWu 1.0 1.0 16 | * Why & What is modified: 17 | */ 18 | public class ToastHelper { 19 | 20 | /** 21 | * Description: 显示短时间Toast信息 22 | * @param context 上下文 23 | * @param msg 显示的消息内容 24 | */ 25 | public static void showShortToast(Context context,String msg){ 26 | showToast(context,msg,true); 27 | } 28 | 29 | /** 30 | * Description: 显示短时间Toast信息 31 | * @param context 上下文 32 | * @param resId 显示的消息资源ID 33 | */ 34 | public static void showShortToast(Context context,int resId){ 35 | showToast(context,resId,true); 36 | } 37 | 38 | /** 39 | * Description: 显示长时间Toast信息 40 | * @param context 上下文 41 | * @param msg 显示的消息内容 42 | */ 43 | public static void showLongToast(Context context,String msg){ 44 | showToast(context,msg,false); 45 | } 46 | 47 | /** 48 | * Description: 显示长时间Toast信息 49 | * @param context 上下文 50 | * @param resId 显示的消息资源ID 51 | */ 52 | public static void showLongToast(Context context,int resId){ 53 | showToast(context,resId,false); 54 | } 55 | 56 | /** 57 | * Description: 显示Toast信息 58 | * @param context 上下文 59 | * @param msg 显示的消息内容 60 | * @param isShort 是否短时间 61 | */ 62 | public static void showToast(Context context, String msg, boolean isShort){ 63 | if(isShort){ 64 | Toast.makeText(context,msg,Toast.LENGTH_SHORT).show(); 65 | }else{ 66 | Toast.makeText(context,msg,Toast.LENGTH_LONG).show(); 67 | } 68 | } 69 | 70 | /** 71 | * Description: 显示Toast信息 72 | * @param context 上下文 73 | * @param resId 显示的消息资源ID 74 | * @param isShort 是否短时间 75 | */ 76 | public static void showToast(Context context, int resId, boolean isShort){ 77 | if(isShort){ 78 | Toast.makeText(context,resId,Toast.LENGTH_SHORT).show(); 79 | }else{ 80 | Toast.makeText(context,resId,Toast.LENGTH_LONG).show(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/ToastHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.utils; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | /** 7 | * Author: ZhuWenWu 8 | * Version V1.0 9 | * Date: 14-3-15 下午8:03 10 | * Description: 弹出信息工具类 11 | * 12 | * Modification History: 13 | * Date Author Version Discription 14 | * ----------------------------------------------------------------------------------- 15 | * 14-3-15 ZhuWenWu 1.0 1.0 16 | * Why & What is modified: 17 | */ 18 | public class ToastHelper { 19 | 20 | /** 21 | * Description: 显示短时间Toast信息 22 | * @param context 上下文 23 | * @param msg 显示的消息内容 24 | */ 25 | public static void showShortToast(Context context,String msg){ 26 | showToast(context,msg,true); 27 | } 28 | 29 | /** 30 | * Description: 显示短时间Toast信息 31 | * @param context 上下文 32 | * @param resId 显示的消息资源ID 33 | */ 34 | public static void showShortToast(Context context,int resId){ 35 | showToast(context,resId,true); 36 | } 37 | 38 | /** 39 | * Description: 显示长时间Toast信息 40 | * @param context 上下文 41 | * @param msg 显示的消息内容 42 | */ 43 | public static void showLongToast(Context context,String msg){ 44 | showToast(context,msg,false); 45 | } 46 | 47 | /** 48 | * Description: 显示长时间Toast信息 49 | * @param context 上下文 50 | * @param resId 显示的消息资源ID 51 | */ 52 | public static void showLongToast(Context context,int resId){ 53 | showToast(context,resId,false); 54 | } 55 | 56 | /** 57 | * Description: 显示Toast信息 58 | * @param context 上下文 59 | * @param msg 显示的消息内容 60 | * @param isShort 是否短时间 61 | */ 62 | public static void showToast(Context context, String msg, boolean isShort){ 63 | if(isShort){ 64 | Toast.makeText(context,msg,Toast.LENGTH_SHORT).show(); 65 | }else{ 66 | Toast.makeText(context,msg,Toast.LENGTH_LONG).show(); 67 | } 68 | } 69 | 70 | /** 71 | * Description: 显示Toast信息 72 | * @param context 上下文 73 | * @param resId 显示的消息资源ID 74 | * @param isShort 是否短时间 75 | */ 76 | public static void showToast(Context context, int resId, boolean isShort){ 77 | if(isShort){ 78 | Toast.makeText(context,resId,Toast.LENGTH_SHORT).show(); 79 | }else{ 80 | Toast.makeText(context,resId,Toast.LENGTH_LONG).show(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/encryption/AesEncryptionHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.encryption; 2 | 3 | import com.ecloud.collection.clothes.utils.LogHelper; 4 | 5 | /** 6 | * Author: ZhuWenWu 7 | * Version V1.0 8 | * Date: 14-3-16 下午4:52 9 | * Description: AES加解密工具类 10 | * Modification History: 11 | * Date Author Version Discription 12 | * ----------------------------------------------------------------------------------- 13 | * 14-3-16 ZhuWenWu 1.0 1.0 14 | * Why & What is modified: 15 | */ 16 | public class AesEncryptionHelper { 17 | private final static String TAG = "DesUntils"; 18 | private final static String masterPassword = "abcd";//密钥 19 | private final static byte[] masterPasswordByte = {'a','b','c','d'};//密钥 20 | 21 | /** 22 | * 解密字符串 23 | * @param msg 需要解密的字符串 24 | * @return String 解密之后的字符串 25 | */ 26 | public static String AesDecryption(String msg) { 27 | LogHelper.d(TAG, "msg = " + msg); 28 | String decryptionMsg = ""; 29 | try { 30 | decryptionMsg = AesEncryption.decrypt(masterPassword, msg); 31 | } catch (Exception e) { 32 | e.printStackTrace(); 33 | } 34 | LogHelper.d(TAG, "decryptionMsg = " + decryptionMsg); 35 | return decryptionMsg; 36 | } 37 | 38 | /** 39 | * 解密数据流 40 | * @param buf 需要解密的数据流 41 | * @return byte[] 42 | */ 43 | public static byte[] AesDecryption(byte[] buf) { 44 | try { 45 | return AesEncryption.decryptByte(masterPasswordByte, buf); 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | return null; 50 | } 51 | 52 | /** 53 | * 加密字符串 54 | * @param msg 需要加密的字符串 55 | * @return String 加密之后的字符串 56 | */ 57 | public static String AesEncryption(String msg) { 58 | LogHelper.d(TAG, "msg = " + msg); 59 | String encryptionMsg = ""; 60 | try { 61 | encryptionMsg = AesEncryption.encrypt(masterPassword, msg); 62 | } catch (Exception e) { 63 | e.printStackTrace(); 64 | } 65 | LogHelper.d(TAG, "encryptionMsg = " + encryptionMsg); 66 | return encryptionMsg; 67 | } 68 | 69 | /** 70 | * 加密数据流 71 | * @param buf 需要加密的流 72 | * @return byte[] 加密之后的流 73 | */ 74 | public static byte[] AesEncryption(byte[] buf) { 75 | try { 76 | return AesEncryption.encryptByte(masterPasswordByte, buf); 77 | } catch (Exception e) { 78 | e.printStackTrace(); 79 | } 80 | return null; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/encryption/AesEncryptionHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.encryption; 2 | 3 | import com.ecloud.androidcodeframework.codeframework.utils.LogHelper; 4 | 5 | /** 6 | * Author: ZhuWenWu 7 | * Version V1.0 8 | * Date: 14-3-16 下午4:52 9 | * Description: AES加解密工具类 10 | * Modification History: 11 | * Date Author Version Discription 12 | * ----------------------------------------------------------------------------------- 13 | * 14-3-16 ZhuWenWu 1.0 1.0 14 | * Why & What is modified: 15 | */ 16 | public class AesEncryptionHelper { 17 | private final static String TAG = "DesUntils"; 18 | private final static String masterPassword = "abcd";//密钥 19 | private final static byte[] masterPasswordByte = {'a','b','c','d'};//密钥 20 | 21 | /** 22 | * 解密字符串 23 | * @param msg 需要解密的字符串 24 | * @return String 解密之后的字符串 25 | */ 26 | public static String AesDecryption(String msg) { 27 | LogHelper.d(TAG, "msg = " + msg); 28 | String decryptionMsg = ""; 29 | try { 30 | decryptionMsg = AesEncryption.decrypt(masterPassword, msg); 31 | } catch (Exception e) { 32 | e.printStackTrace(); 33 | } 34 | LogHelper.d(TAG, "decryptionMsg = " + decryptionMsg); 35 | return decryptionMsg; 36 | } 37 | 38 | /** 39 | * 解密数据流 40 | * @param buf 需要解密的数据流 41 | * @return byte[] 42 | */ 43 | public static byte[] AesDecryption(byte[] buf) { 44 | try { 45 | return AesEncryption.decryptByte(masterPasswordByte, buf); 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | return null; 50 | } 51 | 52 | /** 53 | * 加密字符串 54 | * @param msg 需要加密的字符串 55 | * @return String 加密之后的字符串 56 | */ 57 | public static String AesEncryption(String msg) { 58 | LogHelper.d(TAG, "msg = " + msg); 59 | String encryptionMsg = ""; 60 | try { 61 | encryptionMsg = AesEncryption.encrypt(masterPassword, msg); 62 | } catch (Exception e) { 63 | e.printStackTrace(); 64 | } 65 | LogHelper.d(TAG, "encryptionMsg = " + encryptionMsg); 66 | return encryptionMsg; 67 | } 68 | 69 | /** 70 | * 加密数据流 71 | * @param buf 需要加密的流 72 | * @return byte[] 加密之后的流 73 | */ 74 | public static byte[] AesEncryption(byte[] buf) { 75 | try { 76 | return AesEncryption.encryptByte(masterPasswordByte, buf); 77 | } catch (Exception e) { 78 | e.printStackTrace(); 79 | } 80 | return null; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/thread/BaseThread.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.thread; 2 | 3 | import android.os.Handler; 4 | import android.os.Message; 5 | 6 | import com.ecloud.collection.clothes.http.HttpHelper; 7 | import com.ecloud.collection.clothes.utils.LogHelper; 8 | 9 | import org.apache.http.entity.mime.MultipartEntity; 10 | import org.apache.http.message.BasicNameValuePair; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Author: ZhuWenWu 16 | * Version V1.0 17 | * Date: 14-3-15 下午11:26 18 | * Description: HTTP请求线程基类 19 | * Modification History: 20 | * Date Author Version Discription 21 | * ----------------------------------------------------------------------------------- 22 | * 14-3-15 ZhuWenWu 1.0 1.0 23 | * Why & What is modified: 24 | */ 25 | public class BaseThread extends Thread { 26 | protected final String TAG = getClass().getSimpleName(); 27 | protected Handler handler; 28 | protected Message msg = new Message(); 29 | protected int what; 30 | 31 | protected String result = null; 32 | 33 | private String url; 34 | private List params; 35 | private MultipartEntity mpEntity; 36 | 37 | private boolean isPost; 38 | private boolean isUploadFile; 39 | 40 | public BaseThread(Handler handler, int what) { 41 | this.handler = handler; 42 | this.what = what; 43 | } 44 | 45 | /** 46 | * 设置HTTP请求参数 47 | * @param url url地址 48 | * @param mpEntity 文件参数 49 | */ 50 | public void setParams(String url, MultipartEntity mpEntity) { 51 | this.url = url; 52 | this.isUploadFile = true; 53 | this.mpEntity = mpEntity; 54 | start(); 55 | } 56 | 57 | /** 58 | * 设置HTTP请求参数 59 | * @param url url地址 60 | * @param params 上传参数 61 | * @param isPost 是否Post请求 62 | */ 63 | public void setParams(String url, List params, boolean isPost) { 64 | this.url = url; 65 | this.params = params; 66 | this.isPost = isPost; 67 | start(); 68 | } 69 | 70 | @Override 71 | public void run() { 72 | super.run(); 73 | try { 74 | LogHelper.d(TAG,"isUploadFile = " + isUploadFile); 75 | LogHelper.d(TAG,"isPost = " + isPost); 76 | if(isUploadFile){ 77 | result = HttpHelper.onHttpPostFile(url,mpEntity); 78 | }else if(isPost){ 79 | result = HttpHelper.onHttpPost(url,params); 80 | }else{ 81 | result = HttpHelper.onHttpGet(url, params); 82 | } 83 | } catch (Exception e) { 84 | e.printStackTrace(); 85 | } 86 | } 87 | 88 | /** 89 | * 返回数据给handler 90 | * @param obj 返回数据结构 91 | */ 92 | public void sendMessageToHandler(Object obj){ 93 | msg.what = what; 94 | msg.obj = obj; 95 | handler.sendMessage(msg); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/thread/BaseThread.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.thread; 2 | 3 | import android.os.Handler; 4 | import android.os.Message; 5 | 6 | import com.ecloud.androidcodeframework.codeframework.http.HttpHelper; 7 | import com.ecloud.androidcodeframework.codeframework.utils.LogHelper; 8 | 9 | import org.apache.http.entity.mime.MultipartEntity; 10 | import org.apache.http.message.BasicNameValuePair; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Author: ZhuWenWu 16 | * Version V1.0 17 | * Date: 14-3-15 下午11:26 18 | * Description: HTTP请求线程基类 19 | * Modification History: 20 | * Date Author Version Discription 21 | * ----------------------------------------------------------------------------------- 22 | * 14-3-15 ZhuWenWu 1.0 1.0 23 | * Why & What is modified: 24 | */ 25 | public class BaseThread extends Thread { 26 | protected final String TAG = getClass().getSimpleName(); 27 | protected Handler handler; 28 | protected Message msg = new Message(); 29 | protected int what; 30 | 31 | protected String result = null; 32 | 33 | private String url; 34 | private List params; 35 | private MultipartEntity mpEntity; 36 | 37 | private boolean isPost; 38 | private boolean isUploadFile; 39 | 40 | public BaseThread(Handler handler, int what) { 41 | this.handler = handler; 42 | this.what = what; 43 | } 44 | 45 | /** 46 | * 设置HTTP请求参数 47 | * @param url url地址 48 | * @param mpEntity 文件参数 49 | */ 50 | public void setParams(String url, MultipartEntity mpEntity) { 51 | this.url = url; 52 | this.isUploadFile = true; 53 | this.mpEntity = mpEntity; 54 | start(); 55 | } 56 | 57 | /** 58 | * 设置HTTP请求参数 59 | * @param url url地址 60 | * @param params 上传参数 61 | * @param isPost 是否Post请求 62 | */ 63 | public void setParams(String url, List params, boolean isPost) { 64 | this.url = url; 65 | this.params = params; 66 | this.isPost = isPost; 67 | start(); 68 | } 69 | 70 | @Override 71 | public void run() { 72 | super.run(); 73 | try { 74 | LogHelper.d(TAG,"isUploadFile = " + isUploadFile); 75 | LogHelper.d(TAG,"isPost = " + isPost); 76 | if(isUploadFile){ 77 | result = HttpHelper.onHttpPostFile(url,mpEntity); 78 | }else if(isPost){ 79 | result = HttpHelper.onHttpPost(url,params); 80 | }else{ 81 | result = HttpHelper.onHttpGet(url, params); 82 | } 83 | } catch (Exception e) { 84 | e.printStackTrace(); 85 | } 86 | } 87 | 88 | /** 89 | * 返回数据给handler 90 | * @param obj 返回数据结构 91 | */ 92 | public void sendMessageToHandler(Object obj){ 93 | msg.what = what; 94 | msg.obj = obj; 95 | handler.sendMessage(msg); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/download/DownloadService.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.download; 2 | 3 | import android.app.ActivityManager; 4 | import android.app.Service; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.os.IBinder; 8 | 9 | import com.lidroid.xutils.exception.DbException; 10 | import com.lidroid.xutils.util.LogUtils; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Author: ZhuWenWu 16 | * Version V1.0 17 | * Date: 14-3-16 下午3:11 18 | * Description: 19 | * Modification History: 20 | * Date Author Version Discription 21 | * ----------------------------------------------------------------------------------- 22 | * 14-3-16 ZhuWenWu 1.0 1.0 23 | * Why & What is modified: 24 | */ 25 | public class DownloadService extends Service { 26 | private static DownloadManager DOWNLOAD_MANAGER; 27 | 28 | public static DownloadManager getDownloadManager(Context appContext) { 29 | if (!DownloadService.isServiceRunning(appContext)) { 30 | Intent downloadSvr = new Intent("download.service.action"); 31 | appContext.startService(downloadSvr); 32 | } 33 | if (DownloadService.DOWNLOAD_MANAGER == null) { 34 | DownloadService.DOWNLOAD_MANAGER = new DownloadManager(appContext); 35 | } 36 | return DOWNLOAD_MANAGER; 37 | } 38 | 39 | public DownloadService() { 40 | super(); 41 | } 42 | 43 | @Override 44 | public IBinder onBind(Intent intent) { 45 | return null; 46 | } 47 | 48 | @Override 49 | public void onCreate() { 50 | super.onCreate(); 51 | } 52 | 53 | @Override 54 | public void onStart(Intent intent, int startId) { 55 | super.onStart(intent, startId); 56 | } 57 | 58 | @Override 59 | public void onDestroy() { 60 | if (DOWNLOAD_MANAGER != null) { 61 | try { 62 | DOWNLOAD_MANAGER.stopAllDownload(); 63 | DOWNLOAD_MANAGER.backupDownloadInfoList(); 64 | } catch (DbException e) { 65 | LogUtils.e(e.getMessage(), e); 66 | } 67 | } 68 | super.onDestroy(); 69 | } 70 | 71 | public static boolean isServiceRunning(Context context) { 72 | boolean isRunning = false; 73 | 74 | ActivityManager activityManager = 75 | (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); 76 | List serviceList 77 | = activityManager.getRunningServices(Integer.MAX_VALUE); 78 | 79 | if (serviceList == null || serviceList.size() == 0) { 80 | return false; 81 | } 82 | 83 | int size = serviceList.size(); 84 | for (int i = 0; i < size; i++) { 85 | if (serviceList.get(i).service.getClassName().equals(DownloadService.class.getName())) { 86 | isRunning = true; 87 | break; 88 | } 89 | } 90 | return isRunning; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/download/DownloadService.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.download; 2 | 3 | import android.app.ActivityManager; 4 | import android.app.Service; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.os.IBinder; 8 | 9 | import com.lidroid.xutils.exception.DbException; 10 | import com.lidroid.xutils.util.LogUtils; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Author: ZhuWenWu 16 | * Version V1.0 17 | * Date: 14-3-16 下午3:11 18 | * Description: 19 | * Modification History: 20 | * Date Author Version Discription 21 | * ----------------------------------------------------------------------------------- 22 | * 14-3-16 ZhuWenWu 1.0 1.0 23 | * Why & What is modified: 24 | */ 25 | public class DownloadService extends Service { 26 | private static DownloadManager DOWNLOAD_MANAGER; 27 | 28 | public static DownloadManager getDownloadManager(Context appContext) { 29 | if (!DownloadService.isServiceRunning(appContext)) { 30 | Intent downloadSvr = new Intent("download.service.action"); 31 | appContext.startService(downloadSvr); 32 | } 33 | if (DownloadService.DOWNLOAD_MANAGER == null) { 34 | DownloadService.DOWNLOAD_MANAGER = new DownloadManager(appContext); 35 | } 36 | return DOWNLOAD_MANAGER; 37 | } 38 | 39 | public DownloadService() { 40 | super(); 41 | } 42 | 43 | @Override 44 | public IBinder onBind(Intent intent) { 45 | return null; 46 | } 47 | 48 | @Override 49 | public void onCreate() { 50 | super.onCreate(); 51 | } 52 | 53 | @Override 54 | public void onStart(Intent intent, int startId) { 55 | super.onStart(intent, startId); 56 | } 57 | 58 | @Override 59 | public void onDestroy() { 60 | if (DOWNLOAD_MANAGER != null) { 61 | try { 62 | DOWNLOAD_MANAGER.stopAllDownload(); 63 | DOWNLOAD_MANAGER.backupDownloadInfoList(); 64 | } catch (DbException e) { 65 | LogUtils.e(e.getMessage(), e); 66 | } 67 | } 68 | super.onDestroy(); 69 | } 70 | 71 | public static boolean isServiceRunning(Context context) { 72 | boolean isRunning = false; 73 | 74 | ActivityManager activityManager = 75 | (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); 76 | List serviceList 77 | = activityManager.getRunningServices(Integer.MAX_VALUE); 78 | 79 | if (serviceList == null || serviceList.size() == 0) { 80 | return false; 81 | } 82 | 83 | int size = serviceList.size(); 84 | for (int i = 0; i < size; i++) { 85 | if (serviceList.get(i).service.getClassName().equals(DownloadService.class.getName())) { 86 | isRunning = true; 87 | break; 88 | } 89 | } 90 | return isRunning; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /CodeFramework/src/main/java/com/ecloud/collection/clothes/utils/LogHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.collection.clothes.utils; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-15 下午8:54 7 | * Description: 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-15 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class LogHelper { 15 | private static final boolean DEBUG_V = true; 16 | private static final boolean DEBUG_D = true; 17 | private static final boolean DEBUG_I = true; 18 | private static final boolean DEBUG_W = true; 19 | private static final boolean DEBUG_E = true; 20 | 21 | public static void v(String tag, String msg) { 22 | if(DEBUG_V) { 23 | android.util.Log.v(tag, msg); 24 | } 25 | } 26 | 27 | public static void v(String tag, String msg, boolean isFeatureDebug) { 28 | if(DEBUG_V && isFeatureDebug) { 29 | android.util.Log.v(tag, msg); 30 | } 31 | } 32 | 33 | public static void v(String tag, String msg, Throwable tr) { 34 | if(DEBUG_V) { 35 | android.util.Log.v(tag, msg, tr); 36 | } 37 | } 38 | 39 | public static void d(String tag, String msg) { 40 | if(DEBUG_D) { 41 | android.util.Log.d(tag, msg); 42 | } 43 | } 44 | 45 | public static void d(String tag, String msg, boolean isFeatureDebug) { 46 | if(DEBUG_D && isFeatureDebug) { 47 | android.util.Log.d(tag, msg); 48 | } 49 | } 50 | 51 | public static void d(String tag, String msg, Throwable tr) { 52 | if(DEBUG_D) { 53 | android.util.Log.d(tag, msg, tr); 54 | } 55 | } 56 | 57 | public static void i(String tag, String msg) { 58 | if(DEBUG_I) { 59 | android.util.Log.i(tag, msg); 60 | } 61 | } 62 | 63 | public static void i(String tag, String msg, boolean isFeatureDebug) { 64 | if(DEBUG_I && isFeatureDebug) { 65 | android.util.Log.i(tag, msg); 66 | } 67 | } 68 | 69 | public static void i(String tag, String msg, Throwable tr) { 70 | if(DEBUG_I) { 71 | android.util.Log.i(tag, msg, tr); 72 | } 73 | } 74 | 75 | public static void w(String tag, String msg, boolean isFeatureDebug) { 76 | if(DEBUG_W && isFeatureDebug) { 77 | android.util.Log.w(tag, msg); 78 | } 79 | } 80 | 81 | public static void w(String tag, String msg, Throwable tr) { 82 | if(DEBUG_W) { 83 | android.util.Log.w(tag, msg, tr); 84 | } 85 | } 86 | 87 | public static void w(String tag, Throwable tr) { 88 | if(DEBUG_W) { 89 | android.util.Log.w(tag, tr); 90 | } 91 | } 92 | 93 | public static void e(String tag, String msg) { 94 | if(DEBUG_E) { 95 | android.util.Log.e(tag, msg); 96 | } 97 | } 98 | 99 | public static void e(String tag, String msg, boolean isFeatureDebug) { 100 | if(DEBUG_E && isFeatureDebug) { 101 | android.util.Log.e(tag, msg); 102 | } 103 | } 104 | 105 | public static void e(String tag, String msg, Throwable tr) { 106 | if(DEBUG_E) { 107 | android.util.Log.e(tag, msg, tr); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/LogHelper.java: -------------------------------------------------------------------------------- 1 | package com.ecloud.androidcodeframework.codeframework.utils; 2 | 3 | /** 4 | * Author: ZhuWenWu 5 | * Version V1.0 6 | * Date: 14-3-15 下午8:54 7 | * Description: 8 | * Modification History: 9 | * Date Author Version Discription 10 | * ----------------------------------------------------------------------------------- 11 | * 14-3-15 ZhuWenWu 1.0 1.0 12 | * Why & What is modified: 13 | */ 14 | public class LogHelper { 15 | private static final boolean DEBUG_V = true; 16 | private static final boolean DEBUG_D = true; 17 | private static final boolean DEBUG_I = true; 18 | private static final boolean DEBUG_W = true; 19 | private static final boolean DEBUG_E = true; 20 | 21 | public static void v(String tag, String msg) { 22 | if(DEBUG_V) { 23 | android.util.Log.v(tag, msg); 24 | } 25 | } 26 | 27 | public static void v(String tag, String msg, boolean isFeatureDebug) { 28 | if(DEBUG_V && isFeatureDebug) { 29 | android.util.Log.v(tag, msg); 30 | } 31 | } 32 | 33 | public static void v(String tag, String msg, Throwable tr) { 34 | if(DEBUG_V) { 35 | android.util.Log.v(tag, msg, tr); 36 | } 37 | } 38 | 39 | public static void d(String tag, String msg) { 40 | if(DEBUG_D) { 41 | android.util.Log.d(tag, msg); 42 | } 43 | } 44 | 45 | public static void d(String tag, String msg, boolean isFeatureDebug) { 46 | if(DEBUG_D && isFeatureDebug) { 47 | android.util.Log.d(tag, msg); 48 | } 49 | } 50 | 51 | public static void d(String tag, String msg, Throwable tr) { 52 | if(DEBUG_D) { 53 | android.util.Log.d(tag, msg, tr); 54 | } 55 | } 56 | 57 | public static void i(String tag, String msg) { 58 | if(DEBUG_I) { 59 | android.util.Log.i(tag, msg); 60 | } 61 | } 62 | 63 | public static void i(String tag, String msg, boolean isFeatureDebug) { 64 | if(DEBUG_I && isFeatureDebug) { 65 | android.util.Log.i(tag, msg); 66 | } 67 | } 68 | 69 | public static void i(String tag, String msg, Throwable tr) { 70 | if(DEBUG_I) { 71 | android.util.Log.i(tag, msg, tr); 72 | } 73 | } 74 | 75 | public static void w(String tag, String msg, boolean isFeatureDebug) { 76 | if(DEBUG_W && isFeatureDebug) { 77 | android.util.Log.w(tag, msg); 78 | } 79 | } 80 | 81 | public static void w(String tag, String msg, Throwable tr) { 82 | if(DEBUG_W) { 83 | android.util.Log.w(tag, msg, tr); 84 | } 85 | } 86 | 87 | public static void w(String tag, Throwable tr) { 88 | if(DEBUG_W) { 89 | android.util.Log.w(tag, tr); 90 | } 91 | } 92 | 93 | public static void e(String tag, String msg) { 94 | if(DEBUG_E) { 95 | android.util.Log.e(tag, msg); 96 | } 97 | } 98 | 99 | public static void e(String tag, String msg, boolean isFeatureDebug) { 100 | if(DEBUG_E && isFeatureDebug) { 101 | android.util.Log.e(tag, msg); 102 | } 103 | } 104 | 105 | public static void e(String tag, String msg, Throwable tr) { 106 | if(DEBUG_E) { 107 | android.util.Log.e(tag, msg, tr); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /CodeFramework/src/main/res/layout/activity_login.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 23 | 24 | 30 | 31 | 32 | 37 | 38 | 46 | 47 | 56 | 57 | 58 | 63 | 64 | 72 | 73 | 82 | 83 | 84 |