Compare commits

...
28 Commits
Author SHA1 Message Date
seven332 20441479b6 Merge pull request #237 from yooooki/old
Update a regular expression
2017-03-02 16:40:40 +08:00
yooooki af67773c26 Update a regular expression 2017-03-02 16:28:39 +08:00
seven332 486493eba6 Merge pull request #176 from yooooki/old
修复了表站不能获取封面的问题
2016-08-14 20:06:12 +08:00
yooooki 1be8159fe9 fix something with mode_g 2016-08-14 18:31:22 +08:00
unknown b7b6f66e6b Remove .idea 2016-08-04 23:14:46 +08:00
seven332 09642346fc Merge pull request #170 from yooooki/old 2016-08-04 23:09:55 +08:00
yooooki fdd2d57de1 Fixed the bug while getting gallery list 2016-08-04 02:57:57 +08:00
yooooki 4d52f674b2 make url start with "https" in comments clickable 2016-08-04 02:53:53 +08:00
yooooki e4cc1fbd52 Fix Problem of Reguler Expressions 2016-07-30 02:07:52 +08:00
seven332 6c740199cc Fix ex https 2016-07-29 19:46:42 +08:00
seven332 1c0b06120c Fix ndk build 2016-07-29 19:46:09 +08:00
seven332 a302d150e1 Update build tool 2016-07-29 19:45:38 +08:00
seven332 70d87817c8 Remove ide project stuff 2016-07-29 19:43:20 +08:00
seven332 aeb49f4bb6 Use Vector 2015-10-08 12:22:48 +08:00
seven332 e3134bbea1 buildTools version bump 2015-06-07 19:21:13 +08:00
seven332 87a18bac94 Use android.support.annotation.DrawableRes 2015-06-07 19:20:06 +08:00
seven332 cfe0ca9801 : may fail creating file 2015-06-07 19:18:50 +08:00
seven332 3b25fcf45c Update proguard-rules for VectorResources 2015-06-07 16:55:31 +08:00
seven332 cfe8ba06ab Add show_application_stats preference 2015-06-07 16:54:25 +08:00
seven332 9116312875 Restore EhClient 2015-06-07 16:31:39 +08:00
seven332 9b067c9296 svg to VectorDrawable 2015-06-07 16:24:04 +08:00
seven332 f750922dce Update strings.xml 2015-05-26 15:39:22 +08:00
seven332 ccc298ac1e Fix normal preview image crop area totally out of original image 2015-05-13 12:26:46 +08:00
seven332 fbced66a4e Add StatsActivity 2015-05-08 16:27:53 +08:00
seven332 b0a21d8487 0.6.16.2 2015-05-01 19:16:47 +08:00
seven332 662f81e07d Fix search crash in Meizu Lollipop 2015-05-01 19:11:10 +08:00
seven332 1f03e05424 0.6.16.1 2015-05-01 17:56:20 +08:00
seven332 2da8ebe75f Fix pattern protection no more retry first time 2015-05-01 16:41:27 +08:00
67 changed files with 3413 additions and 302 deletions

No files matched your search

