Showing preview only (1,149K chars total). Download the full file or copy to clipboard to get everything.
Repository: zhaozepeng/Android_framework
Branch: master
Commit: 216cd58506ae
Files: 178
Total size: 1.0 MB
Directory structure:
gitextract_h9zek9ps/
├── .gitignore
├── .idea/
│ ├── compiler.xml
│ ├── copyright/
│ │ └── profiles_settings.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── LICENSE
├── README.md
├── README.md~
├── build.gradle
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── libcore/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── android/
│ │ └── libcore/
│ │ ├── Toast/
│ │ │ └── T.java
│ │ ├── activity/
│ │ │ ├── ActivityManager.java
│ │ │ ├── RootActivity.java
│ │ │ └── RootFragment.java
│ │ ├── application/
│ │ │ └── RootApplication.java
│ │ ├── cachemanager/
│ │ │ └── CacheManager.java
│ │ ├── database/
│ │ │ ├── BaseDB.java
│ │ │ ├── BaseDBHelper.java
│ │ │ └── IBaseDBTable.java
│ │ ├── dialog/
│ │ │ └── BaseDialog.java
│ │ ├── download/
│ │ │ ├── DownloadDB.java
│ │ │ ├── DownloadDBHelper.java
│ │ │ └── FileDownloadManager.java
│ │ ├── guide/
│ │ │ └── GuideManager.java
│ │ ├── log/
│ │ │ └── L.java
│ │ ├── net/
│ │ │ ├── NetError.java
│ │ │ ├── imageloader/
│ │ │ │ ├── ImageLoader.java
│ │ │ │ └── VolleyLruCache.java
│ │ │ └── netapi/
│ │ │ └── BaseNetApi.java
│ │ ├── utils/
│ │ │ ├── CommonUtils.java
│ │ │ ├── FileUtils.java
│ │ │ └── ImageUtils.java
│ │ └── volley/
│ │ ├── BaseVolleyApi.java
│ │ └── VolleyLruCache.java
│ └── res/
│ └── values/
│ └── strings.xml
├── libcore-ui/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── android/
│ │ └── libcore_ui/
│ │ ├── activity/
│ │ │ ├── BaseActivity.java
│ │ │ ├── BaseActivityWithPopWindow.java
│ │ │ ├── BaseFragment.java
│ │ │ └── widget/
│ │ │ └── BottomBarGroupLinearLayout.java
│ │ ├── application/
│ │ │ └── BaseApplication.java
│ │ ├── dialog/
│ │ │ ├── AppDialog.java
│ │ │ ├── DialogCreator.java
│ │ │ └── LoadingDialog.java
│ │ ├── net/
│ │ │ ├── NetApi.java
│ │ │ └── request/
│ │ │ └── XMLRequest.java
│ │ ├── permanentdbcache/
│ │ │ ├── PermanentCacheDB.java
│ │ │ └── PermanentCacheDBHelper.java
│ │ ├── volley/
│ │ │ ├── VolleyApi.java
│ │ │ └── request/
│ │ │ └── XMLRequest.java
│ │ ├── web/
│ │ │ ├── WebFragment.java
│ │ │ └── webactivity/
│ │ │ ├── WebActivity.java
│ │ │ └── WebActivityFragment.java
│ │ └── widget/
│ │ ├── FlowLayout.java
│ │ └── SimpleGridLayout.java
│ └── res/
│ ├── drawable/
│ │ ├── base_dialog_shape.xml
│ │ ├── bg_edittext.xml
│ │ ├── bg_edittext_focus.xml
│ │ ├── bg_edittext_not_focus.xml
│ │ ├── bg_loading_dialog.xml
│ │ ├── bg_progress_bar.xml
│ │ ├── bottom_button_all_selector.xml
│ │ ├── bottom_button_bottom_selector.xml
│ │ ├── bottom_button_middle_selector.xml
│ │ ├── bottom_button_shape.xml
│ │ ├── bottom_button_top_selector.xml
│ │ ├── dialog_button_bottom_selector.xml
│ │ ├── dialog_button_bottomleft_selector.xml
│ │ ├── dialog_button_bottomright_selector.xml
│ │ └── dialog_button_middle_selector.xml
│ ├── layout/
│ │ ├── activity_base_layout.xml
│ │ ├── activity_base_layout_with_popwindow.xml
│ │ ├── activity_top_bar_layout.xml
│ │ ├── activity_top_toolbar_layout.xml
│ │ ├── activity_web_layout.xml
│ │ ├── bottom_group_layout.xml
│ │ ├── bottom_item_layout.xml
│ │ ├── bottom_popwindow_layout.xml
│ │ ├── dialog_base_layout.xml
│ │ ├── dialog_item_button_layout.xml
│ │ ├── dialog_js_prompt_message_layout.xml
│ │ ├── loading_dialog_layout.xml
│ │ └── menu_refresh_layout.xml
│ ├── menu/
│ │ └── menu_webactivity_refresh.xml
│ ├── values/
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-v19/
│ │ └── styles.xml
│ ├── values-v21/
│ │ └── styles.xml
│ └── values-v23/
│ └── styles.xml
├── settings.gradle
└── testsample/
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src/
└── main/
├── AndroidManifest.xml
├── assets/
│ ├── 1.html
│ ├── baidu.html
│ └── baidu_files/
│ ├── activity_start_52498d2c.js
│ ├── all_async_search_57459356.js
│ ├── jquery-1.10.2_d88366fd.js
│ ├── min_nav_9dda26ef.js
│ ├── min_super_6a1867d5.js
│ ├── min_tips_27647c7d.js
│ ├── nav_min_22274039.css
│ ├── sbase_6ae84319.js
│ ├── super_min_de974358.css
│ └── xmancard_c006cb6f.js
├── java/
│ └── com/
│ └── android/
│ └── sample/
│ ├── HomeTestActivity.java
│ ├── test_activity/
│ │ ├── ActivityA.java
│ │ ├── ActivityB.java
│ │ └── ActivityTestHomePage.java
│ ├── test_cache/
│ │ └── CacheActivity.java
│ ├── test_db/
│ │ ├── DBActivity.java
│ │ └── db/
│ │ ├── StudentDB.java
│ │ └── StudentHelper.java
│ ├── test_dialog/
│ │ └── DialogActivity.java
│ ├── test_download/
│ │ └── DownloadActivity.java
│ ├── test_guide/
│ │ └── GuideActivity.java
│ ├── test_imageloader/
│ │ ├── ImageActivity.java
│ │ └── PicUrl.java
│ ├── test_netapi/
│ │ └── NetActivity.java
│ ├── test_utils/
│ │ ├── CommonActivity.java
│ │ ├── FileActivity.java
│ │ ├── ImageActivity.java
│ │ └── UtilsActivity.java
│ ├── test_volley/
│ │ └── VolleyActivity.java
│ ├── test_webview/
│ │ ├── TestWebFragment.java
│ │ └── WebViewActivity.java
│ └── test_widget/
│ ├── FlowLayoutActivity.java
│ ├── GridLayoutActivity.java
│ └── WidgetActivity.java
└── res/
├── drawable/
│ ├── button_forthpage_selector.xml
│ ├── button_homepage_selector.xml
│ ├── button_secondpage_selector.xml
│ └── button_thirdpage_selector.xml
├── layout/
│ ├── activity_home_test.xml
│ ├── activity_test_activity_a.xml
│ ├── activity_test_activity_b.xml
│ ├── activity_test_activity_homepage.xml
│ ├── activity_test_cache.xml
│ ├── activity_test_common.xml
│ ├── activity_test_db.xml
│ ├── activity_test_dialog.xml
│ ├── activity_test_download.xml
│ ├── activity_test_file.xml
│ ├── activity_test_flow.xml
│ ├── activity_test_grid.xml
│ ├── activity_test_guide.xml
│ ├── activity_test_image.xml
│ ├── activity_test_imageloader.xml
│ ├── activity_test_net.xml
│ ├── activity_test_utils.xml
│ ├── activity_test_webview.xml
│ ├── activity_test_widget.xml
│ ├── guide_test_1.xml
│ ├── guide_test_2.xml
│ ├── guide_test_3.xml
│ └── menu_activity_home_test_search.xml
├── menu/
│ └── menu_activity_home_test.xml
└── values/
├── colors.xml
├── strings.xml
├── strings_activity.xml
└── styles.xml
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/libraries
# Keystore files
*.jks
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
================================================
FILE: .idea/compiler.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
================================================
FILE: .idea/copyright/profiles_settings.xml
================================================
<component name="CopyrightManager">
<settings default="" />
</component>
================================================
FILE: .idea/gradle.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.14.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/libcore" />
<option value="$PROJECT_DIR$/libcore-ui" />
<option value="$PROJECT_DIR$/testsample" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
================================================
FILE: .idea/misc.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
================================================
FILE: .idea/modules.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Android_framework.iml" filepath="$PROJECT_DIR$/Android_framework.iml" />
<module fileurl="file://$PROJECT_DIR$/libcore/libcore.iml" filepath="$PROJECT_DIR$/libcore/libcore.iml" />
<module fileurl="file://$PROJECT_DIR$/libcore-ui/libcore-ui.iml" filepath="$PROJECT_DIR$/libcore-ui/libcore-ui.iml" />
<module fileurl="file://$PROJECT_DIR$/testsample/testsample.iml" filepath="$PROJECT_DIR$/testsample/testsample.iml" />
</modules>
</component>
</project>
================================================
FILE: .idea/runConfigurations.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
================================================
FILE: .idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
================================================
FILE: LICENSE
================================================
Copyright (c) 2015, zhao_zepeng
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: README.md
================================================
# android_framework #
<em>an android framework in order for rapid development</em>
##1.开发环境##
环境为*android studio* + *jdk1.7*<br/>
<br/>
##2.框架结构##
该框架分为三个部分:<br/>
<strong> libcore </strong>层<br/>
<strong> libcore-ui </strong>层<br/>
<strong> testsample </strong>层<br/>
第三层为测试代码,重点在第一和第二层...<br/>
##3.框架详细概述##
###第一层libcore###
该层为基础核心代码层,该层的代码特点是封装了应用所应该使用的基础功能,好处是封装的功能仅仅提供简单的接口,使得应用只需要更改libcore的封装实现,而不用修改底层的代码,从而轻松实现功能的变更,功能列表如下所示
<ol>
<li>Application封装,使用了weakRefrence指向当前Activity的context,方便使用,还增加了应用crash,应用关闭等处理</li>
<li>最基础的Activity和Fragment类,配合Application类和ActivityManager类进行Activity的集中管理</li>
<li>ActivityManager类,使用栈来管理所有的activity</li>
<li>BaseNetApi类,实现了网络请求,网络访问的底层使用的是volley框架。现在提供两种方案:第一种就是可更换的网络框架,为了可更换,就要对volley进行大程度的封装,所有子module不可直接使用volley相关类,以后网络框架更改,只需要修改这几个相关类即可,由于volley功能的复杂性,只能封装最基本的网络访问功能,tag和cache等功能由于不通用性,暂时不封装;</li>
<li>BaseVolleyApi类,第二种就是纯粹的volley框架,不会更换网络访问框架,只需对其进行最基本的封装,所有功能类都可在子module中使用,所以会增大项目对volley框架的耦合性</li>
<li>ImageLoader类,用来进行图片的加载,封装的是volley的imageloader功能,支持lrucache和sd卡二级存储功能</li>
<li>log类,用来打印log,打印的日志信息非常完整</li>
<li>Toast类,该类用来弹出toast,支持弹出toast的位置</li>
<li>GuideManager类,用来显示指引蒙版,支持全屏展示和只在内容区域展示</li>
<li>BaseDialog类,定义了一个应用dialog所应该具备的基础行为</li>
<li>数据库相关类,将数据库类进行了非常便捷的封装,创建数据库应该继承自BaseDB类,为了该数据库的访问应该再创建一个helper类继承自BaseDBHelper,封装该数据库的所有操作,另外还需要对表名和列名进行了枚举的封装,这样使用该数据库直接使用该枚举类获取表名和表的相关列名。对数据库的版本升级也做了相应快捷的处理</li>
<li>CacheManager类,这个类使用SharedPreference来存储基本对象,有临时和永久两种,临时存储将会在每次应用退出之后自动清空,永久存储则永久存储</li>
<li>FileDownloadManager类,用来下载相关文件,为多线程断点续传式下载,支持开始,停止和删除操作</li>
<li>Utils类:
<ul>
<li>CommonUtils,用来集中管理一些杂项函数,比如dp2px等</li>
<li>FileUtils,用来管理文件的相关操作</li>
<li>ImageUtils,用来处理图片的相关操作</li>
</ul>
</li>
</ol>
###第二层libcore-ui层###
该层为基础核心扩展层,扩展libcore的层的代码,并且定义应用的基本样式,够统一样式,方便管理
<ol>
<li>扩展实现的Activity和Fragment类,BaseActivity类中定义了整个应用的基本简单样式(现在提供两种样式,顶部透明样式和底部透明样式),顶部bar的样式(顶部bar有自定义bar和系统控件toolbar)等,BaseActivityWithPopWindow类继承BaseActivity类,实现了底部的弹出框;Fragment类定义了fragment和activity之间的通信方式和topbar的交互,</li>
<li>NetApi类,NetApi继承自BaseNetApi类,在原来的基础上扩展相关的功能,支持自定义继承自volley request的请求,额外的处理就只是在NetApi类中添加相应的函数</li>
<li>VolleyApi类,用来对BaseVolleyApi类进行功能扩展</li>
<li>PermanentCacheDB类,用来存储一些和应用生命周期相关的变量,写入数据库,永久保存</li>
<li>WebFragment类,该fragment用来显示网页,可以单独作为一个fragment嵌入一个页面的任何地方</li>
<li>WebActivity类,该activity用来展示网页,传入url即可显示网页,有进度条和刷新操作</li>
<li>AppDialog类,该类继承自父类BaseDialog类,定义了基本的样式,实现了基础的行为</li>
<li>DialogCreator类,该类用来生成基本样式的dialog</li>
<li>LoadingDialog类,用来定义一个应用最基本的加载框</li>
<li>基本实用的控件:
<ul>
<li>SimpleGridLayout类,自定义网格布局,自动换行,自定义attr</li>
<li>FlowLayout类,自定义流式布局,支持方向选择,自动换行,自定义attr</li>
</ul>
</li>
</ol>
###第三层应用层###
该层为模拟应用层,用来测试下层的代码。一个应用在使用了libcore层和libcore-ui层之后,可能还需要在封装一层或几层module,但是保证最基础的两层是应用所通用的module即可
================================================
FILE: README.md~
================================================
# android_framework #
<em>an android framework in order for rapid development</em>
##1.开发环境##
环境为*android studio* + *jdk1.7*<br/>
<br/>
##2.框架结构##
该框架分为三个部分:<br/>
<strong> libcore </strong>层<br/>
<strong> libcore-ui </strong>层<br/>
<strong> testsample </strong>层<br/>
第三层为测试代码,重点在第一和第二层...<br/>
##3.框架详细概述##
###第一层libcore###
该层为基础核心代码层,该层的代码特点是封装了应用所应该使用的基础功能,好处是封装的功能仅仅提供简单的接口,使得应用只需要更改libcore的封装实现,而不用修改底层的代码,从而轻松实现功能的变更,功能列表如下所示
<ol>
<li>Application封装,使用了weakRefrence指向当前Activity的context,方便使用,还增加了应用crash,应用关闭等处理</li>
<li>最基础的Activity和Fragment类,配合Application类和ActivityManager类进行Activity的集中管理</li>
<li>ActivityManager类,使用栈来管理所有的activity</li>
<li>BaseNetApi类,实现了网络请求,网络访问的底层使用的是volley框架。现在提供两种方案:第一种就是可更换的网络框架,为了可更换,就要对volley进行大程度的封装,所有子module不可直接使用volley相关类,以后网络框架更改,只需要修改这几个相关类即可,由于volley功能的复杂性,只能封装最基本的网络访问功能,tag和cache等功能由于不通用性,暂时不封装;</li>
<li>BaseVolleyApi类,第二种就是纯粹的volley框架,不会更换网络访问框架,只需对其进行最基本的封装,所有功能类都可在子module中使用,所以会增大项目对volley框架的耦合性</li>
<li>ImageLoader类,用来进行图片的加载,封装的是volley的imageloader功能,支持lrucache和sd卡二级存储功能</li>
<li>log类,用来打印log,打印的日志信息非常完整</li>
<li>Toast类,该类用来弹出toast,支持弹出toast的位置</li>
<li>GuideManager类,用来显示指引蒙版,支持全屏展示和只在内容区域展示</li>
<li>BaseDialog类,定义了一个应用dialog所应该具备的基础行为</li>
<li>数据库相关类,将数据库类进行了非常便捷的封装,创建数据库应该继承自BaseDB类,为了该数据库的访问应该再创建一个helper类继承自BaseDBHelper,封装该数据库的所有操作,另外还需要对表名和列名进行了枚举的封装,这样使用该数据库直接使用该枚举类获取表名和表的相关列名。对数据库的版本升级也做了相应快捷的处理</li>
<li>CacheManager类,这个类使用SharedPreference来存储基本对象,有临时和永久两种,临时存储将会在每次应用退出之后自动清空,永久存储则永久存储</li>
<li>FileDownloadManager类,用来下载相关文件,为多线程断点续传式下载,支持开始,停止和删除操作</li>
<li>Utils类:
<ul>
<li>CommonUtils,用来集中管理一些杂项函数,比如dp2px等</li>
<li>FileUtils,用来管理文件的相关操作</li>
<li>ImageUtils,用来处理图片的相关操作</li>
</ul>
</li>
</ol>
###第二层libcore-ui层###
该层为基础核心扩展层,扩展libcore的层的代码,并且定义应用的基本样式,够统一样式,方便管理
<ol>
<li>扩展实现的Activity和Fragment类,BaseActivity类中定义了整个应用的基本简单样式(现在提供两种样式,顶部透明样式和底部透明样式),顶部bar的样式(顶部bar有自定义bar和系统控件toolbar)等,BaseActivityWithPopWindow类继承BaseActivity类,实现了底部的弹出框;Fragment类定义了fragment和activity之间的通信方式和topbar的交互,</li>
<li>NetApi类,NetApi继承自BaseNetApi类,在原来的基础上扩展相关的功能,支持自定义继承自volley request的请求,额外的处理就只是在NetApi类中添加相应的函数</li>
<li>VolleyApi类,用来对BaseVolleyApi类进行功能扩展</li>
<li>PermanentCacheDB类,用来存储一些和应用生命周期相关的变量,写入数据库,永久保存</li>
<li>WebFragment类,该fragment用来显示网页,可以单独作为一个fragment嵌入一个页面的任何地方</li>
<li>WebActivity类,该activity用来展示网页,传入url即可显示网页,有进度条和刷新操作</li>
<li>AppDialog类,该类继承自父类BaseDialog类,定义了基本的样式,实现了基础的行为</li>
<li>DialogCreator类,该类用来生成基本样式的dialog</li>
<li>LoadingDialog类,用来定义一个应用最基本的加载框</li>
<li>基本实用的控件:
<ul>
<li>AutomaticNewlineLinearLayout类是自动换行的linearLayout,自定义了attr</li>
</ul>
</li>
</ol>
###第三层应用层###
该层为模拟应用层,用来测试下层的代码。一个应用在使用了libcore层和libcore-ui层之后,可能还需要在封装一层或几层module,但是保证最基础的两层是应用所通用的module即可
================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Fri Mar 03 10:38:35 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
================================================
FILE: gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
================================================
FILE: gradlew
================================================
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: libcore/.gitignore
================================================
/build
================================================
FILE: libcore/build.gradle
================================================
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
================================================
FILE: libcore/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/zzp/adt-bundle-linux-x86_64-20140702/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: libcore/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.libcore">
</manifest>
================================================
FILE: libcore/src/main/java/com/android/libcore/Toast/T.java
================================================
package com.android.libcore.Toast;
import android.view.Gravity;
import android.view.View;
import android.widget.Toast;
import com.android.libcore.application.RootApplication;
/**
* Description: Toast类<br/>
* 如果需要设置gravity,请使用{@link #getInstance()}.{@link #setGravity(int)}方法进行设置<br/>
* 如果需要额外设置{@link #xOffset}或者{@link #yOffset}请调用对应{@link #setxOffset(int)}和
* {@link #setyOffset(int)}即可,用法和gravity一致
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-09
*/
public class T {
private volatile static T instance;
private int mGravity = -1;
private int xOffset = 0;
private int yOffset = 0;
private Toast mTemp;
public static T getInstance() {
if (instance == null){
synchronized (T.class){
if (instance == null){
instance = new T();
}
}
}
return instance;
}
private T(){
}
/**
* 设置该toast的显示位置,只对该toast有效
*/
public T setGravity(int mGravity) {
this.mGravity = mGravity;
return getInstance();
}
/**
* 请在{@link #setGravity(int)}调用之后调用,只对该toast有效
*/
public T setxOffset(int xOffset) {
this.xOffset = xOffset;
return getInstance();
}
/**
* 请在{@link #setGravity(int)}调用之后调用,只对该toast有效
*/
public T setyOffset(int yOffset) {
this.yOffset = yOffset;
return getInstance();
}
public void showShort(String message){
showShort(message, null);
}
/**
* 需要在toast中显示的v
*/
public void showShort(String message, View v){
//防止一堆toast的显示堆积
if (mTemp != null)
mTemp.cancel();
mTemp = Toast.makeText(RootApplication.getInstance(), message, Toast.LENGTH_SHORT);
if (mGravity != -1)
mTemp.setGravity(mGravity, xOffset, yOffset);
if (v != null){
mTemp.setView(v);
}
mTemp.show();
reset();
}
public void showLong(String message){
showLong(message, null);
}
/**
* 需要在toast中显示的v
*/
public void showLong(String message, View v){
//防止一堆toast的显示堆积
if (mTemp != null)
mTemp.cancel();
mTemp = Toast.makeText(RootApplication.getInstance(), message, Toast.LENGTH_LONG);
if (mGravity != -1)
mTemp.setGravity(mGravity, xOffset, yOffset);
if (v != null){
mTemp.setView(v);
}
mTemp.show();
reset();
}
private void reset(){
mGravity = -1;
xOffset = 0;
yOffset = 0;
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/activity/ActivityManager.java
================================================
package com.android.libcore.activity;
import android.app.Activity;
import android.content.Context;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import java.util.Iterator;
import java.util.Stack;
/**
* Description: 该类用栈来管理所有该应用的activity,进栈退栈等
* <ol>
* <li>{@linkplain #finishActivity()} 关闭栈中第一个activity</li>
* <li>{@linkplain #finishAllActivity(Class)} 关闭栈中所有该类名的activity</li>
* <li>{@linkplain #finishAfterActivity(Class)} 关闭栈中该类名的activity之上的activity</li>
* <li>{@linkplain #finishLastActivity(Class)} 关闭栈中第一个与该类名匹配的activity</li>
* <li>{@linkplain #finishAllActivityAndClose()} 关闭应用退出</li>
* </ol>
*
* <strong>注意所有的函数都要进行判空的操作,因为可能因为内存不足导致activity被回收而导致空指针的错误</strong>
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-07
*/
public final class ActivityManager {
private static volatile ActivityManager instance = null;
private Stack<Activity> mStack = null;
private ActivityManager(){
mStack = new Stack<>();
}
public static ActivityManager getInstance(){
if (instance == null){
synchronized (ActivityManager.class){
if (instance == null)
instance = new ActivityManager();
}
}
return instance;
}
/**
* 获取栈的信息
*/
public String getStackInfo() {
StringBuilder sb = new StringBuilder();
for (Activity temp : mStack){
if (temp != null)
sb.append(temp.toString()).append("\n");
}
return sb.toString();
}
/**
* 将activity加入到栈中
* @param activity 需要加入到栈中的activity
*/
public void addActivity(Activity activity){
mStack.push(activity);
}
/**
* 删除栈中activity
*/
public void removeActivity(Activity activity){
mStack.remove(activity);
}
/**
* @return 栈顶的activity
*/
public Activity getActivity(){
if (!mStack.isEmpty())
return mStack.peek();
L.i("Activity 栈为空!!!");
return null;
}
/**
* 关闭并删除掉最上面一个的activity
*/
public void finishActivity(){
if (!mStack.isEmpty()) {
Activity temp = mStack.pop();
if (temp != null)
temp.finish();
return;
}
L.e("Activity 栈为空!!!");
}
/***
* 关闭并删除指定 activity
*/
public void finishActivity(Activity activity){
if (mStack.isEmpty()) {
L.e("Activity 栈为空!!!");
return ;
}
try {
mStack.remove(activity);
}catch (Exception e){
L.e("删除错误", e, ActivityManager.class);
}finally {
if (activity != null)
activity.finish();
}
}
/**
* 删除并关闭栈中该class对应的所有的该activity
*/
public void finishAllActivity(Class<?> clazz){
Iterator<Activity> iterator = mStack.iterator();
while (iterator.hasNext()){
Activity activity = iterator.next();
if (activity!=null && activity.getClass().equals(clazz)) {
//注意应该通过iterator操作stack,要不然回报ConcurrentModificationException
iterator.remove();
activity.finish();
}
}
}
/**
* 删除并关闭栈中该class对应的第一个该activity,从栈顶开始
*/
public void finishLastActivity(Class<?> clazz){
Activity activity = null;
Iterator<Activity> iterator = mStack.iterator();
while (iterator.hasNext()){
Activity temp = iterator.next();
if (temp!=null && temp.getClass().equals(clazz))
activity = temp;
}
if (activity != null)
finishActivity(activity);
}
/**
* 删除栈上该activity之上的所有activity
*/
public void finishAfterActivity(Activity activity){
if (activity!=null && mStack.search(activity) == -1){
L.e("在栈中找不到该activity", ActivityManager.class);
return;
}
while (mStack.peek() != null){
Activity temp = mStack.pop();
if (temp!=null && temp.equals(activity)){
mStack.push(temp);
break;
}
if (temp!=null)
temp.finish();
}
}
/**
* 删除栈上该class之上的所有activity
*/
public void finishAfterActivity(Class<?> clazz){
boolean flag = true;
Activity activity = null;
Iterator<Activity> iterator = mStack.iterator();
while (iterator.hasNext()){
activity = iterator.next();
if (activity!=null && activity.getClass().equals(clazz)) {
flag = false;
break;
}
}
if (flag) {
L.e("在栈中找不到该class", ActivityManager.class);
return;
}
finishAfterActivity(activity);
}
/**
* 弹出关闭所有activity并关闭应用所有进程
*/
public void finishAllActivityAndClose(){
while (mStack.size() > 0){
Activity temp = mStack.pop();
if (temp != null)
temp.finish();
}
//调用finish()之后不会立马调用onDestroy()
RootApplication.checkApplicationDestroy();
try {
android.app.ActivityManager activityManager = (android.app.ActivityManager)
RootApplication.getInstance().getSystemService(Context.ACTIVITY_SERVICE);
activityManager.killBackgroundProcesses(RootApplication.getInstance().getPackageName());
}catch (SecurityException e){
L.e("请添加permission", e);
}
System.exit(0);
}
/**
* 弹出关闭所有activity并保留应用后台进程
*/
public void finishAllActivityWithoutClose(){
while (mStack.size() > 0){
Activity temp = mStack.pop();
if (temp != null)
temp.finish();
}
//调用finish()之后不会立马调用onDestroy()
RootApplication.checkApplicationDestroy();
System.exit(0);
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/activity/RootActivity.java
================================================
package com.android.libcore.activity;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import com.android.libcore.application.RootApplication;
/**
* Description: 所有基础{@linkplain Activity}的基类,所有的Activity应该
* 继承自该基类,以便进行context的管理、页面的管理等<br/>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-07
*/
public abstract class RootActivity extends AppCompatActivity{
/** 用来在页面之间进行广播的传递 */
private BroadcastReceiver mReceiver = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RootApplication.setInstanceRef(this);
ActivityManager.getInstance().addActivity(this);
}
@Override
protected void onResume() {
super.onResume();
//也要在onresume函数里面进行设置,保证弱引用一直引用当前的可见页面
RootApplication.setInstanceRef(this);
}
/**
* 用来在注册广播之后进行广播的接收处理
*/
protected void onReceive(Context context, Intent intent){}
/**
* 用来注册广播
* @param action 需要注册广播的action
*/
public void registerReceiver(String action){
if (mReceiver == null) {
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
RootActivity.this.onReceive(context, intent);
}
};
}
IntentFilter filter = new IntentFilter(action);
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
}
/**
* 发送应用内部广播
*/
protected final void sendLocalBroadcast(String action){
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(action));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mReceiver != null)
LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
ActivityManager.getInstance().removeActivity(this);
//每次在activity销毁的时候调用该函数来检测应用是否被销毁
RootApplication.checkApplicationDestroy();
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/activity/RootFragment.java
================================================
package com.android.libcore.activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View;
/**
* Description: 所有基础{@linkplain Fragment}的基类<br/>
* <a href=http://blog.csdn.net/u012403246/article/details/46371643>从今天开始抛弃Fragment吧</a><br/>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-08
*/
public abstract class RootFragment extends Fragment{
protected BroadcastReceiver mReceiver;
protected View mViewContainer;
private Boolean mIsNeedUnRegister = false;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
this.onReceive(context, intent);
}
};
}
protected void onReceive(Context context, Intent intent){}
protected void registerReceiver(String action){
IntentFilter filter = new IntentFilter(action);
getActivity().registerReceiver(mReceiver, filter);
mIsNeedUnRegister = true;
}
@Override
public void onDestroy() {
super.onDestroy();
if (mIsNeedUnRegister)
getActivity().unregisterReceiver(mReceiver);
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/application/RootApplication.java
================================================
package com.android.libcore.application;
import android.app.AlarmManager;
import android.app.Application;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import com.android.libcore.cachemanager.CacheManager;
import com.android.libcore.activity.ActivityManager;
import com.android.libcore.utils.FileUtils;
import java.lang.ref.WeakReference;
import java.util.HashMap;
/**
* Description: {@linkplain Application}基类,不要忘记在manifest文件中设置application的
* android:name,应用的application应该继承自该基类
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-07
*/
public class RootApplication extends Application{
/** 是否是调试模式,统一使用该全局的debug变量 */
public static final boolean DEBUG = true;
/** 用来保存当前该Application的context */
private static Context instance;
/** 用来保存最新打开页面的context */
private volatile static WeakReference<Context> instanceRef = null;
/** 用来存放一些在软件启动生命周期之内需要存放的变量和数据,但存放的数据量不宜过大,
* 如果需要存放过大的数据,请在使用完之后,立马清除,还有一点需要注意的是该maps可
* 能会因为应用在后台,手机内存不足而被回收,回收之后该maps会被清空!!*/
public static HashMap<String, Object> appMaps;
@Override
public void onCreate() {
super.onCreate();
instance = this;
appMaps = new HashMap<>();
//设置默认崩溃处理,如需使用,不注释即可
// Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler());
}
/**
* 该函数用来返回一个context,一般情况下为当前activity的context,如果为空,
* 就会调用{@linkplain ActivityManager#getActivity()}方法去获取栈顶context,
* 但是如果activity没有调用 {@link #setInstanceRef(Context)}方法去设置context,
* 就会使用整个Application的context,相当于{@link #getApplicationContext()},
* 不推荐使用该方法,特别是耗时任务,因为会导致页面销毁时,任务无法回收,导致内存泄露和
* 其他异常
*
* @return context上下文,如果返回Null检测manifest文件是否设置了application的name
*/
public static Context getInstance(){
if (instanceRef == null || instanceRef.get() == null){
synchronized (RootApplication.class) {
if (instanceRef == null || instanceRef.get() == null) {
Context context = ActivityManager.getInstance().getActivity();
if (context != null)
instanceRef = new WeakReference<>(context);
else {
instanceRef = new WeakReference<>(instance);
}
}
}
}
return instanceRef.get();
}
/**
* 将{@link #instanceRef}设置为最新页面的context
* @param context 最新页面的context
*/
public static void setInstanceRef(Context context){
instanceRef = new WeakReference<>(context);
}
/**
* 检测应用是否退出,并且在应用退出的时候做相关的处理
*/
public static void checkApplicationDestroy(){
//应用被关闭,删除需要删除的相关目录和文件
if (ActivityManager.getInstance().getActivity() == null){
CacheManager.removeTemporary();
FileUtils.clearExternalStorageTemp();
}
}
/**
* 处理崩溃异常,并且在崩溃异常之后重启<br/>
* <strong>Android对待所有传递给Context.startActivity()的 隐式intent好像它们至少包含
* "android.intent.category.DEFAULT"(对应CATEGORY_DEFAULT常量)。
* 因此,活动想要接收隐式intent必须要在intent过滤器中包含"android.intent.category.DEFAULT"</strong>
*/
private class MyExceptionHandler implements Thread.UncaughtExceptionHandler {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
//启动首页
Intent intent = new Intent();
intent.setAction("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");
intent.addCategory("com.android.framework.MAINPAGE");
PendingIntent restartIntent = PendingIntent.getActivity(getInstance(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
//退出程序
AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1000, restartIntent);
ActivityManager.getInstance().finishAllActivityWithoutClose();
}
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/cachemanager/CacheManager.java
================================================
package com.android.libcore.cachemanager;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Set;
/**
* Description: 使用SharedPreferences来保存对象,SharedPreference可以使用两种存储方式存储:
* <ul>
* <li>
* 一种是存储进临时SharedPreference中,{@link #setTemporary(String, Object)},读取使用
* {@link #getTemporary(String, Class, Object)} 来读取固定类型或者{@link #getTemporarySet(String, Class)}
* 函数来读取特定类型的集合,这种类型的存储会在应用退出之后全部删除
* </li>
* <li>
* 一种是存储进永久的SharedPreference中,{@link #setPermanent(String, Object)},读取使用
* {@link #getPermanent(String, Class, Object)}来读取固定类型或者{@link #getPermanentSet(String, Class)}
* 方法来读取特定类型集合,存储之后永久保存
* </li>
* </ul>
*
* <strong>记住如果要保存一个不是基本类型的对象,那么该对象的类一定要继承自{@link ParseObject}虚类,
* 并且该类要有空参构造函数,并且如果该实体类作为一个内部类,则需要定义为static,因为非静态内部类实例化
* 一定要靠外部类的对象,会导致{@link InstantiationException}</strong>
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-23
*/
public class CacheManager {
/** 临时SharedPreference,当退出应用之后会主动删除 */
public static String TEMPORARY = "temporary";
/** 永久SharedPreference,退出应用不会主动删除 */
public static String PERMANENT = "permanent";
private static void setValue(SharedPreferences sp, String key, Object value){
SharedPreferences.Editor editor = sp.edit();
if (value instanceof Boolean){
editor.putBoolean(key, (Boolean) value);
}else if (value instanceof Float){
editor.putFloat(key, (Float) value);
}else if (value instanceof Integer){
editor.putInt(key, (Integer) value);
}else if (value instanceof Long){
editor.putLong(key, (Long) value);
}else if (value instanceof String){
editor.putString(key, (String) value);
}else if (value instanceof Set<?>){
if ((((Set<?>)value).toArray())[0] instanceof String){
if (Build.VERSION.SDK_INT < 11){
L.e(CacheManager.class.getSimpleName() + " 版本不支持String set");
return;
}
editor.putStringSet(key, (Set<String>) value);
}else{
//如果以不是string集合的方式存储进SharedPreference则将其以"|"分割线的模式分割成
//一个String子串存储,取时注意要以"||"分割成String集合进行对象的重组
String putValue = "";
Object[] objects = ((Set<?>)value).toArray();
for (Object object : objects){
putValue += object.toString()+"||";
}
editor.putString(key, putValue);
}
}else{
editor.putString(key, value.toString());
}
editor.commit();
}
private static <T>T getValue(SharedPreferences sp, String key, Class<T> clazz, T defaultValue){
Object returnValue = null;
if (clazz == Boolean.class){
returnValue = sp.getBoolean(key, (Boolean) defaultValue);
}else if (clazz == Float.class){
returnValue = sp.getFloat(key, (Float) defaultValue);
}else if (clazz == Integer.class){
returnValue = sp.getInt(key, (Integer) defaultValue);
}else if (clazz == Long.class){
returnValue = sp.getLong(key, (Long) defaultValue);
}else if (clazz == String.class){
returnValue = sp.getString(key, (String) defaultValue);
}else{
if (ParseObject.class.isAssignableFrom(clazz)){
String value = sp.getString(key, null);
if (value != null){
try {
T temp = clazz.newInstance();
((ParseObject)temp).stringParseObject(value);
return temp;
} catch (Exception e){
return defaultValue;
}
}
}
return defaultValue;
}
if (returnValue == null)
return defaultValue;
return (T) returnValue;
}
private static <T>Set<T> getValueSet(SharedPreferences sp, String key, Class<T> clazz){
if (clazz == String.class){
if (Build.VERSION.SDK_INT < 11){
L.e(CacheManager.class.getSimpleName() + " 版本不支持String set");
return null;
}
return (Set<T>) sp.getStringSet(key, null);
}else{
if (ParseObject.class.isAssignableFrom(clazz)){
String value = sp.getString(key, null);
if (value != null) {
//要用转义符
String[] values = value.split("\\|\\|");
LinkedHashSet<T> lists = new LinkedHashSet<>();
for (String string : values){
try {
T temp = null;
temp = clazz.newInstance();
((ParseObject)temp).stringParseObject(string);
lists.add(temp);
} catch (Exception e){
e.printStackTrace();
}
}
return lists;
}
}
return null;
}
}
/**
* 设置临时变量
*/
public static void setTemporary(String key, Object value){
SharedPreferences sp = RootApplication.getInstance().getSharedPreferences(TEMPORARY, Context.MODE_PRIVATE);
setValue(sp, key, value);
}
/**
* 获取临时变量
* @param key 键
* @param clazz 获取临时变量的类型
* @param defaultValue 当取出失败时返回的默认值
*/
public static <T>T getTemporary(String key, Class<T> clazz, T defaultValue){
SharedPreferences sp = RootApplication.getInstance().getSharedPreferences(TEMPORARY, Context.MODE_PRIVATE);
return getValue(sp, key, clazz, defaultValue);
}
/**
* 返回指定对象的数据集合
*/
public static <T>Set<T> getTemporarySet(String key, Class<T> clazz){
SharedPreferences sp = RootApplication.getInstance().getSharedPreferences(TEMPORARY, Context.MODE_PRIVATE);
return getValueSet(sp, key, clazz);
}
public static void setPermanent(String key, Object value){
SharedPreferences sp = RootApplication.getInstance().getSharedPreferences(PERMANENT, Context.MODE_PRIVATE);
setValue(sp, key, value);
}
public static <T>T getPermanent(String key, Class<T> clazz, T defaultValue){
SharedPreferences sp = RootApplication.getInstance().getSharedPreferences(PERMANENT, Context.MODE_PRIVATE);
return getValue(sp, key, clazz, defaultValue);
}
public static <T>Set<T> getPermanentSet(String key, Class<T> clazz){
SharedPreferences sp = RootApplication.getInstance().getSharedPreferences(PERMANENT, Context.MODE_PRIVATE);
return getValueSet(sp, key, clazz);
}
/** 清空临时SharedPreference */
public static void removeTemporary(){
L.i("application close remove temporary");
SharedPreferences sp = RootApplication.getInstance().getSharedPreferences(TEMPORARY, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.clear();
editor.commit();
}
/**
* 如果需要存储一个非String集合,那么集合里面的对象类必须继承该虚类,完成String到Object的转换
*/
public static abstract class ParseObject{
public abstract void stringParseObject(String value);
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/database/BaseDB.java
================================================
package com.android.libcore.database;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* Description: 基本数据库类,所有的数据库类都应该继承自该类<br/>
* 应该注意的地方是:如果新版本修改了数据库,请在增加version版本号,并且在
* {@link #onDBUpgrade(SQLiteDatabase, int, int)}函数里增加相应的版本升级工作<br/>
*
* 每次数据库的操作请加上事务,开始操作时请调用{@link #beginTransaction()},如果操作成功调用
* {@link #setTransactionSuccessful()},操作完成调用{@link #endTransaction()},还有一定
* 要记住最后调用{@link #close()}方法关闭数据库,使用try-catch-finally结构操作<br/>
*
* <strong>注意:表的创建请在名字后面加上版本,如版本为1的cache表名为<em>cache_1</em></strong>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-20
*/
public abstract class BaseDB {
/** 数据库锁 */
private final Byte[] lock = new Byte[0];
/** 打开数据库超时时间 */
private final int TIME_OUT = 30*1000;
/** 当前操作的表 */
private String mTable;
private DataBaseHelper mHelper;
protected SQLiteDatabase mDb;
public BaseDB(IBaseDBTable table, boolean writable){
this.mTable = table.getTableName()+"_"+getDBVersion();
mHelper = new DataBaseHelper();
if (writable)
mDb = mHelper.getWritableDatabase();
else
mDb = mHelper.getReadableDatabase();
}
/**
* 获取数据库的名字
*/
protected abstract String getDBName();
/**
* 获取数据库的版本,注意该版本只增不减
*/
protected abstract int getDBVersion();
/**
* 数据库的创建
*/
protected abstract void onDBCreate(SQLiteDatabase db);
/**
* 如果应用程序版本号大于本地版本库,会产生升级动作,该函数只需要处理数据库表的变更即可,不需要进行名字的更改,
* 注意该函数使用的是逐步升级版本的操作,比如本地数据库版本为1,升级到3版本,会迭代先升级到2版本,再从2版本升
* 级到3版本,<strong>升级时的版本号仍然为旧版本号</strong>,所以该函数要详细写清楚每个版本之间的差异,
* 并且处理每个版本之间的升级任务,该升级操作会在数据库的第一个操作检测到数据库版本不一致时进行升级
*/
protected abstract void onDBUpgrade(SQLiteDatabase db, int oldVersion, int newVersion);
/**
* 开始事务
*/
public void beginTransaction(){
if (mDb != null && !mDb.inTransaction()){
try {
mDb.beginTransaction();
}catch (Exception e){
e.printStackTrace();
}
}
}
/**
* 事务成功
*/
public void setTransactionSuccessful(){
if (mDb != null && mDb.inTransaction()){
try {
mDb.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}
}
}
/**
* 结束事务
*/
public void endTransaction(){
if (mDb != null && mDb.inTransaction()){
try {
mDb.endTransaction();
}catch (Exception e){
e.printStackTrace();
}
}
}
/**
* 关闭数据库
*/
public void close(){
if (mDb != null && mDb.isOpen())
mDb.close();
}
/**
* 获取表中所有的条目
*/
public int getCount(){
return getCount(null, null);
}
/**
* 获取表中符合该条件的表的条目数
*/
public int getCount(String selection, String[] selectionArgs){
int count = 0;
Cursor cursor = null;
try {
cursor = mDb.query(mTable, new String[]{"count(*)"}, selection, selectionArgs, null, null, null);
if (cursor.moveToNext()){
count = cursor.getInt(0);
}
}catch (Exception e){
e.printStackTrace();
}finally {
if (cursor != null){
try {
cursor.close();
}catch (Exception e1){
e1.printStackTrace();
}
}
}
return count;
}
/**
* 增
*/
public long insert(HashMap<String, String> map, boolean replace){
getCount();
long count = 0;
synchronized (lock){
try {
if (!replace)
count = mDb.insert(mTable, null, parseHashMapToContentValues(map));
else
count = mDb.replace(mTable, null, parseHashMapToContentValues(map));
}catch (Exception e){
e.printStackTrace();
count = -1;
}
}
return count;
}
/**
* 删
*/
public long delete(String selection, String[] selectionArgs){
long count = 0;
synchronized (lock){
try {
count = mDb.delete(mTable, selection, selectionArgs);
}catch (Exception e){
e.printStackTrace();
count = -1;
}
}
return count;
}
/**
* 改<br/>
* 使用范例:如果需要将带"shangh"开头的城市的人数字段都变成0,函数就可以这么调用:
* update(hashmap({"people", "0"}), "city like ?", "new String[]{"shangh"}")
*/
public long update(HashMap<String, String> maps, String whereClause, String[] whereArgs){
long count = 0;
synchronized (lock) {
try {
count = mDb.update(mTable, parseHashMapToContentValues(maps), whereClause, whereArgs);
}catch (Exception e){
e.printStackTrace();
count = -1;
}
}
return count;
}
/**
* 查
*/
public ArrayList<HashMap<String, String>> query(){
return query(null, null);
}
/**
* 查
*/
public ArrayList<HashMap<String, String>> query(String selection, String[] selectionArgs){
return query(selection, selectionArgs, null, null, null, null);
}
/**
* 查<br/>
* 使用范例:query("city like ? or city=?", new String[]{"shangh", "beijing"}, "district", "sum(people)>10", "GDP", "1000"),
* 作用为查找城市中像"shangh"和等于beijing的城市,并且按照district排序,统计所有区总人数大于10万,并且区之间按照GDP排序,显示前1000条信息,该函数的
* 使用与正常的sql语句一样
*/
public ArrayList<HashMap<String, String>> query(String selection, String[] selectionArgs,
String groupBy, String having, String orderBy, String limit){
ArrayList<HashMap<String, String>> result = new ArrayList<>();
synchronized (lock){
try {
Cursor cursor = mDb.query(mTable, null, selection, selectionArgs, groupBy, having, orderBy, limit);
int length = cursor.getColumnCount();
while (cursor.moveToNext()){
HashMap<String, String> value = new HashMap<>();
for (int i=0; i<length; i++){
value.put(cursor.getColumnName(i), cursor.getString(i));
}
result.add(value);
}
if (result.size() == 0)
result = null;
}catch (Exception e){
e.printStackTrace();
result = null;
}
}
return result;
}
private ContentValues parseHashMapToContentValues(HashMap<String, String> map){
ContentValues values = new ContentValues();
for (Map.Entry<String, String> entry : map.entrySet()) {
values.put(entry.getKey(), entry.getValue());
}
return values;
}
/**
* 数据库封装类
*/
private class DataBaseHelper extends SQLiteOpenHelper{
public DataBaseHelper() {
super(RootApplication.getInstance(), getDBName(), null, getDBVersion());
}
@Override
public SQLiteDatabase getReadableDatabase() {
SQLiteDatabase db = null;
synchronized (lock){
boolean retry = false;
long time = System.currentTimeMillis();
do {
retry = false;
try {
db = super.getReadableDatabase();
}catch (Exception e){
L.e(e);
retry = true;
//休眠一个随机时间防止线程并发
try {
Thread.sleep((long) (3*1000+Math.random()*1000));
}catch (InterruptedException e1){
L.e(e1);
}
}
}while (retry && ((System.currentTimeMillis()-time)<TIME_OUT));
}
return db;
}
@Override
public SQLiteDatabase getWritableDatabase() {
SQLiteDatabase db = null;
synchronized (lock){
boolean retry = false;
long time = System.currentTimeMillis();
do {
retry = false;
try {
db = super.getWritableDatabase();
}catch (Exception e){
L.e(e);
retry = true;
//休眠一个随机时间防止线程并发
try {
Thread.sleep((long) (3*1000+Math.random()*1000));
}catch (InterruptedException e1){
L.e("error in interrupt", e1);
}
}
}while (retry && ((System.currentTimeMillis()-time)<TIME_OUT));
}
return db;
}
@Override
public void onCreate(SQLiteDatabase db) {
onDBCreate(db);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < newVersion){
//删除掉数据库中的异常新版本,防止升级出错
removeNewTables(db, oldVersion+1);
//升级版本
onDBUpgrade(db, oldVersion, oldVersion+1);
//等待升级任务完成之后再去修改版本号
renameOldTables(db, oldVersion, oldVersion+1);
oldVersion ++;
//递归的版本升级
onUpgrade(db, oldVersion, newVersion);
//最后应该将数据库中的旧表清除
if (oldVersion == newVersion)
clearOldTables(db, newVersion);
}
}
/**
* 获取该数据库中的所有表
*/
private ArrayList<String> getTables(SQLiteDatabase db){
ArrayList<String> tables = new ArrayList<>();
Cursor cursor = db.rawQuery("select * from sqlite_master where type = 'table'", null);
while (cursor.moveToNext()){
String[] cols = cursor.getColumnNames();
for (int i = 0; i < cols.length; i++) {
if (cols[i].equals("tbl_name")){
String name = cursor.getString(i);
//排除sqlite_master表
if (name.length() < 7 || (!name.substring(0, 7).equals("sqlite_"))) {
tables.add(name);
}
}
}
}
return tables;
}
/**
* 删除所有异常新版本库,保证当前数据的表都为旧版本
* @param version 需要删除的版本
*/
private void removeNewTables(SQLiteDatabase db, int version){
ArrayList<String> tables = getTables(db);
String suffix = "_"+version;
for (String table : tables){
if (table.substring(table.length()-suffix.length()).equals(suffix)){
db.rawQuery("drop table if exists " + table, null);
}
}
}
/**
* 将旧版本的表名后面的版本号修改成新版本号
*/
private void renameOldTables(SQLiteDatabase db, int oldVersion, int newVersion){
String oldSuffix = "_"+oldVersion;
String newSuffix = "_"+newVersion;
ArrayList<String> tables = getTables(db);
for (String table : tables){
if (table.substring(table.length()-oldSuffix.length()).equals(oldSuffix)){
db.execSQL("alter table " + table + " rename to " + table.replace(oldSuffix, newSuffix));
}
}
}
/**
* 清除所有的旧表
*/
private void clearOldTables(SQLiteDatabase db, int newVersion){
ArrayList<String> tables = getTables(db);
String suffix = "_"+newVersion;
for (String table : tables){
//如果数据库中存在不是新版本的表,删除
if (!table.substring(table.length()-suffix.length()).equals(suffix)){
db.rawQuery("drop table if exists " + table, null);
}
}
}
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/database/BaseDBHelper.java
================================================
package com.android.libcore.database;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Description: 所有数据库操作的操作封装类,在此可以封装单次的插入操作,也可以封装大量数据的一次插入,
* 其他类只能通过helper的子类进行数据库的操作,不能直接操作数据库,每一个数据库对应一个数据库helper,
* 这样就能够保证数据库访问的统一性,以便以后的数据库修改,继承自该helper类之后也可增加方法去操作
* {@link #mDb}
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-21
*/
public abstract class BaseDBHelper {
protected BaseDB mDb;
protected IBaseDBTable mTable;
/** 初始化插入数据库 */
protected abstract void initInsertDB();
/** 初始化删除数据库 */
protected abstract void initDeleteDB();
/** 初始化更改数据库 */
protected abstract void initUpdateDB();
/** 初始化查询数据库 */
protected abstract void initQueryDB();
/**
* 单次插入
* @param map 单次插入的一行数据
*/
protected long insert(HashMap<String, String> map, boolean replace){
initInsertDB();
if (mDb == null)
return 0;
long count = -1;
try {
mDb.beginTransaction();
count = mDb.insert(map, replace);
mDb.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
mDb.endTransaction();
mDb.close();
}
return count;
}
/**
* 大量数据的插入
* @param maps 需要插入的数据集
* @return 成功插入的数量
*/
protected long insertAll(ArrayList<HashMap<String, String>> maps, boolean replace){
initInsertDB();
if (mDb == null)
return 0;
long count = 0;
try {
mDb.beginTransaction();
for (HashMap<String, String> map : maps) {
count ++;
mDb.insert(map, replace);
}
mDb.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
mDb.endTransaction();
mDb.close();
}
return count;
}
/**
* 删除
*/
protected long delete(String selection, String[] selectionArgs){
initDeleteDB();
if (mDb == null)
return 0;
long count = -1;
try {
mDb.beginTransaction();
count = mDb.delete(selection, selectionArgs);
mDb.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
mDb.endTransaction();
mDb.close();
}
return count;
}
/**
* 修改
*/
protected long update(HashMap<String, String> maps, String whereClause, String[] whereArgs){
initUpdateDB();
if (mDb == null)
return 0;
long count = -1;
try {
mDb.beginTransaction();
count = mDb.update(maps, whereClause, whereArgs);
mDb.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
mDb.endTransaction();
mDb.close();
}
return count;
}
protected ArrayList<HashMap<String, String>> query(String selection, String[] selectionArgs,
String groupBy, String having, String orderBy, String limit){
initQueryDB();
if (mDb == null)
return null;
ArrayList<HashMap<String, String>> result = null;
try {
mDb.beginTransaction();
result = mDb.query(selection, selectionArgs, groupBy, having, orderBy, limit);
mDb.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
mDb.endTransaction();
mDb.close();
}
return result;
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/database/IBaseDBTable.java
================================================
package com.android.libcore.database;
import java.util.ArrayList;
/**
* Description: 所有数据库DB类应该声明一个枚举类,用来封装该数据库中的所有表名,
* 和表的相关列名,这样将表名和列名封装起来,外部使用封装之后的枚举进行操作
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-22
*/
public interface IBaseDBTable {
/**
* 用来返回表名
*/
String getTableName();
/**
* 用来返回该表中所有的列名
*/
ArrayList<String> getTableColumns();
}
================================================
FILE: libcore/src/main/java/com/android/libcore/dialog/BaseDialog.java
================================================
package com.android.libcore.dialog;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import java.util.ArrayList;
/**
* Description: 最基础的dialog类,用来统一dialog的功能,该dialog可以添加多个按钮,按钮的顺序
* 和添加按钮顺序一致,所以请按照需要显示的顺序要添加按钮
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-16
*/
public abstract class BaseDialog extends Dialog{
/** 用来标识确定按钮的回调id */
public static final int POSITIVE_LISTENER = 0;
/** 用来标识否定按钮的回调id */
public static final int NEGATIVE_LISTENER = 1;
/** 用来标识中间按钮的回调id */
public static final int NEUTRAL_LISTENER = 2;
/** 用来标示是否有title */
protected boolean mHasTitle = false;
/** 其他按钮的id */
protected ArrayList<Integer> mIds = new ArrayList<>();
protected ButtonClickListener mListener;
public BaseDialog(Context context, int theme) {
super(context, theme);
mIds.add(POSITIVE_LISTENER);
mIds.add(NEGATIVE_LISTENER);
mIds.add(NEUTRAL_LISTENER);
}
/**
* 检测按钮id是否合法
* @return 合法返回true
*/
protected boolean checkIllegalId(int id){
return !mIds.contains(id);
}
/**
* 设置dialog的title
* @param title 标题的文字
*/
public abstract BaseDialog setTitle(String title);
/**
* 设置dialog的title view
* @param title view
*/
public abstract BaseDialog setTitle(View title);
/**
* 设置内容区域的文字
* @param message 内容的文字
*/
public abstract BaseDialog setMessage(String message);
/**
* 内容区域的View
* @param message view
*/
public abstract BaseDialog setMessage(View message);
/**
* 设置确定按钮的文字
* @param positive 文字
*/
public abstract BaseDialog setPositiveButton(String positive);
/**
* 设置确定按钮的view
* @param positive view
*/
public abstract BaseDialog setPositiveButton(View positive);
/**
* 设置取消按钮的文字
* @param negative 文字
*/
public abstract BaseDialog setNegativeButton(String negative);
/**
* 设置取消按钮的view
* @param negative view
*/
public abstract BaseDialog setNegativeButton(View negative);
/**
* 设置中性按钮的文字
* @param neutral 文字
*/
public abstract BaseDialog setNeutralButton(String neutral);
/**
* 设置中性按钮的view
* @param neutral view
* @return
*/
public abstract BaseDialog setNeutralButton(View neutral);
/**
* 增加一个按钮
* @param other 按钮的文字
* @param other_listener 按钮的点击回调id
*/
public abstract BaseDialog addOtherButton(String other, int other_listener);
/**
* 增加一个按钮
* @param other 按钮的view
* @param other_listener 按钮的点击回调id
*/
public abstract BaseDialog addOtherButton(View other, int other_listener);
/**
* 设置dialog的按钮点击回调
*/
public BaseDialog setOnButtonClickListener(ButtonClickListener listener){
this.mListener = listener;
return this;
}
/**
* 设置dialog显示的位置
* @param gravity Gravity类的变量
*/
public abstract BaseDialog setGravity(int gravity);
/**
* 设置dialog显示的具体位置,相对于原位置而言,比如:x为负数代表向左,正数代表向右
* @param x x坐标,0代表使用原位置
* @param y y坐标,0代表使用原位置
*/
public abstract BaseDialog setPosition(int x, int y);
/**
* 设置宽度,不使用默认
* @param width 宽度
*/
public abstract BaseDialog setWidth(int width);
/**
* 设置高度,不使用默认
* @param height 高度
*/
public abstract BaseDialog setHeight(int height);
/**
* 设置透明度
* @param alpha 0~1
*/
public abstract BaseDialog setAlpha(float alpha);
public interface ButtonClickListener{
void onButtonClick(int button_id);
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/download/DownloadDB.java
================================================
package com.android.libcore.download;
import android.database.sqlite.SQLiteDatabase;
import com.android.libcore.database.BaseDB;
import com.android.libcore.database.IBaseDBTable;
import com.android.libcore.log.L;
import java.util.ArrayList;
/**
* Description: 保存下载信息的数据库
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-08-05
*/
public class DownloadDB extends BaseDB{
public DownloadDB(IBaseDBTable table, boolean writable) {
super(table, writable);
}
@Override
protected String getDBName() {
return "download.db";
}
@Override
protected int getDBVersion() {
return 1;
}
@Override
protected void onDBCreate(SQLiteDatabase db) {
try {
db.beginTransaction();
String sql;
sql = "create table if not exists "+TABLES.DOWNLOAD.getTableName()+"_" + getDBVersion() + " (";
sql += TABLES.DOWNLOAD.getTableColumns().get(0)+" integer not null, ";
sql += TABLES.DOWNLOAD.getTableColumns().get(1)+" varchar(4000) not null default '', ";
sql += TABLES.DOWNLOAD.getTableColumns().get(2)+" varchar(50) not null default '0', ";
sql += TABLES.DOWNLOAD.getTableColumns().get(3)+" varchar(50) not null default '0', ";
sql += TABLES.DOWNLOAD.getTableColumns().get(4)+" varchar(50) not null default '0'";
sql += ")";
db.execSQL(sql);
db.setTransactionSuccessful();
} catch (Exception e) {
L.e(getClass().getSimpleName()+" sql语句错误", e);
} finally {
db.endTransaction();
}
}
@Override
protected void onDBUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
/**
* 将该数据库中所有的表使用枚举封装
*/
public enum TABLES implements IBaseDBTable {
DOWNLOAD("download"){
@Override
public ArrayList<String> getTableColumns() {
ArrayList<String> columns = new ArrayList<>();
columns.add("id");//id
columns.add("url");//下载url
columns.add("start_pos");//该线程开始位置
columns.add("end_pos");//该线程结束位置
columns.add("complete_size");//线程当前完成的数
return columns;
}
};
private String table_name;
TABLES(String table_name){
this.table_name = table_name;
}
@Override
public String getTableName() {
return table_name;
}
@Override
public ArrayList<String> getTableColumns() {
return null;
}
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/download/DownloadDBHelper.java
================================================
package com.android.libcore.download;
import com.android.libcore.database.BaseDBHelper;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Description: 下载数据库帮助类
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-08-05
*/
public class DownloadDBHelper extends BaseDBHelper{
/**
* 一次性插入大量数据
*/
public void insertInfos(String url, ArrayList<FileDownloadManager.DownloadInfo> infos){
ArrayList<String> columns = DownloadDB.TABLES.DOWNLOAD.getTableColumns();
ArrayList<HashMap<String, String>> lists = new ArrayList<>();
for (FileDownloadManager.DownloadInfo info : infos){
HashMap<String, String> map = new HashMap<>();
map.put(columns.get(0), info.id+"");
map.put(columns.get(1), url);
map.put(columns.get(2), info.startPos+"");
map.put(columns.get(3), info.endPos+"");
map.put(columns.get(4), info.completeSize+"");
lists.add(map);
}
insertAll(lists, true);
}
/**
* 更新该线程下载的完成度
*/
public void updateInfos(String url, ArrayList<FileDownloadManager.DownloadInfo> infos){
ArrayList<String> columns = DownloadDB.TABLES.DOWNLOAD.getTableColumns();
HashMap<String, String> maps = new HashMap<>();
initUpdateDB();
if (mDb == null)
return;
try {
mDb.beginTransaction();
for (FileDownloadManager.DownloadInfo info : infos){
maps.clear();
maps.put(columns.get(4), info.completeSize+"");
String whereClause = columns.get(0)+"=? and "+columns.get(1)+"=?";
String[] whereArgs = new String[]{info.id+"", url};
mDb.update(maps, whereClause, whereArgs);
}
mDb.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
mDb.endTransaction();
mDb.close();
}
}
/**
* 获取该文件下载进度信息
*/
public ArrayList<HashMap<String, String>> getInfo(String url){
ArrayList<String> columns = DownloadDB.TABLES.DOWNLOAD.getTableColumns();
String selection = columns.get(1)+"=?";
String[] selectionArgs = new String[]{url};
return query(selection, selectionArgs, null, null, null, null);
}
/**
* 删除该url的相关下载信息
*/
public void deleteInfos(String url){
ArrayList<String> columns = DownloadDB.TABLES.DOWNLOAD.getTableColumns();
String selection = columns.get(1)+"=?";
String[] selectionArgs = new String[]{url};
delete(selection, selectionArgs);
}
@Override
protected void initInsertDB() {
mDb = new DownloadDB(DownloadDB.TABLES.DOWNLOAD, true);
}
@Override
protected void initDeleteDB() {
mDb = new DownloadDB(DownloadDB.TABLES.DOWNLOAD, true);
}
@Override
protected void initUpdateDB() {
mDb = new DownloadDB(DownloadDB.TABLES.DOWNLOAD, true);
}
@Override
protected void initQueryDB() {
mDb = new DownloadDB(DownloadDB.TABLES.DOWNLOAD, false);
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/download/FileDownloadManager.java
================================================
package com.android.libcore.download;
import android.os.Handler;
import android.os.Message;
import com.android.libcore.Toast.T;
import com.android.libcore.log.L;
import com.android.libcore.utils.CommonUtils;
import com.android.libcore.utils.FileUtils;
import java.io.File;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
/**
* Description: 单个文件下载,支持断点续传,相同url的被认为为同一个文件</br>
* {@link #start()}开启下载</br>
* {@link #stop()}停止下载</br>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-08-05
*/
public class FileDownloadManager {
/** 开启线程 */
private static final int STATE_START_THREADS = -1;
/** 更新状态 */
private static final int STATE_UPDATE_PROGRESS = 0;
/** 下载状态,正在获取文件大小 */
public static final int STATE_GETSIZE = 1;
/** 下载状态,开始下载 */
public static final int STATE_STARTING = 2;
/** 下载状态,正在停止 */
public static final int STATE_STOPING = 3;
/** 下载状态,停止成功 */
public static final int STATE_STOPED = 4;
/** 下载状态,下载完成 */
public static final int STATE_FINISH = 5;
/** 下载状态,正在删除 */
public static final int STATE_DELETING = 6;
/** 下载状态,删除成功 */
public static final int STATE_DELETE = 7;
/** 下载状态,网络错误 */
public static final int STATE_NET_ERROR = 8;
/** 下载状态,服务器错误 */
public static final int STATE_SERVER_ERROR = 9;
/** 当前文件的下载状态,默认为停止成功,即为下载完成,且随时可以开始下载 */
private int currentState = STATE_STOPED;
/** 下载一个文件所开启的线程数量 */
private final int THREAD_NUM = 4;
/** 下载一个文件的所有线程信息 */
private ArrayList<DownloadInfo> infos;
/** 开始下载线程 */
private Thread startDownloadThread;
/** 结束下载线程 */
private Thread stopDownloadThread;
/** 删除下载线程 */
private Thread deleteDownloadThread;
/** 下载一个文件的线程队列 */
private ArrayList<DownloadThread> threads;
/** 更新下载信息,更新界面线程 */
private UpdateThread updateThread;
/** 数据库操作对象 */
private DownloadDBHelper helper;
/** 该文件下载名 */
private String fileName;
/** 该文件下载的url */
private String url;
/** 该文件下载路径,默认为SD卡file目录 */
private String path = FileUtils.getExternalStorageFilePath();
/** 该文件下载的文件大小 */
private long fileSize = 0;
/** 该文件下载的完成度 */
private long completeSize = 0;
/** 通知更新进度handler */
private ProgressChangeHandler progressChangeHandler;
/** 文件下载进度更新 */
private IDownloadProgressChangedListener listener;
/** 文件的下载状态,true表示正在下载 */
private boolean downloadState = false;
/** 文件是否下载完成 */
private boolean isDownloadFinish = false;
/** 下载线程是否结束标识 */
private CountDownLatch countDownLatch;
/**
* @param url 文件下载url
* @param fileName 文件名,默认将会下载到sd卡file目录下
*/
public FileDownloadManager(String url, String fileName){
this(url, fileName, null);
}
/**
* @param url 文件下载url
* @param fileName 文件名
* @param path 文件下载路径,不需要带文件名
*/
public FileDownloadManager(String url, String fileName, String path){
this.url = url;
if (path != null)
this.path = path;
if (!this.path.substring(this.path.length()-1).equals("/")){
this.path += "/";
}
//保存该文件原路径
this.fileName = this.path + fileName;
//将文件名字先进行md5,最后等文件下载完成之后再更改文件名字
String md5 = CommonUtils.md5(fileName);
this.path += md5;
helper = new DownloadDBHelper();
infos = new ArrayList<>();
threads = new ArrayList<>();
progressChangeHandler = new ProgressChangeHandler(this);
checkFileFinish();
}
/**
* 检测该文件是否已经下载完成
*/
private boolean checkFileFinish(){
if (isDownloadFinish || isFileDownloadFinish(helper.getInfo(url))){
isDownloadFinish = true;
progressChangeHandler.sendEmptyMessage(STATE_FINISH);
return true;
}
return false;
}
/**
* 开启下载
*/
public void start(){
if (!CommonUtils.isNetworkAvailable()){
progressChangeHandler.sendEmptyMessage(STATE_NET_ERROR);
T.getInstance().showShort("网络错误");
return;
}
if (checkFileFinish()){
T.getInstance().showShort("文件已下载完成");
return;
}
if (downloadState){
T.getInstance().showShort("已经启动下载");
return;
}
if (currentState == STATE_STOPING){
T.getInstance().showShort("文件还未停止成功");
return;
}
if (currentState == STATE_DELETING){
T.getInstance().showShort("文件正在删除");
return;
}
if (currentState == STATE_DELETE){
T.getInstance().showShort("文件已删除");
return;
}
downloadState = true;
//开启下载任务
startDownload(helper.getInfo(url));
}
/**
* 停止下载
*/
public void stop(){
downloadState = false;
//停止更新界面线程,一定要保证最多只有一个更新线程在执行
if (updateThread != null && updateThread.isAlive())
updateThread.canRun = false;
if (checkFileFinish()){
T.getInstance().showShort("文件已下载完成");
return;
}
if (currentState == STATE_STOPING){
T.getInstance().showShort("正在停止,稍后...");
return;
}
if (currentState == STATE_STOPED){
T.getInstance().showShort("已停止");
return;
}
if (currentState == STATE_DELETING){
T.getInstance().showShort("文件正在删除");
return;
}
if (currentState == STATE_DELETE){
T.getInstance().showShort("文件已删除");
return;
}
stopDownload();
}
/**
* 删除该文件下载的相关所有信息,成功之后,该对象将自动置为null
*/
public void delete(){
//停止下载线程
downloadState = false;
//停止更新界面线程,一定要保证最多只有一个更新线程在执行
if (updateThread != null && updateThread.isAlive())
updateThread.canRun = false;
if (currentState == STATE_DELETING){
T.getInstance().showShort("正在删除,稍后...");
return;
}
if (currentState == STATE_DELETE){
T.getInstance().showShort("已删除");
return;
}
if (currentState == STATE_STOPING){
T.getInstance().showShort("正在停止,稍后...");
return;
}
deleteDownload();
}
private void startDownload(final ArrayList<HashMap<String, String>> maps){
startDownloadThread = new Thread(new Runnable() {
@Override
public void run() {
if (stopDownloadThread!=null && stopDownloadThread.isAlive()){
L.e("正在停止,稍后...");
return;
}
if (deleteDownloadThread!=null && deleteDownloadThread.isAlive()){
L.e("文件正在删除");
return;
}
//如果没有下载信息,则需要创建
if (infos==null || infos.size()==0) {
if (maps == null || maps.size() == 0) {
createDownloadInfos();
} else {
revertDownloadInfos(maps);
}
}
//更新文件状态为正在下载
progressChangeHandler.sendEmptyMessage(STATE_STARTING);
//上次的线程完成之后才能开启新的下载线程开始下载
threads.clear();
for (DownloadInfo info : infos){
DownloadThread thread = new DownloadThread(info);
threads.add(thread);
}
L.i("准备开启下载线程");
//初始化多线程标识
countDownLatch = new CountDownLatch(THREAD_NUM);
progressChangeHandler.sendEmptyMessage(STATE_START_THREADS);
}
});
startDownloadThread.start();
}
private void stopDownload(){
stopDownloadThread = new Thread(new Runnable() {
@Override
public void run() {
if (deleteDownloadThread!=null && deleteDownloadThread.isAlive()){
L.e("文件正在删除");
return;
}
stopStartThread(STATE_STOPING);
stopDownloadThread(STATE_STOPING);
//确保开始线程和下载线程都已经执行完成之后才能将状态修改为停止成功
progressChangeHandler.sendEmptyMessage(STATE_STOPED);
}
});
stopDownloadThread.start();
}
private void deleteDownload(){
deleteDownloadThread = new Thread(new Runnable() {
@Override
public void run() {
if (stopDownloadThread!=null && stopDownloadThread.isAlive()){
L.e("正在停止,稍后...");
return;
}
stopStartThread(STATE_DELETING);
stopDownloadThread(STATE_DELETING);
//确保开始线程,停止线程和下载线程都已经执行完成之后才能开始删除下载的相关信息
helper.deleteInfos(url);
File file = new File(path);
if (file.exists()){
file.delete();
}else{
L.w("FileDownloadManager deleteDownload file not exist");
}
progressChangeHandler.sendEmptyMessage(STATE_DELETE);
}
});
deleteDownloadThread.start();
}
/**
* 停止开始线程
*/
private void stopStartThread(int sendState){
boolean state;
do {
//如果开始线程还未停止,比如用户摁完开始下载之后快速摁停止下载或删除,
// 这时需要更新状态,直到开始线程完成
state = (startDownloadThread!=null&&startDownloadThread.isAlive());
L.i("开始线程还未结束");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
progressChangeHandler.sendEmptyMessage(sendState);
}while (state);
}
/**
* 停止下载线程
*/
private void stopDownloadThread(int sendState){
boolean state;
//检测下载线程,确保下载线程要全部执行完成
state = threads.size()>0;
while(state){
state = countDownLatch.getCount()>0;
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
//还有线程在执行,所以状态还需要相应变更
progressChangeHandler.sendEmptyMessage(sendState);
}
}
/**
* 第一次下载文件,无下载记录,重新创建
*/
private void createDownloadInfos(){
try {
//更新状态为正在获取文件大小
progressChangeHandler.sendEmptyMessage(STATE_GETSIZE);
URL url = new URL(FileDownloadManager.this.url);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5 * 1000);
conn.setRequestMethod("GET");
//添加这句话,要不然disconnect()会花费很多时间
conn.setRequestMethod("HEAD");
conn.setAllowUserInteraction(true);
conn.connect();
if (conn.getResponseCode()==200) {
fileSize = conn.getContentLength();
File file = FileUtils.checkAndCreateFile(path);
// 本地访问文件
RandomAccessFile accessFile = new RandomAccessFile(file, "rwd");
accessFile.setLength(fileSize);
accessFile.close();
}
conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
L.e("获取文件长度发生错误", e);
return;
}
//开始计算每个线程下载的字节范围
long startPos = 0;
//最后一个线程所下载的字节数一定要小于等于前面的线程保证文件完整性
long perSize = (long) Math.ceil((fileSize*1.0) / (THREAD_NUM*1.0));
for (int i=0; i<THREAD_NUM; i++){
DownloadInfo info = new DownloadInfo();
info.id = i;
info.startPos = startPos;
startPos += perSize;
startPos -= 1;
if (startPos >= fileSize)
startPos = fileSize-1;
info.endPos = startPos;
info.completeSize = 0;
//下一个任务的开始位置要+1
startPos ++;
infos.add(info);
}
helper.insertInfos(url, infos);
}
/**
* 恢复以前的下载信息
*/
private void revertDownloadInfos(ArrayList<HashMap<String, String>> maps){
ArrayList<String> columns = DownloadDB.TABLES.DOWNLOAD.getTableColumns();
for (HashMap<String, String> map : maps){
DownloadInfo info = new DownloadInfo();
info.id = Integer.parseInt(map.get(columns.get(0)));
info.startPos = Long.parseLong(map.get(columns.get(2)));
info.endPos = Long.parseLong(map.get(columns.get(3)));
info.completeSize = Long.parseLong(map.get(columns.get(4)));
completeSize += info.completeSize;
fileSize = fileSize>info.endPos ? fileSize:info.endPos;
infos.add(info);
}
}
/**
* 获取该文件的总下载字节数
*/
private long getCompleteSize(){
completeSize = 0;
for (DownloadThread thread : threads)
completeSize += thread.getCompleteSize();
return completeSize;
}
/**
* 检测该文件是否下载完成
*/
private boolean isFileDownloadFinish(ArrayList<HashMap<String, String>> maps){
boolean result = true;
if (maps==null || maps.size() == 0){
return false;
}
ArrayList<String> columns = DownloadDB.TABLES.DOWNLOAD.getTableColumns();
for (HashMap<String, String> map : maps){
//如果完成字节数不足end-start,代表该线程未完成,所以需要继续下载
if (Long.parseLong(map.get(columns.get(4))) <
(Long.parseLong(map.get(columns.get(3)))- Long.parseLong(map.get(columns.get(2))))){
result = false;
break;
}
}
return result;
}
public void setListener(IDownloadProgressChangedListener listener){
this.listener = listener;
}
/**
* 下载进度更新接口
*/
public interface IDownloadProgressChangedListener{
void onProgressChanged(long completeSize, long totalSize);
void onStateChanged(int state);
}
/**
* 开启更新界面线程和开启下载线程
*/
private void startThreads(){
//准备开启线程
updateThread = new UpdateThread();
updateThread.start();
for (Thread thread : threads)
thread.start();
}
/**
* 下载完成之后的处理工作
*/
private void finishDownload(){
downloadState = false;
isDownloadFinish = true;
progressChangeHandler.sendEmptyMessage(STATE_FINISH);
if (updateThread!=null && updateThread.isAlive())
updateThread.canRun = false;
File file = new File(path);
File newFile = new File(fileName);
if (file.exists()){
file.renameTo(newFile);
}
helper.deleteInfos(url);
}
private static class ProgressChangeHandler extends Handler{
private WeakReference<FileDownloadManager> activityWeakReference;
public ProgressChangeHandler(FileDownloadManager manager){
activityWeakReference = new WeakReference<>(manager);
}
@Override
public void handleMessage(Message msg) {
if (msg.what == STATE_START_THREADS){
L.i("开启线程");
activityWeakReference.get().currentState = STATE_START_THREADS;
activityWeakReference.get().startThreads();
}
//下载进度更新
else if (msg.what == STATE_UPDATE_PROGRESS) {
if (activityWeakReference.get().getCompleteSize() >= activityWeakReference.get().fileSize) {
activityWeakReference.get().finishDownload();
T.getInstance().showShort("下载完成");
}
if (activityWeakReference.get().listener != null)
activityWeakReference.get().listener.onProgressChanged
(activityWeakReference.get().getCompleteSize(), activityWeakReference.get().fileSize);
}
//下载状态更新
else {
L.i("state"+msg.what);
if (activityWeakReference.get().currentState != msg.what){
//如果在下载过程中网络发生错误,或者服务器发生错误,就不再更新后面的停止状态
if ((activityWeakReference.get().currentState == STATE_NET_ERROR
|| activityWeakReference.get().currentState == STATE_SERVER_ERROR)
&& (msg.what==STATE_STOPING || msg.what==STATE_STOPED)){
return;
}
activityWeakReference.get().currentState = msg.what;
if (activityWeakReference.get().listener != null){
activityWeakReference.get().listener.onStateChanged(activityWeakReference.get().currentState);
}
}
}
}
}
/**
* 单独一个线程下载的信息
*/
public class DownloadInfo {
public int id;
public long startPos;
public long endPos;
public volatile long completeSize;
}
/**
* 下载线程
*/
private class DownloadThread extends Thread{
private DownloadInfo info;
HttpURLConnection connection = null;
RandomAccessFile randomAccessFile = null;
InputStream is = null;
public DownloadThread(DownloadInfo info){
this.info = info;
}
public long getCompleteSize(){
return info.completeSize;
}
public void initConnection() throws Exception{
URL url = new URL(FileDownloadManager.this.url);
connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(2000);
connection.setReadTimeout(5000);
connection.setRequestMethod("GET");
connection.setAllowUserInteraction(true);
// 设置范围,格式为Range:bytes x-y;
connection.setRequestProperty("Range", "bytes=" + (info.startPos + info.completeSize) + "-" + info.endPos);
}
@Override
public void run() {
try {
initConnection();
randomAccessFile = new RandomAccessFile(path, "rwd");
// 将要下载的字节写到上次写的末尾
randomAccessFile.seek(info.startPos + info.completeSize);
//偶尔发现,下载的资源有时候403 FileNotFoundException,这种情况重新连接一次,不成功就Log出错误日志
try {
is = connection.getInputStream();
}catch (Exception e){
//重新连接
initConnection();
try {
is = connection.getInputStream();
}catch (Exception ee){
L.e("无法连接"+info.startPos+"~"+info.endPos+"处资源", ee);
return;
}
}
byte[] buffer = new byte[1024 * 8];
int length;
while (((length = is.read(buffer)) != -1) && downloadState) {
randomAccessFile.write(buffer, 0, length);
info.completeSize += length;
}
L.i("结束下载线程");
} catch (Exception e) {
e.printStackTrace();
} finally {
countDownLatch.countDown();
try {
//android 4.x disconnect或者close会耗费很长的时间,解决了很长时间,暂未找到方法,有的联系我
is.close();
randomAccessFile.close();
connection.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
/**
* 更新数据库和界面线程
*/
private class UpdateThread extends Thread{
public boolean canRun = true;
private long lastCompleteSize = 0;
/** 重试时间3s */
private final int RETRYCOUNT = 3;
private int retry;
@Override
public void run() {
retry = RETRYCOUNT;
try {
while (canRun) {
// 更新数据库中的下载信息
helper.updateInfos(url, infos);
L.i("lastCompleteSize " + lastCompleteSize);
L.i("更新界面 " + getCompleteSize() + " fileSize" + fileSize);
//由于网络不稳定,或者是服务器不稳定导致的无法返回数据
if (lastCompleteSize == getCompleteSize()){
retry--;
if (retry <= 0){
//停止下载线程,并提示用户重试
FileDownloadManager.this.stop();
//有网络的情况下为服务器错误
if (CommonUtils.isNetworkAvailable()){
L.e("服务器错误,请重试");
progressChangeHandler.sendEmptyMessage(STATE_SERVER_ERROR);
}else{
L.e("网络错误,请连接网络后重试");
progressChangeHandler.sendEmptyMessage(STATE_NET_ERROR);
}
}
}else{
retry = RETRYCOUNT;
}
lastCompleteSize = getCompleteSize();
//更新界面
progressChangeHandler.sendEmptyMessage(STATE_UPDATE_PROGRESS);
//每隔1秒操作数据库和更新界面,防止频繁的更新
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/guide/GuideManager.java
================================================
package com.android.libcore.guide;
import android.app.Activity;
import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import java.util.ArrayList;
/**
* Description: 蒙版管理器,用来管理页面的蒙版<br/>
* 使用{@link #initMask(Integer...)}传入资源layout的id,调用{@link #showMaskFullScreen()}
* 或者{@link #showMaskInContent()}显示蒙版,使用完蒙版之后需要调用{@link #clearMask()}清空蒙版,要不然会影响下次的使用<br/>
* <strong>注意传入的layout文件中请在需要点击消失的地方加入一个id为<em>click_to_disappear</em>的View即可</strong>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-15
*/
public class GuideManager {
private static volatile GuideManager instance = null;
private ArrayList<View> mViews;
private int mCurrentShowId;
private View.OnClickListener mListener;
private boolean mIsShowFullScreen = true;
private GuideManager() {
}
public static GuideManager getInstance() {
if (instance == null) {
synchronized (GuideManager.class) {
if (instance == null) {
instance = new GuideManager();
}
}
}
return instance;
}
/**
* 初始化监听器
*/
private void initListener() {
mListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
showNextMask();
}
};
}
/**
* 此函数用来传入蒙版的id,蒙版的显示顺序将会和参数的顺序一致
*
* @param layoutIds 需要展示蒙版的资源id,按照显示顺序传递即可
*/
public void initMask(Integer... layoutIds) {
if (layoutIds.length <= 0)
throw new IllegalArgumentException("参数不能为空");
LayoutInflater inflater = LayoutInflater.from(RootApplication.getInstance());
try {
//该处需要去根据名字找到该view的id
int btnId = RootApplication.getInstance().getResources().getIdentifier("click_to_disappear", "id",
RootApplication.getInstance().getPackageName());
if (btnId == 0) {
L.e("请先定义id为click_to_disappear的view");
return;
}
mViews = new ArrayList<>();
mCurrentShowId = 0;
initListener();
for (int layoutId : layoutIds) {
//虽然layoutId不在该子module里面定义,但是依然能够inflate
View view = inflater.inflate(layoutId, null);
View btn = view.findViewById(btnId);
if (btn == null) {
L.e("layout id为" + layoutId + "的布局中没有定义click_to_disappear的view");
return;
}
btn.setOnClickListener(mListener);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//用来屏蔽其他view的点击事件
}
});
mViews.add(view);
}
} catch (InflateException e) {
L.e("传入layout id 有误", e);
mViews = null;
}
}
/**
* 使用完蒙版之后记得清空蒙版
*/
public void clearMask() {
mViews = null;
mListener = null;
instance = null;
}
/**
* 全屏展示蒙版,此蒙版将会覆盖top bar
*/
public void showMaskFullScreen() {
if (mViews == null) {
L.e("请先初始化该蒙版");
return;
}
mIsShowFullScreen = true;
mCurrentShowId = 0;
//将其添加在主体界面的上部,覆盖主体窗口
((ViewGroup) (((Activity) (RootApplication.getInstance())).getWindow().getDecorView())).addView(mViews.get
(mCurrentShowId), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
/**
* 在内容区域内显示蒙版,不会覆盖top bar
*/
public void showMaskInContent() {
if (mViews == null) {
L.e("请先初始化该蒙版");
return;
}
mIsShowFullScreen = false;
mCurrentShowId = 0;
//获取activity_base_layout.xml里面的base_content的id
int base_content = RootApplication.getInstance().getResources().getIdentifier("base_content", "id",
RootApplication.getInstance().getPackageName());
//将其添加在主体界面的上部,覆盖主体窗口
((ViewGroup) (((((Activity) (RootApplication.getInstance())).getWindow().getDecorView())).findViewById(base_content)))
.addView(mViews.get(mCurrentShowId), new ViewGroup.LayoutParams(-1, -1));
}
/**
* 手动调用来显示下一个蒙版
*/
public boolean showNextMask(){
//如果当前没有显示任何模板,返回false标识不处理
if (mViews ==null || mViews.size()==0 || mCurrentShowId >= mViews.size()){
return false;
}
if (mIsShowFullScreen){
//将上一次的蒙版去除
((ViewGroup) (((Activity) (RootApplication.getInstance())).getWindow().getDecorView())).removeView(mViews.get(mCurrentShowId));
mCurrentShowId++;
if (mCurrentShowId < mViews.size()) {
((ViewGroup) (((Activity) (RootApplication.getInstance())).getWindow().getDecorView()))
.addView(mViews.get(mCurrentShowId), new ViewGroup.LayoutParams(ViewGroup
.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
}else{
//获取activity_base_layout.xml里面的content
int base_content = RootApplication.getInstance().getResources().getIdentifier("base_content", "id",
RootApplication.getInstance().getPackageName());
//将上一次的蒙版去除
((ViewGroup) (((((Activity) (RootApplication.getInstance())).getWindow().getDecorView())).findViewById
(base_content))).removeView(mViews.get(mCurrentShowId));
mCurrentShowId++;
if (mCurrentShowId < mViews.size()) {
((ViewGroup) (((((Activity) (RootApplication.getInstance())).getWindow().getDecorView())).findViewById
(base_content))).addView(mViews.get(mCurrentShowId), new ViewGroup.LayoutParams(ViewGroup.LayoutParams
.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
}
return true;
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/log/L.java
================================================
package com.android.libcore.log;
import android.text.TextUtils;
import android.util.Log;
import com.android.libcore.application.RootApplication;
import java.util.Locale;
/**
* Description: log打印类
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-07
*/
public final class L {
private static boolean LOG_ENABLE = true;
public static String LOG_TAG = "LOG_TAG";
private L(){}
static {
//一个进程只会调用一次static block,所以使用静态块的方式获取进程名
LOG_ENABLE = RootApplication.DEBUG;
LOG_TAG = "[PID:"+ android.os.Process.myPid() +"]";
}
/**
* 打印基本信息
* @param args 需要打印出来的额外信息,每次换行
*/
public static void i(String message, Object... args){
log(Log.INFO, message, null, args);
}
/**
* 打印警告
* @param args 需要打印出来的额外信息,每次换行
*/
public static void w(String message, Object... args){
log(Log.WARN, message, null, args);
}
/***
* 打印异常
* @param throwable 需要打印的异常信息
*/
public static void e(Throwable throwable){
log(Log.ERROR, null, throwable);
}
/***
* 打印异常
*/
public static void e(String message, Object... args){
log(Log.ERROR, message, null, args);
}
/***
* 打印异常
* @param throwable 需要打印的异常信息
* @param args 需要打印出来的额外信息,每次换行
*/
public static void e(String message, Throwable throwable, Object... args){
log(Log.ERROR, message, throwable, args);
}
private static void log(int priority, String message, Throwable throwable, Object... args){
if (!LOG_ENABLE)
return;
StringBuilder log = new StringBuilder();
//获取调用者类,函数信息和行数信息
StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace();
String caller = "<unknown>";
for (int i = 2; i < trace.length; i++) {
Class<?> clazz = trace[i].getClass();
if (!clazz.equals(L.class)) {
String callingClass = trace[i].getClassName();
callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1);
callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1);
caller = callingClass + "." + trace[i].getMethodName()
+ "(line:" + trace[i].getLineNumber() +")";
break;
}
}
//将message附加到日志上
if (!TextUtils.isEmpty(message))
log.append(String.format(Locale.US, "[TID:%d] %s: %s",
Thread.currentThread().getId(), caller, message)).append("\n");
//附加异常信息
if (throwable != null)
log.append(Log.getStackTraceString(throwable)).append("\n");
//附加额外信息
for (Object object: args)
log.append(object.toString()).append("\n");
//打印日志
Log.println(priority, LOG_TAG, log.toString());
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/net/NetError.java
================================================
package com.android.libcore.net;
import com.android.volley.VolleyError;
/**
* Description: 网络访问错误error
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-09-15
*/
public class NetError extends Exception{
public int errorCode;
public String errorMessage;
/**
* 将volley的错误信息转换成通用的信息
*/
public void transferVolleyError(VolleyError error){
if (error.networkResponse != null)
this.errorCode = error.networkResponse.statusCode;
this.errorMessage = error.toString();
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/net/imageloader/ImageLoader.java
================================================
package com.android.libcore.net.imageloader;
import android.graphics.Bitmap;
import android.widget.ImageView;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import com.android.libcore.net.NetError;
import com.android.volley.RequestQueue;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.Volley;
import java.lang.reflect.Field;
/**
* Description: 图片加载类
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-10-21
*/
public class ImageLoader {
/** 最大的图片缓存大小 */
private final int MAXDISKCACHEBYTES = 10 * 1024 *1024;
private static volatile ImageLoader instance;
private com.android.volley.toolbox.ImageLoader mImageLoader;
private ImageLoader(){
RequestQueue requestQueue = Volley.newRequestQueue(RootApplication.getInstance(), MAXDISKCACHEBYTES);
VolleyLruCache lruCache = new VolleyLruCache();
mImageLoader = new com.android.volley.toolbox.ImageLoader(requestQueue, lruCache);
}
public static ImageLoader getInstance(){
if (instance == null){
synchronized (ImageLoader.class){
if (instance == null)
instance = new ImageLoader();
}
}
return instance;
}
/** 通过反射获取imageview的大小 */
private int getImageViewFieldValue(Object object, String fieldName) {
int value = 0;
try {
Field field = ImageView.class.getDeclaredField(fieldName);
field.setAccessible(true);
int fieldValue = (Integer) field.get(object);
if (fieldValue > 0 && fieldValue < Integer.MAX_VALUE) {
value = fieldValue;
}
} catch (Exception e) {
L.e(e);
}
return value;
}
/**
* 加载图片
* @param url 图片url
* @param imageView 需要加载图片的视图
*/
public void loadImage(String url, final ImageView imageView){
loadImage(url, imageView, null);
}
/**
* 只带回调的图片加载
* @param url 图片url
* @param listener 图片加载回调
*/
public void loadImage(String url, final OnLoadCallBack listener){
loadImage(url, 0, 0, listener);
}
/**
* 带回调的加载图片
* @param url 图片url
* @param width 需要加载的图片宽
* @param height 需要加载的图片高
* @param listener 加载图片完成回调
*/
public void loadImage(String url, int width, int height, final OnLoadCallBack listener){
loadImage(url, width, height, null, listener);
}
/**
* 带回调的加载图片
* @param url 图片url
* @param imageView 需要加载图片的视图
* @param listener 加载图片的回调
*/
public void loadImage(String url, final ImageView imageView, final OnLoadCallBack listener){
int width = getImageViewFieldValue(imageView, "mMaxWidth");
int height = getImageViewFieldValue(imageView, "mMaxHeight");
loadImage(url, width, height, imageView, listener);
}
/**
* 加载图片
* @param url 图片url
* @param width 图片加载的图片宽
* @param height 图片加载的图片高
* @param imageView 需要加载图片的视图
*/
public void loadImage(String url, int width, int height, final ImageView imageView){
loadImage(url, width, height, imageView, null);
}
/**
* 加载图片
* @param url 图片url
* @param imageView 需要加载图片的视图
* @param width 需要加载视图的宽
* @param height 需要加载视图的高
* @param listener 加载图片回调
*/
public void loadImage(String url, int width, int height, final ImageView imageView, final OnLoadCallBack listener){
mImageLoader.get(url, new com.android.volley.toolbox.ImageLoader.ImageListener() {
@Override
public void onResponse(com.android.volley.toolbox.ImageLoader.ImageContainer response, boolean isImmediate) {
if (imageView != null)
imageView.setImageBitmap(response.getBitmap());
if (listener != null)
listener.onLoadSuccess(response.getBitmap(), response.getRequestUrl());
}
@Override
public void onErrorResponse(VolleyError error) {
if (listener != null) {
NetError netError = new NetError();
netError.transferVolleyError(error);
listener.onLoadFail(netError);
}
}
}, width, height);
}
/**
* 加载图片
* @param url 图片url
* @param imageView 需要加载该图片的url
* @param defaultImageResId 加载图片时的默认资源id
* @param errorImageResId 加载图片失败时显示的图片资源id
*/
public void loadImage(String url, final ImageView imageView, int defaultImageResId, int errorImageResId){
int width = getImageViewFieldValue(imageView, "mMaxWidth");
int height = getImageViewFieldValue(imageView, "mMaxHeight");
loadImage(url,width, height, imageView, defaultImageResId, errorImageResId);
}
/**
* 加载图片
* @param url 图片url
* @param imageView 需要加载该图片的url
* @param defaultImageResId 加载图片时的默认资源id
* @param errorImageResId 加载图片失败时显示的图片资源id
* @param width 加载图片的宽度
* @param height 加载图片的高度
*/
public void loadImage(String url, int width, int height, final ImageView imageView,
int defaultImageResId, int errorImageResId){
com.android.volley.toolbox.ImageLoader.ImageListener listener =
com.android.volley.toolbox.ImageLoader.getImageListener(imageView,
defaultImageResId, errorImageResId);
mImageLoader.get(url, listener, width, height);
}
/**
* 加载图片回调
*/
public interface OnLoadCallBack {
void onLoadSuccess(Bitmap bitmap, String url);
void onLoadFail(NetError error);
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/net/imageloader/VolleyLruCache.java
================================================
package com.android.libcore.net.imageloader;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import com.android.volley.toolbox.ImageLoader;
/**
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-10-20
*/
public class VolleyLruCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache{
private static int getCacheSize(){
return (int)(Runtime.getRuntime().maxMemory()/1024/8);
}
public VolleyLruCache() {
this(getCacheSize());
}
private VolleyLruCache(int size){
super(size);
}
@Override
public Bitmap getBitmap(String url) {
return get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
put(url, bitmap);
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/net/netapi/BaseNetApi.java
================================================
package com.android.libcore.net.netapi;
import android.app.Activity;
import android.content.Context;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import com.android.libcore.net.NetError;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.ImageRequest;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONObject;
import java.lang.reflect.Constructor;
import java.util.Map;
/**
* Description: 所有网络访问基础类,使用了volley框架,并且进行了简单的基础
* 封装,<Strong>所有进行网络访问的地方都使用该封装类</Strong>,方便以后更换网络访问框架,
* 只需修改libcore,libcore-ui层相关类即可,这也是封装的唯一目的<br/>
*
* 不能在libcore,libcore-ui层的相关类之外直接使用volley框架内容
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-08
*/
public abstract class BaseNetApi {
/** 网络访问requestQueue */
private RequestQueue requestQueue;
private Context mContext;
private RequestQueue getRequestQueue(int maxDiskCacheBytes){
if (requestQueue == null)
requestQueue = Volley.newRequestQueue(mContext, maxDiskCacheBytes);
return requestQueue;
}
protected RequestQueue getRequestQueue(){
return getRequestQueue(-1);
}
/**
* 回调接口
*/
public interface OnNetCallback<T>{
void onSuccess(T result);
void onFail(NetError error);
}
private boolean checkIfExtendsRequest(Class clazz){
while (clazz.getSuperclass() != null){
clazz = clazz.getSuperclass();
if (clazz == Request.class)
return true;
}
return false;
}
/**
* 网络请求
*/
protected <T> void makeRequest(final Context context, Class<? extends Request> clazz,
String url, final Map<String, String> params, final OnNetCallback<T> callback){
//网络请求
Request request = null;
//失败回调
Response.ErrorListener errorListener = null;
//成功回调
Response.Listener listener = null;
//判空
if (callback != null) {
errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (context instanceof Activity && (((Activity)(context)).isFinishing())) {
L.i("activity finish, not callback");
return ;
}
NetError netError = new NetError();
netError.transferVolleyError(error);
callback.onFail(netError);
}
};
listener = new Response.Listener<T>() {
@Override
public void onResponse(T response) {
if (context instanceof Activity && (((Activity)(context)).isFinishing())) {
L.i("activity finish, not callback");
return ;
}
callback.onSuccess(response);
}
};
}
//启动网络请求
if (clazz == ImageRequest.class){
throw new IllegalArgumentException("please use imageloader");
}else {
try {
Constructor constructor = clazz.getConstructor(Integer.class, String.class, Response.Listener.class,
Response.ErrorListener.class, Map.class);
int method = Request.Method.GET;
if (params != null)
method = Request.Method.POST;
request = (Request) constructor.newInstance(method, url, listener, errorListener, params);
} catch (Exception e) {
L.e("error reflect", e);
return;
}
}
//自定义超时时间,重试次数
// request.setRetryPolicy(new DefaultRetryPolicy());
getRequestQueue().add(request);
}
/**
* 对{@linkplain StringRequest}的封装类
*/
private static class StringRequestImpl extends StringRequest{
private Map<String, String> params;
public StringRequestImpl(Integer method, String url, Response.Listener<String> listener,
Response.ErrorListener errorListener, Map<String, String> params) {
super(method, url, listener, errorListener);
this.params = params;
}
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return params;
}
}
/**
* 对{@linkplain JsonObjectRequest}的封装类
*/
private static class JsonObjectRequestImpl extends JsonObjectRequest{
private Map<String, String> params;
public JsonObjectRequestImpl(Integer method, String url, Response.Listener<JSONObject> listener,
Response.ErrorListener errorListener, Map<String, String> params) {
super(method, url, new JSONObject(params), listener, errorListener);
this.params = params;
}
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return params;
}
}
/**
* 对{@linkplain JsonArrayRequest}的封装类
*/
private static class JsonArrayRequestImpl extends JsonArrayRequest{
private Map<String, String> params;
public JsonArrayRequestImpl(Integer method, String url, Response.Listener<JSONArray> listener,
Response.ErrorListener errorListener, Map<String, String> params) {
super(method, url, new JSONObject(params), listener, errorListener);
this.params = params;
}
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return params;
}
}
/**
* string 请求
* @param context 相关上下文
* @param url 网络访问url
* @param params 网络请求参数
* @param callback 网络请求回调
*/
public void stringRequest(Context context, String url, Map<String, String> params, OnNetCallback<String> callback){
mContext = context;
makeRequest(context, StringRequestImpl.class, url, params, callback);
}
/**
* jsonObject 请求
* @param context 相关上下文
* @param url 网络访问url
* @param params 网络请求参数
* @param callback 网络请求回调
*/
public void jsonObjectRequest(Context context, String url, Map<String, String> params, OnNetCallback<JSONObject> callback){
mContext = context;
makeRequest(context, JsonObjectRequestImpl.class, url, params, callback);
}
/**
* jsonArray 请求
* @param context 相关上下文
* @param url 网络访问url
* @param params 网络请求参数
* @param callback 网络请求回调
*/
public void jsonArrayRequest(Context context, String url, Map<String, String> params, OnNetCallback<JSONArray> callback){
mContext = context;
makeRequest(context, JsonArrayRequestImpl.class, url, params, callback);
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/utils/CommonUtils.java
================================================
package com.android.libcore.utils;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.util.DisplayMetrics;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.ViewConfiguration;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* Description: 基础工具类,该类的所有函数如下所示(所有添加到该类的函数都应该在这标识出来,以防重复)
* <ol>
* <li>{@link #dp2px(float)}用来将dp转换为px</li>
* <li>{@link #px2dp(float)}用来将px转换为dp</li>
* <li>{@link #getScreenWidth()}获取手机屏幕宽度</li>
* <li>{@link #getScreenHeight()}获取手机屏幕高度(有些手机会除去navigation bar高度)</li>
* <li>{@link #isNetworkAvailable()}用来判断网络是否可用</li>
* <li>{@link #isNetworkWifi()}用来判断网络是否是wifi</li>
* <li>{@link #hasNavigationBar()}判断手机是否会有navigation bar</li>
* <li>{@link #md5(String)}用来对字符串进行md5加密</li>
* <li>{@link #pathToUri(String)}手机图片路径path转uri</li>
* <li>{@link #uriToPath(Uri)}手机图片uri转路径path</li>
* </ol>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-14
*/
public class CommonUtils {
public static int dp2px(float dp){
final float scale = RootApplication.getInstance().getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}
public static int px2dp(float px) {
final float scale = RootApplication.getInstance().getResources().getDisplayMetrics().density;
return (int) (px / scale + 0.5f);
}
public static int getScreenWidth(){
DisplayMetrics dm = new DisplayMetrics();
((Activity)RootApplication.getInstance()).getWindow().getWindowManager().getDefaultDisplay().getMetrics(dm);
return dm.widthPixels;
}
public static int getScreenHeight(){
DisplayMetrics dm = new DisplayMetrics();
((Activity)RootApplication.getInstance()).getWindow().getWindowManager().getDefaultDisplay().getMetrics(dm);
return dm.heightPixels;
}
/**
* 判断当前网络是是否可用
*/
public static boolean isNetworkAvailable(){
ConnectivityManager cm = (ConnectivityManager) RootApplication.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
return info!=null && info.isAvailable();
}
/**
* 判断当前的网络是否是wifi
*/
public static boolean isNetworkWifi(){
if (!isNetworkAvailable()){
L.e("当前网络可用,请先调用isNetworkAvailable()函数");
}
ConnectivityManager cm = (ConnectivityManager) RootApplication.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
if (info.getType() == ConnectivityManager.TYPE_WIFI)
return true;
return false;
}
/**
* 检查手机是否会有虚拟底部navigation bar
*/
public static boolean hasNavigationBar(){
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
boolean hasHomeKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME);
if(hasBackKey && hasHomeKey) {
return false;
}
return true;
}
/**
* md5加密
*/
public static String md5(String string) {
byte[] hash;
try {
hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Huh, MD5 should be supported?", e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Huh, UTF-8 should be supported?", e);
}
StringBuilder hex = new StringBuilder(hash.length * 2);
for (byte b : hash) {
if ((b & 0xFF) < 0x10) hex.append("0");
hex.append(Integer.toHexString(b & 0xFF));
}
return hex.toString();
}
/**
* 用来将uri转变成path,兼容19版本以上
* 原文地址http://stackoverflow.com/questions/19834842/android-gallery-on-kitkat-returns-different-uri-for-intent-action-get-content
* @param uri The Uri to query.
*/
public static String uriToPath(final Uri uri) {
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(RootApplication.getInstance(), uri)) {
// ExternalStorageProvider
if (isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
if ("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
}
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(RootApplication.getInstance(), contentUri, null, null);
}
// MediaProvider
else if (isMediaDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Uri contentUri = null;
if ("image".equals(type)) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if ("video".equals(type)) {
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
} else if ("audio".equals(type)) {
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
}
final String selection = "_id=?";
final String[] selectionArgs = new String[] {
split[1]
};
return getDataColumn(RootApplication.getInstance(), contentUri, selection, selectionArgs);
}
}
// MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme())) {
// Return the remote address
if (isGooglePhotosUri(uri))
return uri.getLastPathSegment();
return getDataColumn(RootApplication.getInstance(), uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
}
/**
* Get the value of the data column for this Uri. This is useful for
* MediaStore Uris, and other file-based ContentProviders.
*
* @param context The context.
* @param uri The Uri to query.
* @param selection (Optional) Filter used in the query.
* @param selectionArgs (Optional) Selection arguments used in the query.
* @return The value of the _data column, which is typically a file path.
*/
public static String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) {
Cursor cursor = null;
final String column = "_data";
final String[] projection = {
column
};
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null);
if (cursor != null && cursor.moveToFirst()) {
final int index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(index);
}
} finally {
if (cursor != null)
cursor.close();
}
return null;
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is ExternalStorageProvider.
*/
public static boolean isExternalStorageDocument(Uri uri) {
return "com.android.externalstorage.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is DownloadsProvider.
*/
public static boolean isDownloadsDocument(Uri uri) {
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is MediaProvider.
*/
public static boolean isMediaDocument(Uri uri) {
return "com.android.providers.media.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is Google Photos.
*/
public static boolean isGooglePhotosUri(Uri uri) {
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
}
/**
* 手机图片path转uri
*/
public static Uri pathToUri(String path){
Uri uri = null;
if (path != null) {
path = Uri.decode(path);
ContentResolver cr = RootApplication.getInstance().getContentResolver();
StringBuffer buff = new StringBuffer();
buff.append("(").append(MediaStore.Images.ImageColumns.DATA)
.append("=").append("'" + path + "'").append(")");
Cursor cur = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[] { MediaStore.Images.ImageColumns._ID },
buff.toString(), null, null);
int index = 0;
for (cur.moveToFirst(); !cur.isAfterLast(); cur.moveToNext()) {
index = cur.getColumnIndex(MediaStore.Images.ImageColumns._ID);
index = cur.getInt(index);
}
if (index == 0) {
} else {
Uri uri_temp = Uri.parse("content://media/external/images/media/" + index);
if (uri_temp != null) {
uri = uri_temp;
}
}
}
return uri;
}
/**
* 获取进程名
*/
public static String getCurrentProcessName(Context context){
String currentProcessName = "";
int pid = android.os.Process.myPid();
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses())
{
if (processInfo.pid == pid)
{
currentProcessName = processInfo.processName;
break;
}
}
return currentProcessName;
}
/**
* 制造崩溃
*/
public static int makeCrash(){
int a[] = new int[2];
return a[3];
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/utils/FileUtils.java
================================================
package com.android.libcore.utils;
import android.os.Environment;
import android.text.format.Formatter;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Description: 文件相关的操作,如果需要在SD卡主目录下建立子目录,请在{@link ExternalStorageType}
* 枚举下建立相同的变量,带上目录名字即可,<strong>所有创建之后的目录末尾自带"/"文件分隔符</strong><br/>
* <strong>image,voice,video目录下会有.nomedia文件来屏蔽系统扫描</strong>
*
* <ul>
* <li>{@link #checkAndCreateFile(String)}根据path创建文件</li>
* <li>{@link #checkAndCreateChildDirectory(String)}根据path创建子目录,自动会在末尾添加"/"文件分隔符</li>
*
* <li>{@link #getExternalStoragePath()}获取SD卡根目录,不要在此进行操作以防污染主目录</li>
* <li>{@link #getExternalStorageTempPath()}获取SD卡主目录下缓存目录</li>
* <li>{@link #createFileInImageDirectory(String)}在temp目录下创建文件并返回</li>
* <li>{@link #clearExternalStorageTemp()}应用退出之后删除temp目录</li>
* <li>{@link #getExternalStorageFilePath()} 获取SD卡主目录下文件目录</li>
* <li>{@link #createFileInFileDirectory(String)} 在file目录下创建文件并返回</li>
* <li>{@link #getExternalStorageImagePath()}获取SD卡主目录下图片目录</li>
* <li>{@link #createFileInImageDirectory(String)}在image目录下创建文件并返回</li>
* <li>{@link #getExternalStorageVoicePath()}获取SD卡主目录下声音目录</li>
* <li>{@link #createFileInVoiceDirectory(String)}在voice目录下创建文件并返回</li>
* <li>{@link #getExternalStorageVideoPath()}获取SD卡主目录下视频目录</li>
* <li>{@link #createFileInVideoDirectory(String)}在video目录下创建文件并返回</li>
* <li>{@link #getExternalStorageHtmlPath()}获取SD卡主目录下网页目录</li>
* <li>{@link #createFileInHtmlDirectory(String)}在html目录下创建文件并返回</li>
*
* <li>{@link #getFileOrDirectorySize(String)}获取目录或者文件的大小,单位KB</li>
* </ul>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-22
*/
public class FileUtils {
/** 外部SD卡根目录下的文件夹名 */
private static final String EXTERNAL_STORAGE_PATH = "/FrameWork";
/** 当temp目录大小超过该值的时候,清空该目录,单位为KB */
private static final long K_BYTES_TO_DELETE = 10 * 1024;
/**
* 检测并且创建文件
*/
public static File checkAndCreateFile(String path){
File file = new File(path);
if (!file.exists())
try {
file.createNewFile();
}catch (IOException e){
e.printStackTrace();
}
return file;
}
/**
* 创建主目录下子目录,自动会在末尾添加"/"文件分隔符
*/
public static String checkAndCreateChildDirectory(String path){
File file = new File(path);
if (!file.exists())
file.mkdirs();
if (!file.exists())
return null;
return path+"/";
}
/**
* 外部{@link #EXTERNAL_STORAGE_PATH}目录或者/data/data/com.android.framework/files/目录(如果SD卡不可用),
* 末尾自带"/"符号
*/
public static String getExternalStoragePath(){
String path = null;
//需要检测外部SD卡的挂载状态
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
path = checkAndCreateChildDirectory(Environment.getExternalStorageDirectory().getPath() + EXTERNAL_STORAGE_PATH);
}
if (path == null){
//如果外部SD卡不可用,使用"/data/data/com.android.framework/files/"目录
path = RootApplication.getInstance().getFilesDir().getPath();
}
if (!path.subSequence(path.length()-1, path.length()).equals("/"))
path += "/";
return path;
}
/**
* 所有在外部存储目录下的子目录都需要在此定义文件夹名
*/
public enum ExternalStorageType{
TEMP("temp"),FILE("file"),IMAGE("image"),VOICE("voice"),VIDEO("video"),HTML("html");
private String typeName;
ExternalStorageType(String typeName){
this.typeName = typeName;
}
public String getFilePath(String parentPath) {
String path = parentPath;
if (!(parentPath.charAt(parentPath.length()-1)=='/')){
path += "/";
}
return path+typeName;
}
}
/**
* 获取外部临时文件目录,过大会自动删除
*/
public static String getExternalStorageTempPath(){
ExternalStorageType type = ExternalStorageType.TEMP;
return checkAndCreateChildDirectory(type.getFilePath(getExternalStoragePath()));
}
/**
* 在外部{@link #getExternalStorageTempPath()}目录下创建文件,
*/
public static File createFileInTempDirectory(String filename){
return checkAndCreateFile(getExternalStorageTempPath() + filename);
}
/**
* 删除外部临时文件目录
*/
public static void clearExternalStorageTemp(){
L.i("application close clear temp directory");
if (getFileOrDirectorySize(getExternalStorageTempPath()) >= K_BYTES_TO_DELETE) {
File file = new File(getExternalStorageTempPath());
File[] files = file.listFiles();
for (File temp : files)
temp.delete();
}
}
/**
* 获取外部文件目录,过大会自动删除
*/
public static String getExternalStorageFilePath(){
ExternalStorageType type = ExternalStorageType.FILE;
return checkAndCreateChildDirectory(type.getFilePath(getExternalStoragePath()));
}
/**
* 在外部{@link #getExternalStorageFilePath()}目录下创建文件,
*/
public static File createFileInFileDirectory(String filename){
return checkAndCreateFile(getExternalStorageTempPath() + filename);
}
/**
* 获取外部图片文件目录,在该目录下会创建.nomedia文件防止系统扫描
*/
public static String getExternalStorageImagePath(){
ExternalStorageType type = ExternalStorageType.IMAGE;
String path = type.getFilePath(getExternalStoragePath());
String result = checkAndCreateChildDirectory(path);
checkAndCreateNoMedia(path);
return result;
}
/**
* 在外部{@link #getExternalStorageImagePath()}目录下创建文件,
*/
public static File createFileInImageDirectory(String filename){
return checkAndCreateFile(getExternalStorageImagePath() + filename);
}
/**
* 获取外部声音文件目录,在该目录下会创建.nomedia文件防止系统扫描
*/
public static String getExternalStorageVoicePath(){
ExternalStorageType type = ExternalStorageType.VOICE;
String path = type.getFilePath(getExternalStoragePath());
String result = checkAndCreateChildDirectory(path);
checkAndCreateNoMedia(path);
return result;
}
/**
* 在外部{@link #getExternalStorageVoicePath()}目录下创建文件,
*/
public static File createFileInVoiceDirectory(String filename){
return checkAndCreateFile(getExternalStorageVoicePath() + filename);
}
/**
* 获取外部视频文件目录,在该目录下会创建.nomedia文件防止系统扫描
*/
public static String getExternalStorageVideoPath(){
ExternalStorageType type = ExternalStorageType.VIDEO;
String path = type.getFilePath(getExternalStoragePath());
String result = checkAndCreateChildDirectory(path);
checkAndCreateNoMedia(path);
return result;
}
/**
* 在外部{@link #getExternalStorageVoicePath()}目录下创建文件,
*/
public static File createFileInVideoDirectory(String filename){
return checkAndCreateFile(getExternalStorageVideoPath() + filename);
}
/**
* 获取外部网页文件目录
*/
public static String getExternalStorageHtmlPath(){
ExternalStorageType type = ExternalStorageType.HTML;
return checkAndCreateChildDirectory(type.getFilePath(getExternalStoragePath()));
}
/**
* 在外部{@link #getExternalStorageHtmlPath()}目录下创建文件,
*/
public static File createFileInHtmlDirectory(String filename){
return checkAndCreateFile(getExternalStorageHtmlPath() + filename);
}
/**
* 获取文件或者目录大小,单位为B
*/
public static long getFileOrDirectorySize(String path){
long size = 0;
if (path == null)
return size;
File file = new File(path);
if (!file.exists())
return size;
if (file.isDirectory()){
File[] files = file.listFiles();
if (files != null) {
for (File temp : files) {
size += getFileOrDirectorySize(temp.getAbsolutePath());
}
}
}else{
size = getFileSize(file);
}
return size;
}
/**
* 文件拷贝
* @param src 源文件
* @param des 目标文件
*/
public static void copyFile(File src, File des){
try {
int byteRead = 0;
InputStream inputStream = new FileInputStream(src);
if (!des.exists())
des.createNewFile();
OutputStream outputStream = new FileOutputStream(des);
byte[] buffer = new byte[1024];
while ( (byteRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, byteRead);
}
inputStream.close();
outputStream.flush();
outputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 检测该目录下是否有nomedia文件,如果没有就创建
*/
private static void checkAndCreateNoMedia(String path){
checkAndCreateFile(path + "/.nomedia");
}
/**
* @return 返回文件大小,单位为byte
*/
private static long getFileSize(File file){
long size = 0;
if (file.exists()){
try {
FileInputStream fis = new FileInputStream(file);
size = fis.available();
}catch (Exception e){
e.printStackTrace();
}
}
return size;
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/utils/ImageUtils.java
================================================
package com.android.libcore.utils;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Picture;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.media.ExifInterface;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.webkit.WebView;
import com.android.libcore.Toast.T;
import com.android.libcore.application.RootApplication;
import com.android.libcore.log.L;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Description: 图片相关处理类
*
* <ol>
* <li>{@link #centerSquareScaleBitmap(Bitmap, int)}截取图片的正中部分</li>
* <li>{@link #toRoundCorner(Bitmap, int)}将图片截成圆角的方法</li>
* <li>{@link #saveBitmap(Bitmap, String, Runnable)}保存图片到制定路径下</li>
* <li>{@link #screenShot(Activity)}截取手机当前屏幕</li>
* <li>{@link #viewShot(View)}截取view的整个显示内容</li>
* <li>{@link #compressBitmap(String, int, int)}等比例压缩图片至指定大小</li>
* <li>{@link #resizeBitmap(Bitmap, int, int)}不等比例缩放bitmap至指定长宽</li>
* <li>{@link #getPictureDegree(String)}获取图片的旋转角度</li>
* <li>{@link #rotateBitmap(Bitmap, int)}旋转图片至指定角度</li>
* </ol>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-31
*/
public class ImageUtils {
/**
* @param bitmap 原图
* @param edgeLength 希望得到的正方形部分的边长
* @return 截取正中部分后的位图。
*/
public static Bitmap centerSquareScaleBitmap(Bitmap bitmap, int edgeLength){
if(null == bitmap || edgeLength <= 0){
return null;
}
Bitmap result = bitmap;
int widthOrg = bitmap.getWidth();
int heightOrg = bitmap.getHeight();
//从图中截取正中间的正方形部分。
int xTopLeft = (widthOrg - edgeLength) / 2;
int yTopLeft = (heightOrg - edgeLength) / 2;
if(xTopLeft==0 && yTopLeft==0)
return result;
try{
result = Bitmap.createBitmap(bitmap, xTopLeft, yTopLeft, edgeLength, edgeLength);
}
catch(OutOfMemoryError e){
return result;
}
return result;
}
/**
* 获取圆角位图的方法
* @param bitmap 需要转化成圆角的位图
* @param pixels 圆角的度数,数值越大,圆角越大
* @return 处理后的圆角位图
*/
public static Bitmap toRoundCorner(Bitmap bitmap, int pixels) {
try {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
final float roundPx = pixels;
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}catch (OutOfMemoryError e){
e.printStackTrace();
return null;
}
}
/**
* 截屏,只能截取当前屏幕显示的区域,不包含status bar
*/
public static Bitmap screenShot(Activity activity){
View view = activity.getWindow().getDecorView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap b1 = view.getDrawingCache();
// 获取状态栏高度
Rect frame = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int statusBarHeight = frame.top;
// 获取屏幕长和高
int width = CommonUtils.getScreenWidth();
int height = CommonUtils.getScreenHeight();
// 去掉标题栏
Bitmap b = Bitmap.createBitmap(b1, 0, statusBarHeight, width, height - statusBarHeight);
view.destroyDrawingCache();
return b;
}
/**
* view截图,webview和scrollview(scrollview需要传入子view)之类的view能够截取整个长度的bitmap,
* 如果webview内容很多,view.draw(Canvas)方法会很耗时,在子进程中操作会有额外的问题,所以会暂时阻塞
* UI主线程,求方法~
*/
public static Bitmap viewShot(final View view){
if (view == null)
return null;
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
// if (view.getMeasuredWidth()<=0 || view.getMeasuredHeight()<=0) {
int measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
view.measure(measureSpec, measureSpec);
// }
if (view.getMeasuredWidth()<=0 || view.getMeasuredHeight()<=0) {
L.e("ImageUtils.viewShot size error");
return null;
}
Bitmap bm;
try {
bm = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
}catch (OutOfMemoryError e){
System.gc();
try {
bm = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
}catch (OutOfMemoryError ee){
L.e("ImageUtils.viewShot error", ee);
return null;
}
}
Canvas bigCanvas = new Canvas(bm);
Paint paint = new Paint();
int iHeight = bm.getHeight();
bigCanvas.drawBitmap(bm, 0, iHeight, paint);
view.draw(bigCanvas);
return bm;
}
/**
* 保存bitmap到指定路径下
* @param finish 保存完之后的回调,不在主线程执行
*/
public static void saveBitmap(final Bitmap bitmap, final String filePath, final Runnable finish) {
if (bitmap == null){
L.w("bitmap is null");
return;
}
new Thread(new Runnable() {
@Override
public void run() {
try {
File file = new File(filePath);
if (!file.exists())
file.createNewFile();
else {
file.delete();
file.createNewFile();
}
//使用FileOutputStream防止OOM
FileOutputStream fos = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (finish != null)
finish.run();
}
}).start();
}
/**
* 等比例压缩图片至合适大小,width=0表示加载原图
*/
public static Bitmap compressBitmap(String filePath, int width, int height){
Bitmap bitmap;
BitmapFactory.Options options = new BitmapFactory.Options();
//返回原图
if (width ==0 || height ==0){
//do nothing
}else{
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(filePath, options);
int widthScale = (int)((float) options.outWidth / (float) width);
int heightScale = (int)((float) options.outHeight / (float) height);
//选择缩放比例较大的那个
int scale = (widthScale > heightScale ? widthScale : heightScale);
if (scale < 1)
scale = 1;
options.inSampleSize = scale;
}
options.inJustDecodeBounds = false;
try {
bitmap = BitmapFactory.decodeFile(filePath, options);
}catch (OutOfMemoryError e){
System.gc();
try {
bitmap = BitmapFactory.decodeFile(filePath, options);
}catch (OutOfMemoryError ee){
L.e("ImageUtils compressBitmap error", ee);
return null;
}
}
return bitmap;
}
/**
* 不等比例缩放bitmap至指定长宽
*/
public static Bitmap resizeBitmap(Bitmap srcBitmap, int w, int h) {
if (srcBitmap == null) {
return null;
}
int width = srcBitmap.getWidth();
int height = srcBitmap.getHeight();
float scaleWidth = ((float) w) / width;
float scaleHeight = ((float) h) / height;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
return Bitmap.createBitmap(srcBitmap, 0, 0, width, height, matrix, true);
}
/**
* 获取图片的旋转角度
*/
public static int getPictureDegree(String path) {
int degree = 0;
try {
ExifInterface exifInterface = new ExifInterface(path);
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
default:
degree = 0;
}
} catch (IOException e) {
e.printStackTrace();
}
return degree;
}
/**
* 旋转图片
* @param bitmap 原始图片
* @param degrees 原始图片的角度
*/
public static Bitmap rotateBitmap(Bitmap bitmap, int degrees){
if (degrees == 0 || null == bitmap) {
return bitmap;
}
Matrix matrix = new Matrix();
matrix.setRotate(degrees, bitmap.getWidth() / 2, bitmap.getHeight() / 2);
Bitmap bmp = null;
try {
bmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}catch (OutOfMemoryError error){
L.e("ImageUtils rotateBitmap error", error);
}
return bmp;
}
/**
* 检测一个文件是否为图片
* @param filePath 该文件路径
*/
public static boolean isFileImage(String filePath){
return filePath.endsWith(".png") || filePath.endsWith(".PNG")
|| filePath.endsWith(".jpg") || filePath.endsWith(".JPG")
|| filePath.endsWith(".jpeg") || filePath.endsWith(".JPEG")
|| filePath.endsWith(".bmp") || filePath.endsWith(".BMP");
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/volley/BaseVolleyApi.java
================================================
package com.android.libcore.volley;
import com.android.libcore.application.RootApplication;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
/**
* Description: 封装的volley的请求
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-09-16
*/
public abstract class BaseVolleyApi {
private static RequestQueue requestQueue;
private static ImageLoader imageLoader;
public static RequestQueue getRequestQueue() {
if (requestQueue == null) {
synchronized (BaseVolleyApi.class){
if (requestQueue == null)
requestQueue = Volley.newRequestQueue(RootApplication.getInstance());
}
}
return requestQueue;
}
public static ImageLoader getImageLoader() {
if (imageLoader == null) {
synchronized (BaseVolleyApi.class) {
if (imageLoader == null){
VolleyLruCache cache = new VolleyLruCache();
imageLoader = new ImageLoader(getRequestQueue(), cache);
}
}
}
return imageLoader;
}
}
================================================
FILE: libcore/src/main/java/com/android/libcore/volley/VolleyLruCache.java
================================================
package com.android.libcore.volley;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import com.android.volley.toolbox.ImageLoader;
/**
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-10-20
*/
public class VolleyLruCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache{
private static int getCacheSize(){
return (int)(Runtime.getRuntime().maxMemory()/1024/8);
}
public VolleyLruCache() {
this(getCacheSize());
}
private VolleyLruCache(int size){
super(size);
}
@Override
public Bitmap getBitmap(String url) {
return get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
put(url, bitmap);
}
}
================================================
FILE: libcore/src/main/res/values/strings.xml
================================================
<resources>
</resources>
================================================
FILE: libcore-ui/.gitignore
================================================
/build
================================================
FILE: libcore-ui/build.gradle
================================================
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.1'
compile project(':libcore')
}
================================================
FILE: libcore-ui/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/zzp/adt-bundle-linux-x86_64-20140702/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: libcore-ui/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.libcore_ui">
<application>
<activity android:name=".web.webactivity.WebActivity"
android:hardwareAccelerated="true"
android:configChanges="orientation|screenSize">
<!--<intent-filter>
<data android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>-->
</activity>
</application>
</manifest>
================================================
FILE: libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseActivity.java
================================================
package com.android.libcore_ui.activity;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.libcore.activity.RootActivity;
import com.android.libcore.log.L;
import com.android.libcore.utils.CommonUtils;
import com.android.libcore_ui.R;
/**
* Description: 继承自{@link RootActivity}的基础activity,在这里进行页面界面的统一<br/><br/>
*
* 使用{@link #setContentView(int)},{@link #setContentView(View)}和
* {@link #setContentView(View, ViewGroup.LayoutParams)}来设置内容区域布局<br/><br/>
*
* 使用{@link #setOriginalContentView(int)},{@link #setOriginalContentView(View)}和
* {@link #setOriginalContentView(View, ViewGroup.LayoutParams)}来设置整体布局<br/><br/>
*
* 应用整体样式现在有status bar透明和底部navigation bar透明两种样式<br/>
* 应用可以使用默认action bar样式,自定义top bar样式有ViewGroup和toolbar两种样式<br/><br/>
*
*
* <ol>
* <li>{@linkplain #mReceiver}用来在组件之间进行广播的接收</li>
* <li>{@linkplain #setTitle(String)}用来设置页面标题</li>
* <li>{@linkplain #addOptionsMenu(View)}用来在自定义top bar的情况下在右侧添加一个按钮</li>
* <li>{@linkplain #onCreateOptionsMenu(Menu)}用来在使用toolbar的情况下操作toolbar</li>
* <li>{@linkplain #addNavigationOnBottom(ViewGroup)}将一个和NavigationBar的高度一样的空白的view添加到viewGroup中</li>
* <li>{@linkplain #onHandleMessageFromFragment(Message)}用来处理fragment传递过来的消息</li>
* </ol>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-08
*/
public abstract class BaseActivity extends RootActivity{
/** 填充19版本以上SDK status bar */
protected View v_status_bar;
/** 头部top bar容器 */
protected FrameLayout fl_top_bar;
/** 头部top bar */
protected View top_bar;
/** 默认action bar */
protected ActionBar actionBar;
/** 内容区域 */
protected FrameLayout base_content;
/** 底部navigation是否透明,如果使用的是Activity_translucent_navigation_bar style,
* 变量则会变成true,调用addBlankOnBottom(View view)函数可以将一个空白的view添加到
* 底部用以填充透明的navigation bar,防止覆盖内容区域 */
protected boolean isNavigationTransparent;
private int mThemeID = 0;
/**应用如果使用NoActionBar主题,则默认为使用toolbar,反之则使用系统actionbar */
protected boolean useToolbar = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
mThemeID = getApplicationInfo().theme;
//如果系统的主题为Activity_translucent_navigation_bar,但是手机没有navigation bar,
// 则将其设置回status bar主题,setTheme()调用一定要在onCreate()之前
if (!CommonUtils.hasNavigationBar()
&& mThemeID==R.style.Activity_translucent_navigation_bar) {
setTheme(R.style.Activity_translucent_status_bar);
mThemeID = R.style.Activity_translucent_status_bar;
}
super.onCreate(savedInstanceState);
initLayout();
}
/**
* 初始化布局
*/
protected void initLayout(){
setOriginalContentView(R.layout.activity_base_layout);
base_content = (FrameLayout) findViewById(R.id.base_content);
defineStyle();
//如果系统没有指定action bar,则选用自定义action bar
if (getSupportActionBar()==null)
chooseTopBar();
else{
useToolbar = false;
actionBar = getSupportActionBar();
}
}
/**
* 定义应用的基本样式
*/
protected void defineStyle(){
//SDK19版本以上才支持样式选择
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
(mThemeID==R.style.Activity_translucent_status_bar ||
mThemeID==R.style.Activity_translucent_navigation_bar)){
v_status_bar = findViewById(R.id.v_status_bar);
int id = getResources().getIdentifier("status_bar_height", "dimen", "android");
v_status_bar.getLayoutParams().height = getResources().getDimensionPixelOffset(id);
//21版本以下使用windowTranslucentStatus,使用自定义view填充status bar
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
v_status_bar.setBackgroundColor(ContextCompat.getColor(this, R.color.bar_color));
v_status_bar.setVisibility(View.VISIBLE);
}
//21版本和以上,特殊处理
else{
if (mThemeID==R.style.Activity_translucent_navigation_bar){
v_status_bar.setBackgroundColor(ContextCompat.getColor(this, R.color.bar_color));
v_status_bar.setVisibility(View.VISIBLE);
}
}
if (CommonUtils.hasNavigationBar()) {
isNavigationTransparent = (mThemeID == R.style.Activity_translucent_navigation_bar);
}
}
}
/**
* 选择应用top bar方式
*/
protected void chooseTopBar(){
fl_top_bar = (FrameLayout) findViewById(R.id.fl_top_bar);
//添加top bar,现在有两种样式的top bar可以使用:一种是自定的viewGroup
if (!useToolbar) {
top_bar = View.inflate(this, R.layout.activity_top_bar_layout, null);
View rl_back = top_bar.findViewById(R.id.rl_back);
rl_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
TextView tv_title = (TextView) top_bar.findViewById(R.id.tv_title);
// 通过 android::label 设置的标题
if (!TextUtils.isEmpty(getTitle()))
tv_title.setText(getTitle());
}
//一种是使用系统控件toolbar
else{
top_bar = View.inflate(this, R.layout.activity_top_toolbar_layout, null);
Toolbar toolbar = (Toolbar) top_bar;
setSupportActionBar(toolbar);
toolbar.setTitleTextAppearance(this, R.style.toolbar_title_appearance);
toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white));
toolbar.setNavigationIcon(R.mipmap.ic_arrow_back);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
// 通过 android::label 设置的标题
if (!TextUtils.isEmpty(getTitle()))
toolbar.setTitle(getTitle());
}
fl_top_bar.addView(top_bar);
}
/**
* 设置内容区域布局
*/
@Override
public void setContentView(int layoutResID) {
LayoutInflater inflater = LayoutInflater.from(this);
View v = inflater.inflate(layoutResID, null);
base_content.addView(v);
}
/**
* 省去类型转换
*/
protected <T extends View> T $(int id){
return (T) super.findViewById(id);
}
/**
* 设置内容区域布局
*/
@Override
public void setContentView(View view) {
base_content.addView(view);
}
/**
* 设置内容区域布局
*/
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
base_content.addView(view, params);
}
/**
* 设置整体布局
*/
protected void setOriginalContentView(int layoutResID){
super.setContentView(layoutResID);
}
/**
* 设置整体布局
*/
protected void setOriginalContentView(View view){
super.setContentView(view);
}
/**
* 设置整体布局
*/
protected void setOriginalContentView(View view, ViewGroup.LayoutParams params){
super.setContentView(view, params);
}
/**
* 设置标题
*/
protected void setTitle(String title){
if (!useToolbar) {
if (actionBar == null)
((TextView) top_bar.findViewById(R.id.tv_title)).setText(title);
else
actionBar.setTitle(title);
}else{
((Toolbar) top_bar).setTitle(title);
}
}
/**
* 将view添加进top bar右侧的相关区域中,适用于不使用toolbar样式
*/
protected void addOptionsMenu(View view){
if (useToolbar || actionBar!=null){
L.e("该样式无法使用addOptionsMenuView,请使用onCreateOptionsMenu");
}else{
((ViewGroup) top_bar.findViewById(R.id.rl_top_extra_content)).addView(view);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (useToolbar || actionBar!=null) {
return super.onCreateOptionsMenu(menu);
}else{
L.e("该样式无法使用onCreateOptionsMenu,请使用addOptionsMenu");
return false;
}
}
/**
* 将一个空白和navigation bar高度一致的view添加进传入的参数view中,保证传进来的view要在正确的位置
*/
public void addNavigationOnBottom(ViewGroup view){
if (CommonUtils.hasNavigationBar() && isNavigationTransparent) {
int id = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
View navigationView = new View(this);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, getResources().getDimensionPixelOffset(id));
navigationView.setLayoutParams(params);
navigationView.setBackgroundColor(ContextCompat.getColor(this, R.color.transparent));
view.addView(navigationView);
}
}
/**
* 是否使用toolbar样式
*/
public boolean isUseToolbar() {
return useToolbar;
}
/**
* 处理来自fragment的消息
*/
protected void onHandleMessageFromFragment(Message msg){}
}
================================================
FILE: libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseActivityWithPopWindow.java
================================================
package com.android.libcore_ui.activity;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import com.android.libcore.utils.CommonUtils;
import com.android.libcore_ui.R;
import com.android.libcore_ui.activity.widget.BottomBarGroupLinearLayout;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Description: 自带底部弹出框的{@link BaseActivity}
*
* 自定义底部弹出框规则:
* <ul>
* <li>{@link #addItemToBottomPopWindow(int, int, String)}方法用来在底部弹出的框内加上选项,用组id,
* 元素id,和元素名称来标识,显示的顺序和添加的顺序一致,如果需要在中间插入一个组元素,则初始化添加的时候调用
* {@link #addItemToBottomPopWindow(int, int, String)}函数的时候,groupId传一个新值,itemId传递一个小于0
* 的数值即可,先占一个空位,方便以后来对该groupId位置的元素进行操作</li>
* <li>{@link #removeItemFromBottomPopWindow(int, int)}方法用来删除在底部添加的按钮选项</li>
* <li>{@link #showBottomPopWindow()}方法用来显示底部popwindow,调用之前确保已经调用
* {@link #addItemToBottomPopWindow(int, int, String)}方法</li>
* <li>{@link #onItemClickCallback(int, int)}方法由子类继承用来处理底部弹出框的点击回调</li>
* </ul>
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-11-05
*/
public class BaseActivityWithPopWindow extends BaseActivity{
/** 全屏的半透明显示 */
protected View ll_full_screen;
/** 底部popWindow */
protected ScrollView sv_bottom_content;
protected LinearLayout ll_bottom_content;
/** 填充19版本以上SDK navigation bar */
protected View v_navigation_bar;
/** 底部弹出框数据集合 */
protected LinkedHashMap<Integer, ArrayList<ItemHolder>> bottomItems;
protected LayoutInflater inflater;
protected ObjectAnimator popAnimation;
protected ObjectAnimator reverseAnimation;
/** 底部弹出框的默认高度 */
protected int scrollViewMeasureHeight;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected void initLayout() {
setOriginalContentView(R.layout.activity_base_layout_with_popwindow);
base_content = (FrameLayout) findViewById(R.id.base_content);
bottomItems = new LinkedHashMap<>();
inflater = LayoutInflater.from(this);
sv_bottom_content = (ScrollView) findViewById(R.id.sv_bottom_content);
ll_bottom_content = (LinearLayout) findViewById(R.id.ll_bottom_content);
ll_full_screen = findViewById(R.id.ll_full_screen);
ll_full_screen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
doReverseAnimation();
}
});
defineStyle();
//如果系统没有指定action bar,则选用自定义action bar
if (getSupportActionBar()==null)
chooseTopBar();
else{
useToolbar = false;
actionBar = getSupportActionBar();
}
}
@Override
protected void defineStyle() {
super.defineStyle();
//SDK19版本以上并且导航栏透明
if (Build.VERSION.SDK_INT >= 19 &&
(getApplicationInfo().theme==R.style.Activity_translucent_status_bar ||
getApplicationInfo().theme==R.style.Activity_translucent_navigation_bar)
&& isNavigationTransparent){
v_navigation_bar = findViewById(R.id.v_navigation_bar);
v_navigation_bar.setVisibility(View.VISIBLE);
int id = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
v_navigation_bar.getLayoutParams().height = getResources().getDimensionPixelOffset(id);
}
}
/**
* 通过添加item到底部bar来创建一系列的选项
* @param groupId 该item的组id,不同的组id在不同的区域内,请使用大于0的数字来表示
* @param itemId 该item的item id,用来标示该item,组内的两个item不能有相同的item id,要不然回调无法识别
* @param name 用来显示该item的名字
*/
protected void addItemToBottomPopWindow(int groupId, int itemId, String name){
ArrayList<ItemHolder> temp;
if (bottomItems.containsKey(groupId)) {
if (itemId < 0){
throw new IllegalArgumentException("groupId can be found,so itemId must bigger than 0 or equal 0");
}
temp = bottomItems.get(groupId);
ItemHolder holder = new ItemHolder();
holder.itemId = itemId;
holder.name = name;
temp.add(holder);
}
else {
temp = new ArrayList<>();
if (itemId >= 0) {
ItemHolder holder = new ItemHolder();
holder.itemId = itemId;
holder.name = name;
temp.add(holder);
}
bottomItems.put(groupId, temp);
}
buildBottomPopWindow();
}
/**
* 将item从底部bar中删除
*/
protected void removeItemFromBottomPopWindow(int groupId, int itemId){
if (bottomItems.containsKey(groupId)){
ArrayList<ItemHolder> temp = bottomItems.get(groupId);
for (ItemHolder holder : temp){
if (holder.itemId == itemId){
temp.remove(holder);
buildBottomPopWindow();
return;
}
}
throw new IllegalArgumentException("can't find this itemId in this groupId");
}else{
throw new IllegalArgumentException("can't find this groupId");
}
}
/**
* 通过{@link #bottomItems}建立底部弹出框
*/
private void buildBottomPopWindow(){
if (bottomItems.size() <= 0)
return;
//现将底部弹出框的所有选项去除
ll_bottom_content.removeAllViews();
popAnimation = null;
reverseAnimation = null;
final Iterator iterator = bottomItems.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry<Integer, ArrayList<ItemHolder>> entry = (Map.Entry<Integer, ArrayList<ItemHolder>>) iterator.next();
Integer groupId = entry.getKey();
ArrayList<ItemHolder> holder = entry.getValue();
//如果该groupId的items不为0,代表需要将该group显示出来
if (holder.size() >= 0){
BottomBarGroupLinearLayout group = (BottomBarGroupLinearLayout) inflater.inflate(R.layout.bottom_group_layout, null);
group.setmGroupId(groupId);
group.setCallback(new BottomBarGroupLinearLayout.GroupItemClickCallback() {
@Override
public void callback(int groupId, int itemId) {
onItemClickCallback(groupId, itemId);
}
});
for (ItemHolder temp : holder){
group.addItemToGroup(temp.itemId, temp.name);
}
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams
(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
int margin = CommonUtils.dp2px(10);
params.setMargins(margin, 0, margin, margin);
ll_bottom_content.addView(group, params);
}
}
//每次组建完底部弹出框之后,就开始计算他的高度
int width = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
sv_bottom_content.measure(width, width);
scrollViewMeasureHeight = sv_bottom_content.getMeasuredHeight();
}
@Override
public void onBackPressed() {
if (sv_bottom_content.getVisibility() == View.VISIBLE){
doReverseAnimation();
}else {
super.onBackPressed();
}
}
/**
* 点击底部弹出框的回调
*/
protected void onItemClickCallback(int groupId, int itemId){
doReverseAnimation();
}
/**
* 执行反向动画将其隐藏
*/
private void doReverseAnimation(){
if (Build.VERSION.SDK_INT < 11) {
sv_bottom_content.setVisibility(View.GONE);
ll_full_screen.setVisibility(View.GONE);
}else{
//如果弹出动画还在执行,则直接将弹出动画的值置为最终值,代表该动画结束,接着直接进行收进动画
popAnimation.end();
//避免用户连续快速点击造成短时间内执行两次收进动画,此处进行判断
if (reverseAnimation != null && reverseAnimation.isRunning()){
return;
}
if (reverseAnimation == null) {
reverseAnimation = ObjectAnimator.ofInt(sv_bottom_content, "bottomMargin", 0, -scrollViewMeasureHeight);
reverseAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int value = (Integer) animation.getAnimatedValue();
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) sv_bottom_content.getLayoutParams();
params.bottomMargin = value;
sv_bottom_content.setLayoutParams(params);
((View) (sv_bottom_content.getParent())).invalidate();
if (value <= -scrollViewMeasureHeight){
sv_bottom_content.setVisibility(View.GONE);
}
ll_full_screen.setAlpha((float) (((scrollViewMeasureHeight + value) * 1.0) / (scrollViewMeasureHeight * 1.0)));
if (ll_full_screen.getAlpha()<=0){
ll_full_screen.setVisibility(View.GONE);
}
}
});
reverseAnimation.setDuration(500);
}
reverseAnimation.start();
}
}
/**
* 用来显示该popwindow,保证在调用该方法之前已经调用{@link #addItemToBottomPopWindow(int, int, String)}方法
*/
protected void showBottomPopWindow(){
if (Build.VERSION.SDK_INT >= 11) {
//如果上次的动画还在执行,直接停止
if (reverseAnimation != null){
reverseAnimation.end();
}
sv_bottom_content.setVisibility(View.VISIBLE);
ll_full_screen.setVisibility(View.VISIBLE);
//需要滚动到顶部
sv_bottom_content.scrollTo(0, 0);
if (popAnimation == null) {
popAnimation = ObjectAnimator.ofInt(sv_bottom_content, "bottomMargin", -scrollViewMeasureHeight, 0);
popAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int value = (Integer) animation.getAnimatedValue();
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) sv_bottom_content.getLayoutParams();
params.bottomMargin = value;
sv_bottom_content.setLayoutParams(params);
((View) (sv_bottom_content.getParent())).invalidate();
ll_full_screen.setAlpha((float) (((scrollViewMeasureHeight + value) * 1.0) / (scrollViewMeasureHeight * 1.0)));
}
});
popAnimation.setDuration(500);
}
popAnimation.start();
}else{
ll_full_screen.setVisibility(View.VISIBLE);
sv_bottom_content.setVisibility(View.VISIBLE);
//需要滚动到顶部
sv_bottom_content.scrollTo(0, 0);
}
}
/**
* 底部item的数据集合
*/
private class ItemHolder{
private int itemId;
private String name;
}
}
================================================
FILE: libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseFragment.java
================================================
package com.android.libcore_ui.activity;
import android.app.Activity;
import android.os.Bundle;
import android.os.Message;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.android.libcore.activity.RootFragment;
/**
* Description: 基础fragment
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-27
*/
public abstract class BaseFragment extends RootFragment{
/** fragment所依附的activity */
protected BaseActivity activity;
/** 整个activity的头部bar,如果某些activity需要改变bar样式,修改该view的子view即可 */
public View top_bar;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof BaseActivity) {
this.activity = (BaseActivity) activity;
top_bar = ((BaseActivity)activity).top_bar;
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mViewContainer = setContentView(inflater, container);
initView();
initData();
return mViewContainer;
}
protected abstract View setContentView(LayoutInflater inflater, @Nullable ViewGroup container);
protected abstract void initView();
protected abstract void initData();
/**
* 根据id值获取view
*/
protected View findViewById(int id){
return mViewContainer.findViewById(id);
}
/**
* 设置该activity页面的标题
*/
protected void setTitle(String title){
activity.setTitle(title);
}
/**
* 用来fragment和activity之间的通信
* @param msg fragment发送给activity的消息
*/
protected void sendMessageToActivity(Message msg){
//通过intent传递的数据量最好不要超过1M,而使用msg.obg变量则可以使用堆中的剩余存储
activity.onHandleMessageFromFragment(msg);
}
}
================================================
FILE: libcore-ui/src/main/java/com/android/libcore_ui/activity/widget/BottomBarGroupLinearLayout.java
================================================
package com.android.libcore_ui.activity.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.libcore_ui.R;
/**
* Description: 专用控件,底部弹出框的容器,该控件不是常用控件
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-14
*/
public class BottomBarGroupLinearLayout extends LinearLayout{
private int mGroupId;
private boolean mHasSetGroupId = false;
private LayoutInflater mInflater;
private GroupItemClickCallback mCallback;
public BottomBarGroupLinearLayout(Context context) {
super(context);
}
public BottomBarGroupLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
/** 设置该项的groupId */
public void setmGroupId(int mGroupId){
this.mGroupId = mGroupId;
mHasSetGroupId = true;
mInflater = LayoutInflater.from(getContext());
}
public void addItemToGroup(int itemId, String name){
if (!mHasSetGroupId){
throw new IllegalArgumentException("set mGroupId first");
}
View view = mInflater.inflate(R.layout.bottom_item_layout, null);
TextView tv_item_name = (TextView) view.findViewById(R.id.tv_item_name);
tv_item_name.setText(name);
//设置textview的弧角
if (getChildCount() == 0){
tv_item_name.setBackgroundResource(R.drawable.bottom_button_all_selector);
}else{
tv_item_name.setBackgroundResource(R.drawable.bottom_button_bottom_selector);
if (getChildCount() == 1){
getChildAt(getChildCount() - 1).findViewById(R.id.tv_item_name).setBackgroundResource(R.drawable.bottom_button_top_selector);
}
else{
getChildAt(getChildCount() - 1).findViewById(R.id.tv_item_name).setBackgroundResource(R.drawable.bottom_button_middle_selector);
}
}
view.setTag(itemId);
this.addView(view);
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mCallback.callback(mGroupId, (Integer) v.getTag());
}
});
//将最后一个view的底部分割线去除
for (int i=0; i<getChildCount(); i++){
getChildAt(i).findViewById(R.id.v_line).setVisibility(View.VISIBLE);
}
getChildAt(getChildCount()-1).findViewById(R.id.v_line).setVisibility(View.GONE);
}
public void setCallback(GroupItemClickCallback callback){
this.mCallback = callback;
}
/**
* 点击item之后的回调
*/
public interface GroupItemClickCallback{
public void callback(int groupId, int ItemId);
}
}
================================================
FILE: libcore-ui/src/main/java/com/android/libcore_ui/application/BaseApplication.java
================================================
package com.android.libcore_ui.application;
import com.android.libcore.application.RootApplication;
/**
* Description:
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-09
*/
public class BaseApplication extends RootApplication{
}
================================================
FILE: libcore-ui/src/main/java/com/android/libcore_ui/dialog/AppDialog.java
================================================
package com.android.libcore_ui.dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.libcore.dialog.BaseDialog;
import com.android.libcore_ui.R;
/**
* Description: 扩展dialog类,用来统一dialog的样式和实线dialog的功能,请在此处定义好一个应用
* 的dialog样式,并且保证一个应用的都使用该dialog
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-16
*/
public class AppDialog extends BaseDialog implements View.OnClickListener{
/** 标题 */
private RelativeLayout rl_title;
private TextView tv_title;
/** 内容 */
private RelativeLayout rl_message;
private TextView tv_message;
/** 底部按钮 */
private LinearLayout ll_bottom_button;
private LayoutInflater inflater;
public AppDialog(Context context) {
super(context, R.style.theme_dialog);
inflater = LayoutInflater.from(getContext());
//仿QQ的dialog样式
setContentView(R.layout.dialog_base_layout);
rl_title = (RelativeLayout) findViewById(R.id.rl_title);
tv_title = (TextView) findViewById(R.id.tv_title);
rl_message = (RelativeLayout) findViewById(R.id.rl_message);
tv_message = (TextView) findViewById(R.id.tv_message);
ll_bottom_button = (LinearLayout) findViewById(R.id.ll_bottom_button);
}
@Override
public BaseDialog setTitle(String title) {
mHasTitle = true;
tv_title.setText(title);
return this;
}
@Override
public BaseDialog setTitle(View title) {
mHasTitle = true;
rl_title.removeView(tv_title);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams
(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
rl_title.addView(title, params);
return this;
}
@Override
public BaseDialog setMessage(String message) {
tv_message.setText(message);
return this;
}
@Override
public BaseDialog setMessage(View message) {
rl_message.removeView(tv_message);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams
(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
rl_message.addView(message, params);
return this;
}
private LinearLayout generateLayout(String text){
LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dialog_item_button_layout, null);
View v_line = layout.findViewById(R.id.v_line);
TextView tv_text = (TextView) layout.findViewById(R.id.tv_text);
tv_text.setText(text);
if (ll_bottom_button.getChildCount() == 0){
layout.removeView(v_line);
tv_text.setBackgroundResource(R.drawable.dialog_button_bottom_selector);
}
else if (ll_bottom_button.getChildCount() == 1){
tv_text.setBackgroundResource(R.drawable.dialog_button_bottomright_selector);
}
else{
tv_text.setBackgroundResource(R.drawable.dialog_button_bottomright_selector);
}
reBuildCircle();
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.weight = 1;
layout.setLayoutParams(params);
layout.setOnClickListener(this);
return layout;
}
private void reBuildCircle(){
//因为textview是math_parent,并且该textview的背景颜色不为空,所以覆盖掉父控件的圆弧,所以只能动态设置
//textview的圆弧
if (ll_bottom_button.getChildCount() == 1){
View v = ll_bottom_button.getChildAt(0).findViewById(R.id.tv_text);
if (v != null)
v.setBackgroundResource(R.drawable.dialog_button_bottomleft_selector);
}
//如果大于等于2个,需要将上一个变成没有圆弧并且自己变成右圆弧
else if(ll_bottom_button.getChildCount() > 1){
View v = ll_bottom_button.getChildAt(ll_bottom_button.getChildCount() - 1);
v = v.findViewById(R.id.tv_text);
if (v != null)
v.setBackgroundResource(R.drawable.dialog_button_middle_selector);
}
}
@Override
public BaseDialog setPositiveButton(String positive) {
LinearLayout layout = generateLayout(positive);
layout.setTag(POSITIVE_LISTENER);
ll_bottom_button.addView(layout);
return this;
}
@Override
public BaseDialog setPositiveButton(View positive) {
View layout = positive;
//超过一个view,应该加上一条分割线
if (ll_bottom_button.getChildCount() > 0){
layout = inflater.inflate(R.layout.dialog_item_button_layout, null);
((ViewGroup)layout).removeViewAt(1);
((ViewGroup)layout).addView(positive);
}
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.weight = 1;
layout.setTag(POSITIVE_LISTENER);
layout.setOnClickListener(this);
ll_bottom_button.addView(layout, params);
return this;
}
@Override
public BaseDialog setNegativeButton(String negative) {
LinearLayout layout = generateLayout(negative);
layout.setTag(NEGATIVE_LISTENER);
ll_bottom_button.addView(layout);
return this;
}
@Override
public BaseDialog setNegativeButton(View negative) {
View layout = negative;
//超过一个view,应该加上一条分割线
if (ll_bottom_button.getChildCount() > 0){
layout = inflater.inflate(R.layout.dialog_item_button_layout, null);
((ViewGroup)layout).removeViewAt(1);
((ViewGroup)layout).addView(negative);
}
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.weight = 1;
layout.setTag(NEGATIVE_LISTENER);
layout.setOnClickListener(this);
ll_bottom_button.addView(layout, params);
return this;
}
@Override
public BaseDialog setNeutralButton(String neutral) {
LinearLayout layout = generateLayout(neutral);
layout.setTag(NEUTRAL_LISTENER);
ll_bottom_button.addView(layout);
return this;
}
@Override
public BaseDialog setNeutralButton(View neutral) {
View layout = neutral;
//超过一个view,应该加上一条分割线
if (ll_bottom_button.getChildCount() > 0){
layout = inflater.inflate(R.layout.dialog_item_button_layout, null);
((ViewGroup)layout).removeViewAt(1);
((ViewGroup)layout).addView(neutral);
}
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.weight = 1;
layout.setTag(NEUTRAL_LISTENER);
layout.setOnClickListener(this);
ll_bottom_button.addView(layout, params);
return this;
}
@Override
public BaseDialog addOtherButton(String other, int other_listener) {
if (!checkIllegalId(other_listener)){
throw new IllegalArgumentException("按钮id重复");
}
LinearLayout layout = generateLayout(other);
layout.setTag(other_listener);
mIds.add(other_listener);
ll_bottom_button.addView(layout);
return this;
}
@Override
public BaseDialog addOtherButton(View other, int other_listener) {
if (!checkIllegalId(other_listener)){
throw new IllegalArgumentException("按钮id重复");
}
reBuildCircle();
View layout = other;
layout = inflater.inflate(R.layout.dialog_item_button_layout, null);
//超过一个view,应该加上一条分割线
if (ll_bottom_button.getChildCount() == 0){
((ViewGroup)layout).removeViewAt(0);
}
((ViewGroup)layout).removeViewAt(1);
((ViewGroup)layout).addView(other, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.weight = 1;
other.setTag(other_listener);
other.setOnClickListener(this);
layout.setTag(other_listener);
layout.setOnClickListener(this);
ll_bottom_button.addView(layout, params);
return this;
}
@Override
public BaseDialog setGravity(int gravity) {
Window window = this.getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.gravity = gravity;
window.setAttributes(params);
return this;
}
@Override
public BaseDialog setPosition(int x, int y) {
Window window = this.getWindow();
WindowManager.LayoutParams params = window.getAttributes();
window.setAttributes(params);
return this;
}
@Override
public BaseDialog setWidth(int width) {
Window window = this.getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.width = width;
window.setAttributes(params);
return this;
}
@Override
public BaseDialog setHeight(int height) {
Window window = this.getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.height = height;
window.setAttributes(params);
return this;
}
@Override
public BaseDialog setAlpha(float alpha) {
Window window = this.getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.alpha = alpha;
window.setAttributes(params);
return null;
}
@Override
public void show() {
if (!mHasTitle)
rl_title.setVisibility(View.GONE);
super.show();
}
@Override
public void onClick(View v) {
this.dismiss();
mListener.onButtonClick((Integer) v.getTag());
}
}
================================================
FILE: libcore-ui/src/main/java/com/android/libcore_ui/dialog/DialogCreator.java
================================================
package com.android.libcore_ui.dialog;
import android.view.View;
import com.android.libcore_ui.application.BaseApplication;
import java.util.ArrayList;
/**
* Description: dialog的生成类,用来获取所需要基本常用的dialog
*
* @author zzp(zhao_zepeng@hotmail.com)
* @since 2015-07-16
*/
public class DialogCreator {
/**
* 创建dialog函数
* @param title 只能为string和view
* @param message 只能为string和view
* @param positive 只能为string和view
*/
public static AppDialog createDialog(Object title, Object message, Object positive){
return createDialog(title, message, positive, null);
}
/**
* 创建dialog函数
* @param title 只能为string和view
* @param message 只能为string和view
* @param positive 只能为string和view
* @param negative 只能为string和view
*/
public static AppDialog createDialog(Object title, Object message, Object positive, Object negative){
return createDialog(title, message, positive, negative, null);
}
/**
gitextract_h9zek9ps/
├── .gitignore
├── .idea/
│ ├── compiler.xml
│ ├── copyright/
│ │ └── profiles_settings.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── LICENSE
├── README.md
├── README.md~
├── build.gradle
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── libcore/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── android/
│ │ └── libcore/
│ │ ├── Toast/
│ │ │ └── T.java
│ │ ├── activity/
│ │ │ ├── ActivityManager.java
│ │ │ ├── RootActivity.java
│ │ │ └── RootFragment.java
│ │ ├── application/
│ │ │ └── RootApplication.java
│ │ ├── cachemanager/
│ │ │ └── CacheManager.java
│ │ ├── database/
│ │ │ ├── BaseDB.java
│ │ │ ├── BaseDBHelper.java
│ │ │ └── IBaseDBTable.java
│ │ ├── dialog/
│ │ │ └── BaseDialog.java
│ │ ├── download/
│ │ │ ├── DownloadDB.java
│ │ │ ├── DownloadDBHelper.java
│ │ │ └── FileDownloadManager.java
│ │ ├── guide/
│ │ │ └── GuideManager.java
│ │ ├── log/
│ │ │ └── L.java
│ │ ├── net/
│ │ │ ├── NetError.java
│ │ │ ├── imageloader/
│ │ │ │ ├── ImageLoader.java
│ │ │ │ └── VolleyLruCache.java
│ │ │ └── netapi/
│ │ │ └── BaseNetApi.java
│ │ ├── utils/
│ │ │ ├── CommonUtils.java
│ │ │ ├── FileUtils.java
│ │ │ └── ImageUtils.java
│ │ └── volley/
│ │ ├── BaseVolleyApi.java
│ │ └── VolleyLruCache.java
│ └── res/
│ └── values/
│ └── strings.xml
├── libcore-ui/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── android/
│ │ └── libcore_ui/
│ │ ├── activity/
│ │ │ ├── BaseActivity.java
│ │ │ ├── BaseActivityWithPopWindow.java
│ │ │ ├── BaseFragment.java
│ │ │ └── widget/
│ │ │ └── BottomBarGroupLinearLayout.java
│ │ ├── application/
│ │ │ └── BaseApplication.java
│ │ ├── dialog/
│ │ │ ├── AppDialog.java
│ │ │ ├── DialogCreator.java
│ │ │ └── LoadingDialog.java
│ │ ├── net/
│ │ │ ├── NetApi.java
│ │ │ └── request/
│ │ │ └── XMLRequest.java
│ │ ├── permanentdbcache/
│ │ │ ├── PermanentCacheDB.java
│ │ │ └── PermanentCacheDBHelper.java
│ │ ├── volley/
│ │ │ ├── VolleyApi.java
│ │ │ └── request/
│ │ │ └── XMLRequest.java
│ │ ├── web/
│ │ │ ├── WebFragment.java
│ │ │ └── webactivity/
│ │ │ ├── WebActivity.java
│ │ │ └── WebActivityFragment.java
│ │ └── widget/
│ │ ├── FlowLayout.java
│ │ └── SimpleGridLayout.java
│ └── res/
│ ├── drawable/
│ │ ├── base_dialog_shape.xml
│ │ ├── bg_edittext.xml
│ │ ├── bg_edittext_focus.xml
│ │ ├── bg_edittext_not_focus.xml
│ │ ├── bg_loading_dialog.xml
│ │ ├── bg_progress_bar.xml
│ │ ├── bottom_button_all_selector.xml
│ │ ├── bottom_button_bottom_selector.xml
│ │ ├── bottom_button_middle_selector.xml
│ │ ├── bottom_button_shape.xml
│ │ ├── bottom_button_top_selector.xml
│ │ ├── dialog_button_bottom_selector.xml
│ │ ├── dialog_button_bottomleft_selector.xml
│ │ ├── dialog_button_bottomright_selector.xml
│ │ └── dialog_button_middle_selector.xml
│ ├── layout/
│ │ ├── activity_base_layout.xml
│ │ ├── activity_base_layout_with_popwindow.xml
│ │ ├── activity_top_bar_layout.xml
│ │ ├── activity_top_toolbar_layout.xml
│ │ ├── activity_web_layout.xml
│ │ ├── bottom_group_layout.xml
│ │ ├── bottom_item_layout.xml
│ │ ├── bottom_popwindow_layout.xml
│ │ ├── dialog_base_layout.xml
│ │ ├── dialog_item_button_layout.xml
│ │ ├── dialog_js_prompt_message_layout.xml
│ │ ├── loading_dialog_layout.xml
│ │ └── menu_refresh_layout.xml
│ ├── menu/
│ │ └── menu_webactivity_refresh.xml
│ ├── values/
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-v19/
│ │ └── styles.xml
│ ├── values-v21/
│ │ └── styles.xml
│ └── values-v23/
│ └── styles.xml
├── settings.gradle
└── testsample/
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src/
└── main/
├── AndroidManifest.xml
├── assets/
│ ├── 1.html
│ ├── baidu.html
│ └── baidu_files/
│ ├── activity_start_52498d2c.js
│ ├── all_async_search_57459356.js
│ ├── jquery-1.10.2_d88366fd.js
│ ├── min_nav_9dda26ef.js
│ ├── min_super_6a1867d5.js
│ ├── min_tips_27647c7d.js
│ ├── nav_min_22274039.css
│ ├── sbase_6ae84319.js
│ ├── super_min_de974358.css
│ └── xmancard_c006cb6f.js
├── java/
│ └── com/
│ └── android/
│ └── sample/
│ ├── HomeTestActivity.java
│ ├── test_activity/
│ │ ├── ActivityA.java
│ │ ├── ActivityB.java
│ │ └── ActivityTestHomePage.java
│ ├── test_cache/
│ │ └── CacheActivity.java
│ ├── test_db/
│ │ ├── DBActivity.java
│ │ └── db/
│ │ ├── StudentDB.java
│ │ └── StudentHelper.java
│ ├── test_dialog/
│ │ └── DialogActivity.java
│ ├── test_download/
│ │ └── DownloadActivity.java
│ ├── test_guide/
│ │ └── GuideActivity.java
│ ├── test_imageloader/
│ │ ├── ImageActivity.java
│ │ └── PicUrl.java
│ ├── test_netapi/
│ │ └── NetActivity.java
│ ├── test_utils/
│ │ ├── CommonActivity.java
│ │ ├── FileActivity.java
│ │ ├── ImageActivity.java
│ │ └── UtilsActivity.java
│ ├── test_volley/
│ │ └── VolleyActivity.java
│ ├── test_webview/
│ │ ├── TestWebFragment.java
│ │ └── WebViewActivity.java
│ └── test_widget/
│ ├── FlowLayoutActivity.java
│ ├── GridLayoutActivity.java
│ └── WidgetActivity.java
└── res/
├── drawable/
│ ├── button_forthpage_selector.xml
│ ├── button_homepage_selector.xml
│ ├── button_secondpage_selector.xml
│ └── button_thirdpage_selector.xml
├── layout/
│ ├── activity_home_test.xml
│ ├── activity_test_activity_a.xml
│ ├── activity_test_activity_b.xml
│ ├── activity_test_activity_homepage.xml
│ ├── activity_test_cache.xml
│ ├── activity_test_common.xml
│ ├── activity_test_db.xml
│ ├── activity_test_dialog.xml
│ ├── activity_test_download.xml
│ ├── activity_test_file.xml
│ ├── activity_test_flow.xml
│ ├── activity_test_grid.xml
│ ├── activity_test_guide.xml
│ ├── activity_test_image.xml
│ ├── activity_test_imageloader.xml
│ ├── activity_test_net.xml
│ ├── activity_test_utils.xml
│ ├── activity_test_webview.xml
│ ├── activity_test_widget.xml
│ ├── guide_test_1.xml
│ ├── guide_test_2.xml
│ ├── guide_test_3.xml
│ └── menu_activity_home_test_search.xml
├── menu/
│ └── menu_activity_home_test.xml
└── values/
├── colors.xml
├── strings.xml
├── strings_activity.xml
└── styles.xml
SYMBOL INDEX (920 symbols across 73 files)
FILE: libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseActivity.java
class BaseActivity (line 48) | public abstract class BaseActivity extends RootActivity{
method onCreate (line 70) | @Override
method initLayout (line 87) | protected void initLayout(){
method defineStyle (line 105) | protected void defineStyle(){
method chooseTopBar (line 137) | protected void chooseTopBar(){
method setContentView (line 178) | @Override
method $ (line 188) | protected <T extends View> T $(int id){
method setContentView (line 195) | @Override
method setContentView (line 203) | @Override
method setOriginalContentView (line 211) | protected void setOriginalContentView(int layoutResID){
method setOriginalContentView (line 218) | protected void setOriginalContentView(View view){
method setOriginalContentView (line 225) | protected void setOriginalContentView(View view, ViewGroup.LayoutParam...
method setTitle (line 232) | protected void setTitle(String title){
method addOptionsMenu (line 246) | protected void addOptionsMenu(View view){
method onCreateOptionsMenu (line 254) | @Override
method addNavigationOnBottom (line 267) | public void addNavigationOnBottom(ViewGroup view){
method isUseToolbar (line 282) | public boolean isUseToolbar() {
method onHandleMessageFromFragment (line 289) | protected void onHandleMessageFromFragment(Message msg){}
FILE: libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseActivityWithPopWindow.java
class BaseActivityWithPopWindow (line 42) | public class BaseActivityWithPopWindow extends BaseActivity{
method onCreate (line 61) | @Override
method initLayout (line 66) | @Override
method defineStyle (line 95) | @Override
method addItemToBottomPopWindow (line 116) | protected void addItemToBottomPopWindow(int groupId, int itemId, Strin...
method removeItemFromBottomPopWindow (line 144) | protected void removeItemFromBottomPopWindow(int groupId, int itemId){
method buildBottomPopWindow (line 163) | private void buildBottomPopWindow(){
method onBackPressed (line 201) | @Override
method onItemClickCallback (line 213) | protected void onItemClickCallback(int groupId, int itemId){
method doReverseAnimation (line 220) | private void doReverseAnimation(){
method showBottomPopWindow (line 260) | protected void showBottomPopWindow(){
class ItemHolder (line 299) | private class ItemHolder{
FILE: libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseFragment.java
class BaseFragment (line 19) | public abstract class BaseFragment extends RootFragment{
method onAttach (line 26) | @Override
method onCreate (line 35) | @Override
method onCreateView (line 40) | @Nullable
method setContentView (line 49) | protected abstract View setContentView(LayoutInflater inflater, @Nulla...
method initView (line 51) | protected abstract void initView();
method initData (line 52) | protected abstract void initData();
method findViewById (line 57) | protected View findViewById(int id){
method setTitle (line 64) | protected void setTitle(String title){
method sendMessageToActivity (line 72) | protected void sendMessageToActivity(Message msg){
FILE: libcore-ui/src/main/java/com/android/libcore_ui/activity/widget/BottomBarGroupLinearLayout.java
class BottomBarGroupLinearLayout (line 18) | public class BottomBarGroupLinearLayout extends LinearLayout{
method BottomBarGroupLinearLayout (line 24) | public BottomBarGroupLinearLayout(Context context) {
method BottomBarGroupLinearLayout (line 28) | public BottomBarGroupLinearLayout(Context context, AttributeSet attrs) {
method setmGroupId (line 33) | public void setmGroupId(int mGroupId){
method addItemToGroup (line 39) | public void addItemToGroup(int itemId, String name){
method setCallback (line 76) | public void setCallback(GroupItemClickCallback callback){
type GroupItemClickCallback (line 83) | public interface GroupItemClickCallback{
method callback (line 84) | public void callback(int groupId, int ItemId);
FILE: libcore-ui/src/main/java/com/android/libcore_ui/application/BaseApplication.java
class BaseApplication (line 11) | public class BaseApplication extends RootApplication{
FILE: libcore-ui/src/main/java/com/android/libcore_ui/dialog/AppDialog.java
class AppDialog (line 23) | public class AppDialog extends BaseDialog implements View.OnClickListener{
method AppDialog (line 38) | public AppDialog(Context context) {
method setTitle (line 50) | @Override
method setTitle (line 57) | @Override
method setMessage (line 68) | @Override
method setMessage (line 74) | @Override
method generateLayout (line 84) | private LinearLayout generateLayout(String text){
method reBuildCircle (line 108) | private void reBuildCircle(){
method setPositiveButton (line 125) | @Override
method setPositiveButton (line 133) | @Override
method setNegativeButton (line 152) | @Override
method setNegativeButton (line 160) | @Override
method setNeutralButton (line 179) | @Override
method setNeutralButton (line 187) | @Override
method addOtherButton (line 206) | @Override
method addOtherButton (line 218) | @Override
method setGravity (line 243) | @Override
method setPosition (line 252) | @Override
method setWidth (line 260) | @Override
method setHeight (line 269) | @Override
method setAlpha (line 278) | @Override
method show (line 287) | @Override
method onClick (line 294) | @Override
FILE: libcore-ui/src/main/java/com/android/libcore_ui/dialog/DialogCreator.java
class DialogCreator (line 15) | public class DialogCreator {
method createDialog (line 23) | public static AppDialog createDialog(Object title, Object message, Obj...
method createDialog (line 34) | public static AppDialog createDialog(Object title, Object message, Obj...
method createDialog (line 46) | public static AppDialog createDialog(Object title, Object message, Obj...
method createDialog (line 59) | public static AppDialog createDialog(Object title, Object message, Obj...
class OtherButton (line 127) | public static class OtherButton{
method OtherButton (line 132) | public OtherButton(String text, Integer id){
method OtherButton (line 136) | public OtherButton(View view, Integer id){
FILE: libcore-ui/src/main/java/com/android/libcore_ui/dialog/LoadingDialog.java
class LoadingDialog (line 15) | public class LoadingDialog extends Dialog{
method LoadingDialog (line 18) | public LoadingDialog(Context context) {
method LoadingDialog (line 22) | public LoadingDialog(Context context, int themeResId) {
method setLoadingText (line 28) | public void setLoadingText(String text){
FILE: libcore-ui/src/main/java/com/android/libcore_ui/net/NetApi.java
class NetApi (line 19) | public class NetApi extends BaseNetApi{
method getInstance (line 22) | public static NetApi getInstance(){
method xmlRequest (line 33) | public void xmlRequest(Context context, String url, Map<String, String...
FILE: libcore-ui/src/main/java/com/android/libcore_ui/net/request/XMLRequest.java
class XMLRequest (line 24) | public class XMLRequest extends Request<XmlPullParser>{
method XMLRequest (line 28) | public XMLRequest(int method, String url, Response.Listener<XmlPullPar...
method getParams (line 35) | @Override
method onFinish (line 40) | @Override
method deliverResponse (line 46) | @Override
method parseNetworkResponse (line 53) | @Override
FILE: libcore-ui/src/main/java/com/android/libcore_ui/permanentdbcache/PermanentCacheDB.java
class PermanentCacheDB (line 17) | public class PermanentCacheDB extends BaseDB{
method PermanentCacheDB (line 19) | public PermanentCacheDB(IBaseDBTable table, boolean writable) {
method getDBName (line 23) | @Override
method getDBVersion (line 28) | @Override
method onDBCreate (line 33) | @Override
method onDBUpgrade (line 51) | @Override
type TABLES (line 64) | public enum TABLES implements IBaseDBTable {
method getTableColumns (line 66) | @Override
method TABLES (line 75) | TABLES(String table_name){
method getTableName (line 79) | @Override
method getTableColumns (line 84) | @Override
FILE: libcore-ui/src/main/java/com/android/libcore_ui/permanentdbcache/PermanentCacheDBHelper.java
class PermanentCacheDBHelper (line 15) | public class PermanentCacheDBHelper extends BaseDBHelper{
method getInstance (line 18) | public static PermanentCacheDBHelper getInstance(){
method PermanentCacheDBHelper (line 29) | private PermanentCacheDBHelper(){
method set (line 37) | public boolean set(String key, String value){
method del (line 49) | public boolean del(String key){
method clear (line 58) | public boolean clear(){
method get (line 66) | public String get(String key){
method initInsertDB (line 76) | @Override
method initDeleteDB (line 81) | @Override
method initUpdateDB (line 86) | @Override
method initQueryDB (line 91) | @Override
FILE: libcore-ui/src/main/java/com/android/libcore_ui/volley/VolleyApi.java
class VolleyApi (line 10) | public class VolleyApi extends BaseVolleyApi{
FILE: libcore-ui/src/main/java/com/android/libcore_ui/volley/request/XMLRequest.java
class XMLRequest (line 22) | public class XMLRequest extends Request<XmlPullParser>{
method XMLRequest (line 25) | public XMLRequest(int method, String url, Response.Listener<XmlPullPar...
method onFinish (line 31) | @Override
method deliverResponse (line 37) | @Override
method parseNetworkResponse (line 44) | @Override
FILE: libcore-ui/src/main/java/com/android/libcore_ui/web/WebFragment.java
class WebFragment (line 34) | public class WebFragment extends BaseFragment{
method setContentView (line 44) | @Override
method initView (line 49) | @SuppressLint("SetJavaScriptEnabled")
method initData (line 64) | @Override
method getWebView (line 73) | public WebView getWebView(){
method loadUrl (line 80) | public void loadUrl(String url){
method canGoBack (line 87) | public boolean canGoBack(){
method goBack (line 94) | public void goBack(){
method refresh (line 101) | public void refresh(){
method stopLoading (line 108) | public void stopLoading(){
method handleUrlBeforeLoad (line 113) | protected boolean handleUrlBeforeLoad(String url){
method onPageStarted (line 116) | protected void onPageStarted(WebView view, String url, Bitmap favicon){}
method onPageFinished (line 117) | protected void onPageFinished(WebView view, String url){}
class FrameworkWebViewClient (line 119) | private class FrameworkWebViewClient extends WebViewClient {
method shouldOverrideUrlLoading (line 121) | @Override
method onPageStarted (line 128) | @Override
method onPageFinished (line 135) | @Override
method onReceivedError (line 142) | @Override
method onProgressChanged (line 151) | protected void onProgressChanged(WebView view, int newProgress){}
method onReceivedIcon (line 152) | protected void onReceivedIcon(WebView view, Bitmap icon){}
method onReceivedTitle (line 153) | protected void onReceivedTitle(WebView view, String title){}
class FrameworkChromeClient (line 155) | private class FrameworkChromeClient extends WebChromeClient {
method onProgressChanged (line 157) | @Override
method onReceivedIcon (line 164) | @Override
method onReceivedTitle (line 171) | @Override
method onJsAlert (line 179) | @Override
method onJsConfirm (line 187) | @Override
method onJsPrompt (line 205) | @Override
method onResume (line 227) | @Override
method onPause (line 234) | @Override
method invokeMethod (line 243) | protected void invokeMethod(String method){
method setCallback (line 256) | public void setCallback(WebCallback callback) {
class WebCallback (line 261) | public static class WebCallback{
method onPageStarted (line 262) | public void onPageStarted(String url, Bitmap favicon){}
method onPageFinished (line 263) | public void onPageFinished(String url){}
method onProgressChanged (line 264) | public void onProgressChanged(int progress){}
method onReceivedIcon (line 265) | public void onReceivedIcon(Bitmap icon){}
method onReceivedTitle (line 266) | public void onReceivedTitle(String title){}
FILE: libcore-ui/src/main/java/com/android/libcore_ui/web/webactivity/WebActivity.java
class WebActivity (line 32) | public class WebActivity extends BaseActivity{
method onCreate (line 42) | @Override
method initView (line 49) | protected void initView() {
method onConfigurationChanged (line 77) | @Override
method initData (line 87) | protected void initData() {
method onCreateOptionsMenu (line 95) | @Override
method onBackPressed (line 108) | @Override
method onHandleMessageFromFragment (line 116) | @Override
FILE: libcore-ui/src/main/java/com/android/libcore_ui/web/webactivity/WebActivityFragment.java
class WebActivityFragment (line 24) | public class WebActivityFragment extends WebFragment {
method initView (line 26) | @Override
method handleUrlBeforeLoad (line 38) | @Override
method onPageStarted (line 58) | @Override
method onPageFinished (line 65) | @Override
method onProgressChanged (line 72) | @Override
method onReceivedIcon (line 80) | @Override
method onReceivedTitle (line 88) | @Override
FILE: libcore-ui/src/main/java/com/android/libcore_ui/widget/FlowLayout.java
class FlowLayout (line 18) | public class FlowLayout extends ViewGroup{
method FlowLayout (line 35) | public FlowLayout(Context context) {
method FlowLayout (line 39) | public FlowLayout(Context context, AttributeSet attrs) {
method FlowLayout (line 43) | public FlowLayout(Context context, AttributeSet attrs, int defStyleAtt...
method getAttrValue (line 48) | private void getAttrValue(AttributeSet attrs){
method onMeasure (line 77) | @Override
method onLayout (line 264) | @Override
method setOrientation (line 278) | public void setOrientation(int orientation){
method getOrientation (line 285) | public int getOrientation(){
method checkLayoutParams (line 289) | @Override
method generateDefaultLayoutParams (line 294) | @Override
method generateLayoutParams (line 299) | @Override
method generateLayoutParams (line 304) | @Override
class LayoutParams (line 309) | public static class LayoutParams extends ViewGroup.LayoutParams{
method LayoutParams (line 313) | public LayoutParams(ViewGroup.LayoutParams source) {
method LayoutParams (line 317) | public LayoutParams(Context c, AttributeSet attrs) {
method LayoutParams (line 321) | public LayoutParams(int width, int height) {
method setXY (line 325) | public void setXY(int x, int y){
class ChildSizeTooLongException (line 331) | public static class ChildSizeTooLongException extends RuntimeException{
method ChildSizeTooLongException (line 332) | public ChildSizeTooLongException(String message){
FILE: libcore-ui/src/main/java/com/android/libcore_ui/widget/SimpleGridLayout.java
class SimpleGridLayout (line 18) | public class SimpleGridLayout extends ViewGroup{
method SimpleGridLayout (line 23) | public SimpleGridLayout(Context context) {
method SimpleGridLayout (line 27) | public SimpleGridLayout(Context context, AttributeSet attrs) {
method onMeasure (line 38) | @Override
method onLayout (line 69) | @Override
FILE: libcore/src/main/java/com/android/libcore/Toast/T.java
class T (line 18) | public class T {
method getInstance (line 26) | public static T getInstance() {
method T (line 37) | private T(){
method setGravity (line 43) | public T setGravity(int mGravity) {
method setxOffset (line 51) | public T setxOffset(int xOffset) {
method setyOffset (line 59) | public T setyOffset(int yOffset) {
method showShort (line 64) | public void showShort(String message){
method showShort (line 71) | public void showShort(String message, View v){
method showLong (line 85) | public void showLong(String message){
method showLong (line 92) | public void showLong(String message, View v){
method reset (line 106) | private void reset(){
FILE: libcore/src/main/java/com/android/libcore/activity/ActivityManager.java
class ActivityManager (line 26) | public final class ActivityManager {
method ActivityManager (line 30) | private ActivityManager(){
method getInstance (line 34) | public static ActivityManager getInstance(){
method getStackInfo (line 47) | public String getStackInfo() {
method addActivity (line 60) | public void addActivity(Activity activity){
method removeActivity (line 67) | public void removeActivity(Activity activity){
method getActivity (line 74) | public Activity getActivity(){
method finishActivity (line 84) | public void finishActivity(){
method finishActivity (line 97) | public void finishActivity(Activity activity){
method finishAllActivity (line 115) | public void finishAllActivity(Class<?> clazz){
method finishLastActivity (line 130) | public void finishLastActivity(Class<?> clazz){
method finishAfterActivity (line 145) | public void finishAfterActivity(Activity activity){
method finishAfterActivity (line 164) | public void finishAfterActivity(Class<?> clazz){
method finishAllActivityAndClose (line 185) | public void finishAllActivityAndClose(){
method finishAllActivityWithoutClose (line 206) | public void finishAllActivityWithoutClose(){
FILE: libcore/src/main/java/com/android/libcore/activity/RootActivity.java
class RootActivity (line 21) | public abstract class RootActivity extends AppCompatActivity{
method onCreate (line 26) | @Override
method onResume (line 33) | @Override
method onReceive (line 43) | protected void onReceive(Context context, Intent intent){}
method registerReceiver (line 49) | public void registerReceiver(String action){
method sendLocalBroadcast (line 66) | protected final void sendLocalBroadcast(String action){
method onDestroy (line 70) | @Override
FILE: libcore/src/main/java/com/android/libcore/activity/RootFragment.java
class RootFragment (line 20) | public abstract class RootFragment extends Fragment{
method onCreate (line 25) | @Override
method onReceive (line 36) | protected void onReceive(Context context, Intent intent){}
method registerReceiver (line 38) | protected void registerReceiver(String action){
method onDestroy (line 44) | @Override
FILE: libcore/src/main/java/com/android/libcore/application/RootApplication.java
class RootApplication (line 24) | public class RootApplication extends Application{
method onCreate (line 38) | @Override
method getInstance (line 58) | public static Context getInstance(){
method setInstanceRef (line 78) | public static void setInstanceRef(Context context){
method checkApplicationDestroy (line 85) | public static void checkApplicationDestroy(){
class MyExceptionHandler (line 99) | private class MyExceptionHandler implements Thread.UncaughtExceptionHa...
method uncaughtException (line 101) | @Override
FILE: libcore/src/main/java/com/android/libcore/cachemanager/CacheManager.java
class CacheManager (line 35) | public class CacheManager {
method setValue (line 42) | private static void setValue(SharedPreferences sp, String key, Object ...
method getValue (line 77) | private static <T>T getValue(SharedPreferences sp, String key, Class<T...
method getValueSet (line 109) | private static <T>Set<T> getValueSet(SharedPreferences sp, String key,...
method setTemporary (line 143) | public static void setTemporary(String key, Object value){
method getTemporary (line 154) | public static <T>T getTemporary(String key, Class<T> clazz, T defaultV...
method getTemporarySet (line 162) | public static <T>Set<T> getTemporarySet(String key, Class<T> clazz){
method setPermanent (line 167) | public static void setPermanent(String key, Object value){
method getPermanent (line 172) | public static <T>T getPermanent(String key, Class<T> clazz, T defaultV...
method getPermanentSet (line 177) | public static <T>Set<T> getPermanentSet(String key, Class<T> clazz){
method removeTemporary (line 183) | public static void removeTemporary(){
class ParseObject (line 194) | public static abstract class ParseObject{
method stringParseObject (line 195) | public abstract void stringParseObject(String value);
FILE: libcore/src/main/java/com/android/libcore/database/BaseDB.java
class BaseDB (line 29) | public abstract class BaseDB {
method BaseDB (line 41) | public BaseDB(IBaseDBTable table, boolean writable){
method getDBName (line 53) | protected abstract String getDBName();
method getDBVersion (line 58) | protected abstract int getDBVersion();
method onDBCreate (line 63) | protected abstract void onDBCreate(SQLiteDatabase db);
method onDBUpgrade (line 71) | protected abstract void onDBUpgrade(SQLiteDatabase db, int oldVersion,...
method beginTransaction (line 76) | public void beginTransaction(){
method setTransactionSuccessful (line 89) | public void setTransactionSuccessful(){
method endTransaction (line 102) | public void endTransaction(){
method close (line 115) | public void close(){
method getCount (line 123) | public int getCount(){
method getCount (line 130) | public int getCount(String selection, String[] selectionArgs){
method insert (line 155) | public long insert(HashMap<String, String> map, boolean replace){
method delete (line 175) | public long delete(String selection, String[] selectionArgs){
method update (line 193) | public long update(HashMap<String, String> maps, String whereClause, S...
method query (line 209) | public ArrayList<HashMap<String, String>> query(){
method query (line 216) | public ArrayList<HashMap<String, String>> query(String selection, Stri...
method query (line 226) | public ArrayList<HashMap<String, String>> query(String selection, Stri...
method parseHashMapToContentValues (line 250) | private ContentValues parseHashMapToContentValues(HashMap<String, Stri...
class DataBaseHelper (line 261) | private class DataBaseHelper extends SQLiteOpenHelper{
method DataBaseHelper (line 263) | public DataBaseHelper() {
method getReadableDatabase (line 267) | @Override
method getWritableDatabase (line 292) | @Override
method onCreate (line 317) | @Override
method onUpgrade (line 322) | @Override
method getTables (line 343) | private ArrayList<String> getTables(SQLiteDatabase db){
method removeNewTables (line 365) | private void removeNewTables(SQLiteDatabase db, int version){
method renameOldTables (line 378) | private void renameOldTables(SQLiteDatabase db, int oldVersion, int ...
method clearOldTables (line 392) | private void clearOldTables(SQLiteDatabase db, int newVersion){
FILE: libcore/src/main/java/com/android/libcore/database/BaseDBHelper.java
class BaseDBHelper (line 15) | public abstract class BaseDBHelper {
method initInsertDB (line 20) | protected abstract void initInsertDB();
method initDeleteDB (line 22) | protected abstract void initDeleteDB();
method initUpdateDB (line 24) | protected abstract void initUpdateDB();
method initQueryDB (line 26) | protected abstract void initQueryDB();
method insert (line 32) | protected long insert(HashMap<String, String> map, boolean replace){
method insertAll (line 55) | protected long insertAll(ArrayList<HashMap<String, String>> maps, bool...
method delete (line 79) | protected long delete(String selection, String[] selectionArgs){
method update (line 100) | protected long update(HashMap<String, String> maps, String whereClause...
method query (line 118) | protected ArrayList<HashMap<String, String>> query(String selection, S...
FILE: libcore/src/main/java/com/android/libcore/database/IBaseDBTable.java
type IBaseDBTable (line 12) | public interface IBaseDBTable {
method getTableName (line 16) | String getTableName();
method getTableColumns (line 21) | ArrayList<String> getTableColumns();
FILE: libcore/src/main/java/com/android/libcore/dialog/BaseDialog.java
class BaseDialog (line 16) | public abstract class BaseDialog extends Dialog{
method BaseDialog (line 29) | public BaseDialog(Context context, int theme) {
method checkIllegalId (line 40) | protected boolean checkIllegalId(int id){
method setTitle (line 48) | public abstract BaseDialog setTitle(String title);
method setTitle (line 54) | public abstract BaseDialog setTitle(View title);
method setMessage (line 60) | public abstract BaseDialog setMessage(String message);
method setMessage (line 66) | public abstract BaseDialog setMessage(View message);
method setPositiveButton (line 72) | public abstract BaseDialog setPositiveButton(String positive);
method setPositiveButton (line 78) | public abstract BaseDialog setPositiveButton(View positive);
method setNegativeButton (line 84) | public abstract BaseDialog setNegativeButton(String negative);
method setNegativeButton (line 90) | public abstract BaseDialog setNegativeButton(View negative);
method setNeutralButton (line 96) | public abstract BaseDialog setNeutralButton(String neutral);
method setNeutralButton (line 103) | public abstract BaseDialog setNeutralButton(View neutral);
method addOtherButton (line 110) | public abstract BaseDialog addOtherButton(String other, int other_list...
method addOtherButton (line 117) | public abstract BaseDialog addOtherButton(View other, int other_listen...
method setOnButtonClickListener (line 122) | public BaseDialog setOnButtonClickListener(ButtonClickListener listener){
method setGravity (line 131) | public abstract BaseDialog setGravity(int gravity);
method setPosition (line 138) | public abstract BaseDialog setPosition(int x, int y);
method setWidth (line 144) | public abstract BaseDialog setWidth(int width);
method setHeight (line 150) | public abstract BaseDialog setHeight(int height);
method setAlpha (line 156) | public abstract BaseDialog setAlpha(float alpha);
type ButtonClickListener (line 158) | public interface ButtonClickListener{
method onButtonClick (line 159) | void onButtonClick(int button_id);
FILE: libcore/src/main/java/com/android/libcore/download/DownloadDB.java
class DownloadDB (line 17) | public class DownloadDB extends BaseDB{
method DownloadDB (line 19) | public DownloadDB(IBaseDBTable table, boolean writable) {
method getDBName (line 23) | @Override
method getDBVersion (line 28) | @Override
method onDBCreate (line 33) | @Override
method onDBUpgrade (line 54) | @Override
type TABLES (line 62) | public enum TABLES implements IBaseDBTable {
method getTableColumns (line 64) | @Override
method TABLES (line 76) | TABLES(String table_name){
method getTableName (line 80) | @Override
method getTableColumns (line 85) | @Override
FILE: libcore/src/main/java/com/android/libcore/download/DownloadDBHelper.java
class DownloadDBHelper (line 14) | public class DownloadDBHelper extends BaseDBHelper{
method insertInfos (line 19) | public void insertInfos(String url, ArrayList<FileDownloadManager.Down...
method updateInfos (line 37) | public void updateInfos(String url, ArrayList<FileDownloadManager.Down...
method getInfo (line 65) | public ArrayList<HashMap<String, String>> getInfo(String url){
method deleteInfos (line 75) | public void deleteInfos(String url){
method initInsertDB (line 82) | @Override
method initDeleteDB (line 87) | @Override
method initUpdateDB (line 92) | @Override
method initQueryDB (line 97) | @Override
FILE: libcore/src/main/java/com/android/libcore/download/FileDownloadManager.java
class FileDownloadManager (line 29) | public class FileDownloadManager {
method FileDownloadManager (line 100) | public FileDownloadManager(String url, String fileName){
method FileDownloadManager (line 109) | public FileDownloadManager(String url, String fileName, String path){
method checkFileFinish (line 134) | private boolean checkFileFinish(){
method start (line 146) | public void start(){
method stop (line 187) | public void stop(){
method delete (line 224) | public void delete(){
method startDownload (line 248) | private void startDownload(final ArrayList<HashMap<String, String>> ma...
method stopDownload (line 290) | private void stopDownload(){
method deleteDownload (line 309) | private void deleteDownload(){
method stopStartThread (line 338) | private void stopStartThread(int sendState){
method stopDownloadThread (line 357) | private void stopDownloadThread(int sendState){
method createDownloadInfos (line 377) | private void createDownloadInfos(){
method revertDownloadInfos (line 428) | private void revertDownloadInfos(ArrayList<HashMap<String, String>> ma...
method getCompleteSize (line 445) | private long getCompleteSize(){
method isFileDownloadFinish (line 455) | private boolean isFileDownloadFinish(ArrayList<HashMap<String, String>...
method setListener (line 472) | public void setListener(IDownloadProgressChangedListener listener){
type IDownloadProgressChangedListener (line 479) | public interface IDownloadProgressChangedListener{
method onProgressChanged (line 480) | void onProgressChanged(long completeSize, long totalSize);
method onStateChanged (line 481) | void onStateChanged(int state);
method startThreads (line 487) | private void startThreads(){
method finishDownload (line 498) | private void finishDownload(){
class ProgressChangeHandler (line 513) | private static class ProgressChangeHandler extends Handler{
method ProgressChangeHandler (line 516) | public ProgressChangeHandler(FileDownloadManager manager){
method handleMessage (line 520) | @Override
class DownloadInfo (line 559) | public class DownloadInfo {
class DownloadThread (line 569) | private class DownloadThread extends Thread{
method DownloadThread (line 575) | public DownloadThread(DownloadInfo info){
method getCompleteSize (line 579) | public long getCompleteSize(){
method initConnection (line 583) | public void initConnection() throws Exception{
method run (line 595) | @Override
class UpdateThread (line 641) | private class UpdateThread extends Thread{
method run (line 649) | @Override
FILE: libcore/src/main/java/com/android/libcore/guide/GuideManager.java
class GuideManager (line 23) | public class GuideManager {
method GuideManager (line 30) | private GuideManager() {
method getInstance (line 33) | public static GuideManager getInstance() {
method initListener (line 47) | private void initListener() {
method initMask (line 61) | public void initMask(Integer... layoutIds) {
method clearMask (line 102) | public void clearMask() {
method showMaskFullScreen (line 111) | public void showMaskFullScreen() {
method showMaskInContent (line 126) | public void showMaskInContent() {
method showNextMask (line 146) | public boolean showNextMask(){
FILE: libcore/src/main/java/com/android/libcore/log/L.java
class L (line 16) | public final class L {
method L (line 20) | private L(){}
method i (line 32) | public static void i(String message, Object... args){
method w (line 40) | public static void w(String message, Object... args){
method e (line 48) | public static void e(Throwable throwable){
method e (line 55) | public static void e(String message, Object... args){
method e (line 64) | public static void e(String message, Throwable throwable, Object... ar...
method log (line 68) | private static void log(int priority, String message, Throwable throwa...
FILE: libcore/src/main/java/com/android/libcore/net/NetError.java
class NetError (line 11) | public class NetError extends Exception{
method transferVolleyError (line 18) | public void transferVolleyError(VolleyError error){
FILE: libcore/src/main/java/com/android/libcore/net/imageloader/ImageLoader.java
class ImageLoader (line 21) | public class ImageLoader {
method ImageLoader (line 27) | private ImageLoader(){
method getInstance (line 33) | public static ImageLoader getInstance(){
method getImageViewFieldValue (line 44) | private int getImageViewFieldValue(Object object, String fieldName) {
method loadImage (line 64) | public void loadImage(String url, final ImageView imageView){
method loadImage (line 73) | public void loadImage(String url, final OnLoadCallBack listener){
method loadImage (line 84) | public void loadImage(String url, int width, int height, final OnLoadC...
method loadImage (line 94) | public void loadImage(String url, final ImageView imageView, final OnL...
method loadImage (line 108) | public void loadImage(String url, int width, int height, final ImageVi...
method loadImage (line 120) | public void loadImage(String url, int width, int height, final ImageVi...
method loadImage (line 148) | public void loadImage(String url, final ImageView imageView, int defau...
method loadImage (line 164) | public void loadImage(String url, int width, int height, final ImageVi...
type OnLoadCallBack (line 175) | public interface OnLoadCallBack {
method onLoadSuccess (line 176) | void onLoadSuccess(Bitmap bitmap, String url);
method onLoadFail (line 177) | void onLoadFail(NetError error);
FILE: libcore/src/main/java/com/android/libcore/net/imageloader/VolleyLruCache.java
class VolleyLruCache (line 12) | public class VolleyLruCache extends LruCache<String, Bitmap> implements ...
method getCacheSize (line 14) | private static int getCacheSize(){
method VolleyLruCache (line 18) | public VolleyLruCache() {
method VolleyLruCache (line 22) | private VolleyLruCache(int size){
method getBitmap (line 26) | @Override
method putBitmap (line 31) | @Override
FILE: libcore/src/main/java/com/android/libcore/net/netapi/BaseNetApi.java
class BaseNetApi (line 36) | public abstract class BaseNetApi {
method getRequestQueue (line 41) | private RequestQueue getRequestQueue(int maxDiskCacheBytes){
method getRequestQueue (line 47) | protected RequestQueue getRequestQueue(){
type OnNetCallback (line 54) | public interface OnNetCallback<T>{
method onSuccess (line 55) | void onSuccess(T result);
method onFail (line 56) | void onFail(NetError error);
method checkIfExtendsRequest (line 59) | private boolean checkIfExtendsRequest(Class clazz){
method makeRequest (line 71) | protected <T> void makeRequest(final Context context, Class<? extends ...
class StringRequestImpl (line 130) | private static class StringRequestImpl extends StringRequest{
method StringRequestImpl (line 133) | public StringRequestImpl(Integer method, String url, Response.Listen...
method getParams (line 139) | @Override
class JsonObjectRequestImpl (line 148) | private static class JsonObjectRequestImpl extends JsonObjectRequest{
method JsonObjectRequestImpl (line 151) | public JsonObjectRequestImpl(Integer method, String url, Response.Li...
method getParams (line 157) | @Override
class JsonArrayRequestImpl (line 166) | private static class JsonArrayRequestImpl extends JsonArrayRequest{
method JsonArrayRequestImpl (line 169) | public JsonArrayRequestImpl(Integer method, String url, Response.Lis...
method getParams (line 175) | @Override
method stringRequest (line 188) | public void stringRequest(Context context, String url, Map<String, Str...
method jsonObjectRequest (line 200) | public void jsonObjectRequest(Context context, String url, Map<String,...
method jsonArrayRequest (line 212) | public void jsonArrayRequest(Context context, String url, Map<String, ...
FILE: libcore/src/main/java/com/android/libcore/utils/CommonUtils.java
class CommonUtils (line 47) | public class CommonUtils {
method dp2px (line 49) | public static int dp2px(float dp){
method px2dp (line 54) | public static int px2dp(float px) {
method getScreenWidth (line 59) | public static int getScreenWidth(){
method getScreenHeight (line 65) | public static int getScreenHeight(){
method isNetworkAvailable (line 74) | public static boolean isNetworkAvailable(){
method isNetworkWifi (line 83) | public static boolean isNetworkWifi(){
method hasNavigationBar (line 97) | public static boolean hasNavigationBar(){
method md5 (line 110) | public static String md5(String string) {
method uriToPath (line 133) | public static String uriToPath(final Uri uri) {
method getDataColumn (line 205) | public static String getDataColumn(Context context, Uri uri, String se...
method isExternalStorageDocument (line 233) | public static boolean isExternalStorageDocument(Uri uri) {
method isDownloadsDocument (line 241) | public static boolean isDownloadsDocument(Uri uri) {
method isMediaDocument (line 249) | public static boolean isMediaDocument(Uri uri) {
method isGooglePhotosUri (line 257) | public static boolean isGooglePhotosUri(Uri uri) {
method pathToUri (line 264) | public static Uri pathToUri(String path){
method getCurrentProcessName (line 294) | public static String getCurrentProcessName(Context context){
method makeCrash (line 312) | public static int makeCrash(){
FILE: libcore/src/main/java/com/android/libcore/utils/FileUtils.java
class FileUtils (line 47) | public class FileUtils {
method checkAndCreateFile (line 56) | public static File checkAndCreateFile(String path){
method checkAndCreateChildDirectory (line 70) | public static String checkAndCreateChildDirectory(String path){
method getExternalStoragePath (line 83) | public static String getExternalStoragePath(){
type ExternalStorageType (line 101) | public enum ExternalStorageType{
method ExternalStorageType (line 105) | ExternalStorageType(String typeName){
method getFilePath (line 109) | public String getFilePath(String parentPath) {
method getExternalStorageTempPath (line 121) | public static String getExternalStorageTempPath(){
method createFileInTempDirectory (line 129) | public static File createFileInTempDirectory(String filename){
method clearExternalStorageTemp (line 136) | public static void clearExternalStorageTemp(){
method getExternalStorageFilePath (line 149) | public static String getExternalStorageFilePath(){
method createFileInFileDirectory (line 157) | public static File createFileInFileDirectory(String filename){
method getExternalStorageImagePath (line 164) | public static String getExternalStorageImagePath(){
method createFileInImageDirectory (line 175) | public static File createFileInImageDirectory(String filename){
method getExternalStorageVoicePath (line 182) | public static String getExternalStorageVoicePath(){
method createFileInVoiceDirectory (line 193) | public static File createFileInVoiceDirectory(String filename){
method getExternalStorageVideoPath (line 200) | public static String getExternalStorageVideoPath(){
method createFileInVideoDirectory (line 211) | public static File createFileInVideoDirectory(String filename){
method getExternalStorageHtmlPath (line 218) | public static String getExternalStorageHtmlPath(){
method createFileInHtmlDirectory (line 226) | public static File createFileInHtmlDirectory(String filename){
method getFileOrDirectorySize (line 233) | public static long getFileOrDirectorySize(String path){
method copyFile (line 259) | public static void copyFile(File src, File des){
method checkAndCreateNoMedia (line 283) | private static void checkAndCreateNoMedia(String path){
method getFileSize (line 290) | private static long getFileSize(File file){
FILE: libcore/src/main/java/com/android/libcore/utils/ImageUtils.java
class ImageUtils (line 48) | public class ImageUtils {
method centerSquareScaleBitmap (line 54) | public static Bitmap centerSquareScaleBitmap(Bitmap bitmap, int edgeLe...
method toRoundCorner (line 81) | public static Bitmap toRoundCorner(Bitmap bitmap, int pixels) {
method screenShot (line 106) | public static Bitmap screenShot(Activity activity){
method viewShot (line 129) | public static Bitmap viewShot(final View view){
method saveBitmap (line 167) | public static void saveBitmap(final Bitmap bitmap, final String filePa...
method compressBitmap (line 202) | public static Bitmap compressBitmap(String filePath, int width, int he...
method resizeBitmap (line 237) | public static Bitmap resizeBitmap(Bitmap srcBitmap, int w, int h) {
method getPictureDegree (line 256) | public static int getPictureDegree(String path) {
method rotateBitmap (line 285) | public static Bitmap rotateBitmap(Bitmap bitmap, int degrees){
method isFileImage (line 304) | public static boolean isFileImage(String filePath){
FILE: libcore/src/main/java/com/android/libcore/volley/BaseVolleyApi.java
class BaseVolleyApi (line 15) | public abstract class BaseVolleyApi {
method getRequestQueue (line 19) | public static RequestQueue getRequestQueue() {
method getImageLoader (line 29) | public static ImageLoader getImageLoader() {
FILE: libcore/src/main/java/com/android/libcore/volley/VolleyLruCache.java
class VolleyLruCache (line 12) | public class VolleyLruCache extends LruCache<String, Bitmap> implements ...
method getCacheSize (line 14) | private static int getCacheSize(){
method VolleyLruCache (line 18) | public VolleyLruCache() {
method VolleyLruCache (line 22) | private VolleyLruCache(int size){
method getBitmap (line 26) | @Override
method putBitmap (line 31) | @Override
FILE: testsample/src/main/assets/baidu_files/all_async_search_57459356.js
function i (line 1) | function i(ap,aq){var an=[];function am(ar){if(ar.indexOf(".")===0){an.p...
function I (line 1) | function I(){var aq=[];var ar=[];var ao={};var ap={};var an={};function ...
function R (line 2) | function R(aq,ap,ao){if(ao==null){if(ap==null){ao=aq;aq=null}else{ao=ap;...
function ad (line 2) | function ad(){var am=n.config[this.id];if(am&&typeof am==="object"){retu...
function y (line 2) | function y(ao,an,am){if(!o[ao]){o[ao]={id:ao,depsDec:an,deps:an||["requi...
function ag (line 2) | function ag(ar){var ao=o[ar];if(!ao||l(ar,g)){return}var aq=ao.deps;var ...
function S (line 3) | function S(){for(var am in C){E(am);al(am)}}
function E (line 3) | function E(ao){var am={};an(ao);function an(ar){if(!l(ar,g)){return fals...
function O (line 3) | function O(ap){var an=o[ap];var ao;an.invokeFactory=am;aa(an.depPMs,func...
function l (line 4) | function l(an,am){return o[an]&&o[an].state>=am}
function al (line 4) | function al(an){var am=o[an];if(am&&am.invokeFactory){am.invokeFactory()}}
function ae (line 4) | function ae(an,ao){var am=[];aa(an,function(aq,ap){am[ap]=ao[aq]||u(aq)}...
function f (line 4) | function f(ao,an){if(l(ao,p)){an();return}var am=V[ao];if(!am){am=V[ao]=...
function D (line 4) | function D(ap){var ao=V[ap]||[];var an=o[ap];an.state=p;var am=ao.length...
function u (line 4) | function u(am){if(l(am,p)){return o[am].exports}return null}
function q (line 4) | function q(am){aa(r,function(an){y(am,an.deps,an.factory)});r.length=0;a...
function a (line 4) | function a(ap,ar,am,an){if(typeof ap==="string"){al(ap);
function j (line 5) | function j(an){if(P[an]||o[an]){return}P[an]=1;var am=document.createEle...
function F (line 5) | function F(am,ao){if(o[am]){return}var ar=W(am);var aq={id:am,state:g};o...
function ap (line 6) | function ap(ar){am.push(ar)}
function H (line 6) | function H(ao,am){var an=U(ao,1,am);an.sort(m);return an}
function aj (line 6) | function aj(){n.baseUrl=n.baseUrl.replace(/\/$/,"")+"/";L=H(n.paths);M=H...
function Z (line 7) | function Z(an,am,ao){aa(am,function(ap){if(ap.reg.test(an)){ao(ap.v,ap.k...
function K (line 7) | function K(ap){var au=/(\.[a-z0-9]+)$/i;var an=/(\?[^#]*)$/;var ar="";va...
function X (line 7) | function X(am){var ao={};function an(ar,av){if(typeof ar==="string"){if(...
function af (line 8) | function af(ar,am){if(!ar){return""}am=am||"";var ap=W(ar);if(!ap){retur...
function k (line 8) | function k(an,av){if(an.indexOf(".")===0){var aw=av.split("/");var au=an...
function W (line 8) | function W(an){var am=an.split("!");if(am[0]){return{mod:am[0],res:am[1]...
function U (line 8) | function U(ar,ap,am){var aq=[];
function t (line 9) | function t(){if(Q){return Q}else{if(w&&w.readyState==="interactive"){ret...
function ak (line 9) | function ak(am){Q=am;d?T.insertBefore(am,d):T.appendChild(am);Q=null}
function Y (line 9) | function Y(am){return new RegExp("^"+am+"(/|$)")}
function aa (line 9) | function aa(ap,ao){if(ap instanceof Array){for(var an=0,am=ap.length;an<...
function m (line 9) | function m(an,am){var ap=an.k||an.name;var ao=am.k||am.name;if(ao==="*")...
function i (line 10) | function i(n){if(/["\\\x00-\x1f]/.test(n)){n=n.replace(/["\\\x00-\x1f]/g...
function a (line 10) | function a(s){var o=["["],p=s.length,n,q,r;for(q=0;q<p;q++){r=s[q];switc...
function addEV (line 13) | function addEV(d,b,a){if(window.attachEvent){d.attachEvent("on"+b,a)}els...
function _aMC (line 13) | function _aMC(d){var b=d,a=-1;while(b=b.parentNode){a=parseInt(b.getAttr...
function al_c (line 13) | function al_c(a){while(a.tagName!="TABLE"){a=a.parentNode}return a.getAt...
function al_c2 (line 13) | function al_c2(b,a){while(a--){while((b=b.parentNode).tagName!="TABLE"){...
function c (line 13) | function c(a){var k=a.p1;if(a.fm=="alop"&&!("rsv_xpath" in a)){if(k&&G(k...
function TagQ (line 15) | function TagQ(a,b){return b.getElementsByTagName(a)
function h (line 16) | function h(b){b.style.behavior="url(#default#homepage)";b.setHomePage(bd...
function setHeadUrl (line 16) | function setHeadUrl(b){var d=G("kw").value;d=encodeURIComponent(d);var a...
function G (line 16) | function G(a){return document.getElementById(a)}
function ns_c_pj (line 18) | function ns_c_pj(i,f){var j=encodeURIComponent(window.document.location....
function ns_c (line 19) | function ns_c(b,a){if(a===true){return ns_c_pj(b,"pj=www&rsv_sample=1&")...
function a (line 24) | function a(u,z){var x=typeof u==="string"?u.split(/\s*,\s*/):u;if(x.leng...
function o (line 25) | function o(u,w){w=w||m;if(u in b){w();return}var t=p.createElement("link...
function k (line 25) | function k(t){if(i){r(t,m);return}if(t in b){return}p.write('<script cha...
function r (line 25) | function r(w,x){x=x||m;if(w in b){x();return}if(w in j){s[w].push(x);ret...
function d (line 27) | function d(j,l){if(typeof l=="function"||l instanceof Function){var k=a(...
function g (line 27) | function g(l,o){var n=a(l),k=i[n.name]||[],j=0;while(j<k.length){var m=k...
function b (line 27) | function b(j,m){var q=a(j),k=i[q.name]||[],r={data:m,eventId:j};for(var ...
function f (line 27) | function f(j,k){return new RegExp("^"+j.replace(/\./g,"\\.").replace(/\*...
function a (line 28) | function a(j){var k=j.match(/(.+)\.(.+)/);if(k&&k[2]){return{prod:k[1],n...
function escapeHTML (line 28) | function escapeHTML(a){return a.replace(/&/g,"&").replace(/</g,"<...
function initPreload (line 28) | function initPreload(be){document.write=document.writeln=function(){};fu...
function clickDebug (line 81) | function clickDebug(e){}
function bindP5 (line 82) | function bindP5(){var item,index=(bds.comm.pageNum-1)*bds.comm.pageSize+...
function getXPath (line 83) | function getXPath(node,wrap,path){path=path||[];wrap=wrap||document;if(n...
function bindLogEvent (line 83) | function bindLogEvent(){$body=$("body");$body.on("mousedown",function(e)...
function getType (line 84) | function getType(xpath,t,wrap){var node=t,cs=LOG_CLASS,cl=cs.length,clc=...
function check (line 84) | function check(xpath,t,wrap){if(A.LOGTOOL){A.LOGTOOL.call(t,xpath,t,wrap...
function log (line 84) | function log(xpath,t,wrap,fm){if(t.getAttribute("data-nolog")!=null){return
function addEV (line 87) | function addEV(d,b,a){if(window.attachEvent){d.attachEvent("on"+b,a)}els...
function f (line 95) | function f(z){if(z){var y=z.parentNode;
function user_c (line 97) | function user_c(i){var g="",f="",a="",b="",k=encodeURIComponent(window.d...
function initPassV3 (line 97) | function initPassV3(){var a=bds.comm.passnew?3:2;bds.se.passv3=passport....
function isp_hijack (line 99) | function isp_hijack(g){var i=document.getElementById("wrapper"),b,a=fals...
function a (line 100) | function a(){var d,f="http://isphijack.baidu.com/index.php?cb=isp_hijack...
function o (line 111) | function o(){i.show();g.play()}
function init (line 126) | function init(){bds.util.addStyle(selfCSS.join(""));var num_unsafe=0,tj_...
function setTipCon (line 127) | function setTipCon(obj,data,tip_id,tip_tpl){var safeName={qq:"电脑<br>管家",...
function r (line 128) | function r(){q=[],o=[];$(".c-trust").each(function(){var t=$(this);var s...
function j (line 128) | function j(){if(m){return}$.getJSON(d+"/?urls="+q.join(",")+"&sid="+bds....
function b (line 128) | function b(s){m=false;if(s.code!=0){return
function f (line 129) | function f(w,s){var t=$("<span>",{"class":"c-vline"});var u=$("<a>",{"cl...
function g (line 129) | function g(){var s=$("<span>",{"class":"c-vline"});var t=$("<a>",{"class...
function i (line 129) | function i(){var s=$("<span>",{"class":"c-vline"});var t=$("<a>",{"class...
function l (line 129) | function l(u,x){var B=u.hint;var z="over";var t=u.url;if(!u||!B){return}...
function a (line 131) | function a(t){var s=t;s=s.replace(/</g,"<").replace(/>/g,">").repl...
function isbase64 (line 131) | function isbase64(p){var w;if(bds&&bds._base64){w=bds._base64}else{w={do...
function a (line 135) | function a(){if($("#imsg")[0]&&$("#u")[0]&&$("#user")[0]){bds.se.message...
function b (line 135) | function b(){bds.se.message&&bds.se.message.addStyle&&bds.se.message.add...
function m (line 138) | function m(){if(g.indexOf("lbbrowser")>0){return g.match(/lbbrowser/gi)}...
function l (line 140) | function l(){var n=(navigator.platform=="Win32")||(navigator.platform=="...
function a (line 142) | function a(){this.start=null;this.mouse=[];this.mouseTime=null;this.mous...
function g (line 145) | function g(m,n){var l=[];if(m==="mouse"){l[0]=n.pageX;l[1]=n.pageY}else{...
function g (line 149) | function g(){var q;var x=0;var t=[];var z=false;var u=this.commLog[j]["l...
function save (line 156) | function save(callback){var optionsStr=[];for(tmpName in options){if(opt...
function set (line 157) | function set(optionName,value){options[optionName]=value}
function get (line 157) | function get(optionName){return options[optionName]}
function writeCookie (line 157) | function writeCookie(){if(options.hasOwnProperty("sugSet")){var value=op...
function writeBAIDUID (line 157) | function writeBAIDUID(){var BAIDUID=Cookie.get("BAIDUID"),NR,FG,SL;if(/F...
function clearCookie (line 158) | function clearCookie(name){Cookie.clear(name,"/");Cookie.clear(name,"/",...
function reset (line 158) | function reset(callback){options=defaultOptions;save(callback)}
function a (line 159) | function a(){}
function b (line 159) | function b(j,i,g){g=g||19558;
function f (line 160) | function f(k,l,m,g){l=l||a;m=m||a;var i=new Image();i.onload=function(){...
function d (line 160) | function d(j,k,i){var g=new Image();g.onload=g.onerror=function(){this.o...
function f (line 160) | function f(){var o=g.pop();if(o){d(o)}if(i){n=window.setTimeout(f,j)}}
function d (line 160) | function d(o){var r=o.url,p=o.size||-1,q=[];q.push("id="+encodeURICompon...
function m (line 161) | function m(){return true}
function formatDate (line 163) | function formatDate(a,d){var b=function(f){return f>9?f:"0"+f};if(typeof...
function baseChangeUrl (line 164) | function baseChangeUrl(a){if(bds.comm.search_tool.st&&bds.comm.search_to...
function langChangeUrl (line 164) | function langChangeUrl(a,d,b){ns_c({fm:"advTool",qid:bds.comm.qid,title:...
function advChangeUrl (line 164) | function advChangeUrl(d,g,f,a){if(g.indexOf("=")!=-1){var b=1}else{var b...
function fileChangeUrl (line 165) | function fileChangeUrl(d,b,a){ns_c({fm:"advTool",qid:bds.comm.qid,title:...
function queryReplace (line 165) | function queryReplace(f,d){if(f&&(f=="filetype"||f=="site")){var b=new R...
function extChangeUrl (line 165) | function extChangeUrl(a){if(a){ns_c({fm:"advTool",qid:bds.comm.qid,title...
function y (line 172) | function y(D){var C=/^\s*(\d{4})-(\d\d)-(\d\d)\s*$/,B=new Date(NaN),F,E=...
function a (line 178) | function a(){var d={},b={};var g=$("#wrapper");d.topResult=g.find("#con-...
function a (line 179) | function a(){var b=this;b.display={};b.expand={};b.dom={};b.init()}
function r (line 181) | function r(){var t=d.size;return{w:t.width||0,h:t.height||0}}
function l (line 181) | function l(){var t=d.pos;return{t:t.top||0,l:t.left||0}}
function q (line 181) | function q(){if(j.rsv_bdr&&j.rsv_bdr!=0){return j.rsv_bdr}else{if(s.hasC...
function i (line 181) | function i(){var u={};t(".favurl")&&(u.fi=1);t(".c-text-public.c-text-mu...
function n (line 181) | function n(){var w=s.find("a").not(":hidden").not("h3 a, .m");var t=[];v...
function b (line 182) | function b(){var t=[];var u=s.find("img").not(":hidden").not("[data-nolo...
function p (line 182) | function p(){var u=[];var t=s.find("object, video, audio");if(t.length){...
function a (line 182) | function a(){this.pageElementsList=[];this.scrollTime=null;this.scrollCh...
function g (line 184) | function g(){j[f]=setTimeout(function(){bds.log.send.sendPack("new_view"...
function b (line 184) | function b(l){if(l==="resize"){var n=$(window);j.windowHeight=n.height()...
function o (line 190) | function o(t,w){var F='<div class="cr-content" data-click=\'#{2}\'><div ...
function a (line 200) | function a(i){var g=["voice_beha=1"],f=window.bds&&bds.util&&bds.util.do...
FILE: testsample/src/main/assets/baidu_files/jquery-1.10.2_d88366fd.js
function Z (line 14) | function Z(b4){var b3=b4.length,e=bI.type(b4);if(bI.isWindow(b4)){return...
function cu (line 25) | function cu(ds,dk,dw,dy){var dx,dp,dq,du,dv,dn,dm,e,dl,dt;if((dk?dk.owne...
function cy (line 25) | function cy(){var dk=[];function e(dl,dm){if(dk.push(dl+=" ")>cm.cacheLe...
function ci (line 25) | function ci(e){e[c7]=true;return e}
function cd (line 25) | function cd(dk){var dm=cA.createElement("div");try{return !!dk(dm)}catch...
function dh (line 25) | function dh(dk,dm){var e=dk.split("|"),dl=dk.length;while(dl--){cm.attrH...
function b7 (line 25) | function b7(dk,e){var dm=e&&dk,dl=dm&&dk.nodeType===1&&e.nodeType===1&&(...
function cv (line 25) | function cv(e){return function(dl){var dk=dl.nodeName.toLowerCase();retu...
function b8 (line 25) | function b8(e){return function(dl){var dk=dl.nodeName.toLowerCase();retu...
function c4 (line 25) | function c4(e){return ci(function(dk){dk=+dk;return ci(function(dl,dq){v...
function cS (line 25) | function cS(){}
function cf (line 25) | function cf(dn,dt){var dk,dp,dr,ds,dq,dl,e,dm=c6[dn+" "];if(dm){return d...
function cg (line 25) | function cg(dm){var dl=0,dk=dm.length,e="";for(;dl<dk;dl++){e+=dm[dl].va...
function cp (line 25) | function cp(dn,dl,dm){var e=dl.dir,dp=dm&&e==="parentNode",dk=c1++;retur...
function di (line 25) | function di(e){return e.length>1?function(dn,dm,dk){var dl=e.length;whil...
function cX (line 25) | function cX(e,dk,dl,dm,dq){var dn,dt=[],dp=0,dr=e.length,ds=dk!=null;for...
function ce (line 25) | function ce(dl,dk,dn,dm,dp,e){if(dm&&!dm[c7]){dm=ce(dm)}if(dp&&!dp[c7]){...
function c8 (line 25) | function c8(dq){var dk,dn,dl,dp=dq.length,dt=cm.relative[dq[0].type],du=...
function cV (line 25) | function cV(dm,dl){var dp=0,e=dl.length>0,dn=dm.length>0,dk=function(dz,...
function cx (line 25) | function cx(dk,dn,dm){var dl=0,e=dn.length;for(;dl<e;dl++){cu(dk,dn[dl],...
function de (line 25) | function de(dl,e,dm,dq){var dn,ds,dk,dt,dr,dp=cf(dl);if(!dq){if(dp.lengt...
function ac (line 25) | function ac(b3){var e=bY[b3]={};bI.each(b3.match(aa)||[],function(b5,b4)...
function a9 (line 25) | function a9(b5,b3,b7,b6){if(!bI.acceptData(b5)){return}var b9,b8,ca=bI.e...
function X (line 25) | function X(b6,b4,e){if(!bI.acceptData(b6)){return}var b8,b5,b7=b6.nodeTy...
function bx (line 25) | function bx(b5,b4,b6){if(b6===aE&&b5.nodeType===1){var b3="data-"+b4.rep...
function L (line 25) | function L(b3){var e;for(e in b3){if(e==="data"&&bI.isEmptyObject(b3[e])...
function P (line 25) | function P(){return true}
function V (line 25) | function V(){return false}
function ai (line 25) | function ai(){try{return l.activeElement}catch(e){}}
function aV (line 25) | function aV(b3,e){do{b3=b3[e]}while(b3&&b3.nodeType!==1);return b3}
function aM (line 25) | function aM(b4,e,b3){if(bI.isFunction(e)){return bI.grep(b4,function(b6,...
function z (line 25) | function z(e){var b4=d.split("|"),b3=e.createDocumentFragment();if(b3.cr...
function aZ (line 25) | function aZ(b3,e){return bI.nodeName(b3,"table")&&bI.nodeName(e.nodeType...
function t (line 25) | function t(e){e.type=(bI.find.attr(e,"type")!==null)+"/"+e.type;return e}
function bc (line 25) | function bc(b3){var e=ap.exec(b3.type);if(e){b3.type=e[1]}else{b3.remove...
function br (line 25) | function br(e,b4){var b5,b3=0;for(;(b5=e[b3])!=null;b3++){bI._data(b5,"g...
function aq (line 25) | function aq(b9,b3){if(b3.nodeType!==1||!bI.hasData(b9)){return}var b6,b5...
function O (line 25) | function O(b6,b3){var b7,b5,b4;if(b3.nodeType!==1){return}b7=b3.nodeName...
function k (line 25) | function k(b5,e){var b3,b6,b4=0,b7=typeof b5.getElementsByTagName!==aA?b...
function bU (line 25) | function bU(e){if(q.test(e.type)){e.defaultChecked=e.checked}}
function b (line 25) | function b(b5,b3){if(b3 in b5){return b3}var b6=b3.charAt(0).toUpperCase...
function N (line 25) | function N(b3,e){b3=e||b3;return bI.css(b3,"display")==="none"||!bI.cont...
function p (line 25) | function p(b8,e){var b9,b6,b7,b3=[],b4=0,b5=b8.length;for(;b4<b5;b4++){b...
function aH (line 25) | function aH(e,b4,b5){var b3=a8.exec(b4);return b3?Math.max(0,b3[1]-(b5||...
function au (line 25) | function au(b6,b3,e,b8,b5){var b4=e===(b8?"border":"content")?4:b3==="wi...
function u (line 25) | function u(b6,b3,e){var b5=true,b7=b3==="width"?b6.offsetWidth:b6.offset...
function bD (line 25) | function bD(b4){var b3=l,e=bi[b4];if(!e){e=a0(b4,b3);if(e==="none"||!e){...
function a0 (line 25) | function a0(e,b5){var b3=bI(b5.createElement(e)).appendTo(b5.body),b4=bI...
function i (line 25) | function i(b4,b6,b3,b5){var e;if(bI.isArray(b6)){bI.each(b6,function(b8,...
function bK (line 25) | function bK(e){return function(b6,b7){if(typeof b6!=="string"){b7=b6;b6=...
function n (line 25) | function n(e,b4,b8,b5){var b3={},b6=(e===a6);function b7(b9){var ca;b3[b...
function r (line 25) | function r(b4,b5){var e,b3,b6=bI.ajaxSettings.flatOptions||{};for(b3 in ...
function cd (line 25) | function cd(cu,cq,cv,cs){var e,cy,cw,ct,cx,cr=cq;if(b6===2){return}b6=2;...
function g (line 25) | function g(ca,b9,b6){var e,b5,b4,b7,b3=ca.contents,b8=ca.dataTypes;while...
function ad (line 25) | function ad(ce,b6,cb,b4){var b3,b9,cc,b7,b5,cd={},ca=ce.dataTypes.slice(...
function bC (line 25) | function bC(){try{return new a1.XMLHttpRequest()}catch(b3){}}
function bd (line 25) | function bd(){try{return new a1.ActiveXObject("Microsoft.XMLHTTP")}catch...
function bl (line 25) | function bl(){setTimeout(function(){J=aE});return(J=bI.now())}
function ba (line 25) | function ba(b6,b8,b5){var b3,b7=(aY[b8]||[]).concat(aY["*"]),e=0,b4=b7.l...
function f (line 25) | function f(b4,b8,cb){var cc,e,b7=0,b3=az.length,ca=bI.Deferred().always(...
function ak (line 25) | function ak(b5,b7){var b4,b3,b8,b6,e;for(b4 in b5){b3=bI.camelCase(b4);b...
function h (line 25) | function h(b5,b9,e){var b4,cb,b7,ce,cf,cc,b6=this,ca={},b3=b5.style,b8=b...
function F (line 25) | function F(b4,b3,b6,e,b5){return new F.prototype.init(b4,b3,b6,e,b5)}
function bH (line 25) | function bH(b4,b6){var b5,e={height:b4},b3=0;b6=b6?1:0;for(;b3<4;b3+=2-b...
function bo (line 25) | function bo(e){return bI.isWindow(e)?e:e.nodeType===9?e.defaultView||e.p...
FILE: testsample/src/main/assets/baidu_files/min_nav_9dda26ef.js
function d (line 1) | function d(){}
FILE: testsample/src/main/assets/baidu_files/min_super_6a1867d5.js
function i (line 1) | function i(m){var n=m.getBoundingClientRect();return !!(n.bottom-n.top)}
function g (line 1) | function g(){return true}
function c (line 1) | function c(j){$("#"+j).bind("mousedown",g)}
function h (line 1) | function h(k,j){var l={category:k};if(j){$.extend(l,j)}i.fire("categoryC...
function z (line 1) | function z(n,k,i){if(p.attachEvent){n.attachEvent("on"+k,i)}else{if(p.ad...
function q (line 1) | function q(i){return E.getElementById(i)}
function u (line 1) | function u(){$("#kw").on("focus",function(){$(this).addClass("nobg_s_fm_...
function o (line 1) | function o(n,L,k,w,i){$("#"+n).bind("mouseover",function(O){j[i]=true;$(...
function I (line 1) | function I(i,n){if(i){var k=E.createElement("script");k.charset=n?n:"gbk...
function d (line 1) | function d(){var h=0;var g=setInterval(function(){if(window.s_session.in...
function G (line 1) | function G(a){return document.getElementById(a)}
function addEV (line 1) | function addEV(c,b,a){if(window.attachEvent){c.attachEvent("on"+b,a)}els...
function A (line 1) | function A(){try{return(z in v&&v[z])}catch(a){return false}}
function p (line 1) | function p(){try{return(e in v&&v[e]&&v[e][v.location.hostname])}catch(a...
function B (line 1) | function B(a){return function(){var b=Array.prototype.slice.call(argumen...
function q (line 1) | function q(a){return"_"+a}
function k (line 1) | function k(C){return document.getElementById(C)}
function n (line 1) | function n(C){return document.createElement(C)}
function x (line 1) | function x(C){return String(C).replace(new RegExp("(^[\\s\\t\\xa0\\u3000...
function z (line 1) | function z(C){return String(C).replace(new RegExp("[\\s\\t\\xa0\\u3000]"...
function t (line 1) | function t(E,D,C){if(q){E.attachEvent("on"+D,(function(H){return functio...
function r (line 1) | function r(C){if(q){C.returnValue=false}else{C.preventDefault()}}
function v (line 1) | function v(D){if(q){var E=document.createStyleSheet();E.cssText=D}else{v...
function h (line 1) | function h(H){var E=document.forms[0];for(var D in H){if(H[D]==undefined...
function s (line 1) | function s(E){var H=document.forms[0];var I=false;var C=H.getElementsByT...
function o (line 1) | function o(E){var D=document.forms[0];for(var C in E){if(C=="f"){if(s("f...
function C (line 1) | function C(E){var I=this.__MSG_QS__;if(!I[E]){I[E]=[]}for(var H=1,K=argu...
function D (line 1) | function D(I){var H=this.__MSG_QS__[I.type];if(H==null){return}for(var E...
function U (line 1) | function U(){h({inputT:a>0?(new Date().getTime()-a):0})}
function T (line 1) | function T(){if(S){g.dm({type:"start"});S=false}}
function O (line 1) | function O(Z){if(a==0){a=new Date().getTime()}if(S){g.dm({type:"start"})...
function E (line 1) | function E(){var Z=W.value;if(Z==P&&Z!=""&&Z!=V&&Z!=Q){if(Y==0){Y=setTim...
function D (line 1) | function D(){if(!K){K=setInterval(E,30)}}
function M (line 1) | function M(){clearInterval(K);K=0}
function J (line 1) | function J(){if(H){window.event.cancelBubble=true;window.event.returnVal...
function R (line 1) | function R(Z){W.blur();W.setAttribute("autocomplete",Z);W.focus()}
function X (line 1) | function X(Z){var Z=Z||window.event;if(Z.keyCode==13){r(Z)}}
function E (line 1) | function E(){var ac=J.rows;for(var ad=0;ad<ac.length;ad++){ac[ad].classN...
function R (line 1) | function R(){if(typeof(J)!="undefined"&&J!=null&&O.style.display!="none"...
function N (line 1) | function N(){if(q&&q<=6){D&&(D.style.display="none")}O&&(O.style.display...
function aa (line 1) | function aa(){E();this.className="mo"}
function U (line 1) | function U(ac){B.dm({type:"mousedown_tr"});if(!q){ac.stopPropagation();a...
function T (line 1) | function T(ad){var ac=ad;return function(){var ae=ab[ac].value;N();var a...
function Q (line 1) | function Q(ac){ac=ac||window.event;r(ac);B.dm({type:"close"});N();(new I...
function Z (line 1) | function Z(){var ac=[W.offsetWidth,W.offsetHeight];O.style.width=((q&&A)...
function Y (line 1) | function Y(ad,ae){if(ad&&ae){var ac=x(ad);if(ae.indexOf(ac)==0){ae=C(ae,...
function C (line 1) | function C(ag,ae){ag=ag.replace(/&/g,"&");ag=ag.replace(/</g,"<")...
function M (line 1) | function M(ag){var ad=k("kw").value,ae=/[^\x00-\xff]/g,ak=[],aj=[];p=0;f...
function L (line 1) | function L(){function ac(ak){if(!ak||!ak.title){return}setTimeout(functi...
function H (line 1) | function H(ad,ae){var ac=[];switch(V[ae].type){case"1":ac.push("<h3>"+V[...
function X (line 1) | function X(){S=R()[0];if(S==-1){B.dm({type:"submit"})}else{B.dm({type:"e...
function K (line 1) | function K(){S=R()[0];E();if(S==0){B.dm({type:"key_select",selected:""})...
function P (line 1) | function P(){S=R()[0];E();if(S==ab.length-1){B.dm({type:"key_select",sel...
function H (line 1) | function H(){if(k("bdsug_ipt_sug")){if(k("bdsug_ipt_sug").value==x(k("kw...
function E (line 1) | function E(){H();h({inputT:a>0?(new Date().getTime()-a):0});C.onsubmit()...
function D (line 1) | function D(I){h(I);h({inputT:a>0?(new Date().getTime()-a):0});o({sug:1,r...
function H (line 1) | function H(I){if(typeof C[I]=="undefined"){c.dm({type:"request_data",wd:...
function E (line 1) | function E(I){C[I.q]=I;c.dm({type:"give_data",data:C[I.q]})}
function D (line 1) | function D(L,K){if(typeof C[L]!="undefined"){if(K.length>0){var I=[];for...
function E (line 1) | function E(I){var H=$.url.escapeSSL("http://suggestion.baidu.com/su");u....
function C (line 1) | function C(){if(navigator.cookieEnabled){document.cookie="su=0; domain=w...
function D (line 1) | function D(){var E=(navigator.cookieEnabled&&/sug=(\d)/.test(document.co...
function K (line 1) | function K(){if(E.offsetWidth!=0&&L.offsetWidth!=E.offsetWidth){e.dm({ty...
function H (line 1) | function H(){E=n("DIV");E.id="sd_"+new Date().getTime();E.className="s-p...
function J (line 1) | function J(N){N=N||window.event;var O=N.target||N.srcElement;if(O==L){re...
function C (line 1) | function C(){e.dm({type:"window_blur"})}
function D (line 1) | function D(){var O="#"+E.id;var N=[];e.dm({type:"div_ready",sdiv:E,frm:M...
function a (line 1) | function a(){F.call("superplus:start/skin_start","init")}
function b (line 1) | function b(){F.call("superplus:mngr/top_menu","init");if(c){F.call("supe...
function d (line 1) | function d(){var e=$("#s_mod_weather");e.one("mouseenter",function(){var...
FILE: testsample/src/main/assets/baidu_files/min_tips_27647c7d.js
function e (line 1) | function e(){}
FILE: testsample/src/main/assets/baidu_files/sbase_6ae84319.js
function c (line 1) | function c(s,r){if(s instanceof Array){for(var q=0,p=s.length;q<p;q++){i...
function b (line 1) | function b(q,p){this.svnMod="";this.name=null;this.path=q;this.fn=null;t...
function k (line 1) | function k(r,p){var o=(p=="css");var q=document.createElement(o?"link":"...
function l (line 1) | function l(t,q,v,s){var r=k(t,q);if(r.nodeName==="SCRIPT"){d(r,o)}else{g...
function d (line 1) | function d(o,p){o.onload=o.onerror=o.onreadystatechange=function(){if(/l...
function g (line 1) | function g(o,p){if(o.attachEvent){o.attachEvent("onload",p)}else{setTime...
function f (line 1) | function f(s,u){if(u&&u.isCalled){return}var o;var r=navigator.userAgent...
function f (line 1) | function f(m){if(/["\\\x00-\x1f]/.test(m)){m=m.replace(/["\\\x00-\x1f]/g...
function a (line 1) | function a(r){var n=["["],o=r.length,m,p,q;for(p=0;p<o;p++){q=r[p];switc...
function j (line 1) | function j(l){return"_super_"+l.replace(/[_\s]/g,function(m){return m=="...
function b (line 1) | function b(){return document.getElementById(c+"-storage")}
function a (line 1) | function a(){var l;if(window.ActiveXObject&&$.browser.ie<9){l=k()}else{i...
function k (line 1) | function k(){$(document.body).append($.formatString('<div id="#{id}" sty...
function e (line 1) | function e(){return{set:function(r,q,s,t){var m=g.SUCCESS,n=window.local...
function d (line 1) | function d(){return{set:function(m,n,o,l){S.cookie.set(j(m),n,l);o&&o.ca...
function l (line 1) | function l(m){var o=m||window.event,s=g.call(arguments,1),u=0,q=0,p=0,r=...
function f (line 1) | function f(){b=null}
function a (line 1) | function a(n,m){return e.settings.adjustOldDeltas&&n.type==="mousewheel"...
FILE: testsample/src/main/java/com/android/sample/HomeTestActivity.java
class HomeTestActivity (line 32) | public class HomeTestActivity extends BaseActivity implements View.OnCli...
method onCreate (line 64) | @Override
method initView (line 71) | protected void initView() {
method initData (line 104) | protected void initData() {
method onReceive (line 108) | @Override
method onClick (line 115) | @Override
FILE: testsample/src/main/java/com/android/sample/test_activity/ActivityA.java
class ActivityA (line 23) | public class ActivityA extends BaseActivity implements View.OnClickListe...
method onCreate (line 33) | @Override
method initView (line 40) | protected void initView() {
method initData (line 61) | protected void initData() {
method onResume (line 64) | @Override
method showStackInfo (line 70) | private void showStackInfo(){
method onNewIntent (line 77) | @Override
method onClick (line 83) | @Override
FILE: testsample/src/main/java/com/android/sample/test_activity/ActivityB.java
class ActivityB (line 23) | public class ActivityB extends BaseActivity implements View.OnClickListe...
method onCreate (line 33) | @Override
method initView (line 40) | protected void initView() {
method initData (line 60) | protected void initData() {
method showStackInfo (line 63) | private void showStackInfo(){
method onClick (line 70) | @Override
method onResume (line 95) | @Override
FILE: testsample/src/main/java/com/android/sample/test_activity/ActivityTestHomePage.java
class ActivityTestHomePage (line 24) | public class ActivityTestHomePage extends BaseActivityWithPopWindow impl...
method onCreate (line 30) | @Override
method initView (line 37) | protected void initView() {
method initData (line 50) | protected void initData() {
method onCreateOptionsMenu (line 80) | @Override
method onClick (line 98) | @Override
method onItemClickCallback (line 133) | @Override
FILE: testsample/src/main/java/com/android/sample/test_cache/CacheActivity.java
class CacheActivity (line 24) | public class CacheActivity extends BaseActivity implements View.OnClickL...
method onCreate (line 29) | @Override
method initView (line 36) | protected void initView() {
method initData (line 45) | protected void initData() {
method onClick (line 48) | @Override
class TestModule (line 99) | public static class TestModule extends CacheManager.ParseObject{
method TestModule (line 104) | public TestModule() {
method stringParseObject (line 107) | @Override
method toString (line 119) | @Override
FILE: testsample/src/main/java/com/android/sample/test_db/DBActivity.java
class DBActivity (line 21) | public class DBActivity extends BaseActivity implements View.OnClickList...
method onCreate (line 25) | @Override
method initView (line 32) | protected void initView() {
method initData (line 40) | protected void initData() {
method onClick (line 43) | @Override
FILE: testsample/src/main/java/com/android/sample/test_db/db/StudentDB.java
class StudentDB (line 17) | public class StudentDB extends BaseDB{
method StudentDB (line 18) | public StudentDB(IBaseDBTable table, boolean writable) {
method getDBName (line 22) | @Override
method getDBVersion (line 27) | @Override
method onDBCreate (line 32) | @Override
method onDBUpgrade (line 58) | @Override
type TABLES (line 72) | public enum TABLES implements IBaseDBTable {
method getTableColumns (line 74) | @Override
method getTableColumns (line 85) | @Override
method TABLES (line 95) | TABLES(String table_name){
method getTableName (line 99) | @Override
method getTableColumns (line 104) | @Override
FILE: testsample/src/main/java/com/android/sample/test_db/db/StudentHelper.java
class StudentHelper (line 14) | public class StudentHelper extends BaseDBHelper{
method getInstance (line 17) | public static StudentHelper getInstance(){
method StudentHelper (line 28) | private StudentHelper(){
class StudentInfo (line 34) | public static class StudentInfo{
method insertStudentInfo (line 45) | public boolean insertStudentInfo(String name, String gender, int weight){
method insertStudentInfos (line 56) | public long insertStudentInfos(ArrayList<StudentInfo> infos){
method deleteStudentInfo (line 69) | public boolean deleteStudentInfo(String name){
method clear (line 77) | public boolean clear(){
method insertGrade (line 83) | public boolean insertGrade(int Class, int grade){
method getStudentInfo (line 93) | public ArrayList<StudentInfo> getStudentInfo(String name){
method initInsertDB (line 113) | @Override
method initDeleteDB (line 118) | @Override
method initUpdateDB (line 123) | @Override
method initQueryDB (line 128) | @Override
FILE: testsample/src/main/java/com/android/sample/test_dialog/DialogActivity.java
class DialogActivity (line 29) | public class DialogActivity extends BaseActivity implements View.OnClick...
method onCreate (line 30) | @Override
method initView (line 37) | protected void initView() {
method initData (line 50) | protected void initData() {
method onClick (line 54) | @Override
FILE: testsample/src/main/java/com/android/sample/test_download/DownloadActivity.java
class DownloadActivity (line 24) | public class DownloadActivity extends BaseActivity implements View.OnCli...
method onCreate (line 34) | @Override
method initView (line 41) | protected void initView() {
method initData (line 54) | protected void initData() {
method onRequestPermissionsResult (line 66) | @Override
method initManager (line 98) | private void initManager(){
method onClick (line 186) | @Override
method onDestroy (line 204) | @Override
FILE: testsample/src/main/java/com/android/sample/test_guide/GuideActivity.java
class GuideActivity (line 16) | public class GuideActivity extends BaseActivity implements View.OnClickL...
method onCreate (line 18) | @Override
method initView (line 25) | protected void initView() {
method initData (line 31) | protected void initData() {
method onClick (line 34) | @Override
method onBackPressed (line 50) | @Override
method onDestroy (line 56) | @Override
FILE: testsample/src/main/java/com/android/sample/test_imageloader/ImageActivity.java
class ImageActivity (line 25) | public class ImageActivity extends BaseActivity{
method onCreate (line 28) | @Override
method initView (line 35) | protected void initView() {
method initData (line 40) | protected void initData() {
class GridAdapter (line 44) | public class GridAdapter extends BaseAdapter{
method getCount (line 46) | @Override
method getItem (line 51) | @Override
method getItemId (line 56) | @Override
method getView (line 61) | @Override
FILE: testsample/src/main/java/com/android/sample/test_imageloader/PicUrl.java
class PicUrl (line 10) | public class PicUrl {
FILE: testsample/src/main/java/com/android/sample/test_netapi/NetActivity.java
class NetActivity (line 28) | public class NetActivity extends BaseActivity implements View.OnClickLis...
method onCreate (line 34) | @Override
method initView (line 41) | protected void initView() {
method initData (line 56) | protected void initData() {
method onClick (line 60) | @Override
FILE: testsample/src/main/java/com/android/sample/test_utils/CommonActivity.java
class CommonActivity (line 16) | public class CommonActivity extends BaseActivity{
method onCreate (line 21) | @Override
method initView (line 28) | protected void initView() {
method initData (line 38) | protected void initData() {
FILE: testsample/src/main/java/com/android/sample/test_utils/FileActivity.java
class FileActivity (line 18) | public class FileActivity extends BaseActivity implements View.OnClickLi...
method onCreate (line 19) | @Override
method initView (line 26) | protected void initView() {
method initData (line 31) | protected void initData() {
method onClick (line 35) | @Override
FILE: testsample/src/main/java/com/android/sample/test_utils/ImageActivity.java
class ImageActivity (line 28) | public class ImageActivity extends BaseActivity implements View.OnClickL...
method onCreate (line 39) | @Override
method initView (line 46) | protected void initView() {
method initData (line 75) | protected void initData() {
method onClick (line 86) | @Override
FILE: testsample/src/main/java/com/android/sample/test_utils/UtilsActivity.java
class UtilsActivity (line 16) | public class UtilsActivity extends BaseActivity implements View.OnClickL...
method onCreate (line 18) | @Override
method initView (line 25) | protected void initView() {
method initData (line 32) | protected void initData() {
method onClick (line 36) | @Override
FILE: testsample/src/main/java/com/android/sample/test_volley/VolleyActivity.java
class VolleyActivity (line 34) | public class VolleyActivity extends BaseActivity implements View.OnClick...
method onCreate (line 39) | @Override
method initView (line 46) | protected void initView() {
method initData (line 61) | protected void initData() {
method onClick (line 65) | @Override
FILE: testsample/src/main/java/com/android/sample/test_webview/TestWebFragment.java
class TestWebFragment (line 13) | public class TestWebFragment extends WebFragment{
method initView (line 16) | @Override
FILE: testsample/src/main/java/com/android/sample/test_webview/WebViewActivity.java
class WebViewActivity (line 25) | public class WebViewActivity extends BaseActivity implements View.OnClic...
method onCreate (line 28) | @Override
method initView (line 35) | protected void initView() {
method initData (line 44) | protected void initData() {
method onClick (line 62) | @Override
FILE: testsample/src/main/java/com/android/sample/test_widget/FlowLayoutActivity.java
class FlowLayoutActivity (line 20) | public class FlowLayoutActivity extends BaseActivity{
method onCreate (line 22) | @Override
FILE: testsample/src/main/java/com/android/sample/test_widget/GridLayoutActivity.java
class GridLayoutActivity (line 19) | public class GridLayoutActivity extends BaseActivity{
method onCreate (line 21) | @Override
FILE: testsample/src/main/java/com/android/sample/test_widget/WidgetActivity.java
class WidgetActivity (line 16) | public class WidgetActivity extends BaseActivity implements View.OnClick...
method onCreate (line 18) | @Override
method onClick (line 26) | @Override
Condensed preview — 178 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,160K chars).
[
{
"path": ".gitignore",
"chars": 591,
"preview": "# Built application files\n*.apk\n*.ap_\n\n# Files for the ART/Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated file"
},
{
"path": ".idea/compiler.xml",
"chars": 686,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"CompilerConfiguration\">\n <resourceExt"
},
{
"path": ".idea/copyright/profiles_settings.xml",
"chars": 74,
"preview": "<component name=\"CopyrightManager\">\n <settings default=\"\" />\n</component>"
},
{
"path": ".idea/gradle.xml",
"chars": 821,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"GradleSettings\">\n <option name=\"linke"
},
{
"path": ".idea/misc.xml",
"chars": 2226,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"EntryPointsManager\">\n <entry_points v"
},
{
"path": ".idea/modules.xml",
"chars": 637,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectModuleManager\">\n <modules>\n "
},
{
"path": ".idea/runConfigurations.xml",
"chars": 564,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"RunConfigurationProducerService\">\n <o"
},
{
"path": ".idea/vcs.xml",
"chars": 167,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"VcsDirectoryMappings\">\n <mapping dire"
},
{
"path": "LICENSE",
"chars": 1295,
"preview": "Copyright (c) 2015, zhao_zepeng\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without"
},
{
"path": "README.md",
"chars": 2734,
"preview": "# android_framework #\n<em>an android framework in order for rapid development</em>\n\n##1.开发环境##\n环境为*android studio* + *j"
},
{
"path": "README.md~",
"chars": 2702,
"preview": "# android_framework #\n<em>an android framework in order for rapid development</em>\n\n##1.开发环境##\n环境为*android studio* + *jd"
},
{
"path": "build.gradle",
"chars": 482,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n r"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 230,
"preview": "#Fri Mar 03 10:38:35 CST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
},
{
"path": "gradle.properties",
"chars": 855,
"preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
},
{
"path": "gradlew",
"chars": 5080,
"preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n## Gradle start "
},
{
"path": "gradlew.bat",
"chars": 2404,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "libcore/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "libcore/build.gradle",
"chars": 586,
"preview": "apply plugin: 'com.android.library'\n\nandroid {\n compileSdkVersion 25\n buildToolsVersion '25.0.0'\n\n defaultConfi"
},
{
"path": "libcore/proguard-rules.pro",
"chars": 677,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /h"
},
{
"path": "libcore/src/main/AndroidManifest.xml",
"chars": 123,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.android.libcore\">\n\n</manifes"
},
{
"path": "libcore/src/main/java/com/android/libcore/Toast/T.java",
"chars": 2613,
"preview": "package com.android.libcore.Toast;\n\nimport android.view.Gravity;\nimport android.view.View;\nimport android.widget.Toast;\n"
},
{
"path": "libcore/src/main/java/com/android/libcore/activity/ActivityManager.java",
"chars": 5976,
"preview": "package com.android.libcore.activity;\n\nimport android.app.Activity;\nimport android.content.Context;\n\nimport com.android."
},
{
"path": "libcore/src/main/java/com/android/libcore/activity/RootActivity.java",
"chars": 2293,
"preview": "package com.android.libcore.activity;\n\nimport android.app.Activity;\nimport android.content.BroadcastReceiver;\nimport and"
},
{
"path": "libcore/src/main/java/com/android/libcore/activity/RootFragment.java",
"chars": 1492,
"preview": "package com.android.libcore.activity;\n\n\nimport android.content.BroadcastReceiver;\nimport android.content.Context;\nimport"
},
{
"path": "libcore/src/main/java/com/android/libcore/application/RootApplication.java",
"chars": 4020,
"preview": "package com.android.libcore.application;\n\n\nimport android.app.AlarmManager;\nimport android.app.Application;\nimport andro"
},
{
"path": "libcore/src/main/java/com/android/libcore/cachemanager/CacheManager.java",
"chars": 7567,
"preview": "package com.android.libcore.cachemanager;\n\nimport android.content.Context;\nimport android.content.SharedPreferences;\nimp"
},
{
"path": "libcore/src/main/java/com/android/libcore/database/BaseDB.java",
"chars": 12562,
"preview": "package com.android.libcore.database;\n\nimport android.content.ContentValues;\nimport android.database.Cursor;\nimport andr"
},
{
"path": "libcore/src/main/java/com/android/libcore/database/BaseDBHelper.java",
"chars": 3730,
"preview": "package com.android.libcore.database;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\n\n/**\n * Description: 所有数据库操"
},
{
"path": "libcore/src/main/java/com/android/libcore/database/IBaseDBTable.java",
"chars": 399,
"preview": "package com.android.libcore.database;\n\nimport java.util.ArrayList;\n\n/**\n * Description: 所有数据库DB类应该声明一个枚举类,用来封装该数据库中的所有表名"
},
{
"path": "libcore/src/main/java/com/android/libcore/dialog/BaseDialog.java",
"chars": 3658,
"preview": "package com.android.libcore.dialog;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.view.View"
},
{
"path": "libcore/src/main/java/com/android/libcore/download/DownloadDB.java",
"chars": 2625,
"preview": "package com.android.libcore.download;\n\nimport android.database.sqlite.SQLiteDatabase;\n\nimport com.android.libcore.databa"
},
{
"path": "libcore/src/main/java/com/android/libcore/download/DownloadDBHelper.java",
"chars": 3153,
"preview": "package com.android.libcore.download;\n\nimport com.android.libcore.database.BaseDBHelper;\n\nimport java.util.ArrayList;\nim"
},
{
"path": "libcore/src/main/java/com/android/libcore/download/FileDownloadManager.java",
"chars": 21860,
"preview": "package com.android.libcore.download;\n\nimport android.os.Handler;\nimport android.os.Message;\n\nimport com.android.libcore"
},
{
"path": "libcore/src/main/java/com/android/libcore/guide/GuideManager.java",
"chars": 6253,
"preview": "package com.android.libcore.guide;\n\nimport android.app.Activity;\nimport android.view.InflateException;\nimport android.vi"
},
{
"path": "libcore/src/main/java/com/android/libcore/log/L.java",
"chars": 2898,
"preview": "package com.android.libcore.log;\n\nimport android.text.TextUtils;\nimport android.util.Log;\n\nimport com.android.libcore.ap"
},
{
"path": "libcore/src/main/java/com/android/libcore/net/NetError.java",
"chars": 534,
"preview": "package com.android.libcore.net;\n\nimport com.android.volley.VolleyError;\n\n/**\n * Description: 网络访问错误error\n *\n * @author "
},
{
"path": "libcore/src/main/java/com/android/libcore/net/imageloader/ImageLoader.java",
"chars": 5720,
"preview": "package com.android.libcore.net.imageloader;\n\nimport android.graphics.Bitmap;\nimport android.widget.ImageView;\n\nimport c"
},
{
"path": "libcore/src/main/java/com/android/libcore/net/imageloader/VolleyLruCache.java",
"chars": 767,
"preview": "package com.android.libcore.net.imageloader;\n\nimport android.graphics.Bitmap;\nimport android.support.v4.util.LruCache;\n\n"
},
{
"path": "libcore/src/main/java/com/android/libcore/net/netapi/BaseNetApi.java",
"chars": 7251,
"preview": "package com.android.libcore.net.netapi;\n\nimport android.app.Activity;\nimport android.content.Context;\n\nimport com.androi"
},
{
"path": "libcore/src/main/java/com/android/libcore/utils/CommonUtils.java",
"chars": 11308,
"preview": "package com.android.libcore.utils;\n\nimport android.app.Activity;\nimport android.app.ActivityManager;\nimport android.cont"
},
{
"path": "libcore/src/main/java/com/android/libcore/utils/FileUtils.java",
"chars": 9704,
"preview": "package com.android.libcore.utils;\n\nimport android.os.Environment;\nimport android.text.format.Formatter;\n\nimport com.and"
},
{
"path": "libcore/src/main/java/com/android/libcore/utils/ImageUtils.java",
"chars": 10648,
"preview": "package com.android.libcore.utils;\n\nimport android.app.Activity;\nimport android.graphics.Bitmap;\nimport android.graphics"
},
{
"path": "libcore/src/main/java/com/android/libcore/volley/BaseVolleyApi.java",
"chars": 1176,
"preview": "package com.android.libcore.volley;\n\n\nimport com.android.libcore.application.RootApplication;\nimport com.android.volley."
},
{
"path": "libcore/src/main/java/com/android/libcore/volley/VolleyLruCache.java",
"chars": 758,
"preview": "package com.android.libcore.volley;\n\nimport android.graphics.Bitmap;\nimport android.support.v4.util.LruCache;\n\nimport co"
},
{
"path": "libcore/src/main/res/values/strings.xml",
"chars": 25,
"preview": "<resources>\n</resources>\n"
},
{
"path": "libcore-ui/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "libcore-ui/build.gradle",
"chars": 569,
"preview": "apply plugin: 'com.android.library'\n\nandroid {\n compileSdkVersion 25\n buildToolsVersion '25.0.0'\n\n defaultConfi"
},
{
"path": "libcore-ui/proguard-rules.pro",
"chars": 677,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /h"
},
{
"path": "libcore-ui/src/main/AndroidManifest.xml",
"chars": 687,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.android.libcore_ui\">\n\n <a"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseActivity.java",
"chars": 9513,
"preview": "package com.android.libcore_ui.activity;\n\nimport android.content.pm.PackageManager;\nimport android.os.Build;\nimport andr"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseActivityWithPopWindow.java",
"chars": 11560,
"preview": "package com.android.libcore_ui.activity;\n\nimport android.animation.ObjectAnimator;\nimport android.animation.ValueAnimato"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/activity/BaseFragment.java",
"chars": 2018,
"preview": "package com.android.libcore_ui.activity;\n\nimport android.app.Activity;\nimport android.os.Bundle;\nimport android.os.Messa"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/activity/widget/BottomBarGroupLinearLayout.java",
"chars": 2781,
"preview": "package com.android.libcore_ui.activity.widget;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimpor"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/application/BaseApplication.java",
"chars": 246,
"preview": "package com.android.libcore_ui.application;\n\nimport com.android.libcore.application.RootApplication;\n\n/**\n * Description"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/dialog/AppDialog.java",
"chars": 10370,
"preview": "package com.android.libcore_ui.dialog;\n\nimport android.content.Context;\nimport android.view.LayoutInflater;\nimport andro"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/dialog/DialogCreator.java",
"chars": 4484,
"preview": "package com.android.libcore_ui.dialog;\n\nimport android.view.View;\n\nimport com.android.libcore_ui.application.BaseApplica"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/dialog/LoadingDialog.java",
"chars": 760,
"preview": "package com.android.libcore_ui.dialog;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.widget"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/net/NetApi.java",
"chars": 942,
"preview": "package com.android.libcore_ui.net;\n\nimport android.content.Context;\n\nimport com.android.libcore.net.netapi.BaseNetApi;\n"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/net/request/XMLRequest.java",
"chars": 2201,
"preview": "package com.android.libcore_ui.net.request;\n\nimport com.android.volley.AuthFailureError;\nimport com.android.volley.Netwo"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/permanentdbcache/PermanentCacheDB.java",
"chars": 2337,
"preview": "package com.android.libcore_ui.permanentdbcache;\n\nimport android.database.sqlite.SQLiteDatabase;\n\nimport com.android.lib"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/permanentdbcache/PermanentCacheDBHelper.java",
"chars": 2473,
"preview": "package com.android.libcore_ui.permanentdbcache;\n\nimport com.android.libcore.database.BaseDBHelper;\n\nimport java.util.Ar"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/volley/VolleyApi.java",
"chars": 210,
"preview": "package com.android.libcore_ui.volley;\n\nimport com.android.libcore.volley.BaseVolleyApi;\n\n/**\n *\n * @author zzp(zhao_zep"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/volley/request/XMLRequest.java",
"chars": 1921,
"preview": "package com.android.libcore_ui.volley.request;\n\nimport com.android.volley.NetworkResponse;\nimport com.android.volley.Par"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/web/WebFragment.java",
"chars": 8384,
"preview": "package com.android.libcore_ui.web;\n\nimport android.annotation.SuppressLint;\nimport android.app.Dialog;\nimport android.g"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/web/webactivity/WebActivity.java",
"chars": 4954,
"preview": "package com.android.libcore_ui.web.webactivity;\n\nimport android.content.res.Configuration;\nimport android.graphics.Bitma"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/web/webactivity/WebActivityFragment.java",
"chars": 2665,
"preview": "package com.android.libcore_ui.web.webactivity;\n\nimport android.content.Intent;\nimport android.content.pm.PackageManager"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/widget/FlowLayout.java",
"chars": 12059,
"preview": "package com.android.libcore_ui.widget;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport an"
},
{
"path": "libcore-ui/src/main/java/com/android/libcore_ui/widget/SimpleGridLayout.java",
"chars": 3593,
"preview": "package com.android.libcore_ui.widget;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport an"
},
{
"path": "libcore-ui/src/main/res/drawable/base_dialog_shape.xml",
"chars": 273,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <stroke an"
},
{
"path": "libcore-ui/src/main/res/drawable/bg_edittext.xml",
"chars": 313,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\" >\r\n <ite"
},
{
"path": "libcore-ui/src/main/res/drawable/bg_edittext_focus.xml",
"chars": 293,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\" >\r\n <solid "
},
{
"path": "libcore-ui/src/main/res/drawable/bg_edittext_not_focus.xml",
"chars": 287,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\" >\r\n<solid andr"
},
{
"path": "libcore-ui/src/main/res/drawable/bg_loading_dialog.xml",
"chars": 294,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:"
},
{
"path": "libcore-ui/src/main/res/drawable/bg_progress_bar.xml",
"chars": 1059,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <item"
},
{
"path": "libcore-ui/src/main/res/drawable/bottom_button_all_selector.xml",
"chars": 500,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- 使用"
},
{
"path": "libcore-ui/src/main/res/drawable/bottom_button_bottom_selector.xml",
"chars": 586,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- 使用"
},
{
"path": "libcore-ui/src/main/res/drawable/bottom_button_middle_selector.xml",
"chars": 410,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- 使用"
},
{
"path": "libcore-ui/src/main/res/drawable/bottom_button_shape.xml",
"chars": 279,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <stroke an"
},
{
"path": "libcore-ui/src/main/res/drawable/bottom_button_top_selector.xml",
"chars": 574,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- 使用"
},
{
"path": "libcore-ui/src/main/res/drawable/dialog_button_bottom_selector.xml",
"chars": 586,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- 使用"
},
{
"path": "libcore-ui/src/main/res/drawable/dialog_button_bottomleft_selector.xml",
"chars": 520,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- 使用"
},
{
"path": "libcore-ui/src/main/res/drawable/dialog_button_bottomright_selector.xml",
"chars": 522,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- 使用"
},
{
"path": "libcore-ui/src/main/res/drawable/dialog_button_middle_selector.xml",
"chars": 410,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- 使用"
},
{
"path": "libcore-ui/src/main/res/layout/activity_base_layout.xml",
"chars": 1253,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "libcore-ui/src/main/res/layout/activity_base_layout_with_popwindow.xml",
"chars": 2710,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "libcore-ui/src/main/res/layout/activity_top_bar_layout.xml",
"chars": 1796,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- 所有activity的顶部bar样式,如果需要改变高度,颜色或者图标,请在此进行更改 -->\n<LinearLayout xmlns:android="
},
{
"path": "libcore-ui/src/main/res/layout/activity_top_toolbar_layout.xml",
"chars": 335,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.v7.widget.Toolbar\n xmlns:android=\"http://schemas.android.com/"
},
{
"path": "libcore-ui/src/main/res/layout/activity_web_layout.xml",
"chars": 1078,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "libcore-ui/src/main/res/layout/bottom_group_layout.xml",
"chars": 410,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<com.android.libcore_ui.activity.widget.BottomBarGroupLinearLayout\n xmlns:andr"
},
{
"path": "libcore-ui/src/main/res/layout/bottom_item_layout.xml",
"chars": 777,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "libcore-ui/src/main/res/layout/bottom_popwindow_layout.xml",
"chars": 517,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n androi"
},
{
"path": "libcore-ui/src/main/res/layout/dialog_base_layout.xml",
"chars": 1853,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "libcore-ui/src/main/res/layout/dialog_item_button_layout.xml",
"chars": 812,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "libcore-ui/src/main/res/layout/dialog_js_prompt_message_layout.xml",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "libcore-ui/src/main/res/layout/loading_dialog_layout.xml",
"chars": 972,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "libcore-ui/src/main/res/layout/menu_refresh_layout.xml",
"chars": 279,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "libcore-ui/src/main/res/menu/menu_webactivity_refresh.xml",
"chars": 341,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"h"
},
{
"path": "libcore-ui/src/main/res/values/attrs.xml",
"chars": 869,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <declare-styleable name=\"SimpleGridLayout\">\n <attr name=\"c"
},
{
"path": "libcore-ui/src/main/res/values/colors.xml",
"chars": 637,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"transparent\">#00000000</color>\n <color name=\"blac"
},
{
"path": "libcore-ui/src/main/res/values/strings.xml",
"chars": 244,
"preview": "<resources>\n <string name=\"loading_process\">正在加载</string>\n <string name=\"confirm\">确定</string>\n <string name=\"ca"
},
{
"path": "libcore-ui/src/main/res/values/styles.xml",
"chars": 1084,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <style name=\"theme_dialog\" parent=\"Theme.AppCompat.Dialog\">\n "
},
{
"path": "libcore-ui/src/main/res/values-v19/styles.xml",
"chars": 494,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <style name=\"Activity_translucent_status_bar\" parent=\"@style/Them"
},
{
"path": "libcore-ui/src/main/res/values-v21/styles.xml",
"chars": 499,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <style name=\"Activity_translucent_status_bar\" parent=\"@style/Them"
},
{
"path": "libcore-ui/src/main/res/values-v23/styles.xml",
"chars": 63,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n</resources>"
},
{
"path": "settings.gradle",
"chars": 49,
"preview": "include ':libcore', ':libcore-ui', ':testsample'\n"
},
{
"path": "testsample/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "testsample/build.gradle",
"chars": 622,
"preview": "apply plugin: 'com.android.application'\n\nandroid {\n compileSdkVersion 25\n buildToolsVersion '25.0.0'\n\n defaultC"
},
{
"path": "testsample/proguard-rules.pro",
"chars": 677,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /h"
},
{
"path": "testsample/src/main/AndroidManifest.xml",
"chars": 6354,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.android.framework\">\n\n <us"
},
{
"path": "testsample/src/main/assets/1.html",
"chars": 134,
"preview": "<html><head>\n</head>\n<body >\n\n\n<input type=\"button\" value=\"promt\" onclick=\"alert(window.prompt('title1','text1'));\">\n\n\n"
},
{
"path": "testsample/src/main/assets/baidu.html",
"chars": 157235,
"preview": "<!DOCTYPE html>\n<!-- saved from url=(0022)https://www.baidu.com/ -->\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><m"
},
{
"path": "testsample/src/main/assets/baidu_files/activity_start_52498d2c.js",
"chars": 1799,
"preview": "F.module(\"activity:skin/lottery\",function(g,f,e){var d=g(\"superui:component/share\"),c=g(\"superui:component/dialog\"),a=g("
},
{
"path": "testsample/src/main/assets/baidu_files/all_async_search_57459356.js",
"chars": 214216,
"preview": "var define;var require;var esl;(function(b){var o={};var C={};var x=1;var g=2;var s=3;var p=4;var ah=X();var N;function "
},
{
"path": "testsample/src/main/assets/baidu_files/jquery-1.10.2_d88366fd.js",
"chars": 105386,
"preview": "/*!\n * jQuery JavaScript Library v1.10.2\n * http://jquery.com/\n *\n * Includes Sizzle.js\n * http://sizzlejs.com/\n *\n * Co"
},
{
"path": "testsample/src/main/assets/baidu_files/min_nav_9dda26ef.js",
"chars": 38114,
"preview": "F._setMod(\"navplus\");F._fileMap({\"/js/min_nav_3025724b.js\":[\"config\",\"log/nav_all\",\"nav/ns_data\",\"nav/ns\",\"nav/nused_con"
},
{
"path": "testsample/src/main/assets/baidu_files/min_super_6a1867d5.js",
"chars": 44419,
"preview": "F.module(\"common/result_page\",function(c,b,a){b.createResulPageLink=function(d){if(!d||!d.wd){return\"\"}if(!d.tn){d.tn=\"b"
},
{
"path": "testsample/src/main/assets/baidu_files/min_tips_27647c7d.js",
"chars": 4227,
"preview": "F._setMod(\"tipsplus\");F._fileMap({\"/js/min_tips_88223c25.js\":[\"config\",\"log/log\",\"start/tips_start\"],\"/js/tips_mods_f03a"
},
{
"path": "testsample/src/main/assets/baidu_files/nav_min_22274039.css",
"chars": 33827,
"preview": ".tab-product{position:relative}.tab-product em{color:red;font-size:21px;position:absolute;top:10px;right:6px;line-height"
},
{
"path": "testsample/src/main/assets/baidu_files/sbase_6ae84319.js",
"chars": 38271,
"preview": "(function(m,e){function c(s,r){if(s instanceof Array){for(var q=0,p=s.length;q<p;q++){if(r.call(s[q],s[q],q)===false){re"
},
{
"path": "testsample/src/main/assets/baidu_files/super_min_de974358.css",
"chars": 26401,
"preview": "html{height:100%}body{min-height:100%;_height:100%;cursor:default;min-width:940px;_position:}#head{min-height:100%;_heig"
},
{
"path": "testsample/src/main/assets/baidu_files/xmancard_c006cb6f.js",
"chars": 4315,
"preview": "F._setMod(\"xcard\");F._fileMap({\"/js/xmancard_a70456df.js\":[\"config\",\"base/conf\",\"base/card\",\"base/view\",\"base/common\"],\""
},
{
"path": "testsample/src/main/java/com/android/sample/HomeTestActivity.java",
"chars": 5709,
"preview": "package com.android.sample;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.os.Bundle;\nim"
},
{
"path": "testsample/src/main/java/com/android/sample/test_activity/ActivityA.java",
"chars": 3698,
"preview": "package com.android.sample.test_activity;\n\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view."
},
{
"path": "testsample/src/main/java/com/android/sample/test_activity/ActivityB.java",
"chars": 3524,
"preview": "package com.android.sample.test_activity;\n\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view."
},
{
"path": "testsample/src/main/java/com/android/sample/test_activity/ActivityTestHomePage.java",
"chars": 5089,
"preview": "package com.android.sample.test_activity;\n\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.suppo"
},
{
"path": "testsample/src/main/java/com/android/sample/test_cache/CacheActivity.java",
"chars": 4438,
"preview": "package com.android.sample.test_cache;\n\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.Button"
},
{
"path": "testsample/src/main/java/com/android/sample/test_db/DBActivity.java",
"chars": 3487,
"preview": "package com.android.sample.test_db;\n\nimport android.os.Bundle;\nimport android.view.View;\n\nimport com.android.framework.R"
},
{
"path": "testsample/src/main/java/com/android/sample/test_db/db/StudentDB.java",
"chars": 3542,
"preview": "package com.android.sample.test_db.db;\n\nimport android.database.sqlite.SQLiteDatabase;\n\nimport com.android.libcore.datab"
},
{
"path": "testsample/src/main/java/com/android/sample/test_db/db/StudentHelper.java",
"chars": 4107,
"preview": "package com.android.sample.test_db.db;\n\nimport com.android.libcore.database.BaseDBHelper;\n\nimport java.util.ArrayList;\ni"
},
{
"path": "testsample/src/main/java/com/android/sample/test_dialog/DialogActivity.java",
"chars": 5630,
"preview": "package com.android.sample.test_dialog;\n\nimport android.os.Bundle;\nimport android.view.Gravity;\nimport android.view.View"
},
{
"path": "testsample/src/main/java/com/android/sample/test_download/DownloadActivity.java",
"chars": 8222,
"preview": "package com.android.sample.test_download;\n\nimport android.Manifest;\nimport android.app.AlertDialog;\nimport android.conte"
},
{
"path": "testsample/src/main/java/com/android/sample/test_guide/GuideActivity.java",
"chars": 1823,
"preview": "package com.android.sample.test_guide;\n\nimport android.os.Bundle;\nimport android.view.View;\n\nimport com.android.framewor"
},
{
"path": "testsample/src/main/java/com/android/sample/test_imageloader/ImageActivity.java",
"chars": 2810,
"preview": "package com.android.sample.test_imageloader;\n\nimport android.graphics.Bitmap;\nimport android.graphics.drawable.BitmapDra"
},
{
"path": "testsample/src/main/java/com/android/sample/test_imageloader/PicUrl.java",
"chars": 14211,
"preview": "package com.android.sample.test_imageloader;\n\n\n/**\n * Description:\n *\n * @author zzp(zhao_zepeng@hotmail.com)\n * @since "
},
{
"path": "testsample/src/main/java/com/android/sample/test_netapi/NetActivity.java",
"chars": 5423,
"preview": "package com.android.sample.test_netapi;\n\nimport android.os.Bundle;\nimport android.view.View;\nimport android.view.ViewGro"
},
{
"path": "testsample/src/main/java/com/android/sample/test_utils/CommonActivity.java",
"chars": 1145,
"preview": "package com.android.sample.test_utils;\n\nimport android.os.Bundle;\nimport android.widget.TextView;\n\nimport com.android.fr"
},
{
"path": "testsample/src/main/java/com/android/sample/test_utils/FileActivity.java",
"chars": 1302,
"preview": "package com.android.sample.test_utils;\n\nimport android.os.Bundle;\nimport android.view.View;\n\nimport com.android.framewor"
},
{
"path": "testsample/src/main/java/com/android/sample/test_utils/ImageActivity.java",
"chars": 4833,
"preview": "package com.android.sample.test_utils;\n\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport an"
},
{
"path": "testsample/src/main/java/com/android/sample/test_utils/UtilsActivity.java",
"chars": 1342,
"preview": "package com.android.sample.test_utils;\n\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view.Vie"
},
{
"path": "testsample/src/main/java/com/android/sample/test_volley/VolleyActivity.java",
"chars": 5791,
"preview": "package com.android.sample.test_volley;\n\nimport android.os.Bundle;\nimport android.view.View;\nimport android.view.ViewGro"
},
{
"path": "testsample/src/main/java/com/android/sample/test_webview/TestWebFragment.java",
"chars": 398,
"preview": "package com.android.sample.test_webview;\n\nimport android.webkit.WebView;\n\nimport com.android.libcore_ui.web.WebFragment;"
},
{
"path": "testsample/src/main/java/com/android/sample/test_webview/WebViewActivity.java",
"chars": 3249,
"preview": "package com.android.sample.test_webview;\n\nimport android.content.Intent;\nimport android.os.Build;\nimport android.os.Bund"
},
{
"path": "testsample/src/main/java/com/android/sample/test_widget/FlowLayoutActivity.java",
"chars": 3158,
"preview": "package com.android.sample.test_widget;\n\nimport android.os.Bundle;\nimport android.support.v4.content.ContextCompat;\nimpo"
},
{
"path": "testsample/src/main/java/com/android/sample/test_widget/GridLayoutActivity.java",
"chars": 1175,
"preview": "package com.android.sample.test_widget;\n\nimport android.os.Bundle;\nimport android.view.Gravity;\nimport android.view.View"
},
{
"path": "testsample/src/main/java/com/android/sample/test_widget/WidgetActivity.java",
"chars": 1039,
"preview": "package com.android.sample.test_widget;\n\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view.Vi"
},
{
"path": "testsample/src/main/res/drawable/button_forthpage_selector.xml",
"chars": 873,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!--点击背"
},
{
"path": "testsample/src/main/res/drawable/button_homepage_selector.xml",
"chars": 873,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!--点击背"
},
{
"path": "testsample/src/main/res/drawable/button_secondpage_selector.xml",
"chars": 869,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!--点击背"
},
{
"path": "testsample/src/main/res/drawable/button_thirdpage_selector.xml",
"chars": 873,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!--点击背"
},
{
"path": "testsample/src/main/res/layout/activity_home_test.xml",
"chars": 4435,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n androi"
},
{
"path": "testsample/src/main/res/layout/activity_test_activity_a.xml",
"chars": 2730,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n androi"
},
{
"path": "testsample/src/main/res/layout/activity_test_activity_b.xml",
"chars": 2752,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_activity_homepage.xml",
"chars": 1486,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_cache.xml",
"chars": 937,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_common.xml",
"chars": 1575,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_db.xml",
"chars": 1363,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "testsample/src/main/res/layout/activity_test_dialog.xml",
"chars": 3392,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_download.xml",
"chars": 2277,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_file.xml",
"chars": 554,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_flow.xml",
"chars": 1721,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_grid.xml",
"chars": 833,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_guide.xml",
"chars": 873,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_image.xml",
"chars": 3216,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_imageloader.xml",
"chars": 464,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_net.xml",
"chars": 2295,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_utils.xml",
"chars": 1127,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_webview.xml",
"chars": 972,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/activity_test_widget.xml",
"chars": 836,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "testsample/src/main/res/layout/guide_test_1.xml",
"chars": 881,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/guide_test_2.xml",
"chars": 874,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/guide_test_3.xml",
"chars": 872,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/layout/menu_activity_home_test_search.xml",
"chars": 487,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "testsample/src/main/res/menu/menu_activity_home_test.xml",
"chars": 759,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app="
},
{
"path": "testsample/src/main/res/values/colors.xml",
"chars": 152,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"darkorchid\">#9932CC</color>\n <color name=\"palegre"
},
{
"path": "testsample/src/main/res/values/strings.xml",
"chars": 63,
"preview": "<resources>\n <string name=\"menu\">menu</string>\n</resources>\n"
},
{
"path": "testsample/src/main/res/values/strings_activity.xml",
"chars": 1337,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <string name=\"app_name\">android_framework</string>\n <string na"
},
{
"path": "testsample/src/main/res/values/styles.xml",
"chars": 194,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the zhaozepeng/Android_framework GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 178 files (1.0 MB), approximately 333.1k tokens, and a symbol index with 920 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.