22
.gitattributes
vendored
@ -1,22 +0,0 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
171
.gitignore
vendored
@ -1,169 +1,34 @@
|
||||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
gen/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
proguard/
|
||||
# Android Studio
|
||||
*.jks
|
||||
.DS_Store
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/build
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.vspscc
|
||||
.builds
|
||||
*.dotCover
|
||||
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment this
|
||||
#packages/
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish
|
||||
|
||||
# Others
|
||||
[Bb]in
|
||||
[Oo]bj
|
||||
sql
|
||||
TestResults
|
||||
*.Cache
|
||||
ClientBin
|
||||
stylecop.*
|
||||
~$*
|
||||
*.dbmdl
|
||||
Generated_Code #added for RIA/Silverlight projects
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
|
||||
|
||||
|
||||
############
|
||||
## Windows
|
||||
############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
gradle.properties
|
||||
.directory
|
||||
|
||||
# Intellij project files
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
# Gradle
|
||||
build
|
||||
eggs
|
||||
parts
|
||||
bin
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
# Support libraries
|
||||
/external/appcompat
|
||||
/external/palette
|
||||
.gradle
|
22
.idea/compiler.xml
generated
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
3
.idea/copyright/profiles_settings.xml
generated
Normal file
@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
6
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
20
.idea/gradle.xml
generated
Normal file
@ -0,0 +1,20 @@
|
||||
<?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="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.2.1" />
|
||||
<option name="gradleJvm" value="1.7" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/external/netcipher/libnetcipher" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
11
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<option name="myLocal" value="true" />
|
||||
<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
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
31
.idea/misc.xml
generated
Normal file
@ -0,0 +1,31 @@
|
||||
<?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" />
|
||||
</project>
|
10
.idea/modules.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Lightning-Browser.iml" filepath="$PROJECT_DIR$/Lightning-Browser.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/external/netcipher/libnetcipher/libnetcipher.iml" filepath="$PROJECT_DIR$/external/netcipher/libnetcipher/libnetcipher.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
8
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/external/netcipher" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,15 +1,16 @@
|
||||
language: android
|
||||
android:
|
||||
components:
|
||||
- build-tools-21.1.1
|
||||
- android-21
|
||||
- build-tools-22.0.1
|
||||
- android-22
|
||||
- extra-android-support
|
||||
- extra-android-m2repository
|
||||
licenses:
|
||||
- 'android-sdk-license-.+'
|
||||
- '.*intel.+'
|
||||
before_install:
|
||||
- chmod +x gradlew
|
||||
- git submodule update --init --recursive
|
||||
install:
|
||||
- ./setup-ant.sh
|
||||
- ./gradlew
|
||||
script:
|
||||
- ant debug && lint -w --exitcode --disable MissingTranslation .
|
||||
|
19
Lightning-Browser.iml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="Lightning-Browser" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
<option name="BUILDABLE" value="false" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -1,2 +0,0 @@
|
||||
java.source=1.7
|
||||
java.target=1.7
|
3
app/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/build
|
||||
app-release.apk
|
||||
manifest-merger-release-report.txt
|
99
app/app.iml
Normal file
@ -0,0 +1,99 @@
|
||||
<?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="Lightning-Browser" 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/jni" 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/exploded-aar/com.android.support/appcompat-v7/22.1.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/22.1.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/jars" />
|
||||
<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="appcompat-v7-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="palette-v7-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="jsoup-1.8.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
|
||||
<orderEntry type="module" module-name="libnetcipher" exported="" />
|
||||
</component>
|
||||
</module>
|
42
app/build.gradle
Normal file
@ -0,0 +1,42 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "22.0.1"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "acr.browser.lightning"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 22
|
||||
versionCode 78
|
||||
versionName "4.0.10a"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles 'proguard-project.txt'
|
||||
}
|
||||
debug {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles 'proguard-project.txt'
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile(project(':libnetcipher')) {
|
||||
// Exclude any support-v4 modules because appcompat-v7 will import the latest
|
||||
exclude module: 'support-v4'
|
||||
exclude module: 'android-support-v4'
|
||||
}
|
||||
compile 'com.android.support:palette-v7:22.1.1'
|
||||
compile 'com.android.support:appcompat-v7:22.1.1'
|
||||
compile files('libs/jsoup-1.8.1.jar')
|
||||
}
|
@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
# Without this rule, openFileChooser does not get called on KitKat
|
||||
-keep class acr.browser.lightning.LightningView$LightningChromeClient {
|
||||
-keep class acr.browser.lightning.view.LightningView$LightningChromeClient {
|
||||
void openFileChooser(android.webkit.ValueCallback);
|
||||
void openFileChooser(android.webkit.ValueCallback, java.lang.String);
|
||||
void openFileChooser(android.webkit.ValueCallback, java.lang.String, java.lang.String);
|
||||
@ -72,3 +72,8 @@
|
||||
-keep class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
||||
|
||||
# The support library contains references to newer platform versions.
|
||||
# Don't warn about those in case this app is linking against an older
|
||||
# platform version. We know about them, and they are safe.
|
||||
-dontwarn android.support.**
|
@ -1,219 +1,214 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2014 A.C.R. Development -->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="acr.browser.lightning"
|
||||
android:versionCode="77"
|
||||
android:versionName="4.0.9a" >
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
|
||||
<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.location.gps"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.location"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
android:targetSdkVersion="22" />
|
||||
|
||||
<application
|
||||
android:name="acr.browser.lightning.BrowserApp"
|
||||
android:allowBackup="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name" >
|
||||
<activity
|
||||
android:name="acr.browser.lightning.MainActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/Theme.LightTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.APP_BROWSER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="about" />
|
||||
<data android:scheme="javascript" />
|
||||
</intent-filter>
|
||||
<!--
|
||||
For these schemes where any of these particular MIME types
|
||||
have been supplied, we are a good candidate.
|
||||
-->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="inline" />
|
||||
<data android:mimeType="text/html" />
|
||||
<data android:mimeType="text/plain" />
|
||||
<data android:mimeType="application/xhtml+xml" />
|
||||
<data android:mimeType="application/vnd.wap.xhtml+xml" />
|
||||
</intent-filter>
|
||||
<!-- For viewing saved web archives. -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="application/x-webarchive-xml" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.WEB_SEARCH" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.SettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.GeneralSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_general"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GENERAL_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.DisplaySettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_display"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.DISPLAY_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.PrivacySettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_privacy"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PRIVACY_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.AdvancedSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_advanced"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ADVANCED_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.AboutSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_about"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ABOUT_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.IncognitoActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/Theme.DarkTheme"
|
||||
android:windowSoftInputMode="stateHidden" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.INCOGNITO" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.LicenseActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/licenses"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.LICENSE" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.BookmarkActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/bookmark_settings"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOKMARK" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.lightning.ReadingActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/reading_mode"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.READING" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2014 A.C.R. Development -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="acr.browser.lightning" >
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
|
||||
<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.location.gps"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.location"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
|
||||
<application
|
||||
android:name=".activity.BrowserApp"
|
||||
android:allowBackup="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name" >
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/Theme.LightTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.APP_BROWSER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="about" />
|
||||
<data android:scheme="javascript" />
|
||||
</intent-filter>
|
||||
<!--
|
||||
For these schemes where any of these particular MIME types
|
||||
have been supplied, we are a good candidate.
|
||||
|
||||
|
||||
-->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="inline" />
|
||||
<data android:mimeType="text/html" />
|
||||
<data android:mimeType="text/plain" />
|
||||
<data android:mimeType="application/xhtml+xml" />
|
||||
<data android:mimeType="application/vnd.wap.xhtml+xml" />
|
||||
</intent-filter>
|
||||
<!-- For viewing saved web archives. -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="application/x-webarchive-xml" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.WEB_SEARCH" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.GeneralSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_general"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GENERAL_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.DisplaySettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_display"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.DISPLAY_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.PrivacySettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_privacy"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PRIVACY_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AdvancedSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_advanced"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ADVANCED_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AboutSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_about"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ABOUT_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.IncognitoActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/Theme.DarkTheme"
|
||||
android:windowSoftInputMode="stateHidden" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.INCOGNITO" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.LicenseActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/licenses"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.LICENSE" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.BookmarkActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/bookmark_settings"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOKMARK" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.ReadingActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/reading_mode"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.READING" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
@ -15,6 +15,8 @@ import android.view.View.OnClickListener;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class AboutSettingsActivity extends ThemableSettingsActivity implements OnClickListener {
|
||||
|
||||
private int mEasterEggCounter;
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
@ -18,6 +18,9 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class AdvancedSettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
private CheckBox cbAllowPopups, cbAllowCookies, cbAllowIncognitoCookies, cbRestoreTabs;
|
||||
@ -160,7 +163,7 @@ public class AdvancedSettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
}
|
||||
|
||||
public void renderPicker() {
|
||||
private void renderPicker() {
|
||||
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||
picker.setTitle(getResources().getString(R.string.rendering_mode));
|
||||
@ -203,7 +206,7 @@ public class AdvancedSettingsActivity extends ThemableSettingsActivity {
|
||||
picker.show();
|
||||
}
|
||||
|
||||
public void urlBoxPicker() {
|
||||
private void urlBoxPicker() {
|
||||
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||
picker.setTitle(getResources().getString(R.string.url_contents));
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
@ -17,11 +17,13 @@ import android.view.View.OnClickListener;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.database.BookmarkManager;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class BookmarkActivity extends ThemableSettingsActivity implements OnClickListener {
|
||||
|
||||
private BookmarkManager mBookmarkManager;
|
||||
private PreferenceManager mPreferences;
|
||||
private boolean mSystemBrowser;
|
||||
private File[] mFileList;
|
||||
private String[] mFileNameList;
|
||||
private static final File mPath = new File(Environment.getExternalStorageDirectory().toString());
|
||||
@ -44,15 +46,15 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
|
||||
TextView importBookmarks = (TextView) findViewById(R.id.isImportBrowserAvailable);
|
||||
|
||||
mBookmarkManager = BookmarkManager.getInstance(getApplicationContext());
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
mSystemBrowser = mPreferences.getSystemBrowserPresent();
|
||||
PreferenceManager mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
boolean systemBrowser = mPreferences.getSystemBrowserPresent();
|
||||
|
||||
exportBackup.setOnClickListener(this);
|
||||
importBackup.setOnClickListener(this);
|
||||
importFromBrowser.setOnClickListener(this);
|
||||
|
||||
if (mSystemBrowser) {
|
||||
if (systemBrowser) {
|
||||
importBookmarks.setText(getResources().getString(R.string.stock_browser_available));
|
||||
} else {
|
||||
importBookmarks.setText(getResources().getString(R.string.stock_browser_unavailable));
|
||||
@ -112,7 +114,7 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
|
||||
}
|
||||
}
|
||||
|
||||
public class SortName implements Comparator<File> {
|
||||
private class SortName implements Comparator<File> {
|
||||
|
||||
@Override
|
||||
public int compare(File a, File b) {
|
||||
@ -133,7 +135,7 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
|
||||
}
|
||||
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
Dialog dialog = null;
|
||||
Dialog dialog;
|
||||
final AlertDialog.Builder builder = new Builder(this);
|
||||
|
||||
switch (id) {
|
@ -2,7 +2,7 @@
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ValueAnimator;
|
||||
@ -61,6 +61,22 @@ import android.support.v7.graphics.Palette;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
|
||||
import acr.browser.lightning.view.AnimatedProgressBar;
|
||||
import acr.browser.lightning.database.BookmarkManager;
|
||||
import acr.browser.lightning.constant.BookmarkPage;
|
||||
import acr.browser.lightning.controller.BrowserController;
|
||||
import acr.browser.lightning.object.ClickHandler;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.object.DrawerArrowDrawable;
|
||||
import acr.browser.lightning.database.HistoryDatabase;
|
||||
import acr.browser.lightning.database.HistoryItem;
|
||||
import acr.browser.lightning.constant.HistoryPage;
|
||||
import acr.browser.lightning.view.LightningView;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.object.SearchAdapter;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
import info.guardianproject.onionkit.ui.OrbotHelper;
|
||||
import info.guardianproject.onionkit.web.WebkitProxy;
|
||||
|
||||
@ -80,19 +96,16 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
private FullscreenHolder mFullscreenContainer;
|
||||
private ListView mDrawerListLeft, mDrawerListRight;
|
||||
private LinearLayout mDrawerLeft, mDrawerRight, mUiLayout, mToolbarLayout;
|
||||
private RelativeLayout mNewTab, mSearchBar;
|
||||
private RelativeLayout mSearchBar;
|
||||
|
||||
// List
|
||||
private final List<LightningView> mWebViews = new ArrayList<LightningView>();
|
||||
private final List<LightningView> mWebViews = new ArrayList<>();
|
||||
private List<HistoryItem> mBookmarkList;
|
||||
private LightningView mCurrentView;
|
||||
|
||||
// View
|
||||
private ActionBar mActionBar;
|
||||
private AnimatedProgressBar mProgressBar;
|
||||
private AutoCompleteTextView mSearch;
|
||||
private ImageView mArrowImage;
|
||||
private Toolbar mToolbar;
|
||||
private VideoView mVideoView;
|
||||
private View mCustomView, mVideoProgressView;
|
||||
|
||||
@ -144,9 +157,9 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
@SuppressWarnings("deprecation")
|
||||
private synchronized void initialize() {
|
||||
setContentView(R.layout.activity_main);
|
||||
mToolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(mToolbar);
|
||||
mActionBar = getSupportActionBar();
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
mDarkTheme = mPreferences.getUseDarkTheme() || isIncognito();
|
||||
@ -161,7 +174,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
|
||||
mUiLayout = (LinearLayout) findViewById(R.id.ui_layout);
|
||||
mProgressBar = (AnimatedProgressBar) findViewById(R.id.progress_view);
|
||||
mNewTab = (RelativeLayout) findViewById(R.id.new_tab_button);
|
||||
RelativeLayout newTab = (RelativeLayout) findViewById(R.id.new_tab_button);
|
||||
mDrawerLeft = (LinearLayout) findViewById(R.id.left_drawer);
|
||||
// Drawer stutters otherwise
|
||||
mDrawerLeft.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
@ -189,22 +202,22 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
mHistoryDatabase = HistoryDatabase.getInstance(getApplicationContext());
|
||||
|
||||
// set display options of the ActionBar
|
||||
mActionBar.setDisplayShowTitleEnabled(false);
|
||||
mActionBar.setDisplayShowHomeEnabled(false);
|
||||
mActionBar.setDisplayShowCustomEnabled(true);
|
||||
mActionBar.setCustomView(R.layout.toolbar_content);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setDisplayShowHomeEnabled(false);
|
||||
actionBar.setDisplayShowCustomEnabled(true);
|
||||
actionBar.setCustomView(R.layout.toolbar_content);
|
||||
|
||||
View v = mActionBar.getCustomView();
|
||||
View v = actionBar.getCustomView();
|
||||
LayoutParams lp = v.getLayoutParams();
|
||||
lp.width = LayoutParams.MATCH_PARENT;
|
||||
v.setLayoutParams(lp);
|
||||
|
||||
mArrowDrawable = new DrawerArrowDrawable(this);
|
||||
mArrowImage = (ImageView) mActionBar.getCustomView().findViewById(R.id.arrow);
|
||||
mArrowImage = (ImageView) actionBar.getCustomView().findViewById(R.id.arrow);
|
||||
// Use hardware acceleration for the animation
|
||||
mArrowImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
mArrowImage.setImageDrawable(mArrowDrawable);
|
||||
LinearLayout arrowButton = (LinearLayout) mActionBar.getCustomView().findViewById(
|
||||
LinearLayout arrowButton = (LinearLayout) actionBar.getCustomView().findViewById(
|
||||
R.id.arrow_button);
|
||||
arrowButton.setOnClickListener(this);
|
||||
|
||||
@ -215,8 +228,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
forward.setOnClickListener(this);
|
||||
|
||||
// create the search EditText in the ToolBar
|
||||
mSearch = (AutoCompleteTextView) mActionBar.getCustomView().findViewById(R.id.search);
|
||||
mUntitledTitle = (String) getString(R.string.untitled);
|
||||
mSearch = (AutoCompleteTextView) actionBar.getCustomView().findViewById(R.id.search);
|
||||
mUntitledTitle = getString(R.string.untitled);
|
||||
mBackgroundColor = getResources().getColor(R.color.primary_color);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
mDeleteIcon = getResources().getDrawable(R.drawable.ic_action_delete);
|
||||
@ -267,8 +280,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
});
|
||||
initialize.run();
|
||||
|
||||
mNewTab.setOnClickListener(this);
|
||||
mNewTab.setOnLongClickListener(new OnLongClickListener() {
|
||||
newTab.setOnClickListener(this);
|
||||
newTab.setOnLongClickListener(new OnLongClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
@ -484,7 +497,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
* If Orbot/Tor is installed, prompt the user if they want to enable
|
||||
* proxying for this session
|
||||
*/
|
||||
public boolean checkForTor() {
|
||||
private boolean checkForTor() {
|
||||
boolean useProxy = mPreferences.getUseProxy();
|
||||
|
||||
OrbotHelper oh = new OrbotHelper(this);
|
||||
@ -522,7 +535,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
/*
|
||||
* Initialize WebKit Proxying for Tor
|
||||
*/
|
||||
public void initializeTor() {
|
||||
private void initializeTor() {
|
||||
|
||||
OrbotHelper oh = new OrbotHelper(this);
|
||||
if (!oh.isOrbotRunning()) {
|
||||
@ -531,7 +544,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
try {
|
||||
String host = mPreferences.getProxyHost();
|
||||
int port = mPreferences.getProxyPort();
|
||||
WebkitProxy.setProxy(this.getPackageName() + ".BrowserApp", getApplicationContext(),
|
||||
WebkitProxy.setProxy(BrowserApp.class.getName(), getApplicationContext(),
|
||||
host, port);
|
||||
} catch (Exception e) {
|
||||
Log.d(Constants.TAG, "error enabling web proxying", e);
|
||||
@ -601,12 +614,12 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
mPreferences.setMemoryUrl("");
|
||||
String[] array = Utils.getArray(mem);
|
||||
int count = 0;
|
||||
for (int n = 0; n < array.length; n++) {
|
||||
if (array[n].length() > 0) {
|
||||
if (url != null && url.compareTo(array[n]) == 0) {
|
||||
for (String urlString : array) {
|
||||
if (urlString.length() > 0) {
|
||||
if (url != null && url.compareTo(urlString) == 0) {
|
||||
url = null;
|
||||
}
|
||||
newTab(array[n], true);
|
||||
newTab(urlString, true);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -627,7 +640,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
mFullScreen = mPreferences.getFullScreenEnabled();
|
||||
mColorMode = mPreferences.getColorModeEnabled();
|
||||
mColorMode &= !mDarkTheme;
|
||||
|
||||
if (!isIncognito() && !mColorMode && !mDarkTheme && mWebpageBitmap != null) {
|
||||
changeToolbarBackground(mWebpageBitmap);
|
||||
} else if (!isIncognito() && mCurrentView != null && !mDarkTheme
|
||||
@ -695,7 +707,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
initializeTor();
|
||||
} else {
|
||||
try {
|
||||
WebkitProxy.resetProxy(mActivity.getPackageName() + ".BrowserApp",
|
||||
WebkitProxy.resetProxy(BrowserApp.class.getName(),
|
||||
getApplicationContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -995,7 +1007,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
/**
|
||||
* Takes in the id of which bookmark was selected and shows a dialog that
|
||||
* allows the user to rename and change the url of the bookmark
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* which id in the list was chosen
|
||||
*/
|
||||
@ -1039,7 +1051,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
/**
|
||||
* displays the WebView contained in the LightningView Also handles the
|
||||
* removal of previous views
|
||||
*
|
||||
*
|
||||
* @param view
|
||||
* the LightningView to show
|
||||
*/
|
||||
@ -1444,13 +1456,13 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
|
||||
public class LightningViewAdapter extends ArrayAdapter<LightningView> {
|
||||
|
||||
Context context;
|
||||
final Context context;
|
||||
ColorMatrix colorMatrix;
|
||||
ColorMatrixColorFilter filter;
|
||||
Paint paint;
|
||||
int layoutResourceId;
|
||||
final int layoutResourceId;
|
||||
List<LightningView> data = null;
|
||||
CloseTabListener mExitListener;
|
||||
final CloseTabListener mExitListener;
|
||||
|
||||
public LightningViewAdapter(Context context, int layoutResourceId, List<LightningView> data) {
|
||||
super(context, layoutResourceId, data);
|
||||
@ -1463,7 +1475,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
LightningViewHolder holder = null;
|
||||
LightningViewHolder holder;
|
||||
if (row == null) {
|
||||
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
|
||||
row = inflater.inflate(layoutResourceId, parent, false);
|
||||
@ -1533,54 +1545,54 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
}
|
||||
|
||||
private void changeToolbarBackground(Bitmap favicon) {
|
||||
android.support.v7.graphics.Palette.generateAsync(favicon,
|
||||
new android.support.v7.graphics.Palette.PaletteAsyncListener() {
|
||||
Palette.from(favicon).generate(new Palette.PaletteAsyncListener() {
|
||||
@Override
|
||||
public void onGenerated(Palette palette) {
|
||||
|
||||
// OR with opaque black to remove transparency glitches
|
||||
int color = 0xff000000 | palette.getVibrantColor(mActivity.getResources()
|
||||
.getColor(R.color.primary_color));
|
||||
|
||||
int finalColor; // Lighten up the dark color if it is
|
||||
// too dark
|
||||
if (isColorTooDark(color)) {
|
||||
finalColor = mixTwoColors(
|
||||
mActivity.getResources().getColor(R.color.primary_color),
|
||||
color, 0.25f);
|
||||
} else {
|
||||
finalColor = color;
|
||||
}
|
||||
|
||||
ValueAnimator anim = ValueAnimator.ofObject(new ArgbEvaluator(),
|
||||
mBackground.getColor(), finalColor);
|
||||
|
||||
anim.addUpdateListener(new AnimatorUpdateListener() {
|
||||
|
||||
@Override
|
||||
public void onGenerated(Palette palette) {
|
||||
// OR with opaque black to remove transparency glitches
|
||||
int color = 0xff000000 | palette.getVibrantColor(mActivity.getResources()
|
||||
.getColor(R.color.primary_color));
|
||||
|
||||
int finalColor; // Lighten up the dark color if it is
|
||||
// too dark
|
||||
if (isColorTooDark(color)) {
|
||||
finalColor = mixTwoColors(
|
||||
mActivity.getResources().getColor(R.color.primary_color),
|
||||
color, 0.25f);
|
||||
} else {
|
||||
finalColor = color;
|
||||
}
|
||||
|
||||
ValueAnimator anim = ValueAnimator.ofObject(new ArgbEvaluator(),
|
||||
mBackground.getColor(), finalColor);
|
||||
|
||||
anim.addUpdateListener(new AnimatorUpdateListener() {
|
||||
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
int color = (Integer) animation.getAnimatedValue();
|
||||
mBackground.setColor(color);
|
||||
getWindow().setBackgroundDrawable(mBackground);
|
||||
mToolbarLayout.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
anim.setDuration(300);
|
||||
anim.start();
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
int color = (Integer) animation.getAnimatedValue();
|
||||
mBackground.setColor(color);
|
||||
getWindow().setBackgroundDrawable(mBackground);
|
||||
mToolbarLayout.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
anim.setDuration(300);
|
||||
anim.start();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isColorTooDark(int color) {
|
||||
final byte RED_CHANNEL = 16;
|
||||
final byte GREEN_CHANNEL = 8;
|
||||
final byte BLUE_CHANNEL = 0;
|
||||
//final byte BLUE_CHANNEL = 0;
|
||||
|
||||
int r = ((int) ((float) (color >> RED_CHANNEL & 0xff) * 0.3f)) & 0xff;
|
||||
int g = ((int) ((float) (color >> GREEN_CHANNEL & 0xff) * 0.59)) & 0xff;
|
||||
int b = ((int) ((float) (color >> BLUE_CHANNEL & 0xff) * 0.11)) & 0xff;
|
||||
int b = ((int) ((float) (color & 0xff) * 0.11)) & 0xff;
|
||||
int gr = (r + g + b) & 0xff;
|
||||
int gray = gr + (gr << GREEN_CHANNEL) + (gr << RED_CHANNEL);
|
||||
|
||||
@ -1591,7 +1603,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
final byte ALPHA_CHANNEL = 24;
|
||||
final byte RED_CHANNEL = 16;
|
||||
final byte GREEN_CHANNEL = 8;
|
||||
final byte BLUE_CHANNEL = 0;
|
||||
//final byte BLUE_CHANNEL = 0;
|
||||
|
||||
final float inverseAmount = 1.0f - amount;
|
||||
|
||||
@ -1599,14 +1611,14 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
int g = ((int) (((float) (color1 >> GREEN_CHANNEL & 0xff) * amount) + ((float) (color2 >> GREEN_CHANNEL & 0xff) * inverseAmount))) & 0xff;
|
||||
int b = ((int) (((float) (color1 & 0xff) * amount) + ((float) (color2 & 0xff) * inverseAmount))) & 0xff;
|
||||
|
||||
return 0xff << ALPHA_CHANNEL | r << RED_CHANNEL | g << GREEN_CHANNEL | b << BLUE_CHANNEL;
|
||||
return 0xff << ALPHA_CHANNEL | r << RED_CHANNEL | g << GREEN_CHANNEL | b;
|
||||
}
|
||||
|
||||
public class BookmarkViewAdapter extends ArrayAdapter<HistoryItem> {
|
||||
|
||||
Context context;
|
||||
final Context context;
|
||||
List<HistoryItem> data = null;
|
||||
int layoutResourceId;
|
||||
final int layoutResourceId;
|
||||
|
||||
public BookmarkViewAdapter(Context context, int layoutResourceId, List<HistoryItem> data) {
|
||||
super(context, layoutResourceId, data);
|
||||
@ -1618,7 +1630,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
BookmarkViewHolder holder = null;
|
||||
BookmarkViewHolder holder;
|
||||
|
||||
if (row == null) {
|
||||
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
|
||||
@ -1655,8 +1667,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
|
||||
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
|
||||
|
||||
ImageView bmImage;
|
||||
HistoryItem mWeb;
|
||||
final ImageView bmImage;
|
||||
final HistoryItem mWeb;
|
||||
|
||||
public DownloadImageTask(ImageView bmImage, HistoryItem web) {
|
||||
this.bmImage = bmImage;
|
||||
@ -1837,14 +1849,13 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
public boolean getSystemBrowser() {
|
||||
Cursor c = null;
|
||||
String[] columns = new String[] { "url", "title" };
|
||||
boolean browserFlag = false;
|
||||
boolean browserFlag;
|
||||
try {
|
||||
|
||||
Uri bookmarks = Browser.BOOKMARKS_URI;
|
||||
c = getContentResolver().query(bookmarks, columns, null, null, null);
|
||||
} catch (SQLiteException ignored) {
|
||||
} catch (IllegalStateException ignored) {
|
||||
} catch (NullPointerException ignored) {
|
||||
} catch (SQLiteException | IllegalStateException | NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
@ -1856,7 +1867,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
}
|
||||
if (c != null) {
|
||||
c.close();
|
||||
c = null;
|
||||
}
|
||||
mPreferences.setSystemBrowserPresent(browserFlag);
|
||||
return browserFlag;
|
||||
@ -1884,7 +1894,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
getUrl.setText(url);
|
||||
}
|
||||
searchTheWeb(url);
|
||||
url = null;
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
|
||||
if (mCurrentView != null) {
|
||||
@ -2030,7 +2039,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
|
||||
mFilePathCallback.onReceiveValue(results);
|
||||
mFilePathCallback = null;
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2181,7 +2189,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
|
||||
/**
|
||||
* turns on fullscreen mode in the app
|
||||
*
|
||||
*
|
||||
* @param enabled
|
||||
* whether to enable fullscreen or not
|
||||
*/
|
||||
@ -2358,7 +2366,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
|
||||
@Override
|
||||
/**
|
||||
* handles a long click on the page, parameter String url
|
||||
* handles a long click on the page, parameter String url
|
||||
* is the url that should have been obtained from the WebView touch node
|
||||
* thingy, if it is null, this method tries to deal with it and find a workaround
|
||||
*/
|
||||
@ -2571,7 +2579,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
/**
|
||||
* handle presses on the refresh icon in the search bar, if the page is
|
||||
* loading, stop the page, if it is done loading refresh the page.
|
||||
*
|
||||
*
|
||||
* See setIsFinishedLoading and setIsLoading for displaying the correct icon
|
||||
*/
|
||||
public void refreshOrStop() {
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
@ -15,6 +15,9 @@ import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class DisplaySettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
// mPreferences variables
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@ -23,6 +23,11 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class GeneralSettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
// mPreferences variables
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
@ -7,6 +7,9 @@ import android.view.Menu;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class IncognitoActivity extends BrowserActivity {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@ -10,6 +10,8 @@ import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
/*
|
||||
*NOTE: This activity must not be removed in order to comply with the Mozilla Public License v. 2.0
|
||||
*under which this code is licensed. Unless you plan on providing other attribution in the app to
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
@ -7,6 +7,9 @@ import android.view.Menu;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class MainActivity extends BrowserActivity {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
@ -22,6 +22,11 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.database.HistoryDatabase;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class PrivacySettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
// mPreferences variables
|
||||
@ -139,7 +144,7 @@ public class PrivacySettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
private static class MessageHandler extends Handler {
|
||||
|
||||
Context mHandlerContext;
|
||||
final Context mHandlerContext;
|
||||
|
||||
public MessageHandler(Context context) {
|
||||
this.mHandlerContext = context;
|
@ -1,10 +1,5 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import acr.browser.lightning.reading.HtmlFetcher;
|
||||
import acr.browser.lightning.reading.JResult;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
@ -14,7 +9,7 @@ import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@ -24,7 +19,17 @@ import android.widget.SeekBar;
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ReadingActivity extends ActionBarActivity {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.reading.HtmlFetcher;
|
||||
import acr.browser.lightning.reading.JResult;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class ReadingActivity extends AppCompatActivity {
|
||||
|
||||
private TextView mTitle;
|
||||
private TextView mBody;
|
||||
@ -110,7 +115,7 @@ public class ReadingActivity extends ActionBarActivity {
|
||||
|
||||
private class PageLoader extends AsyncTask<String, Void, Void> {
|
||||
|
||||
private Context mContext;
|
||||
private final Context mContext;
|
||||
private ProgressDialog mProgressDialog;
|
||||
private String mTitleText;
|
||||
private List<String> mBodyText;
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@ -23,11 +23,16 @@ import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
import info.guardianproject.onionkit.ui.OrbotHelper;
|
||||
|
||||
public class SettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
private static int API = android.os.Build.VERSION.SDK_INT;
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
private PreferenceManager mPreferences;
|
||||
private Context mContext;
|
||||
private Activity mActivity;
|
@ -1,10 +1,13 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
public abstract class ThemableActivity extends ActionBarActivity {
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public abstract class ThemableActivity extends AppCompatActivity {
|
||||
|
||||
private boolean mDark;
|
||||
|
@ -1,10 +1,13 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
public abstract class ThemableSettingsActivity extends ActionBarActivity {
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public abstract class ThemableSettingsActivity extends AppCompatActivity {
|
||||
|
||||
private boolean mDark;
|
||||
|
@ -1,7 +1,10 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.constant;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.activity.BrowserApp;
|
||||
|
||||
public class BookmarkPage {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.constant;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
@ -14,7 +14,6 @@ public final class Constants {
|
||||
|
||||
public static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36";
|
||||
public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
|
||||
public static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
public static final String YAHOO_SEARCH = "https://search.yahoo.com/search?p=";
|
||||
public static final String GOOGLE_SEARCH = "https://www.google.com/search?client=lightning&ie=UTF-8&oe=UTF-8&q=";
|
||||
public static final String BING_SEARCH = "https://www.bing.com/search?q=";
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.constant;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
@ -11,6 +11,11 @@ import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import acr.browser.lightning.activity.BrowserApp;
|
||||
import acr.browser.lightning.database.HistoryItem;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.database.HistoryDatabase;
|
||||
|
||||
public class HistoryPage {
|
||||
|
||||
private static final String FILENAME = "history.html";
|
@ -1,9 +1,12 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.constant;
|
||||
|
||||
public class HomepageVariables {
|
||||
import acr.browser.lightning.activity.BrowserApp;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class StartPage {
|
||||
|
||||
public static final String HEAD = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">"
|
||||
+ "<head>"
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.controller;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient.CustomViewCallback;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public interface BrowserController {
|
||||
|
||||
void updateUrl(String title, boolean shortUrl);
|
||||
|
||||
void updateProgress(int n);
|
||||
|
||||
void updateHistory(String title, String url);
|
||||
|
||||
void openFileChooser(ValueCallback<Uri> uploadMsg);
|
||||
|
||||
void update();
|
||||
|
||||
void onLongPress();
|
||||
|
||||
void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback);
|
||||
|
||||
void onHideCustomView();
|
||||
|
||||
Bitmap getDefaultVideoPoster();
|
||||
|
||||
View getVideoLoadingProgressView();
|
||||
|
||||
void onCreateWindow(boolean isUserGesture, Message resultMsg);
|
||||
|
||||
Activity getActivity();
|
||||
|
||||
void hideActionBar();
|
||||
|
||||
void showActionBar();
|
||||
|
||||
void toggleActionBar();
|
||||
|
||||
void longClickPage(String url);
|
||||
|
||||
void openBookmarkPage(WebView view);
|
||||
|
||||
void showFileChooser(ValueCallback<Uri[]> filePathCallback);
|
||||
|
||||
void closeEmptyTab();
|
||||
|
||||
boolean isIncognito();
|
||||
|
||||
int getMenu();
|
||||
}
|
@ -1,9 +1,17 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.database;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.os.Environment;
|
||||
import android.provider.Browser;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
@ -15,24 +23,20 @@ import java.util.Locale;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.os.Environment;
|
||||
import android.provider.Browser;
|
||||
import android.widget.Toast;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class BookmarkManager {
|
||||
|
||||
private Context mContext;
|
||||
private final Context mContext;
|
||||
private static final String TITLE = "title";
|
||||
private static final String URL = "url";
|
||||
private static final String FOLDER = "folder";
|
||||
private static final String ORDER = "order";
|
||||
private static final String FILE_BOOKMARKS = "bookmarks.dat";
|
||||
private static SortedMap<String, Integer> mBookmarkMap = new TreeMap<String, Integer>(
|
||||
private static SortedMap<String, Integer> mBookmarkMap = new TreeMap<>(
|
||||
String.CASE_INSENSITIVE_ORDER);
|
||||
private static BookmarkManager mInstance;
|
||||
|
||||
@ -69,9 +73,7 @@ public class BookmarkManager {
|
||||
bookmarkWriter.newLine();
|
||||
bookmarkWriter.close();
|
||||
mBookmarkMap.put(item.getUrl(), 1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
@ -99,9 +101,7 @@ public class BookmarkManager {
|
||||
}
|
||||
}
|
||||
bookmarkWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -112,7 +112,7 @@ public class BookmarkManager {
|
||||
* @param url
|
||||
*/
|
||||
public synchronized boolean deleteBookmark(String url) {
|
||||
List<HistoryItem> list = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> list;
|
||||
if (url == null) {
|
||||
return false;
|
||||
}
|
||||
@ -136,9 +136,7 @@ public class BookmarkManager {
|
||||
}
|
||||
}
|
||||
fileWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return bookmarkDeleted;
|
||||
@ -177,9 +175,7 @@ public class BookmarkManager {
|
||||
mContext,
|
||||
mContext.getString(R.string.bookmark_export_path) + " "
|
||||
+ bookmarksExport.getPath(), Toast.LENGTH_SHORT).show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -191,7 +187,7 @@ public class BookmarkManager {
|
||||
* @return
|
||||
*/
|
||||
public synchronized List<HistoryItem> getBookmarks(boolean sort) {
|
||||
List<HistoryItem> bookmarks = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> bookmarks = new ArrayList<>();
|
||||
File bookmarksFile = new File(mContext.getFilesDir(), FILE_BOOKMARKS);
|
||||
try {
|
||||
BufferedReader bookmarksReader = new BufferedReader(new FileReader(bookmarksFile));
|
||||
@ -207,11 +203,7 @@ public class BookmarkManager {
|
||||
bookmarks.add(item);
|
||||
}
|
||||
bookmarksReader.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (sort) {
|
||||
@ -227,7 +219,7 @@ public class BookmarkManager {
|
||||
* @return
|
||||
*/
|
||||
public synchronized List<HistoryItem> getBookmarksFromFolder(String folder) {
|
||||
List<HistoryItem> bookmarks = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> bookmarks = new ArrayList<>();
|
||||
File bookmarksFile = new File(mContext.getFilesDir(), FILE_BOOKMARKS);
|
||||
try {
|
||||
BufferedReader bookmarksReader = new BufferedReader(new FileReader(bookmarksFile));
|
||||
@ -245,11 +237,7 @@ public class BookmarkManager {
|
||||
}
|
||||
}
|
||||
bookmarksReader.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return bookmarks;
|
||||
@ -261,7 +249,7 @@ public class BookmarkManager {
|
||||
* @return
|
||||
*/
|
||||
private synchronized SortedMap<String, Integer> getBookmarkUrls() {
|
||||
SortedMap<String, Integer> map = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER);
|
||||
SortedMap<String, Integer> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
File bookmarksFile = new File(mContext.getFilesDir(), FILE_BOOKMARKS);
|
||||
try {
|
||||
BufferedReader bookmarksReader = new BufferedReader(new FileReader(bookmarksFile));
|
||||
@ -271,11 +259,7 @@ public class BookmarkManager {
|
||||
map.put(object.getString(URL), 1);
|
||||
}
|
||||
bookmarksReader.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (JSONException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
@ -287,8 +271,8 @@ public class BookmarkManager {
|
||||
* @return
|
||||
*/
|
||||
public synchronized List<HistoryItem> getFolders() {
|
||||
List<HistoryItem> folders = new ArrayList<HistoryItem>();
|
||||
SortedMap<String, Integer> folderMap = new TreeMap<String, Integer>(
|
||||
List<HistoryItem> folders = new ArrayList<>();
|
||||
SortedMap<String, Integer> folderMap = new TreeMap<>(
|
||||
String.CASE_INSENSITIVE_ORDER);
|
||||
File bookmarksFile = new File(mContext.getFilesDir(), FILE_BOOKMARKS);
|
||||
try {
|
||||
@ -306,11 +290,7 @@ public class BookmarkManager {
|
||||
}
|
||||
}
|
||||
bookmarksReader.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return folders;
|
||||
@ -323,7 +303,7 @@ public class BookmarkManager {
|
||||
public synchronized void importBookmarksFromBrowser(Context context) {
|
||||
if (PreferenceManager.getInstance().getSystemBrowserPresent()) {
|
||||
|
||||
List<HistoryItem> bookmarkList = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> bookmarkList = new ArrayList<>();
|
||||
String[] columns = new String[] { Browser.BookmarkColumns.TITLE,
|
||||
Browser.BookmarkColumns.URL };
|
||||
String selection = Browser.BookmarkColumns.BOOKMARK + " = 1";
|
||||
@ -367,7 +347,7 @@ public class BookmarkManager {
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
List<HistoryItem> list = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> list = new ArrayList<>();
|
||||
try {
|
||||
BufferedReader bookmarksReader = new BufferedReader(new FileReader(file));
|
||||
String line;
|
||||
@ -386,17 +366,7 @@ public class BookmarkManager {
|
||||
addBookmarkList(list);
|
||||
Utils.showToast(mContext,
|
||||
number + " " + mContext.getResources().getString(R.string.message_import));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
Utils.createInformativeDialog(context,
|
||||
mContext.getResources().getString(R.string.title_error), mContext
|
||||
.getResources().getString(R.string.import_bookmark_error));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Utils.createInformativeDialog(context,
|
||||
mContext.getResources().getString(R.string.title_error), mContext
|
||||
.getResources().getString(R.string.import_bookmark_error));
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
Utils.createInformativeDialog(context,
|
||||
mContext.getResources().getString(R.string.title_error), mContext
|
||||
@ -425,9 +395,7 @@ public class BookmarkManager {
|
||||
bookmarkWriter.newLine();
|
||||
}
|
||||
bookmarkWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.database;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
@ -11,6 +11,8 @@ import android.database.sqlite.SQLiteOpenHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class HistoryDatabase extends SQLiteOpenHelper {
|
||||
|
||||
// All Static variables
|
||||
@ -90,6 +92,7 @@ public class HistoryDatabase extends SQLiteOpenHelper {
|
||||
} else {
|
||||
addHistoryItem(new HistoryItem(url, title));
|
||||
}
|
||||
q.close();
|
||||
}
|
||||
|
||||
public synchronized void addHistoryItem(HistoryItem item) {
|
||||
@ -114,7 +117,7 @@ public class HistoryDatabase extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public List<HistoryItem> findItemsContaining(String search) {
|
||||
List<HistoryItem> itemList = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> itemList = new ArrayList<>();
|
||||
String selectQuery = "SELECT * FROM " + TABLE_HISTORY + " WHERE " + KEY_TITLE + " LIKE '%"
|
||||
+ search + "%' OR " + KEY_URL + " LIKE '%" + search + "%' " + "ORDER BY "
|
||||
+ KEY_TIME_VISITED + " DESC LIMIT 5";
|
||||
@ -137,7 +140,7 @@ public class HistoryDatabase extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public List<HistoryItem> getLastHundredItems() {
|
||||
List<HistoryItem> itemList = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> itemList = new ArrayList<>();
|
||||
String selectQuery = "SELECT * FROM " + TABLE_HISTORY + " ORDER BY " + KEY_TIME_VISITED
|
||||
+ " DESC";
|
||||
|
||||
@ -159,7 +162,7 @@ public class HistoryDatabase extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public List<HistoryItem> getAllHistoryItems() {
|
||||
List<HistoryItem> itemList = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> itemList = new ArrayList<>();
|
||||
String selectQuery = "SELECT * FROM " + TABLE_HISTORY + " ORDER BY " + KEY_TIME_VISITED
|
||||
+ " DESC";
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.database;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
public class HistoryItem implements Comparable<HistoryItem> {
|
||||
|
||||
@ -112,7 +113,7 @@ public class HistoryItem implements Comparable<HistoryItem> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(HistoryItem another) {
|
||||
public int compareTo(@NonNull HistoryItem another) {
|
||||
return mTitle.compareTo(another.mTitle);
|
||||
}
|
||||
|
||||
@ -137,10 +138,7 @@ public class HistoryItem implements Comparable<HistoryItem> {
|
||||
if (mBitmap != null ? !mBitmap.equals(that.mBitmap) : that.mBitmap != null) {
|
||||
return false;
|
||||
}
|
||||
if (!mTitle.equals(that.mTitle)) {
|
||||
return false;
|
||||
}
|
||||
return mUrl.equals(that.mUrl);
|
||||
return mTitle.equals(that.mTitle) && mUrl.equals(that.mUrl);
|
||||
}
|
||||
|
||||
@Override
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.download;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@ -20,6 +20,9 @@ import android.webkit.CookieManager;
|
||||
import android.webkit.URLUtil;
|
||||
import android.widget.Toast;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
/**
|
||||
* Handle download requests
|
||||
*/
|
||||
@ -128,8 +131,8 @@ public class DownloadHandler {
|
||||
* If the request is coming from a private browsing tab.
|
||||
*/
|
||||
/* package */
|
||||
static void onDownloadStartNoStream(Activity activity, String url, String userAgent,
|
||||
String contentDisposition, String mimetype, boolean privateBrowsing) {
|
||||
private static void onDownloadStartNoStream(Activity activity, String url, String userAgent,
|
||||
String contentDisposition, String mimetype, boolean privateBrowsing) {
|
||||
|
||||
String filename = URLUtil.guessFileName(url, contentDisposition, mimetype);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.download;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
import android.content.Context;
|
||||
@ -14,6 +14,8 @@ import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
/**
|
||||
* This class is used to pull down the http headers of a given URL so that we
|
||||
* can analyse the mimetype and make any correction needed before we give the
|
||||
@ -24,15 +26,15 @@ import java.net.URL;
|
||||
*/
|
||||
public class FetchUrlMimeType extends Thread {
|
||||
|
||||
private Context mContext;
|
||||
private final Context mContext;
|
||||
|
||||
private DownloadManager.Request mRequest;
|
||||
private final DownloadManager.Request mRequest;
|
||||
|
||||
private String mUri;
|
||||
private final String mUri;
|
||||
|
||||
private String mCookies;
|
||||
private final String mCookies;
|
||||
|
||||
private String mUserAgent;
|
||||
private final String mUserAgent;
|
||||
|
||||
public FetchUrlMimeType(Context context, DownloadManager.Request request, String uri,
|
||||
String cookies, String userAgent) {
|
||||
@ -76,10 +78,7 @@ public class FetchUrlMimeType extends Thread {
|
||||
contentDisposition = contentDispositionHeader;
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException ex) {
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
} catch (IOException ex) {
|
||||
} catch (IllegalArgumentException | IOException ex) {
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
} finally {
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.download;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@ -10,11 +10,15 @@ import android.util.Log;
|
||||
import android.webkit.DownloadListener;
|
||||
import android.webkit.URLUtil;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.download.DownloadHandler;
|
||||
|
||||
public class LightningDownloadListener implements DownloadListener {
|
||||
|
||||
private Activity mActivity;
|
||||
private final Activity mActivity;
|
||||
|
||||
LightningDownloadListener(Activity activity) {
|
||||
public LightningDownloadListener(Activity activity) {
|
||||
mActivity = activity;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.download;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
@ -32,7 +32,7 @@ public class WebAddress {
|
||||
static final int MATCH_GROUP_HOST = 3;
|
||||
static final int MATCH_GROUP_PORT = 4;
|
||||
static final int MATCH_GROUP_PATH = 5;
|
||||
static Pattern sAddressPattern = Pattern.compile(
|
||||
static final Pattern sAddressPattern = Pattern.compile(
|
||||
/* scheme */"(?:(http|https|file)\\:\\/\\/)?" +
|
||||
/* authority */"(?:([-A-Za-z0-9$_.+!*'(),;?&=]+(?:\\:[-A-Za-z0-9$_.+!*'(),;?&=]+)?)@)?" +
|
||||
/* host */"([" + GOOD_IRI_CHAR + "%_-][" + GOOD_IRI_CHAR + "%_\\.-]*|\\[[0-9a-fA-F:\\.]+\\])?" +
|
@ -1,12 +1,14 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.object;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import acr.browser.lightning.controller.BrowserController;
|
||||
|
||||
public class ClickHandler extends Handler {
|
||||
|
||||
private BrowserController mBrowserController;
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.object;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
@ -30,7 +30,7 @@ import android.support.v7.appcompat.R;
|
||||
* A drawable that can draw a "Drawer hamburger" menu or an Arrow and animate
|
||||
* between them.
|
||||
*/
|
||||
class DrawerArrowDrawable extends Drawable {
|
||||
public class DrawerArrowDrawable extends Drawable {
|
||||
private final Paint mPaint = new Paint();
|
||||
// The angle in degress that the arrow head is inclined at.
|
||||
private static final float ARROW_HEAD_ANGLE = (float) Math.toRadians(45);
|
||||
@ -60,7 +60,7 @@ class DrawerArrowDrawable extends Drawable {
|
||||
* @param context
|
||||
* used to get the configuration for the drawable from
|
||||
*/
|
||||
DrawerArrowDrawable(Context context) {
|
||||
public DrawerArrowDrawable(Context context) {
|
||||
final TypedArray typedArray = context.getTheme().obtainStyledAttributes(null,
|
||||
R.styleable.DrawerArrowToggle, R.attr.drawerArrowStyle,
|
||||
R.style.Base_Widget_AppCompat_DrawerArrowToggle);
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.object;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
@ -36,6 +36,12 @@ import android.widget.Filterable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.database.BookmarkManager;
|
||||
import acr.browser.lightning.database.HistoryDatabase;
|
||||
import acr.browser.lightning.database.HistoryItem;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public class SearchAdapter extends BaseAdapter implements Filterable {
|
||||
|
||||
private List<HistoryItem> mHistory;
|
||||
@ -44,26 +50,26 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
|
||||
private List<HistoryItem> mFilteredList;
|
||||
private List<HistoryItem> mAllBookmarks;
|
||||
private HistoryDatabase mDatabaseHandler;
|
||||
private Context mContext;
|
||||
private final Context mContext;
|
||||
private boolean mUseGoogle = true;
|
||||
private boolean mIsExecuting = false;
|
||||
private boolean mDarkTheme;
|
||||
private boolean mIncognito;
|
||||
private BookmarkManager mBookmarkManager;
|
||||
private final boolean mDarkTheme;
|
||||
private final boolean mIncognito;
|
||||
private final BookmarkManager mBookmarkManager;
|
||||
private static final String ENCODING = "ISO-8859-1";
|
||||
private static final long INTERVAL_DAY = 86400000;
|
||||
private String mSearchSubtitle;
|
||||
private final String mSearchSubtitle;
|
||||
private static final int API = Build.VERSION.SDK_INT;
|
||||
private Theme mTheme;
|
||||
private final Theme mTheme;
|
||||
private SearchFilter mFilter;
|
||||
|
||||
public SearchAdapter(Context context, boolean dark, boolean incognito) {
|
||||
mDatabaseHandler = HistoryDatabase.getInstance(context.getApplicationContext());
|
||||
mTheme = context.getTheme();
|
||||
mFilteredList = new ArrayList<HistoryItem>();
|
||||
mHistory = new ArrayList<HistoryItem>();
|
||||
mBookmarks = new ArrayList<HistoryItem>();
|
||||
mSuggestions = new ArrayList<HistoryItem>();
|
||||
mFilteredList = new ArrayList<>();
|
||||
mHistory = new ArrayList<>();
|
||||
mBookmarks = new ArrayList<>();
|
||||
mSuggestions = new ArrayList<>();
|
||||
mBookmarkManager = BookmarkManager.getInstance(context.getApplicationContext());
|
||||
mAllBookmarks = mBookmarkManager.getBookmarks(true);
|
||||
mUseGoogle = PreferenceManager.getInstance().getGoogleSearchSuggestionsEnabled();
|
||||
@ -140,7 +146,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
SuggestionHolder holder = null;
|
||||
SuggestionHolder holder;
|
||||
|
||||
if (row == null) {
|
||||
LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
|
||||
@ -222,7 +228,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
FilterResults results = new FilterResults();
|
||||
if (constraint == null || constraint.toString() == null) {
|
||||
if (constraint == null) {
|
||||
return results;
|
||||
}
|
||||
String query = constraint.toString().toLowerCase(Locale.getDefault());
|
||||
@ -231,7 +237,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
|
||||
}
|
||||
|
||||
int counter = 0;
|
||||
mBookmarks = new ArrayList<HistoryItem>();
|
||||
mBookmarks = new ArrayList<>();
|
||||
for (int n = 0; n < mAllBookmarks.size(); n++) {
|
||||
if (counter >= 5) {
|
||||
break;
|
||||
@ -283,7 +289,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
|
||||
protected List<HistoryItem> doInBackground(String... arg0) {
|
||||
mIsExecuting = true;
|
||||
|
||||
List<HistoryItem> filter = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> filter = new ArrayList<>();
|
||||
String query = arg0[0];
|
||||
try {
|
||||
query = query.replace(" ", "+");
|
||||
@ -391,7 +397,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
|
||||
}
|
||||
|
||||
public List<HistoryItem> getSuggestions() {
|
||||
List<HistoryItem> filteredList = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> filteredList = new ArrayList<>();
|
||||
|
||||
int suggestionsSize = (mSuggestions == null) ? 0 : mSuggestions.size();
|
||||
int historySize = (mHistory == null) ? 0 : mHistory.size();
|
@ -1,8 +1,11 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.preference;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Environment;
|
||||
|
||||
import acr.browser.lightning.activity.BrowserApp;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
|
||||
public class PreferenceManager {
|
||||
|
||||
private static class Name {
|
@ -127,7 +127,7 @@ public class ArticleTextExtractor {
|
||||
}
|
||||
|
||||
public JResult extractContent(JResult res, Document doc, OutputFormatter formatter)
|
||||
throws Exception {
|
||||
throws NullPointerException {
|
||||
if (doc == null)
|
||||
throw new NullPointerException("missing document");
|
||||
|
||||
@ -153,7 +153,7 @@ public class ArticleTextExtractor {
|
||||
}
|
||||
|
||||
if (bestMatchElement != null) {
|
||||
List<ImageResult> images = new ArrayList<ImageResult>();
|
||||
List<ImageResult> images = new ArrayList<>();
|
||||
Element imgEl = determineImageSource(bestMatchElement, images);
|
||||
if (imgEl != null) {
|
||||
res.setImageUrl(SHelper.replaceSpaces(imgEl.attr("src")));
|
||||
@ -321,7 +321,7 @@ public class ArticleTextExtractor {
|
||||
protected int weightChildNodes(Element rootEl) {
|
||||
int weight = 0;
|
||||
Element caption = null;
|
||||
List<Element> pEls = new ArrayList<Element>(5);
|
||||
List<Element> pEls = new ArrayList<>(5);
|
||||
for (Element child : rootEl.children()) {
|
||||
String ownText = child.ownText();
|
||||
int ownTextLength = ownText.length();
|
||||
@ -373,6 +373,7 @@ public class ArticleTextExtractor {
|
||||
try {
|
||||
old = Integer.parseInt(el.attr("gravityScore"));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return old;
|
||||
}
|
||||
@ -444,6 +445,7 @@ public class ArticleTextExtractor {
|
||||
else
|
||||
weight -= 20;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
int width = 0;
|
||||
@ -454,6 +456,7 @@ public class ArticleTextExtractor {
|
||||
else
|
||||
weight -= 20;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
String alt = e.attr("alt");
|
||||
if (alt.length() > 35)
|
||||
@ -463,7 +466,7 @@ public class ArticleTextExtractor {
|
||||
if (title.length() > 35)
|
||||
weight += 20;
|
||||
|
||||
String rel = null;
|
||||
String rel;
|
||||
boolean noFollow = false;
|
||||
if (e.parent() != null) {
|
||||
rel = e.parent().attr("rel");
|
||||
@ -561,7 +564,7 @@ public class ArticleTextExtractor {
|
||||
* @return a set of all important nodes
|
||||
*/
|
||||
public Collection<Element> getNodes(Document doc) {
|
||||
Set<Element> nodes = new HashSet<Element>(64);
|
||||
Set<Element> nodes = new HashSet<>(64);
|
||||
int score = 100;
|
||||
for (Element el : doc.select("body").select("*")) {
|
||||
if (NODES.matcher(el.tagName()).matches()) {
|
@ -15,13 +15,17 @@
|
||||
*/
|
||||
package acr.browser.lightning.reading;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.SocketTimeoutException;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Locale;
|
||||
|
||||
import acr.browser.lightning.Constants;
|
||||
import android.util.Log;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
|
||||
/**
|
||||
* This class is not thread safe. Use one new instance every time due to
|
||||
@ -156,8 +160,6 @@ public class Converter {
|
||||
}
|
||||
|
||||
return output.toString(encoding);
|
||||
} catch (SocketTimeoutException e) {
|
||||
Log.e(Constants.TAG, e.toString() + " url:" + url);
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, e.toString() + " url:" + url);
|
||||
} finally {
|
||||
@ -165,6 +167,7 @@ public class Converter {
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
import acr.browser.lightning.Constants;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
@ -51,8 +51,8 @@ public class HtmlFetcher {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
BufferedReader reader = new BufferedReader(new FileReader("urls.txt"));
|
||||
String line = null;
|
||||
Set<String> existing = new LinkedHashSet<String>();
|
||||
String line;
|
||||
Set<String> existing = new LinkedHashSet<>();
|
||||
while ((line = reader.readLine()) != null) {
|
||||
int index1 = line.indexOf("\"");
|
||||
int index2 = line.indexOf("\"", index1 + 1);
|
||||
@ -81,10 +81,10 @@ public class HtmlFetcher {
|
||||
private String accept = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
|
||||
private String charset = "UTF-8";
|
||||
private SCache cache;
|
||||
private AtomicInteger cacheCounter = new AtomicInteger(0);
|
||||
private final AtomicInteger cacheCounter = new AtomicInteger(0);
|
||||
private int maxTextLength = -1;
|
||||
private ArticleTextExtractor extractor = new ArticleTextExtractor();
|
||||
private Set<String> furtherResolveNecessary = new LinkedHashSet<String>() {
|
||||
private final Set<String> furtherResolveNecessary = new LinkedHashSet<String>() {
|
||||
{
|
||||
add("bit.ly");
|
||||
add("cli.gs");
|
||||
@ -298,13 +298,13 @@ public class HtmlFetcher {
|
||||
return SHelper.useDomainOfFirstArg4Second(url, urlOrPath);
|
||||
}
|
||||
|
||||
public String fetchAsString(String urlAsString, int timeout) throws MalformedURLException,
|
||||
public String fetchAsString(String urlAsString, int timeout) throws
|
||||
IOException {
|
||||
return fetchAsString(urlAsString, timeout, true);
|
||||
}
|
||||
|
||||
public String fetchAsString(String urlAsString, int timeout, boolean includeSomeGooseOptions)
|
||||
throws MalformedURLException, IOException {
|
||||
throws IOException {
|
||||
HttpURLConnection hConn = createUrlConnection(urlAsString, timeout, includeSomeGooseOptions);
|
||||
hConn.setInstanceFollowRedirects(true);
|
||||
String encoding = hConn.getContentEncoding();
|
||||
@ -401,7 +401,7 @@ public class HtmlFetcher {
|
||||
}
|
||||
|
||||
protected HttpURLConnection createUrlConnection(String urlAsStr, int timeout,
|
||||
boolean includeSomeGooseOptions) throws MalformedURLException, IOException {
|
||||
boolean includeSomeGooseOptions) throws IOException {
|
||||
URL url = new URL(urlAsStr);
|
||||
// using proxy may increase latency
|
||||
HttpURLConnection hConn = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY);
|
@ -9,13 +9,13 @@ import org.jsoup.nodes.Element;
|
||||
*/
|
||||
public class ImageResult {
|
||||
|
||||
public String src;
|
||||
public Integer weight;
|
||||
public String title;
|
||||
public int height;
|
||||
public int width;
|
||||
public String alt;
|
||||
public boolean noFollow;
|
||||
public final String src;
|
||||
public final Integer weight;
|
||||
public final String title;
|
||||
public final int height;
|
||||
public final int width;
|
||||
public final String alt;
|
||||
public final boolean noFollow;
|
||||
public Element element;
|
||||
|
||||
public ImageResult(String src, Integer weight, String title, int height, int width, String alt,
|
@ -133,7 +133,7 @@ public class JResult implements Serializable {
|
||||
|
||||
public List<String> getTextList() {
|
||||
if (this.textList == null)
|
||||
return new ArrayList<String>();
|
||||
return new ArrayList<>();
|
||||
return this.textList;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class OutputFormatter {
|
||||
* Takes an element and returns a list of texts extracted from the P tags
|
||||
*/
|
||||
public List<String> getTextList(Element topNode) {
|
||||
List<String> texts = new ArrayList<String>();
|
||||
List<String> texts = new ArrayList<>();
|
||||
for (Element element : topNode.select(this.nodesToKeepCssSelector)) {
|
||||
if (element.hasText()) {
|
||||
texts.add(element.text());
|
@ -279,11 +279,10 @@ public class SHelper {
|
||||
if (url.startsWith("http://www.google.com/url?")) {
|
||||
url = url.substring("http://www.google.com/url?".length());
|
||||
String arr[] = urlDecode(url).split("\\&");
|
||||
if (arr != null)
|
||||
for (String str : arr) {
|
||||
if (str.startsWith("q="))
|
||||
return str.substring("q=".length());
|
||||
}
|
||||
for (String str : arr) {
|
||||
if (str.startsWith("q="))
|
||||
return str.substring("q=".length());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -382,6 +381,7 @@ public class SHelper {
|
||||
try {
|
||||
day = Integer.parseInt(str);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
if (day < 1 || day > 31) {
|
||||
day = -1;
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
@ -13,11 +13,14 @@ import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public class AdBlock {
|
||||
|
||||
private static final String TAG = "AdBlock";
|
||||
private static final String BLOCKED_DOMAINS_LIST_FILE_NAME = "hosts.txt";
|
||||
private static final Set<String> mBlockedDomainsList = new HashSet<String>();
|
||||
private static final Set<String> mBlockedDomainsList = new HashSet<>();
|
||||
private boolean mBlockAds;
|
||||
private static final Locale mLocale = Locale.getDefault();
|
||||
private static AdBlock mInstance;
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
@ -15,9 +15,11 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import acr.browser.lightning.controller.BrowserController;
|
||||
|
||||
public class IntentUtils {
|
||||
|
||||
private Activity mActivity;
|
||||
private final Activity mActivity;
|
||||
|
||||
static final Pattern ACCEPTED_URI_SCHEMA = Pattern.compile("(?i)"
|
||||
+ // switch on case insensitive matching
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@ -28,6 +28,11 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.database.HistoryItem;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.download.DownloadHandler;
|
||||
|
||||
public final class Utils {
|
||||
|
||||
private Utils() {
|
||||
@ -110,7 +115,7 @@ public final class Utils {
|
||||
}
|
||||
|
||||
public static List<HistoryItem> getOldBookmarks(Context context) {
|
||||
List<HistoryItem> bookmarks = new ArrayList<HistoryItem>();
|
||||
List<HistoryItem> bookmarks = new ArrayList<>();
|
||||
File bookUrl = new File(context.getFilesDir(), "bookurl");
|
||||
File book = new File(context.getFilesDir(), "bookmarks");
|
||||
try {
|
||||
@ -123,8 +128,8 @@ public final class Utils {
|
||||
}
|
||||
readBook.close();
|
||||
readUrl.close();
|
||||
} catch (FileNotFoundException ignored) {
|
||||
} catch (IOException ignored) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return bookmarks;
|
||||
}
|
||||
@ -187,11 +192,10 @@ public final class Utils {
|
||||
String imageFileName = "JPEG_" + timeStamp + "_";
|
||||
File storageDir = Environment
|
||||
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
||||
File imageFile = File.createTempFile(imageFileName, /* prefix */
|
||||
return File.createTempFile(imageFileName, /* prefix */
|
||||
".jpg", /* suffix */
|
||||
storageDir /* directory */
|
||||
);
|
||||
return imageFile;
|
||||
}
|
||||
|
||||
public static Bitmap getWebpageBitmap(Resources resources, boolean dark) {
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.lightning;
|
||||
package acr.browser.lightning.view;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
@ -15,6 +15,8 @@ import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Transformation;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
/**
|
||||
* Copyright 11/4/2014 Anthony Restaino
|
||||
* <p/>
|
@ -2,15 +2,7 @@
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
|
||||
package acr.browser.lightning;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
package acr.browser.lightning.view;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@ -28,6 +20,7 @@ import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Build;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.InputType;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.Log;
|
||||
@ -52,19 +45,36 @@ import android.webkit.WebViewClient;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.constant.StartPage;
|
||||
import acr.browser.lightning.controller.BrowserController;
|
||||
import acr.browser.lightning.download.LightningDownloadListener;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.AdBlock;
|
||||
import acr.browser.lightning.utils.IntentUtils;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class LightningView {
|
||||
|
||||
private Title mTitle;
|
||||
private final Title mTitle;
|
||||
private WebView mWebView;
|
||||
private BrowserController mBrowserController;
|
||||
private GestureDetector mGestureDetector;
|
||||
private Activity mActivity;
|
||||
private final Activity mActivity;
|
||||
private WebSettings mSettings;
|
||||
private static String mHomepage;
|
||||
private static String mDefaultUserAgent;
|
||||
private static Bitmap mWebpageBitmap;
|
||||
private static PreferenceManager mPreferences;
|
||||
private AdBlock mAdBlock;
|
||||
private final AdBlock mAdBlock;
|
||||
private IntentUtils mIntentUtils;
|
||||
private final Paint mPaint = new Paint();
|
||||
private boolean isForegroundTab;
|
||||
@ -142,7 +152,7 @@ public class LightningView {
|
||||
|
||||
public String getHomepage() {
|
||||
StringBuilder homepageBuilder = new StringBuilder();
|
||||
homepageBuilder.append(HomepageVariables.HEAD);
|
||||
homepageBuilder.append(StartPage.HEAD);
|
||||
String icon;
|
||||
String searchUrl;
|
||||
switch (mPreferences.getSearchChoice()) {
|
||||
@ -185,6 +195,7 @@ public class LightningView {
|
||||
icon = "file:///android_asset/startpage.png";
|
||||
// "https://startpage.com/graphics/startp_logo.gif";
|
||||
searchUrl = Constants.STARTPAGE_MOBILE_SEARCH;
|
||||
break;
|
||||
case 7:
|
||||
// DUCK_SEARCH;
|
||||
icon = "file:///android_asset/duckduckgo.png";
|
||||
@ -218,9 +229,9 @@ public class LightningView {
|
||||
}
|
||||
|
||||
homepageBuilder.append(icon);
|
||||
homepageBuilder.append(HomepageVariables.MIDDLE);
|
||||
homepageBuilder.append(StartPage.MIDDLE);
|
||||
homepageBuilder.append(searchUrl);
|
||||
homepageBuilder.append(HomepageVariables.END);
|
||||
homepageBuilder.append(StartPage.END);
|
||||
|
||||
File homepage = new File(mActivity.getFilesDir(), "homepage.html");
|
||||
try {
|
||||
@ -529,8 +540,6 @@ public class LightningView {
|
||||
icon.compress(Bitmap.CompressFormat.PNG, 100, fos);
|
||||
fos.flush();
|
||||
fos.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -627,7 +636,7 @@ public class LightningView {
|
||||
|
||||
public class LightningWebClient extends WebViewClient {
|
||||
|
||||
Context mActivity;
|
||||
final Context mActivity;
|
||||
|
||||
LightningWebClient(Context context) {
|
||||
mActivity = context;
|
||||
@ -680,7 +689,7 @@ public class LightningView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedHttpAuthRequest(final WebView view, final HttpAuthHandler handler,
|
||||
public void onReceivedHttpAuthRequest(final WebView view, @NonNull final HttpAuthHandler handler,
|
||||
final String host, final String realm) {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
@ -750,7 +759,7 @@ public class LightningView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
|
||||
public void onReceivedSslError(WebView view, @NonNull final SslErrorHandler handler, SslError error) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mActivity.getString(R.string.title_warning));
|
||||
builder.setMessage(mActivity.getString(R.string.message_untrusted_certificate))
|
||||
@ -779,7 +788,7 @@ public class LightningView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFormResubmission(WebView view, final Message dontResend, final Message resend) {
|
||||
public void onFormResubmission(WebView view, @NonNull final Message dontResend, final Message resend) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mActivity.getString(R.string.title_form_resubmission));
|
||||
builder.setMessage(mActivity.getString(R.string.message_form_resubmission))
|
||||
@ -820,7 +829,7 @@ public class LightningView {
|
||||
view.reload();
|
||||
return true;
|
||||
} else if (url.startsWith("intent://")) {
|
||||
Intent intent = null;
|
||||
Intent intent;
|
||||
try {
|
||||
intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
|
||||
} catch (URISyntaxException ex) {
|
||||
@ -841,7 +850,7 @@ public class LightningView {
|
||||
|
||||
public class LightningChromeClient extends WebChromeClient {
|
||||
|
||||
Context mActivity;
|
||||
final Context mActivity;
|
||||
|
||||
LightningChromeClient(Context context) {
|
||||
mActivity = context;
|
||||
@ -878,7 +887,7 @@ public class LightningView {
|
||||
final boolean remember = true;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mActivity.getString(R.string.location));
|
||||
String org = null;
|
||||
String org;
|
||||
if (origin.length() > 50) {
|
||||
org = origin.subSequence(0, 50) + "...";
|
||||
} else {
|
||||
@ -1002,7 +1011,7 @@ public class LightningView {
|
||||
|
||||
private Bitmap mFavicon;
|
||||
private String mTitle;
|
||||
private Bitmap mDefaultIcon;
|
||||
private final Bitmap mDefaultIcon;
|
||||
|
||||
public Title(Context context, boolean darkTheme) {
|
||||
mDefaultIcon = Utils.getWebpageBitmap(context.getResources(), darkTheme);
|
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 509 B |
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 353 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 546 B |
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 753 B After Width: | Height: | Size: 753 B |
Before Width: | Height: | Size: 820 B After Width: | Height: | Size: 820 B |
Before Width: | Height: | Size: 652 B After Width: | Height: | Size: 652 B |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 617 B |