+4 -2
View File
@@ -1,6 +1,8 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/src
*.iml
.idea
/captures
Generated
-1
View File
@@ -1 +0,0 @@
EhViewer
-23
View File
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<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" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
-3
View File
@@ -1,3 +0,0 @@
<component name="CopyrightManager">
<settings default="" />
</component>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" defaultCharsetForPropertiesFiles="UTF-8">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
-18
View File
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.7" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
-15
View File
@@ -1,15 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>
-7
View File
@@ -1,7 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
-33
View File
@@ -1,33 +0,0 @@
<?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="org.jetbrains.annotations.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="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/EhViewer.iml" filepath="$PROJECT_DIR$/EhViewer.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
-5
View File
@@ -1,5 +0,0 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
Generated
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+1 -1
View File
@@ -8,7 +8,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
+110 -93
View File
@@ -1,94 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EhViewer" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="svg-android-2.0.6" level="project" />
<orderEntry type="library" exported="" name="libGoogleAnalyticsServices" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.1.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.1.0" level="project" />
</component>
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EhViewer" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="libGoogleAnalyticsServices" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
<orderEntry type="module" module-name="vector" exported="" />
</component>
</module>
+15 -8
View File
@@ -4,14 +4,14 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.hippo.ehviewer"
minSdkVersion 14
targetSdkVersion 22
versionCode 44
versionName "0.6.16"
versionCode 47
versionName "0.6.16.3"
}
buildTypes {
debug {
@@ -24,6 +24,13 @@ android {
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
// Disable default NdkCompile task
// Set new jni lib dir
sourceSets.main {
@@ -41,9 +48,9 @@ android {
ndkBuilder = 'ndk-build'
}
commandLine "$ndkDir\\$ndkBuilder",
'-C', file('src/main/jni').absolutePath,
'-C', file('src/main').absolutePath,
'NDK_DEBUG=0',
'NDK_TOOLCHAIN_VERSION=clang3.5',
'NDK_TOOLCHAIN_VERSION=clang',
'-j4'
}
@@ -59,7 +66,7 @@ clean {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.1.0'
compile 'com.android.support:recyclerview-v7:22.1.0'
compile 'com.github.japgolly.android:svg-android:2.0.6'
compile project(':vector')
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
}
+3
View File
@@ -48,5 +48,8 @@
*** get*();
}
# For VectorResources
-keep class android.content.res.VectorResources {*;}
# I want to track the error in them
-keep class android.support.v7.widget.StaggeredGridLayoutManager {*;}
+1
View File
@@ -79,6 +79,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="exhentai.org" />
<data android:host="g.e-hentai.org" />
<data android:host="lofi.e-hentai.org" />
@@ -23,16 +23,16 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Typeface;
import android.view.ContextThemeWrapper;
import com.hippo.ehviewer.cache.ImageCache;
import com.hippo.ehviewer.data.Data;
import com.hippo.ehviewer.ehclient.EhClient;
import com.hippo.ehviewer.ehclient.EhInfo;
import com.hippo.ehviewer.ehclient.ExDownloaderManager;
import com.hippo.ehviewer.miscellaneous.FavoriteHelper;
import com.hippo.ehviewer.network.HttpHelper;
import com.hippo.ehviewer.cache.ImageCache;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Crash;
import com.hippo.ehviewer.util.EhUtils;
import com.hippo.ehviewer.miscellaneous.FavoriteHelper;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Utils;
@@ -23,7 +23,6 @@ import android.os.Bundle;
import android.text.util.Linkify;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.hippo.ehviewer.app.MaterialAlertDialog;
@@ -37,7 +36,8 @@ import com.hippo.ehviewer.util.Crash;
import com.hippo.ehviewer.util.Secret;
import com.hippo.ehviewer.util.ViewUtils;
import com.hippo.ehviewer.widget.LockPatternUtils;
import com.larvalabs.svgandroid.SVGBuilder;
import com.hippo.ehviewer.widget.SimpleImageView;
import com.hippo.vector.VectorDrawable;
public class StartActivity extends AbsActivity {
@@ -188,9 +188,8 @@ public class StartActivity extends AbsActivity {
TextView text = (TextView) findViewById(R.id.text);
text.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/GloriaHallelujah.ttf"));
ImageView image = (ImageView) findViewById(R.id.image);
image.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
image.setImageDrawable(new SVGBuilder().readFromResource(getResources(), R.raw.sad_pandroid).build().getDrawable());
SimpleImageView image = (SimpleImageView) findViewById(R.id.image);
image.setDrawable(VectorDrawable.create(this, R.drawable.sad_pandroid));
// Update secret image here
int state = Network.getNetworkState(this);
@@ -16,8 +16,6 @@
package com.hippo.ehviewer.data;
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
@@ -31,6 +29,8 @@ import com.hippo.ehviewer.R;
import com.hippo.ehviewer.ui.GalleryActivity;
import com.hippo.ehviewer.widget.SimpleGridLayout;
import java.util.ArrayList;
public class NormalPreviewList extends PreviewList{
public class Item {
@@ -166,10 +166,20 @@ public class NormalPreviewList extends PreviewList{
int i = row.startIndex;
for(Item item : row.itemArray) {
if (item.xOffset + item.width > maxWidth)
if (item.xOffset + item.width > maxWidth) {
item.width = maxWidth - item.xOffset;
if (item.yOffset + item.height > maxHeight)
if (item.width <= 0) {
// Bad area
continue;
}
}
if (item.yOffset + item.height > maxHeight) {
item.height = maxHeight - item.yOffset;
if (item.height <= 0) {
// Bad area
continue;
}
}
Bitmap bitmap = Bitmap.createBitmap(bmp, item.xOffset, item.yOffset, item.width, item.height);
((ImageView)mViewGroup.getChildAt(i).findViewById(R.id.image)).setImageBitmap(bitmap);
@@ -130,8 +130,7 @@ public class DetailParser {
// Get detail
if ((mode & DETAIL) != 0) {
p = Pattern
.compile("<div id=\"gd1\"><img src=\"([^\"]+)\"[^<>]+></div>" // thumb
+ "</div>"
.compile("<div id=\"gd1\">.+?background:transparent url\\(([^\"]+)\\).+?" // thumb
+ "<div id=\"gd2\">"
+ "<h1 id=\"gn\">([^<>]+)</h1>" // title
+ "<h1 id=\"gj\">([^<>]*)</h1>" // title_jpn might be empty string
@@ -52,7 +52,7 @@ public class EdDetailParser {
isLastPage = true;
// Parser preview
p = Pattern.compile("<div class=\"gi\"[^>]*><a href=\"http://lofi.e-hentai.org/s/(\\w+)/\\d+-(\\d+)\"[^>]*>");
p = Pattern.compile("<div class=\"gi\"[^>]*><a href=\"https?://lofi.e-hentai.org/s/(\\w+)/\\d+-(\\d+)\"[^>]*>");
m = p.matcher(body);
boolean first = true;
while(m.find()) {
@@ -94,7 +94,7 @@ public class EdDetailParser {
boolean first = true;
if (body.contains("<div class=\"gdtl\"")) {
p = Pattern.compile("<div class=\"gdtl\"[^>]*><a href=\"http://[^/]+/s/(\\w+)/\\d+-(\\d+)\">");
p = Pattern.compile("<div class=\"gdtl\"[^>]*><a href=\"https?://[^/]+/s/(\\w+)/\\d+-(\\d+)\">");
m = p.matcher(body);
while(m.find()) {
if (first) {
@@ -106,7 +106,7 @@ public class EdDetailParser {
}
} else {
p = Pattern.compile("<div class=\"gdtm\"[^>]*><div[^>]*><a href=\"http://[^/]+/s/(\\w+)/\\d+-(\\d+)\">");
p = Pattern.compile("<div class=\"gdtm\"[^>]*><div[^>]*><a href=\"https?://[^/]+/s/(\\w+)/\\d+-(\\d+)\">");
m = p.matcher(body);
while(m.find()) {
if (first) {
@@ -63,15 +63,15 @@ public class EhClient {
public static final int MODE_LOFI = 0x2;
public static final String API_G = "http://g.e-hentai.org/api.php";
public static final String API_EX = "http://exhentai.org/api.php";
public static final String API_EX = "https://exhentai.org/api.php";
public static final long APIUID = 1363542;
public static final String APIKEY = "f4b5407ab1727b9d08d7";
public static final String LOGIN_URL = "http://forums.e-hentai.org/index.php?act=Login&CODE=01";
private static final String FORUMS_URL = "http://forums.e-hentai.org/index.php";
public static final String LOGIN_URL = "https://forums.e-hentai.org/index.php?act=Login&CODE=01";
private static final String FORUMS_URL = "https://forums.e-hentai.org/index.php";
public static final String HEADER_G = "http://g.e-hentai.org/";
public static final String HEADER_EX = "http://exhentai.org/";
public static final String HEADER_EX = "https://exhentai.org/";
public static final String HEADER_LOFI = "http://lofi.e-hentai.org/";
public static final String API_EHVIEWER = "http://www.ehviewer.com/API";
@@ -376,7 +376,7 @@ public class EhClient {
}
String avatarUrl = m.group(1);
if (!avatarUrl.startsWith("http"))
avatarUrl = "http://forums.e-hentai.org/" + avatarUrl;
avatarUrl = "https://forums.e-hentai.org/" + avatarUrl;
// Get avatar
Bitmap avatar = hp.getImage(avatarUrl);
// Set avatar if not null
@@ -535,7 +535,7 @@ public class EhClient {
public static String getFileSearchUrl(int apiMode) {
switch (apiMode) {
case MODE_EX:
return "http://ul.exhentai.org/image_lookup.php";
return "https://ul.exhentai.org/image_lookup.php";
case MODE_G:
default:
return "http://ul.e-hentai.org/image_lookup.php";
@@ -27,7 +27,7 @@ import com.hippo.ehviewer.R;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.MathUtils;
import com.hippo.ehviewer.util.Utils;
import com.larvalabs.svgandroid.SVGBuilder;
import com.hippo.vector.VectorDrawable;
import java.io.File;
import java.io.FileInputStream;
@@ -108,7 +108,7 @@ public class EhInfo {
mContext = context;
mInfoPref = mContext.getSharedPreferences(PREF_NAME, 0);
if (DEFAULT_AVATAR == null)
DEFAULT_AVATAR = new SVGBuilder().readFromResource(context.getResources(), R.raw.default_avatar).build().getDrawable();
DEFAULT_AVATAR = VectorDrawable.create(context, R.drawable.default_avatar);
mIsLogin = mInfoPref.getBoolean(KEY_LOGIN, DEFAULT_LOGIN);
mUsername = mInfoPref.getString(KEY_USERNAME, DEFAULT_NAME);
@@ -118,8 +118,65 @@ public class ListParser {
return ALL;
}
case EhClient.MODE_G:
case EhClient.MODE_EX:
p = Pattern.compile("<a[^<>]+>([\\d]+)</a></td><td[^<>]+>(?:<a[^<>]+>)?&");
m = p.matcher(body);
if (m.find()) {
pageNum = Integer.parseInt(m.group(1));
} else if (body.contains("No hits found</p>")) {
pageNum = 0;
return NOT_FOUND;
} else {
return PARSER_ERROR;
}
p = Pattern.compile("<td class=\"itdc\">(?:<a.+?>)?<img.+?alt=\"(.+?)\".+?/>(?:</a>)?</td>" // category
+ "<td.+?>(.+?)</td>" // posted
+ "<td.+?><div.+?><div.+?height:(\\d+)px; width:(\\d+)px\">"
+ "(?:<img.+?src=\"(.+?)\".+?alt=\"(.+?)\" style.+?/>"
+ "|inits~([^<>\"~]+~[^<>\"~]+)~([^<>]+))" // thumb and title
+ "</div>"
+ ".+?"
+ "<div class=\"it5\"><a href=\"([^<>\"]+)\"[^<>]+>(.+?)</a></div>" // url and title
+ ".+?"
+ "<div class=\"ir it4r\" style=\"([^<>\"]+)\">" // rating
+ ".+?"
+ "<td class=\"itu\"><div><a.+?>(.+?)</a>"); // uploader
m = p.matcher(body);
while (m.find()) {
GalleryInfo gi = new GalleryInfo();
gi.category = EhUtils.getCategory(m.group(1));
gi.posted = m.group(2);
gi.thumbHeight = Integer.parseInt(m.group(3));
gi.thumbWidth = Integer.parseInt(m.group(4));
if (m.group(5) == null) {
gi.thumb = Utils.unescapeXml("http://"
+ m.group(7).replace('~', '/'));
gi.title = Utils.unescapeXml(m.group(8));
} else {
gi.thumb = Utils.unescapeXml(m.group(5));
gi.title = Utils.unescapeXml(m.group(6));
}
Pattern pattern = Pattern
.compile("/(\\d+)/(\\w+)");
Matcher matcher = pattern.matcher(m.group(9));
if (matcher.find()) {
gi.gid = Integer.parseInt(matcher.group(1));
gi.token = matcher.group(2);
} else
continue;
gi.rating = Float.parseFloat(getRate(m.group(11)));
gi.uploader = m.group(12);
gi.generateSLang();
giList.add(gi);
}
return ALL;
case EhClient.MODE_G:
default:
p = Pattern.compile("<a[^<>]+>([\\d]+)</a></td><td[^<>]+>(?:<a[^<>]+>)?&");
m = p.matcher(body);
@@ -20,7 +20,7 @@ import android.content.res.Configuration;
import com.hippo.ehviewer.util.Ui;
public class AbsTranslucentActivity extends AbsActivity {
public class AbsTranslucentActivity extends StatsActivity {
@Override
public void onConfigurationChanged(Configuration newConfig) {
@@ -40,7 +40,7 @@ public class EnterPatternActivity extends AbsActivity {
Ui.setMaterialIndicator(getActionBar(), materialIndicator);
// Can't try if bad retry happened in 10 mins
long lastBadRetry = Config.getLong(KEY_LAST_BAD_PATTERN_RETRY, Long.MAX_VALUE);
long lastBadRetry = Config.getLong(KEY_LAST_BAD_PATTERN_RETRY, 0);
if (System.currentTimeMillis() - lastBadRetry < 1000 * 60 * 10) {
mRetryTimes = 10;
}
@@ -39,7 +39,6 @@ import com.hippo.ehviewer.AppHandler;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.app.DirSelectDialog;
import com.hippo.ehviewer.app.MaterialAlertDialog;
import com.hippo.ehviewer.content.Messenger;
import com.hippo.ehviewer.data.Data;
import com.hippo.ehviewer.data.GalleryInfo;
import com.hippo.ehviewer.ehclient.ExDownloader;
@@ -49,6 +48,7 @@ import com.hippo.ehviewer.gallery.ui.GLRootView;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.FullScreenHelper;
import com.hippo.ehviewer.util.MathUtils;
import com.hippo.ehviewer.util.Messenger;
import com.hippo.ehviewer.util.Utils;
import com.hippo.ehviewer.widget.ColorView;
import com.hippo.ehviewer.widget.MaterialToast;
@@ -56,7 +56,7 @@ import com.hippo.ehviewer.widget.SlidingLayout;
import java.io.File;
public class GalleryActivity extends AbsActivity
public class GalleryActivity extends StatsActivity
implements GalleryView.GalleryViewListener, SeekBar.OnSeekBarChangeListener,
FullScreenHelper.OnFullScreenBrokenListener, CompoundButton.OnCheckedChangeListener,
SlidingLayout.OnChildHideListener, AdapterView.OnItemSelectedListener,
@@ -455,7 +455,7 @@ public class GalleryActivity extends AbsActivity
}
@Override
public void onReceive(Object obj) {
public void onReceive(int id, Object obj) {
if (obj instanceof Boolean) {
mVolumePage = (Boolean) obj;
}
@@ -84,6 +84,7 @@ import com.hippo.ehviewer.widget.GalleryListView;
import com.hippo.ehviewer.widget.GalleryListView.OnGetListListener;
import com.hippo.ehviewer.widget.MaterialToast;
import com.hippo.ehviewer.widget.SearchView;
import com.hippo.ehviewer.widget.SimpleImageView;
import com.hippo.ehviewer.widget.SlidingDrawerLayout;
import com.hippo.ehviewer.widget.SuggestionHelper;
import com.hippo.ehviewer.widget.SuggestionTextView;
@@ -162,7 +163,7 @@ public class GalleryListActivity extends AbsTranslucentActivity implements View.
private View mUserPanel;
private DrawerListView mMenuList;
private ImageView mAvatar;
private SimpleImageView mAvatar;
private TextView mUsernameView;
private Button mLoginButton;
private Button mRegisterButton;
@@ -204,7 +205,7 @@ public class GalleryListActivity extends AbsTranslucentActivity implements View.
// private int mListModeThumbHeight;
private void toRegister() {
Uri uri = Uri.parse("http://forums.e-hentai.org/index.php?act=Reg");
Uri uri = Uri.parse("https://forums.e-hentai.org/index.php?act=Reg");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
@@ -1027,7 +1028,7 @@ public class GalleryListActivity extends AbsTranslucentActivity implements View.
mUserPanel = mLeftMenu.findViewById(R.id.user_panel);
mMenuList = (DrawerListView) mLeftMenu.findViewById(R.id.list_menu_item_list);
mAvatar = (ImageView) mUserPanel.findViewById(R.id.avatar);
mAvatar = (SimpleImageView) mUserPanel.findViewById(R.id.avatar);
mUsernameView = (TextView) mUserPanel.findViewById(R.id.user);
mLoginButton = (Button) mUserPanel.findViewById(R.id.login);
mRegisterButton = (Button) mUserPanel.findViewById(R.id.register);
@@ -1515,7 +1516,7 @@ public class GalleryListActivity extends AbsTranslucentActivity implements View.
switch (state) {
case LOGIN:
mAvatar.setImageDrawable(mClient.getAvatar());
mAvatar.setDrawable(mClient.getAvatar());
mUsernameView.setVisibility(View.GONE);
mLoginButton.setVisibility(View.VISIBLE);
mRegisterButton.setVisibility(View.VISIBLE);
@@ -1523,7 +1524,7 @@ public class GalleryListActivity extends AbsTranslucentActivity implements View.
mWaitLogView.setVisibility(View.GONE);
break;
case LOGOUT:
mAvatar.setImageDrawable(mClient.getAvatar());
mAvatar.setDrawable(mClient.getAvatar());
mUsernameView.setText(mClient.getDisplayname());
mUsernameView.setVisibility(View.VISIBLE);
mLoginButton.setVisibility(View.GONE);
@@ -1532,7 +1533,7 @@ public class GalleryListActivity extends AbsTranslucentActivity implements View.
mWaitLogView.setVisibility(View.GONE);
break;
case WAIT:
mAvatar.setImageDrawable(mClient.getAvatar());
mAvatar.setDrawable(mClient.getAvatar());
mUsernameView.setVisibility(View.GONE);
mLoginButton.setVisibility(View.GONE);
mRegisterButton.setVisibility(View.GONE);
@@ -50,7 +50,6 @@ import com.hippo.ehviewer.UpdateHelper;
import com.hippo.ehviewer.app.DirSelectDialog;
import com.hippo.ehviewer.app.MaterialAlertDialog;
import com.hippo.ehviewer.app.MaterialProgressDialog;
import com.hippo.ehviewer.content.Messenger;
import com.hippo.ehviewer.data.ApiGalleryInfo;
import com.hippo.ehviewer.data.Data;
import com.hippo.ehviewer.data.DownloadInfo;
@@ -58,14 +57,17 @@ import com.hippo.ehviewer.drawable.MaterialIndicatorDrawable;
import com.hippo.ehviewer.drawable.MaterialIndicatorDrawable.Stroke;
import com.hippo.ehviewer.ehclient.EhClient;
import com.hippo.ehviewer.ehclient.EhInfo;
import com.hippo.ehviewer.miscellaneous.ActivityHelper;
import com.hippo.ehviewer.miscellaneous.FavoriteHelper;
import com.hippo.ehviewer.network.HttpHelper;
import com.hippo.ehviewer.preference.ListPreference;
import com.hippo.ehviewer.miscellaneous.ActivityHelper;
import com.hippo.ehviewer.util.BgThread;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Constants;
import com.hippo.ehviewer.util.DialogUtils;
import com.hippo.ehviewer.util.EhUtils;
import com.hippo.ehviewer.miscellaneous.FavoriteHelper;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.util.Messenger;
import com.hippo.ehviewer.util.Secret;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Utils;
@@ -684,15 +686,17 @@ public class SettingsActivity extends AbsPreferenceActivity {
}
public static class AdvancedFragment extends PreferenceFragment implements
Preference.OnPreferenceClickListener {
Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
private static final String KEY_FIX_DIRNAME = "fix_dirname";
private static final String KEY_LOGIN_VIA_COOKIE = "login_via_cookie";
private static final String KEY_PATTERN_PROTECTION = "pattern_protection";
private static final String KEY_SHOW_APPLICATION_STATS = "show_application_stats";
private Preference mFixDirname;
private Preference mLoginViaCookie;
private Preference mPatternProtection;
private Preference mShowApplicationStats;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -705,6 +709,8 @@ public class SettingsActivity extends AbsPreferenceActivity {
mLoginViaCookie.setOnPreferenceClickListener(this);
mPatternProtection = findPreference(KEY_PATTERN_PROTECTION);
mPatternProtection.setOnPreferenceClickListener(this);
mShowApplicationStats = findPreference(KEY_SHOW_APPLICATION_STATS);
mShowApplicationStats.setOnPreferenceChangeListener(this);
}
@Override
@@ -830,6 +836,18 @@ public class SettingsActivity extends AbsPreferenceActivity {
}
return true;
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String key = preference.getKey();
if (KEY_SHOW_APPLICATION_STATS.equals(key)) {
Log.d("TAG","KEY_SHOW_APPLICATION_STATS");
Messenger.getInstance().notify(Constants.MESSENGER_ID_SHOW_APP_STATUS, newValue);
}
return true;
}
}
public static class AboutFragment extends PreferenceFragment implements
@@ -0,0 +1,159 @@
/*
* Copyright (C) 2015 Hippo Seven
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hippo.ehviewer.ui;
import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.hippo.ehviewer.AppHandler;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Constants;
import com.hippo.ehviewer.util.Messenger;
import java.util.Locale;
public abstract class StatsActivity extends AbsActivity {
private static final int DEFAULT_MESSAGE_SIZE = 128;
private static final long STATS_CLOCK_INTERVAL_MS = 1000;
private static final int BYTES_IN_MEGABYTE = 1024 * 1024;
private TextView mStatsTextView;
private boolean mShowStats;
private Runnable mStatsClockTickRunnable;
private Handler mHandler;
private Messenger.Receiver mReceiver = new Messenger.Receiver() {
@Override
public void onReceive(int id, Object obj) {
if (obj instanceof Boolean) {
boolean showStats = (Boolean) obj;
if (mShowStats != showStats) {
mShowStats = showStats;
ViewGroup vg = (ViewGroup) getWindow().getDecorView();
if (showStats) {
vg.addView(mStatsTextView, generateLayoutParams());
updateStats();
scheduleNextStatsClockTick();
} else {
vg.removeView(mStatsTextView);
cancelNextStatsClockTick();
}
}
}
}
};
@SuppressLint("RtlHardcoded")
private ViewGroup.LayoutParams generateLayoutParams() {
Resources resources = getResources();
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.TOP | Gravity.RIGHT;
lp.topMargin = resources.getDimensionPixelOffset(R.dimen.stats_text_view_padding_top);
lp.rightMargin = resources.getDimensionPixelOffset(R.dimen.stats_text_view_padding_right);
return lp;
}
private boolean isShowStats() {
return Config.getShowApplicationStats();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mStatsTextView = new TextView(this);
mHandler = AppHandler.getInstance();
mStatsClockTickRunnable = new Runnable() {
@Override
public void run() {
updateStats();
scheduleNextStatsClockTick();
}
};
Messenger.getInstance().register(
Constants.MESSENGER_ID_SHOW_APP_STATUS, mReceiver);
if (isShowStats()) {
mShowStats = true;
((ViewGroup) getWindow().getDecorView()).addView(mStatsTextView,
generateLayoutParams());
} else {
mShowStats = false;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
Messenger.getInstance().unregister(Constants.MESSENGER_ID_SHOW_APP_STATUS, mReceiver);
}
@Override
protected void onResume() {
super.onResume();
if (mShowStats) {
updateStats();
scheduleNextStatsClockTick();
}
}
@Override
protected void onPause() {
super.onPause();
if (mShowStats) {
cancelNextStatsClockTick();
}
}
private void scheduleNextStatsClockTick() {
mHandler.postDelayed(mStatsClockTickRunnable, STATS_CLOCK_INTERVAL_MS);
}
private void cancelNextStatsClockTick() {
mHandler.removeCallbacks(mStatsClockTickRunnable);
}
private void updateStats() {
final Runtime runtime = Runtime.getRuntime();
final long heapMemory = runtime.totalMemory() - runtime.freeMemory();
final StringBuilder sb = new StringBuilder(DEFAULT_MESSAGE_SIZE);
appendSize(sb, "Java heap size: ", heapMemory, "\n");
appendSize(sb, "Native heap size: ", Debug.getNativeHeapAllocatedSize(), "\n");
mStatsTextView.setText(sb.toString());
}
private static void appendSize(StringBuilder sb, String prefix, long bytes, String suffix) {
String value = String.format(Locale.getDefault(), "%.2f", (float) bytes / BYTES_IN_MEGABYTE);
appendValue(sb, prefix, value + " MB", suffix);
}
private static void appendValue(StringBuilder sb, String prefix, String value, String suffix) {
sb.append(prefix).append(value).append(suffix);
}
}
@@ -22,7 +22,6 @@ import android.content.pm.ActivityInfo;
import android.os.Environment;
import android.preference.PreferenceManager;
import com.hippo.ehviewer.content.Messenger;
import com.hippo.ehviewer.data.ListUrls;
import com.hippo.ehviewer.ehclient.EhClient;
@@ -574,6 +573,9 @@ public final class Config {
private static final String KEY_PATTERN_PROTECTION = "pattern_protection";
private static final String DEFAULT_PATTERN_PROTECTION = "";
private static final String KEY_SHOW_APPLICATION_STATS = "show_application_stats";
private static final boolean DEFAULT_SHOW_APPLICATION_STATS = false;
public static int getHttpRetry() {
return getIntFromStr(KEY_HTTP_RETRY, DEFAULT_HTTP_RETRY);
}
@@ -598,6 +600,14 @@ public final class Config {
setString(KEY_PATTERN_PROTECTION, value);
}
public static boolean getShowApplicationStats() {
return getBoolean(KEY_SHOW_APPLICATION_STATS, DEFAULT_SHOW_APPLICATION_STATS);
}
public static void setShowApplicationStats(boolean value) {
setBoolean(KEY_SHOW_APPLICATION_STATS, value);
}
/****** About ******/
@@ -28,4 +28,11 @@ public final class Constants {
public static final int MAX_REDIRECTS = 5;
public static final int BUFFER_SIZE = 4096;
public static final int MESSENGER_ID_SHOW_APP_STATUS;
static {
Messenger messenger = Messenger.getInstance();
MESSENGER_ID_SHOW_APP_STATUS = messenger.newId();
}
}
@@ -99,8 +99,8 @@ public class Crash {
sb.append("======== CrashInfo ========\n").append(result).append("\n");
try {
long timestamp = System.currentTimeMillis();
String time = Utils.sDate.format(System.currentTimeMillis());
String fileName = "crash-" + time + "-" + timestamp + ".log";
//String time = Utils.sDate.format(System.currentTimeMillis());
String fileName = "crash-" + timestamp + ".log";
String path = null;
boolean position = false;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
@@ -1,9 +1,23 @@
package com.hippo.ehviewer.content;
/*
* Copyright (C) 2015 Hippo Seven
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hippo.ehviewer.util;
import android.util.SparseArray;
import com.hippo.ehviewer.AppHandler;
import com.hippo.ehviewer.util.IntIdGenerator;
import java.util.HashSet;
import java.util.Set;
@@ -40,7 +54,7 @@ public class Messenger {
Set<Receiver> receiverSet = mReceiverSetMap.get(id);
if (receiverSet != null) {
for (Receiver receiver : receiverSet) {
receiver.onReceive(obj);
receiver.onReceive(id, obj);
}
}
}
@@ -68,6 +82,6 @@ public class Messenger {
}
public interface Receiver {
void onReceive (final Object obj);
void onReceive(final int id, final Object obj);
}
}
@@ -370,7 +370,8 @@ public class Ui {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(d);
actionBar.setIcon(null);
// actionBar.setIcon(null) may cause crash in Meizu lollipop
actionBar.setIcon(new ColorDrawable());
actionBar.setElevation(dp2pix(4.0f));
}
}
@@ -0,0 +1,137 @@
/*
* Copyright (C) 2015 Hippo Seven
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hippo.ehviewer.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
public class SimpleImageView extends View implements Drawable.Callback {
private Drawable mDrawable;
private boolean mKeepAspect = true;
private static final int[] LAYOUT_ATTRS = new int[] {
android.R.attr.src
};
public SimpleImageView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public SimpleImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setDrawable(a.getDrawable(0));
a.recycle();
// Mostly drawable is VectorDrawable, it has cache already
setWillNotCacheDrawing(true);
}
@SuppressWarnings("deprecation")
public void setDrawable(@DrawableRes int resId) {
setDrawable(getContext().getResources().getDrawable(resId));
}
public void setDrawable(Drawable drawable) {
if (mDrawable != null) {
mDrawable.setCallback(null);
}
mDrawable = drawable;
if (mDrawable != null) {
mDrawable.setCallback(this);
}
requestLayout();
}
@Override
public void invalidateDrawable(@NonNull Drawable who) {
invalidate();
}
@Override
protected int getSuggestedMinimumWidth() {
int superMinWidth = super.getSuggestedMinimumWidth();
return (mDrawable == null) ? superMinWidth :
Math.max(superMinWidth, mDrawable.getMinimumWidth() + getPaddingLeft() + getPaddingRight());
}
@Override
protected int getSuggestedMinimumHeight() {
int superMinHeight = super.getSuggestedMinimumHeight();
return (mDrawable == null) ? superMinHeight :
Math.max(superMinHeight, mDrawable.getMinimumHeight() + getPaddingTop() + getPaddingBottom());
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (mDrawable != null) {
int paddingLeft = getPaddingLeft();
int paddingTop = getPaddingTop();
int paddingRight = getPaddingRight();
int paddingBottom = getPaddingBottom();
int canvasWidth = right - left - paddingLeft - paddingRight;
int canvasHeight = bottom - top - paddingTop - paddingBottom;
int intrinsicWidth = mDrawable.getIntrinsicWidth();
int intrinsicHeight = mDrawable.getIntrinsicHeight();
if (mKeepAspect && intrinsicWidth > 0 && intrinsicHeight > 0) {
int drawWidth;
int drawHeight;
float canvasAspect = canvasWidth / canvasHeight;
float drawableAspect = intrinsicWidth / intrinsicHeight;
if (drawableAspect > canvasAspect) {
drawWidth = (int) (canvasHeight * drawableAspect);
drawHeight = canvasHeight;
} else {
drawWidth = canvasWidth;
drawHeight = (int) (canvasWidth / drawableAspect);
}
int drawLeft = paddingLeft + ((canvasWidth - drawWidth) / 2);
int drawTop = paddingTop + ((canvasHeight - drawHeight) / 2);
mDrawable.setBounds(drawLeft, drawTop,
drawLeft + drawWidth, drawTop + drawHeight);
} else {
mDrawable.setBounds(paddingLeft, paddingTop,
paddingLeft + canvasWidth, paddingTop + canvasHeight);
}
}
}
@Override
protected void onDraw(Canvas canvas) {
if (mDrawable != null) {
mDrawable.draw(canvas);
}
}
}
@@ -149,6 +149,10 @@ public class SwipeToDismissTouchListener implements RecyclerView.OnItemTouchList
}
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean b) {
}
@Override
public boolean onInterceptTouchEvent(final RecyclerView view, MotionEvent motionEvent) {
if (mPaused) return false;
+2
View File
@@ -62,6 +62,7 @@ ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
endif
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_ASMFLAGS := -DELF -DPIC
LOCAL_SRC_FILES += \
libjpeg-turbo/simd/jsimd_i386.c \
libjpeg-turbo/simd/jsimdcpu.asm \
@@ -100,6 +101,7 @@ ifeq ($(TARGET_ARCH_ABI),x86)
endif
ifeq ($(TARGET_ARCH_ABI),x86_64)
LOCAL_ASMFLAGS := -D__x86_64__ -DELF -DPIC
LOCAL_SRC_FILES += \
libjpeg-turbo/simd/jsimd_x86_64.c \
libjpeg-turbo/simd/jfdctflt-sse-64.asm \
+1 -1
View File
@@ -1,3 +1,3 @@
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-7
APP_PLATFORM := android-9
APP_OPTIM := release
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:auto="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:targetApi="21"
auto:height="24dp"
auto:width="24dp"
auto:viewportWidth="24"
auto:viewportHeight="24"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<path
auto:fillColor="#009688"
auto:pathData="M0,12a12,12 0 1,0 24,0a12,12 0 1,0 -24,0z"
android:fillColor="#009688"
android:pathData="M0,12a12,12 0 1,0 24,0a12,12 0 1,0 -24,0z"/>
<path
auto:fillColor="#FFFFFF"
auto:pathData="M17.4,8.9l-0.6-0.3c-1.2-0.6-2.6-1-4.1-1.1s-2.9,0-4.2,0.4L7.9,8C4.8,9.1,2.5,11.6,2,14.6l20,1.8C22,13.3,20.2,10.5,17.4,8.9z"
android:fillColor="#FFFFFF"
android:pathData="M17.4,8.9l-0.6-0.3c-1.2-0.6-2.6-1-4.1-1.1s-2.9,0-4.2,0.4L7.9,8C4.8,9.1,2.5,11.6,2,14.6l20,1.8C22,13.3,20.2,10.5,17.4,8.9z"/>
<path
auto:fillColor="#000000"
auto:pathData="M16.4,13c-0.6-0.1-1.1-0.6-1-1.2c0.1-0.6,0.6-1.1,1.2-1c0.6,0.1,1.1,0.6,1,1.2S17,13.1,16.4,13z"
android:fillColor="#000000"
android:pathData="M16.4,13c-0.6-0.1-1.1-0.6-1-1.2c0.1-0.6,0.6-1.1,1.2-1c0.6,0.1,1.1,0.6,1,1.2S17,13.1,16.4,13z"/>
<path
auto:fillColor="#000000"
auto:pathData="M8.1,12.3c-0.6-0.1-1.1-0.6-1-1.2c0.1-0.6,0.6-1.1,1.2-1s1.1,0.6,1,1.2C9.2,11.9,8.7,12.4,8.1,12.3z"
android:fillColor="#000000"
android:pathData="M8.1,12.3c-0.6-0.1-1.1-0.6-1-1.2c0.1-0.6,0.6-1.1,1.2-1s1.1,0.6,1,1.2C9.2,11.9,8.7,12.4,8.1,12.3z"/>
<path
auto:fillColor="#000000"
auto:pathData="M17.4,8.9l2.1-2.5c0.1-0.2,0.1-0.4,0-0.5c-0.1-0.1-0.3-0.1-0.5,0.1l-2.2,2.6L17.4,8.9z"
android:fillColor="#000000"
android:pathData="M17.4,8.9l2.1-2.5c0.1-0.2,0.1-0.4,0-0.5c-0.1-0.1-0.3-0.1-0.5,0.1l-2.2,2.6L17.4,8.9z"/>
<path
auto:fillColor="#000000"
auto:pathData="M8.5,7.8l-1.7-3C6.7,4.7,6.5,4.6,6.3,4.7C6.2,4.8,6.1,5,6.2,5.2L7.8,8L8.5,7.8z"
android:fillColor="#000000"
android:pathData="M8.5,7.8l-1.7-3C6.7,4.7,6.5,4.6,6.3,4.7C6.2,4.8,6.1,5,6.2,5.2L7.8,8L8.5,7.8z"/>
</group>
</vector>
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:auto="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:targetApi="21"
auto:height="24dp"
auto:width="24dp"
auto:viewportWidth="24"
auto:viewportHeight="24"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<path
auto:fillColor="#FFFFFF"
auto:pathData="M14.7,5.2l-0.3-0.2c-0.6-0.3-1.4-0.5-2.2-0.6c-0.8-0.1-1.5,0-2.2,0.2L9.7,4.8C8.1,5.4,6.9,6.6,6.6,8.2l10.6,0.9C17.2,7.5,16.2,6.1,14.7,5.2z"
android:fillColor="#FFFFFF"
android:pathData="M14.7,5.2l-0.3-0.2c-0.6-0.3-1.4-0.5-2.2-0.6c-0.8-0.1-1.5,0-2.2,0.2L9.7,4.8C8.1,5.4,6.9,6.6,6.6,8.2l10.6,0.9C17.2,7.5,16.2,6.1,14.7,5.2z"/>
<path
auto:fillColor="#000000"
auto:pathData="M14.3,7.4c-0.3,0-0.6-0.3-0.5-0.6c0-0.3,0.3-0.6,0.6-0.5c0.3,0,0.6,0.3,0.5,0.6S14.6,7.4,14.3,7.4z"
android:fillColor="#000000"
android:pathData="M14.3,7.4c-0.3,0-0.6-0.3-0.5-0.6c0-0.3,0.3-0.6,0.6-0.5c0.3,0,0.6,0.3,0.5,0.6S14.6,7.4,14.3,7.4z"/>
<path
auto:fillColor="#000000"
auto:pathData="M9.8,7C9.5,7,9.3,6.7,9.3,6.4c0-0.3,0.3-0.6,0.6-0.5c0.3,0,0.6,0.3,0.5,0.6C10.4,6.8,10.2,7.1,9.8,7z"
android:fillColor="#000000"
android:pathData="M9.8,7C9.5,7,9.3,6.7,9.3,6.4c0-0.3,0.3-0.6,0.6-0.5c0.3,0,0.6,0.3,0.5,0.6C10.4,6.8,10.2,7.1,9.8,7z"/>
<path
auto:fillColor="#000000"
auto:pathData="M14.8,5.2l1.1-1.3c0.1-0.1,0.1-0.2,0-0.2c-0.1-0.1-0.2,0-0.2,0l-1.1,1.4L14.8,5.2z"
android:fillColor="#000000"
android:pathData="M14.8,5.2l1.1-1.3c0.1-0.1,0.1-0.2,0-0.2c-0.1-0.1-0.2,0-0.2,0l-1.1,1.4L14.8,5.2z"/>
<path
auto:fillColor="#000000"
auto:pathData="M10,4.7L9.2,3.1C9.1,3,9,3,8.9,3c-0.1,0-0.1,0.2-0.1,0.2l0.9,1.5L10,4.7z"
android:fillColor="#000000"
android:pathData="M10,4.7L9.2,3.1C9.1,3,9,3,8.9,3c-0.1,0-0.1,0.2-0.1,0.2l0.9,1.5L10,4.7z"/>
<path
auto:fillColor="#000000"
auto:pathData="M18,16.2c0,0.7,0.5,1.2,1.2,1.2l0,0c0.7,0,1.2-0.5,1.2-1.2v-4.8c0-0.7-0.5-1.2-1.2-1.2l0,0c-0.7,0-1.2,0.5-1.2,1.2V16.2z"
android:fillColor="#000000"
android:pathData="M18,16.2c0,0.7,0.5,1.2,1.2,1.2l0,0c0.7,0,1.2-0.5,1.2-1.2v-4.8c0-0.7-0.5-1.2-1.2-1.2l0,0c-0.7,0-1.2,0.5-1.2,1.2V16.2z"/>
<path
auto:fillColor="#000000"
auto:pathData="M6,16.2c0,0.7-0.5,1.2-1.2,1.2l0,0c-0.7,0-1.2-0.5-1.2-1.2v-4.8c0-0.7,0.5-1.2,1.2-1.2l0,0c0.7,0,1.2,0.5,1.2,1.2V16.2z"
android:fillColor="#000000"
android:pathData="M6,16.2c0,0.7-0.5,1.2-1.2,1.2l0,0c-0.7,0-1.2-0.5-1.2-1.2v-4.8c0-0.7,0.5-1.2,1.2-1.2l0,0c0.7,0,1.2,0.5,1.2,1.2V16.2z"/>
<path
auto:fillColor="#FFFFFF"
auto:pathData="M6.7,10.2v8.7c0,0.5,0.4,0.9,0.9,0.9h8.8c0.5,0,0.9-0.4,0.9-0.9v-8.7H6.7z"
android:fillColor="#FFFFFF"
android:pathData="M6.7,10.2v8.7c0,0.5,0.4,0.9,0.9,0.9h8.8c0.5,0,0.9-0.4,0.9-0.9v-8.7H6.7z"/>
<path
auto:fillColor="#000000"
auto:pathData="M14.1,18.6h-2.7c-0.7,0-1.2,0.5-1.2,1.2c0,0.7,0.5,1.2,1.2,1.2h2.7V18.6z"
android:fillColor="#000000"
android:pathData="M14.1,18.6h-2.7c-0.7,0-1.2,0.5-1.2,1.2c0,0.7,0.5,1.2,1.2,1.2h2.7V18.6z"/>
<path
auto:fillColor="#000000"
auto:pathData="M9.9,18.6H7.2c-0.7,0-1.2,0.5-1.2,1.2c0,0.7,0.5,1.2,1.2,1.2h2.7V18.6z"
android:fillColor="#000000"
android:pathData="M9.9,18.6H7.2c-0.7,0-1.2,0.5-1.2,1.2c0,0.7,0.5,1.2,1.2,1.2h2.7V18.6z"/>
</group>
</vector>
@@ -36,12 +36,11 @@
android:text="@string/do_not_be_a_sad_pandroid"
android:background="?attr/themeColor" />
<ImageView
<com.hippo.ehviewer.widget.SimpleImageView
android:id="@+id/image"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="6"
android:scaleType="fitCenter"
android:background="?attr/themeColor" />
</com.hippo.ehviewer.widget.TransitionLayout>
+1 -2
View File
@@ -36,12 +36,11 @@
android:text="@string/do_not_be_a_sad_pandroid"
android:background="?attr/themeColor" />
<ImageView
<com.hippo.ehviewer.widget.SimpleImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:scaleType="fitCenter"
android:background="?attr/themeColor" />
</com.hippo.ehviewer.widget.TransitionLayout>
+1 -1
View File
@@ -29,7 +29,7 @@
android:layout_gravity="left|center_vertical"
android:orientation="horizontal" >
<ImageView
<com.hippo.ehviewer.widget.SimpleImageView
android:id="@+id/avatar"
android:layout_width="64dp"
android:layout_height="64dp" />
+6
View File
@@ -1,3 +1,9 @@
Version 0.6.16.2 (2015-5-1)
* 修正 Meizu Lollipop 系统下搜索崩溃
Version 0.6.16.1 (2015-5-1)
* 修正首次图案保护必定成功(请记住 110722)
Version 0.6.16 (2015-4-30)
* 添加图案保护
* 添加快速搜索名称建议
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="768px" height="768px" viewBox="0 0 768 768" enable-background="new 0 0 768 768" xml:space="preserve">
<g>
<circle fill="#009688" cx="384" cy="384" r="384"/>
<path fill="#FFFFFF" d="M555.4,283.6l-18.2-9.8c-39.1-19.5-83.2-32.3-130.6-36.5c-47.4-4.2-93.1,0.8-135,13.2l-19.6,6.5c-97.8,35.5-171.1,112.8-188,209l640,56.2C704.1,424.4,645.5,335.6,555.4,283.6"/>
<path d="M525.5,417.3c-19.5-1.7-34-19-32.3-38.5c1.7-19.6,19-34,38.5-32.3c19.6,1.7,34,19,32.3,38.5C562.3,404.5,545,419,525.5,417.3"/>
<path d="M258.1,393.8c-19.6-1.7-34-19-32.3-38.5c1.7-19.6,19-34,38.5-32.3c19.5,1.7,34,19,32.3,38.5C294.9,381,277.6,395.5,258.1,393.8"/>
<path d="M556.3,283.7l66.6-80.6c4-4.8,3.7-11.6-0.6-15.1c-4.3-3.6-11-2.6-14.9,2.2l-69.3,83.7L556.3,283.7"/>
<path d="M270.7,250.4l-53.6-94.5c-3.1-5.4-9.5-7.5-14.4-4.8c-4.9,2.8-6.3,9.4-3.3,14.8l51.6,91L270.7,250.4z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

@@ -301,6 +301,8 @@
<string name="fixing_over">共修正 %d 项</string>
<string name="login_via_cookie_title">通过 cookie 登录</string>
<string name="pattern_protection_title">图案保护</string>
<string name="show_application_stats_title">显示应用状态</string>
<string name="show_application_stats_summary">在某些 Activity 右上角显示内存使用情况</string>
<string name="about_settings_title">关于</string>
<string name="author_title">作者</string>
@@ -289,6 +289,8 @@
<string name="fixing_over">共修正 %d 項</string>
<string name="login_via_cookie_title">通過 cookie 登錄</string>
<string name="pattern_protection_title">圖案保護</string>
<string name="show_application_stats_title">顯示應用狀態</string>
<string name="show_application_stats_summary">在某些 Activity 右上角顯示內存使用情況</string>
<string name="about_settings_title">關於</string>
<string name="author_title">作者</string>
@@ -289,6 +289,8 @@
<string name="fixing_over">共修正 %d 項</string>
<string name="login_via_cookie_title">通過 cookie 登入</string>
<string name="pattern_protection_title">圖形保護</string>
<string name="show_application_stats_title">顯示應用狀態</string>
<string name="show_application_stats_summary">在某些 Activity 右上角顯示記憶體使用情況</string>
<string name="about_settings_title">關於</string>
<string name="author_title">作者</string>
+3
View File
@@ -41,4 +41,7 @@
<dimen name="lock_pattern_dot_size">12dp</dimen>
<dimen name="lock_pattern_dot_size_activated">28dp</dimen>
<dimen name="stats_text_view_padding_top">24dp</dimen>
<dimen name="stats_text_view_padding_right">16dp</dimen>
</resources>
+3 -1
View File
@@ -93,7 +93,7 @@
<!-- GalleryDetialActivity -->
<string name="we_feel">We feel %s</string>
<string name="more_of_uploader">More of uploader</string>
<string name="no_more_comment">No more comments</string>
<string name="no_more_comment">No more comment</string>
<string name="no_comment">No comment</string>
<string name="start_saving_torrent">Start saving torrent</string>
<string name="save_torrent_successful">Save torrent to %s</string>
@@ -306,6 +306,8 @@
<string name="fixing_over">%d item(s) fixed</string>
<string name="login_via_cookie_title">Login via cookie</string>
<string name="pattern_protection_title">Pattern protection</string>
<string name="show_application_stats_title">Show application stats</string>
<string name="show_application_stats_summary">Show application stats at the top-right corner of the screen</string>
<string name="about_settings_title">About</string>
<string name="author_title">Author</string>
@@ -85,5 +85,11 @@
android:key="pattern_protection"
android:title="@string/pattern_protection_title"/>
<CheckBoxPreference
android:key="show_application_stats"
android:title="@string/show_application_stats_title"
android:summary="@string/show_application_stats_summary"
android:defaultValue="false" />
</PreferenceCategory>
</PreferenceScreen>
+5 -1
View File
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -17,3 +17,7 @@ allprojects {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
+1 -1
View File
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
+1 -1
View File
@@ -1 +1 @@
include ':app'
include ':app', ':vector'
+1
View File
@@ -0,0 +1 @@
/build
+24
View File
@@ -0,0 +1,24 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
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:support-v4:22.2.1'
}
+17
View File
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in E:\Android\android-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 *;
#}
@@ -0,0 +1,13 @@
package com.hippo.vector;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
+7
View File
@@ -0,0 +1,7 @@
<manifest package="com.hippo.vector">
<application>
</application>
</manifest>
@@ -0,0 +1,689 @@
/*
* Copyright 2015 Hippo Seven
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hippo.vector;
import android.graphics.Path;
import android.util.Log;
import java.util.ArrayList;
import java.util.Arrays;
public class PathParser {
static final String LOGTAG = PathParser.class.getSimpleName();
/**
* @param pathData The string representing a path, the same as "d" string in svg file.
* @return the generated Path object.
*/
public static Path createPathFromPathData(String pathData) {
Path path = new Path();
PathDataNode[] nodes = createNodesFromPathData(pathData);
if (nodes != null) {
try {
PathDataNode.nodesToPath(nodes, path);
} catch (RuntimeException e) {
throw new RuntimeException("Error in parsing " + pathData, e);
}
return path;
}
return null;
}
/**
* @param pathData The string representing a path, the same as "d" string in svg file.
* @return an array of the PathDataNode.
*/
public static PathDataNode[] createNodesFromPathData(String pathData) {
if (pathData == null) {
return null;
}
int start = 0;
int end = 1;
ArrayList<PathDataNode> list = new ArrayList<PathDataNode>();
while (end < pathData.length()) {
end = nextStart(pathData, end);
String s = pathData.substring(start, end).trim();
if (s.length() > 0) {
float[] val = getFloats(s);
addNode(list, s.charAt(0), val);
}
start = end;
end++;
}
if ((end - start) == 1 && start < pathData.length()) {
addNode(list, pathData.charAt(start), new float[0]);
}
return list.toArray(new PathDataNode[list.size()]);
}
/**
* @param source The array of PathDataNode to be duplicated.
* @return a deep copy of the <code>source</code>.
*/
public static PathDataNode[] deepCopyNodes(PathDataNode[] source) {
if (source == null) {
return null;
}
PathDataNode[] copy = new PathDataNode[source.length];
for (int i = 0; i < source.length; i ++) {
copy[i] = new PathDataNode(source[i]);
}
return copy;
}
/**
* @param nodesFrom The source path represented in an array of PathDataNode
* @param nodesTo The target path represented in an array of PathDataNode
* @return whether the <code>nodesFrom</code> can morph into <code>nodesTo</code>
*/
public static boolean canMorph(PathDataNode[] nodesFrom, PathDataNode[] nodesTo) {
if (nodesFrom == null || nodesTo == null) {
return false;
}
if (nodesFrom.length != nodesTo.length) {
return false;
}
for (int i = 0; i < nodesFrom.length; i ++) {
if (nodesFrom[i].mType != nodesTo[i].mType
|| nodesFrom[i].mParams.length != nodesTo[i].mParams.length) {
return false;
}
}
return true;
}
/**
* Update the target's data to match the source.
* Before calling this, make sure canMorph(target, source) is true.
*
* @param target The target path represented in an array of PathDataNode
* @param source The source path represented in an array of PathDataNode
*/
public static void updateNodes(PathDataNode[] target, PathDataNode[] source) {
for (int i = 0; i < source.length; i ++) {
target[i].mType = source[i].mType;
for (int j = 0; j < source[i].mParams.length; j ++) {
target[i].mParams[j] = source[i].mParams[j];
}
}
}
private static int nextStart(String s, int end) {
char c;
while (end < s.length()) {
c = s.charAt(end);
// Note that 'e' or 'E' are not valid path commands, but could be
// used for floating point numbers' scientific notation.
// Therefore, when searching for next command, we should ignore 'e'
// and 'E'.
if ((((c - 'A') * (c - 'Z') <= 0) || ((c - 'a') * (c - 'z') <= 0))
&& c != 'e' && c != 'E') {
return end;
}
end++;
}
return end;
}
private static void addNode(ArrayList<PathDataNode> list, char cmd, float[] val) {
list.add(new PathDataNode(cmd, val));
}
private static class ExtractFloatResult {
// We need to return the position of the next separator and whether the
// next float starts with a '-' or a '.'.
int mEndPosition;
boolean mEndWithNegOrDot;
}
/**
* Parse the floats in the string.
* This is an optimized version of parseFloat(s.split(",|\\s"));
*
* @param s the string containing a command and list of floats
* @return array of floats
*/
private static float[] getFloats(String s) {
if (s.charAt(0) == 'z' || s.charAt(0) == 'Z') {
return new float[0];
}
try {
float[] results = new float[s.length()];
int count = 0;
int startPosition = 1;
int endPosition = 0;
ExtractFloatResult result = new ExtractFloatResult();
int totalLength = s.length();
// The startPosition should always be the first character of the
// current number, and endPosition is the character after the current
// number.
while (startPosition < totalLength) {
extract(s, startPosition, result);
endPosition = result.mEndPosition;
if (startPosition < endPosition) {
results[count++] = Float.parseFloat(
s.substring(startPosition, endPosition));
}
if (result.mEndWithNegOrDot) {
// Keep the '-' or '.' sign with next number.
startPosition = endPosition;
} else {
startPosition = endPosition + 1;
}
}
return Arrays.copyOf(results, count);
} catch (NumberFormatException e) {
throw new RuntimeException("error in parsing \"" + s + "\"", e);
}
}
/**
* Calculate the position of the next comma or space or negative sign
* @param s the string to search
* @param start the position to start searching
* @param result the result of the extraction, including the position of the
* the starting position of next number, whether it is ending with a '-'.
*/
private static void extract(String s, int start, ExtractFloatResult result) {
// Now looking for ' ', ',', '.' or '-' from the start.
int currentIndex = start;
boolean foundSeparator = false;
result.mEndWithNegOrDot = false;
boolean secondDot = false;
boolean isExponential = false;
for (; currentIndex < s.length(); currentIndex++) {
boolean isPrevExponential = isExponential;
isExponential = false;
char currentChar = s.charAt(currentIndex);
switch (currentChar) {
case ' ':
case ',':
foundSeparator = true;
break;
case '-':
// The negative sign following a 'e' or 'E' is not a separator.
if (currentIndex != start && !isPrevExponential) {
foundSeparator = true;
result.mEndWithNegOrDot = true;
}
break;
case '.':
if (!secondDot) {
secondDot = true;
} else {
// This is the second dot, and it is considered as a separator.
foundSeparator = true;
result.mEndWithNegOrDot = true;
}
break;
case 'e':
case 'E':
isExponential = true;
break;
}
if (foundSeparator) {
break;
}
}
// When there is nothing found, then we put the end position to the end
// of the string.
result.mEndPosition = currentIndex;
}
/**
* Each PathDataNode represents one command in the "d" attribute of the svg
* file.
* An array of PathDataNode can represent the whole "d" attribute.
*/
public static class PathDataNode {
private char mType;
private float[] mParams;
private PathDataNode(char type, float[] params) {
mType = type;
mParams = params;
}
private PathDataNode(PathDataNode n) {
mType = n.mType;
mParams = Arrays.copyOf(n.mParams, n.mParams.length);
}
/**
* Convert an array of PathDataNode to Path.
*
* @param node The source array of PathDataNode.
* @param path The target Path object.
*/
public static void nodesToPath(PathDataNode[] node, Path path) {
float[] current = new float[6];
char previousCommand = 'm';
for (int i = 0; i < node.length; i++) {
addCommand(path, current, previousCommand, node[i].mType, node[i].mParams);
previousCommand = node[i].mType;
}
}
/**
* The current PathDataNode will be interpolated between the
* <code>nodeFrom</code> and <code>nodeTo</code> according to the
* <code>fraction</code>.
*
* @param nodeFrom The start value as a PathDataNode.
* @param nodeTo The end value as a PathDataNode
* @param fraction The fraction to interpolate.
*/
public void interpolatePathDataNode(PathDataNode nodeFrom,
PathDataNode nodeTo, float fraction) {
for (int i = 0; i < nodeFrom.mParams.length; i++) {
mParams[i] = nodeFrom.mParams[i] * (1 - fraction)
+ nodeTo.mParams[i] * fraction;
}
}
private static void addCommand(Path path, float[] current,
char previousCmd, char cmd, float[] val) {
int incr = 2;
float currentX = current[0];
float currentY = current[1];
float ctrlPointX = current[2];
float ctrlPointY = current[3];
float currentSegmentStartX = current[4];
float currentSegmentStartY = current[5];
float reflectiveCtrlPointX;
float reflectiveCtrlPointY;
switch (cmd) {
case 'z':
case 'Z':
path.close();
// Path is closed here, but we need to move the pen to the
// closed position. So we cache the segment's starting position,
// and restore it here.
currentX = currentSegmentStartX;
currentY = currentSegmentStartY;
ctrlPointX = currentSegmentStartX;
ctrlPointY = currentSegmentStartY;
path.moveTo(currentX, currentY);
break;
case 'm':
case 'M':
case 'l':
case 'L':
case 't':
case 'T':
incr = 2;
break;
case 'h':
case 'H':
case 'v':
case 'V':
incr = 1;
break;
case 'c':
case 'C':
incr = 6;
break;
case 's':
case 'S':
case 'q':
case 'Q':
incr = 4;
break;
case 'a':
case 'A':
incr = 7;
break;
}
for (int k = 0; k < val.length; k += incr) {
switch (cmd) {
case 'm': // moveto - Start a new sub-path (relative)
path.rMoveTo(val[k + 0], val[k + 1]);
currentX += val[k + 0];
currentY += val[k + 1];
currentSegmentStartX = currentX;
currentSegmentStartY = currentY;
break;
case 'M': // moveto - Start a new sub-path
path.moveTo(val[k + 0], val[k + 1]);
currentX = val[k + 0];
currentY = val[k + 1];
currentSegmentStartX = currentX;
currentSegmentStartY = currentY;
break;
case 'l': // lineto - Draw a line from the current point (relative)
path.rLineTo(val[k + 0], val[k + 1]);
currentX += val[k + 0];
currentY += val[k + 1];
break;
case 'L': // lineto - Draw a line from the current point
path.lineTo(val[k + 0], val[k + 1]);
currentX = val[k + 0];
currentY = val[k + 1];
break;
case 'h': // horizontal lineto - Draws a horizontal line (relative)
path.rLineTo(val[k + 0], 0);
currentX += val[k + 0];
break;
case 'H': // horizontal lineto - Draws a horizontal line
path.lineTo(val[k + 0], currentY);
currentX = val[k + 0];
break;
case 'v': // vertical lineto - Draws a vertical line from the current point (r)
path.rLineTo(0, val[k + 0]);
currentY += val[k + 0];
break;
case 'V': // vertical lineto - Draws a vertical line from the current point
path.lineTo(currentX, val[k + 0]);
currentY = val[k + 0];
break;
case 'c': // curveto - Draws a cubic Bézier curve (relative)
path.rCubicTo(val[k + 0], val[k + 1], val[k + 2], val[k + 3],
val[k + 4], val[k + 5]);
ctrlPointX = currentX + val[k + 2];
ctrlPointY = currentY + val[k + 3];
currentX += val[k + 4];
currentY += val[k + 5];
break;
case 'C': // curveto - Draws a cubic Bézier curve
path.cubicTo(val[k + 0], val[k + 1], val[k + 2], val[k + 3],
val[k + 4], val[k + 5]);
currentX = val[k + 4];
currentY = val[k + 5];
ctrlPointX = val[k + 2];
ctrlPointY = val[k + 3];
break;
case 's': // smooth curveto - Draws a cubic Bézier curve (reflective cp)
reflectiveCtrlPointX = 0;
reflectiveCtrlPointY = 0;
if (previousCmd == 'c' || previousCmd == 's'
|| previousCmd == 'C' || previousCmd == 'S') {
reflectiveCtrlPointX = currentX - ctrlPointX;
reflectiveCtrlPointY = currentY - ctrlPointY;
}
path.rCubicTo(reflectiveCtrlPointX, reflectiveCtrlPointY,
val[k + 0], val[k + 1],
val[k + 2], val[k + 3]);
ctrlPointX = currentX + val[k + 0];
ctrlPointY = currentY + val[k + 1];
currentX += val[k + 2];
currentY += val[k + 3];
break;
case 'S': // shorthand/smooth curveto Draws a cubic Bézier curve(reflective cp)
reflectiveCtrlPointX = currentX;
reflectiveCtrlPointY = currentY;
if (previousCmd == 'c' || previousCmd == 's'
|| previousCmd == 'C' || previousCmd == 'S') {
reflectiveCtrlPointX = 2 * currentX - ctrlPointX;
reflectiveCtrlPointY = 2 * currentY - ctrlPointY;
}
path.cubicTo(reflectiveCtrlPointX, reflectiveCtrlPointY,
val[k + 0], val[k + 1], val[k + 2], val[k + 3]);
ctrlPointX = val[k + 0];
ctrlPointY = val[k + 1];
currentX = val[k + 2];
currentY = val[k + 3];
break;
case 'q': // Draws a quadratic Bézier (relative)
path.rQuadTo(val[k + 0], val[k + 1], val[k + 2], val[k + 3]);
ctrlPointX = currentX + val[k + 0];
ctrlPointY = currentY + val[k + 1];
currentX += val[k + 2];
currentY += val[k + 3];
break;
case 'Q': // Draws a quadratic Bézier
path.quadTo(val[k + 0], val[k + 1], val[k + 2], val[k + 3]);
ctrlPointX = val[k + 0];
ctrlPointY = val[k + 1];
currentX = val[k + 2];
currentY = val[k + 3];
break;
case 't': // Draws a quadratic Bézier curve(reflective control point)(relative)
reflectiveCtrlPointX = 0;
reflectiveCtrlPointY = 0;
if (previousCmd == 'q' || previousCmd == 't'
|| previousCmd == 'Q' || previousCmd == 'T') {
reflectiveCtrlPointX = currentX - ctrlPointX;
reflectiveCtrlPointY = currentY - ctrlPointY;
}
path.rQuadTo(reflectiveCtrlPointX, reflectiveCtrlPointY,
val[k + 0], val[k + 1]);
ctrlPointX = currentX + reflectiveCtrlPointX;
ctrlPointY = currentY + reflectiveCtrlPointY;
currentX += val[k + 0];
currentY += val[k + 1];
break;
case 'T': // Draws a quadratic Bézier curve (reflective control point)
reflectiveCtrlPointX = currentX;
reflectiveCtrlPointY = currentY;
if (previousCmd == 'q' || previousCmd == 't'
|| previousCmd == 'Q' || previousCmd == 'T') {
reflectiveCtrlPointX = 2 * currentX - ctrlPointX;
reflectiveCtrlPointY = 2 * currentY - ctrlPointY;
}
path.quadTo(reflectiveCtrlPointX, reflectiveCtrlPointY,
val[k + 0], val[k + 1]);
ctrlPointX = reflectiveCtrlPointX;
ctrlPointY = reflectiveCtrlPointY;
currentX = val[k + 0];
currentY = val[k + 1];
break;
case 'a': // Draws an elliptical arc
// (rx ry x-axis-rotation large-arc-flag sweep-flag x y)
drawArc(path,
currentX,
currentY,
val[k + 5] + currentX,
val[k + 6] + currentY,
val[k + 0],
val[k + 1],
val[k + 2],
val[k + 3] != 0,
val[k + 4] != 0);
currentX += val[k + 5];
currentY += val[k + 6];
ctrlPointX = currentX;
ctrlPointY = currentY;
break;
case 'A': // Draws an elliptical arc
drawArc(path,
currentX,
currentY,
val[k + 5],
val[k + 6],
val[k + 0],
val[k + 1],
val[k + 2],
val[k + 3] != 0,
val[k + 4] != 0);
currentX = val[k + 5];
currentY = val[k + 6];
ctrlPointX = currentX;
ctrlPointY = currentY;
break;
}
previousCmd = cmd;
}
current[0] = currentX;
current[1] = currentY;
current[2] = ctrlPointX;
current[3] = ctrlPointY;
current[4] = currentSegmentStartX;
current[5] = currentSegmentStartY;
}
private static void drawArc(Path p,
float x0,
float y0,
float x1,
float y1,
float a,
float b,
float theta,
boolean isMoreThanHalf,
boolean isPositiveArc) {
/* Convert rotation angle from degrees to radians */
double thetaD = Math.toRadians(theta);
/* Pre-compute rotation matrix entries */
double cosTheta = Math.cos(thetaD);
double sinTheta = Math.sin(thetaD);
/* Transform (x0, y0) and (x1, y1) into unit space */
/* using (inverse) rotation, followed by (inverse) scale */
double x0p = (x0 * cosTheta + y0 * sinTheta) / a;
double y0p = (-x0 * sinTheta + y0 * cosTheta) / b;
double x1p = (x1 * cosTheta + y1 * sinTheta) / a;
double y1p = (-x1 * sinTheta + y1 * cosTheta) / b;
/* Compute differences and averages */
double dx = x0p - x1p;
double dy = y0p - y1p;
double xm = (x0p + x1p) / 2;
double ym = (y0p + y1p) / 2;
/* Solve for intersecting unit circles */
double dsq = dx * dx + dy * dy;
if (dsq == 0.0) {
Log.w(LOGTAG, " Points are coincident");
return; /* Points are coincident */
}
double disc = 1.0 / dsq - 1.0 / 4.0;
if (disc < 0.0) {
Log.w(LOGTAG, "Points are too far apart " + dsq);
float adjust = (float) (Math.sqrt(dsq) / 1.99999);
drawArc(p, x0, y0, x1, y1, a * adjust,
b * adjust, theta, isMoreThanHalf, isPositiveArc);
return; /* Points are too far apart */
}
double s = Math.sqrt(disc);
double sdx = s * dx;
double sdy = s * dy;
double cx;
double cy;
if (isMoreThanHalf == isPositiveArc) {
cx = xm - sdy;
cy = ym + sdx;
} else {
cx = xm + sdy;
cy = ym - sdx;
}
double eta0 = Math.atan2((y0p - cy), (x0p - cx));
double eta1 = Math.atan2((y1p - cy), (x1p - cx));
double sweep = (eta1 - eta0);
if (isPositiveArc != (sweep >= 0)) {
if (sweep > 0) {
sweep -= 2 * Math.PI;
} else {
sweep += 2 * Math.PI;
}
}
cx *= a;
cy *= b;
double tcx = cx;
cx = cx * cosTheta - cy * sinTheta;
cy = tcx * sinTheta + cy * cosTheta;
arcToBezier(p, cx, cy, a, b, x0, y0, thetaD, eta0, sweep);
}
/**
* Converts an arc to cubic Bezier segments and records them in p.
*
* @param p The target for the cubic Bezier segments
* @param cx The x coordinate center of the ellipse
* @param cy The y coordinate center of the ellipse
* @param a The radius of the ellipse in the horizontal direction
* @param b The radius of the ellipse in the vertical direction
* @param e1x E(eta1) x coordinate of the starting point of the arc
* @param e1y E(eta2) y coordinate of the starting point of the arc
* @param theta The angle that the ellipse bounding rectangle makes with horizontal plane
* @param start The start angle of the arc on the ellipse
* @param sweep The angle (positive or negative) of the sweep of the arc on the ellipse
*/
private static void arcToBezier(Path p,
double cx,
double cy,
double a,
double b,
double e1x,
double e1y,
double theta,
double start,
double sweep) {
// Taken from equations at: http://spaceroots.org/documents/ellipse/node8.html
// and http://www.spaceroots.org/documents/ellipse/node22.html
// Maximum of 45 degrees per cubic Bezier segment
int numSegments = Math.abs((int) Math.ceil(sweep * 4 / Math.PI));
double eta1 = start;
double cosTheta = Math.cos(theta);
double sinTheta = Math.sin(theta);
double cosEta1 = Math.cos(eta1);
double sinEta1 = Math.sin(eta1);
double ep1x = (-a * cosTheta * sinEta1) - (b * sinTheta * cosEta1);
double ep1y = (-a * sinTheta * sinEta1) + (b * cosTheta * cosEta1);
double anglePerSegment = sweep / numSegments;
for (int i = 0; i < numSegments; i++) {
double eta2 = eta1 + anglePerSegment;
double sinEta2 = Math.sin(eta2);
double cosEta2 = Math.cos(eta2);
double e2x = cx + (a * cosTheta * cosEta2) - (b * sinTheta * sinEta2);
double e2y = cy + (a * sinTheta * cosEta2) + (b * cosTheta * sinEta2);
double ep2x = -a * cosTheta * sinEta2 - b * sinTheta * cosEta2;
double ep2y = -a * sinTheta * sinEta2 + b * cosTheta * cosEta2;
double tanDiff2 = Math.tan((eta2 - eta1) / 2);
double alpha =
Math.sin(eta2 - eta1) * (Math.sqrt(4 + (3 * tanDiff2 * tanDiff2)) - 1) / 3;
double q1x = e1x + alpha * ep1x;
double q1y = e1y + alpha * ep1y;
double q2x = e2x - alpha * ep2x;
double q2y = e2y - alpha * ep2y;
p.cubicTo((float) q1x,
(float) q1y,
(float) q2x,
(float) q2y,
(float) e2x,
(float) e2y);
eta1 = eta2;
e1x = e2x;
e1y = e2y;
ep1x = ep2x;
ep1y = ep2y;
}
}
}
}
@@ -0,0 +1,56 @@
/*
* Copyright 2015 Hippo Seven
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hippo.vector;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
public class Utils {
/**
* Ensures the tint filter is consistent with the current tint color and
* mode.
*/
public static PorterDuffColorFilter updateTintFilter(Drawable drawable, PorterDuffColorFilter tintFilter,
ColorStateList tint, PorterDuff.Mode tintMode) {
if (tint == null || tintMode == null) {
return null;
}
final int color = tint.getColorForState(drawable.getState(), Color.TRANSPARENT);
return new PorterDuffColorFilter(color, tintMode);
}
/**
* Parses a {@link PorterDuff.Mode} from a tintMode
* attribute's enum value.
*/
public static PorterDuff.Mode parseTintMode(int value, PorterDuff.Mode defaultMode) {
switch (value) {
case 3: return PorterDuff.Mode.SRC_OVER;
case 5: return PorterDuff.Mode.SRC_IN;
case 9: return PorterDuff.Mode.SRC_ATOP;
case 14: return PorterDuff.Mode.MULTIPLY;
case 15: return PorterDuff.Mode.SCREEN;
case 16: return PorterDuff.Mode.ADD;
default: return defaultMode;
}
}
}
File diff suppressed because it is too large. Load diff
+138
View File
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2015 Hippo Seven
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<resources>
<attr name="height"/>
<!-- ========================== -->
<!-- VectorDrawable class -->
<!-- ========================== -->
<eat-comment/>
<!-- Drawable used to draw vector paths. -->
<declare-styleable name="VectorDrawable">
<!-- If set, specifies the color to apply to the drawable as a tint. By default,
no tint is applied. May be a color state list. -->
<attr name="tint" format="color"/>
<!-- When a tint color is set, specifies its Porter-Duff blending mode. The
default value is src_in, which treats the drawable as an alpha mask. -->
<attr name="tintMode">
<!-- The tint is drawn on top of the drawable.
[Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] -->
<enum name="src_over" value="3" />
<!-- The tint is masked by the alpha channel of the drawable. The drawable’s
color channels are thrown out. [Sa * Da, Sc * Da] -->
<enum name="src_in" value="5" />
<!-- The tint is drawn above the drawable, but with the drawable’s alpha
channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] -->
<enum name="src_atop" value="9" />
<!-- Multiplies the color and alpha channels of the drawable with those of
the tint. [Sa * Da, Sc * Dc] -->
<enum name="multiply" value="14" />
<!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] -->
<enum name="screen" value="15" />
<!-- Combines the tint and drawable color and alpha channels, clamping the
result to valid color values. Saturate(S + D) -->
<enum name="add" value="16" />
</attr>
<!-- The intrinsic width of the Vector Drawable. -->
<attr name="width" format="dimension"/>
<!-- The intrinsic height of the Vector Drawable. -->
<attr name="height"/>
<!-- The width of the canvas the drawing is on. -->
<attr name="viewportWidth" format="float"/>
<!-- The height of the canvas the drawing is on. -->
<attr name="viewportHeight" format="float"/>
<!-- The name of this vector drawable -->
<attr name="name" format="string"/>
<!-- The opacity of the whole vector drawable, as a value between 0
(completely transparent) and 1 (completely opaque). -->
<attr name="alpha" format="float"/>
<attr name="allowCaching" format="boolean"/>
</declare-styleable>
<!-- Defines the group used in VectorDrawables. -->
<declare-styleable name="VectorDrawableGroup">
<!-- The name of this group -->
<attr name="name"/>
<!-- The amount to rotate the group -->
<attr name="rotation" format="float"/>
<!-- The X coordinate of the center of rotation of a group -->
<attr name="pivotX" format="float|fraction"/>
<!-- The Y coordinate of the center of rotation of a group -->
<attr name="pivotY" format="float|fraction"/>
<!-- The amount to translate the group on X coordinate -->
<attr name="translateX" format="float"/>
<!-- The amount to translate the group on Y coordinate -->
<attr name="translateY" format="float"/>
<!-- The amount to scale the group on X coordinate -->
<attr name="scaleX" format="float"/>
<!-- The amount to scale the group on X coordinate -->
<attr name="scaleY" format="float"/>
</declare-styleable>
<!-- Defines the path used in VectorDrawables. -->
<declare-styleable name="VectorDrawablePath">
<!-- The name of this path -->
<attr name="name"/>
<!-- The width a path stroke -->
<attr name="strokeWidth" format="float"/>
<!-- The color to stroke the path if not defined implies no stroke-->
<attr name="strokeColor" format="color"/>
<!-- The opacity of a path stroke, as a value between 0 (completely transparent)
and 1 (completely opaque) -->
<attr name="strokeAlpha" format="float"/>
<!-- The color to fill the path if not defined implies no fill-->
<attr name="fillColor" format="color"/>
<!-- The alpha of the path fill, as a value between 0 (completely transparent)
and 1 (completely opaque)-->
<attr name="fillAlpha" format="float"/>
<!-- The specification of the operations that define the path -->
<attr name="pathData" format="string"/>
<!-- The fraction of the path to trim from the start from 0 to 1 -->
<attr name="trimPathStart" format="float"/>
<!-- The fraction of the path to trim from the end from 0 to 1 -->
<attr name="trimPathEnd" format="float"/>
<!-- Shift trim region (allows visible region to include the start and end) from 0 to 1 -->
<attr name="trimPathOffset" format="float"/>
<!-- sets the linecap for a stroked path -->
<attr name="strokeLineCap" format="enum">
<enum name="butt" value="0"/>
<enum name="round" value="1"/>
<enum name="square" value="2"/>
</attr>
<!-- sets the lineJoin for a stroked path -->
<attr name="strokeLineJoin" format="enum">
<enum name="miter" value="0"/>
<enum name="round" value="1"/>
<enum name="bevel" value="2"/>
</attr>
<!-- sets the Miter limit for a stroked path -->
<attr name="strokeMiterLimit" format="float"/>
</declare-styleable>
<!-- Defines the clip path used in VectorDrawables. -->
<declare-styleable name="VectorDrawableClipPath">
<!-- The Name of this path -->
<attr name="name"/>
<!-- The specification of the operations that define the path -->
<attr name="pathData"/>
</declare-styleable>
</resources>
@@ -0,0 +1,15 @@
package com.hippo.vector;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
+107
View File
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":vector" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EhViewer" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":vector" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
</component>
</module>