First mac commit

This commit is contained in:
Vlad Mihalachi
2014-12-11 18:28:54 +01:00
parent b359950e34
commit 7a86540c60
147 changed files with 14630 additions and 14798 deletions

122
.gitignore vendored
View File

@ -1,62 +1,62 @@
# Built application files # Built application files
*.apk *.apk
*.ap_ *.ap_
# Files for the Dalvik VM # Files for the Dalvik VM
*.dex *.dex
# Java class files # Java class files
*.class *.class
# Generated files # Generated files
bin/ bin/
gen/ gen/
doc/ doc/
# Proguard folder generated by Eclipse # Proguard folder generated by Eclipse
proguard/ proguard/
# Log Files # Log Files
*.log *.log
# Built application files # Built application files
/*/build/ /*/build/
# Crashlytics configuations # Crashlytics configuations
com_crashlytics_export_strings.xml com_crashlytics_export_strings.xml
crashlytics-build.properties crashlytics-build.properties
crashlytics.properties crashlytics.properties
# Local configuration file (sdk path, etc) # Local configuration file (sdk path, etc)
local.properties local.properties
# Gradle generated files # Gradle generated files
.gradle/ .gradle/
# Signing files # Signing files
.signing/ .signing/
# User-specific configurations # User-specific configurations
.idea/libraries/ .idea/libraries/
.idea/workspace.xml .idea/workspace.xml
.idea/tasks.xml .idea/tasks.xml
.idea/.name .idea/.name
.idea/compiler.xml .idea/compiler.xml
.idea/copyright/profiles_settings.xml .idea/copyright/profiles_settings.xml
.idea/encodings.xml .idea/encodings.xml
.idea/misc.xml .idea/misc.xml
.idea/modules.xml .idea/modules.xml
.idea/scopes/scope_settings.xml .idea/scopes/scope_settings.xml
.idea/vcs.xml .idea/vcs.xml
*.iml *.iml
# OS-specific files # OS-specific files
.DS_Store .DS_Store
.DS_Store? .DS_Store?
._* ._*
.Spotlight-V100 .Spotlight-V100
.Trashes .Trashes
ehthumbs.db ehthumbs.db
Thumbs.db Thumbs.db
*~ *~
#*# #*#

View File

@ -1,174 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectCodeStyleSettingsManager"> <component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS"> <option name="PER_PROJECT_SETTINGS">
<value> <value>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" /> <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" /> <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND"> <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value /> <value />
</option> </option>
<option name="IMPORT_LAYOUT_TABLE"> <option name="IMPORT_LAYOUT_TABLE">
<value> <value>
<package name="android" withSubpackages="true" static="false" /> <package name="android" withSubpackages="true" static="false" />
<emptyLine /> <emptyLine />
<package name="com" withSubpackages="true" static="false" /> <package name="com" withSubpackages="true" static="false" />
<emptyLine /> <emptyLine />
<package name="junit" withSubpackages="true" static="false" /> <package name="junit" withSubpackages="true" static="false" />
<emptyLine /> <emptyLine />
<package name="net" withSubpackages="true" static="false" /> <package name="net" withSubpackages="true" static="false" />
<emptyLine /> <emptyLine />
<package name="org" withSubpackages="true" static="false" /> <package name="org" withSubpackages="true" static="false" />
<emptyLine /> <emptyLine />
<package name="java" withSubpackages="true" static="false" /> <package name="java" withSubpackages="true" static="false" />
<emptyLine /> <emptyLine />
<package name="javax" withSubpackages="true" static="false" /> <package name="javax" withSubpackages="true" static="false" />
<emptyLine /> <emptyLine />
<package name="" withSubpackages="true" static="false" /> <package name="" withSubpackages="true" static="false" />
<emptyLine /> <emptyLine />
<package name="" withSubpackages="true" static="true" /> <package name="" withSubpackages="true" static="true" />
<emptyLine /> <emptyLine />
</value> </value>
</option> </option>
<option name="RIGHT_MARGIN" value="100" /> <option name="RIGHT_MARGIN" value="100" />
<AndroidXmlCodeStyleSettings> <AndroidXmlCodeStyleSettings>
<option name="USE_CUSTOM_SETTINGS" value="true" /> <option name="USE_CUSTOM_SETTINGS" value="true" />
</AndroidXmlCodeStyleSettings> </AndroidXmlCodeStyleSettings>
<XML> <XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML> </XML>
<codeStyleSettings language="XML"> <codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" /> <option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions> <indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" /> <option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions> </indentOptions>
<arrangement> <arrangement>
<rules> <rules>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>xmlns:android</NAME> <NAME>xmlns:android</NAME>
<XML_NAMESPACE>Namespace:</XML_NAMESPACE> <XML_NAMESPACE>Namespace:</XML_NAMESPACE>
</AND> </AND>
</match> </match>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>xmlns:.*</NAME> <NAME>xmlns:.*</NAME>
<XML_NAMESPACE>Namespace:</XML_NAMESPACE> <XML_NAMESPACE>Namespace:</XML_NAMESPACE>
</AND> </AND>
</match> </match>
<order>BY_NAME</order> <order>BY_NAME</order>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*:id</NAME> <NAME>.*:id</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND> </AND>
</match> </match>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*:name</NAME> <NAME>.*:name</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND> </AND>
</match> </match>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>name</NAME> <NAME>name</NAME>
<XML_NAMESPACE>^$</XML_NAMESPACE> <XML_NAMESPACE>^$</XML_NAMESPACE>
</AND> </AND>
</match> </match>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>style</NAME> <NAME>style</NAME>
<XML_NAMESPACE>^$</XML_NAMESPACE> <XML_NAMESPACE>^$</XML_NAMESPACE>
</AND> </AND>
</match> </match>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*</NAME> <NAME>.*</NAME>
<XML_NAMESPACE>^$</XML_NAMESPACE> <XML_NAMESPACE>^$</XML_NAMESPACE>
</AND> </AND>
</match> </match>
<order>BY_NAME</order> <order>BY_NAME</order>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*:layout_width</NAME> <NAME>.*:layout_width</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND> </AND>
</match> </match>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*:layout_height</NAME> <NAME>.*:layout_height</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND> </AND>
</match> </match>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*:layout_.*</NAME> <NAME>.*:layout_.*</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND> </AND>
</match> </match>
<order>BY_NAME</order> <order>BY_NAME</order>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*:width</NAME> <NAME>.*:width</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND> </AND>
</match> </match>
<order>BY_NAME</order> <order>BY_NAME</order>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*:height</NAME> <NAME>.*:height</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND> </AND>
</match> </match>
<order>BY_NAME</order> <order>BY_NAME</order>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*</NAME> <NAME>.*</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND> </AND>
</match> </match>
<order>BY_NAME</order> <order>BY_NAME</order>
</rule> </rule>
<rule> <rule>
<match> <match>
<AND> <AND>
<NAME>.*</NAME> <NAME>.*</NAME>
<XML_NAMESPACE>.*</XML_NAMESPACE> <XML_NAMESPACE>.*</XML_NAMESPACE>
</AND> </AND>
</match> </match>
<order>BY_NAME</order> <order>BY_NAME</order>
</rule> </rule>
</rules> </rules>
</arrangement> </arrangement>
</codeStyleSettings> </codeStyleSettings>
</value> </value>
</option> </option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" /> <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
</component> </component>
</project> </project>

View File

@ -1,9 +1,9 @@
<component name="CopyrightManager"> <component name="CopyrightManager">
<copyright> <copyright>
<option name="notice" value="Copyright (C) 2014 Vlad Mihalachi&#10;&#10;This file is part of Turbo Editor.&#10;&#10;Turbo Editor is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU General Public License as published by&#10;the Free Software Foundation, either version 3 of the License, or&#10;(at your option) any later version.&#10;&#10;Turbo Editor is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU General Public License for more details.&#10;&#10;You should have received a copy of the GNU General Public License&#10;along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;." /> <option name="notice" value="Copyright (C) 2014 Vlad Mihalachi&#10;&#10;This file is part of Turbo Editor.&#10;&#10;Turbo Editor is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU General Public License as published by&#10;the Free Software Foundation, either version 3 of the License, or&#10;(at your option) any later version.&#10;&#10;Turbo Editor is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU General Public License for more details.&#10;&#10;You should have received a copy of the GNU General Public License&#10;along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;." />
<option name="keyword" value="Copyright" /> <option name="keyword" value="Copyright" />
<option name="allowReplaceKeyword" value="Copyright" /> <option name="allowReplaceKeyword" value="Copyright" />
<option name="myName" value="Copyright Vlad Mihalachi" /> <option name="myName" value="Copyright Vlad Mihalachi" />
<option name="myLocal" value="true" /> <option name="myLocal" value="true" />
</copyright> </copyright>
</component> </component>

46
.idea/gradle.xml generated
View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" /> <option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/app-pro" /> <option value="$PROJECT_DIR$/app-pro" />
<option value="$PROJECT_DIR$/libraries" /> <option value="$PROJECT_DIR$/libraries" />
<option value="$PROJECT_DIR$/libraries/FloatingActionButton" /> <option value="$PROJECT_DIR$/libraries/FloatingActionButton" />
<option value="$PROJECT_DIR$/libraries/RootCommands" /> <option value="$PROJECT_DIR$/libraries/RootCommands" />
<option value="$PROJECT_DIR$/libraries/sharedCode" /> <option value="$PROJECT_DIR$/libraries/sharedCode" />
</set> </set>
</option> </option>
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>
</component> </component>
</project> </project>

View File

@ -1,14 +1,14 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false"> <profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<option name="myLocal" value="false" /> <option name="myLocal" value="false" />
<inspection_tool class="AndroidLintMissingQuantity" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="AndroidLintMissingQuantity" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintMissingTranslation" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="AndroidLintMissingTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintNewApi" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="AndroidLintNewApi" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintUnusedQuantity" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="AndroidLintUnusedQuantity" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false"> <inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" /> <option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" /> <option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool> </inspection_tool>
</profile> </profile>
</component> </component>

View File

@ -1,7 +1,7 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<settings> <settings>
<option name="PROJECT_PROFILE" value="Project Default" /> <option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" /> <option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" /> <version value="1.0" />
</settings> </settings>
</component> </component>

1354
LICENSE

File diff suppressed because it is too large Load Diff

120
README.md
View File

@ -1,60 +1,60 @@
# Turbo Editor # Turbo Editor
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/turbo-client/localized.png)](https://crowdin.com/project/turbo-client) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/turbo-client/localized.png)](https://crowdin.com/project/turbo-client)
Simple, powerful and Open Source text editor for Android licensed under the GPLv3 license. Simple, powerful and Open Source text editor for Android licensed under the GPLv3 license.
### Download ### Download
[![Play Store](http://developer.android.com/images/brand/en_generic_rgb_wo_60.png)](http://play.google.com/store/apps/details?id=com.maskyn.fileeditorpro) [![Play Store](http://developer.android.com/images/brand/en_generic_rgb_wo_60.png)](http://play.google.com/store/apps/details?id=com.maskyn.fileeditorpro)
[![F-Droid](https://lh5.googleusercontent.com/-zezQqsBye0c/VCUpPVjcKEI/AAAAAAAAAIQ/HbcG5f1qMIw/w129-h45-no/getitonfdroid.png)](https://f-droid.org/repository/browse/?fdid=com.maskyn.fileeditorpro) [![F-Droid](https://lh5.googleusercontent.com/-zezQqsBye0c/VCUpPVjcKEI/AAAAAAAAAIQ/HbcG5f1qMIw/w129-h45-no/getitonfdroid.png)](https://f-droid.org/repository/browse/?fdid=com.maskyn.fileeditorpro)
### Contribute ### Contribute
You can contribute to this project in many ways: You can contribute to this project in many ways:
* Browse our issues, comment on proposals, report bugs. * Browse our issues, comment on proposals, report bugs.
* Help to translate the application on [Crowdin][crowdin] * Help to translate the application on [Crowdin][crowdin]
* Be a part of the Google Plus [Community][community googleplus] * Be a part of the Google Plus [Community][community googleplus]
* Discuss with us on [XDA thread][xda thread] * Discuss with us on [XDA thread][xda thread]
* Help to maintain this project active and [Donate][donate] * Help to maintain this project active and [Donate][donate]
------ ------
###Donate ###Donate
[![Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=26VWS2TSAMUJA) [![Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=26VWS2TSAMUJA)
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=vmihalachi&url=https://github.com/vmihalachi/turbo-editor&title=Turbo Editor&language=java&tags=github&category=software) [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=vmihalachi&url=https://github.com/vmihalachi/turbo-editor&title=Turbo Editor&language=java&tags=github&category=software)
------ ------
###Images ###Images
![](https://lh3.googleusercontent.com/-0GHukwGQPW4/VCUpEhKnZCI/AAAAAAAAAH4/cclI70K79_Q/w347-h520-no/PhoneCustom_7.png)![](https://lh3.googleusercontent.com/-OvazluFl_QQ/VCUo9DAje9I/AAAAAAAAAHQ/i7n1uCpU1hE/w347-h520-no/PhoneCustom_1.png)![](https://lh4.googleusercontent.com/-zh4CYdQPecg/VCUpD3QXpAI/AAAAAAAAAHw/ulL5-V0iJUw/w347-h520-no/PhoneCustom_6.png)![](https://lh4.googleusercontent.com/-LT3k4z9JHo8/VCUo_0jnZRI/AAAAAAAAAHg/Npk9UlkXIV8/w347-h520-no/PhoneCustom_4.png)![](https://lh5.googleusercontent.com/-hXvsf-WYvBs/VCUo9sYfR-I/AAAAAAAAAHY/TTfAgiV_7ko/w347-h520-no/PhoneCustom_3.png)![](https://lh6.googleusercontent.com/-Qib82pK6mZU/VCUpAgYmUdI/AAAAAAAAAHo/zoPVmwcatbQ/w347-h520-no/PhoneCustom_5.png)![](https://lh5.googleusercontent.com/-SERL7X-JHuc/VCax0QSlCGI/AAAAAAAAAJA/hu8dvbvJGBM/w375-h563-no/PhoneCustom_2.png) ![](https://lh3.googleusercontent.com/-0GHukwGQPW4/VCUpEhKnZCI/AAAAAAAAAH4/cclI70K79_Q/w347-h520-no/PhoneCustom_7.png)![](https://lh3.googleusercontent.com/-OvazluFl_QQ/VCUo9DAje9I/AAAAAAAAAHQ/i7n1uCpU1hE/w347-h520-no/PhoneCustom_1.png)![](https://lh4.googleusercontent.com/-zh4CYdQPecg/VCUpD3QXpAI/AAAAAAAAAHw/ulL5-V0iJUw/w347-h520-no/PhoneCustom_6.png)![](https://lh4.googleusercontent.com/-LT3k4z9JHo8/VCUo_0jnZRI/AAAAAAAAAHg/Npk9UlkXIV8/w347-h520-no/PhoneCustom_4.png)![](https://lh5.googleusercontent.com/-hXvsf-WYvBs/VCUo9sYfR-I/AAAAAAAAAHY/TTfAgiV_7ko/w347-h520-no/PhoneCustom_3.png)![](https://lh6.googleusercontent.com/-Qib82pK6mZU/VCUpAgYmUdI/AAAAAAAAAHo/zoPVmwcatbQ/w347-h520-no/PhoneCustom_5.png)![](https://lh5.googleusercontent.com/-SERL7X-JHuc/VCax0QSlCGI/AAAAAAAAAJA/hu8dvbvJGBM/w375-h563-no/PhoneCustom_2.png)
------ ------
### Developer ### Developer
[Vlad Mihalachi][developer site] [Vlad Mihalachi][developer site]
------ ------
### A special thanks to.. ### A special thanks to..
* [Dumitru Grubii][contributor dumitru grubii] for the icon * [Dumitru Grubii][contributor dumitru grubii] for the icon
* All the translators * All the translators
* You? * You?
------ ------
### License ### License
Turbo Client is made available under the terms of the [GPLv3][gplv3]. Turbo Client is made available under the terms of the [GPLv3][gplv3].
See the [LICENSE][license] file that accompanies this distribution for the full text of the license. See the [LICENSE][license] file that accompanies this distribution for the full text of the license.
[gplv3]: http://www.gnu.org/licenses/gpl.html [gplv3]: http://www.gnu.org/licenses/gpl.html
[license]: https://github.com/vmihalachi/turbo-editor/LICENSE [license]: https://github.com/vmihalachi/turbo-editor/LICENSE
[donate]: https://github.com/vmihalachi/turbo-editor#donate [donate]: https://github.com/vmihalachi/turbo-editor#donate
[donate paypal]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PUQXSX6MTXHZ2 [donate paypal]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PUQXSX6MTXHZ2
[xda thread]: http://forum.xda-developers.com/android/apps-games/app-turbo-editor-text-editor-t2832016 [xda thread]: http://forum.xda-developers.com/android/apps-games/app-turbo-editor-text-editor-t2832016
[community googleplus]: https://plus.google.com/u/0/communities/111974095419108178946 [community googleplus]: https://plus.google.com/u/0/communities/111974095419108178946
[crowdin]: https://crowdin.net/project/turbo-client [crowdin]: https://crowdin.net/project/turbo-client
[developer site]: http://vmihalachi.com/ [developer site]: http://vmihalachi.com/
[crowdin]: https://crowdin.net/project/turbo-client [crowdin]: https://crowdin.net/project/turbo-client
[contributor dumitru grubii]: https://twitter.com/DumitruGrubii [contributor dumitru grubii]: https://twitter.com/DumitruGrubii
[project issues]: https://github.com/vmihalachi/turbo-editor/issues [project issues]: https://github.com/vmihalachi/turbo-editor/issues
[project wiki]: https://github.com/vmihalachi/turbo-editor/wiki [project wiki]: https://github.com/vmihalachi/turbo-editor/wiki

2
app-pro/.gitignore vendored
View File

@ -1 +1 @@
/build /build

View File

@ -1,56 +1,55 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion '21.0.2' buildToolsVersion '21.0.2'
defaultConfig { defaultConfig {
applicationId "com.maskyn.fileeditorpro" applicationId "com.maskyn.fileeditorpro"
minSdkVersion 11 minSdkVersion 11
targetSdkVersion 21 targetSdkVersion 21
versionCode 35 versionCode 35
versionName "1.13.2" versionName "1.13.2"
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
buildTypes { buildTypes {
release { release {
runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }
} }
} lintOptions {
lintOptions { abortOnError false
abortOnError false }
} packagingOptions {
packagingOptions { exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE.txt' }
} }
}
dependencies {
dependencies { compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':libraries:sharedCode')
compile project(':libraries:sharedCode') }
}

View File

@ -1,17 +1,17 @@
# Add project specific ProGuard rules here. # Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified # By default, the flags in this file are appended to flags specified
# in C:/Users/Vlad/AppData/Local/Android/android-sdk/tools/proguard/proguard-android.txt # in C:/Users/Vlad/AppData/Local/Android/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles # You can edit the include path and order by changing the proguardFiles
# directive in build.gradle. # directive in build.gradle.
# #
# For more details, see # For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html # http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here: # Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following # If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface # and specify the fully qualified class name to the JavaScript interface
# class: # class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *; # public *;
#} #}

View File

@ -1,32 +1,32 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.maskyn.fileeditorpro; package com.maskyn.fileeditorpro;
import android.app.Application; import android.app.Application;
import android.test.ApplicationTestCase; import android.test.ApplicationTestCase;
/** /**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/ */
public class ApplicationTest extends ApplicationTestCase<Application> { public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() { public ApplicationTest() {
super(Application.class); super(Application.class);
} }
} }

View File

@ -1,120 +1,120 @@
<!-- <!--
~ Copyright (C) 2014 Vlad Mihalachi ~ Copyright (C) 2014 Vlad Mihalachi
~ ~
~ This file is part of Turbo Editor. ~ This file is part of Turbo Editor.
~ ~
~ Turbo Editor is free software: you can redistribute it and/or modify ~ Turbo Editor is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by ~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or ~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version. ~ (at your option) any later version.
~ ~
~ Turbo Editor is distributed in the hope that it will be useful, ~ Turbo Editor is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details. ~ GNU General Public License for more details.
~ ~
~ You should have received a copy of the GNU General Public License ~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maskyn.fileeditorpro" package="com.maskyn.fileeditorpro"
android:installLocation="auto"> android:installLocation="auto">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" /> <uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
<supports-screens <supports-screens
android:anyDensity="true" android:anyDensity="true"
android:largeScreens="true" android:largeScreens="true"
android:normalScreens="true" android:normalScreens="true"
android:resizeable="true" android:resizeable="true"
android:smallScreens="true" android:smallScreens="true"
android:xlargeScreens="true" /> android:xlargeScreens="true" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/nome_app_turbo_editor" android:label="@string/nome_app_turbo_editor"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:largeHeap="true" android:largeHeap="true"
android:supportsRtl="true" android:supportsRtl="true"
android:name="sharedcode.turboeditor.application.MyApp" android:name="sharedcode.turboeditor.application.MyApp"
> >
<!-- android:alwaysRetainTaskState="true" --> <!-- android:alwaysRetainTaskState="true" -->
<activity <activity
android:name=".HomeActivity" android:name=".HomeActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:launchMode="singleTop" android:launchMode="singleTop"
android:windowSoftInputMode="stateUnspecified|adjustResize" android:windowSoftInputMode="stateUnspecified|adjustResize"
android:theme="@style/AppThemeEditorDark"> android:theme="@style/AppThemeEditorDark">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" /> <category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" /> <action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" /> <data android:scheme="file" />
<data android:mimeType="text/*" /> <data android:mimeType="text/*" />
<data android:pathPattern="*.txt" /> <data android:pathPattern="*.txt" />
<data android:pathPattern="*.html" /> <data android:pathPattern="*.html" />
<data android:pathPattern="*.css" /> <data android:pathPattern="*.css" />
<data android:pathPattern="*.js" /> <data android:pathPattern="*.js" />
<data android:pathPattern="*.md"/> <data android:pathPattern="*.md"/>
<data android:pathPattern="*.php" /> <data android:pathPattern="*.php" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" /> <data android:mimeType="text/plain" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="sharedcode.turboeditor.activity.SelectFileActivity" android:name="sharedcode.turboeditor.activity.SelectFileActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/open_a_file" android:label="@string/open_a_file"
android:parentActivityName=".HomeActivity" android:parentActivityName=".HomeActivity"
android:theme="@style/AppThemeBaseLight"> android:theme="@style/AppThemeBaseLight">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".HomeActivity" /> android:value=".HomeActivity" />
</activity> </activity>
<activity <activity
android:name="sharedcode.turboeditor.preferences.ExtraSettingsActivity" android:name="sharedcode.turboeditor.preferences.ExtraSettingsActivity"
android:label="@string/extra_options" android:label="@string/extra_options"
android:parentActivityName=".HomeActivity"> android:parentActivityName=".HomeActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".HomeActivity" /> android:value=".HomeActivity" />
</activity> </activity>
<meta-data <meta-data
android:name="com.sec.android.support.multiwindow" android:name="com.sec.android.support.multiwindow"
android:value="true" /> android:value="true" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W"
android:value="632.0dip" /> android:value="632.0dip" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H"
android:value="598.0dip" /> android:value="598.0dip" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W"
android:value="632.0dip" /> android:value="632.0dip" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H"
android:value="598.0dip" /> android:value="598.0dip" />
</application> </application>
</manifest> </manifest>

View File

@ -1,30 +1,31 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.maskyn.fileeditorpro; package com.maskyn.fileeditorpro;
import sharedcode.turboeditor.activity.MainActivity; import sharedcode.turboeditor.activity.MainActivity;
public class HomeActivity extends MainActivity { public class HomeActivity extends MainActivity {
@Override @Override
public void displayInterstitial() { public boolean showInterstitial() {
// nothing to do here // nothing to do here
} return false;
} }
}

2
app/.gitignore vendored
View File

@ -1 +1 @@
/build /build

View File

@ -1,78 +1,77 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
buildscript { buildscript {
repositories { repositories {
mavenCentral() mavenCentral()
maven { url 'https://maven.fabric.io/repo' } maven { url 'https://maven.fabric.io/repo' }
} }
dependencies { dependencies {
classpath 'io.fabric.tools:gradle:1.+' classpath 'io.fabric.tools:gradle:1.+'
} }
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'io.fabric' apply plugin: 'io.fabric'
repositories { repositories {
mavenCentral() mavenCentral()
maven { url 'https://maven.fabric.io/repo' } maven { url 'https://maven.fabric.io/repo' }
} }
android { android {
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion '21.0.2' buildToolsVersion '21.0.2'
defaultConfig { defaultConfig {
applicationId "com.maskyn.fileeditor" applicationId "com.maskyn.fileeditor"
minSdkVersion 11 minSdkVersion 11
targetSdkVersion 21 targetSdkVersion 21
versionCode 35 versionCode 35
versionName "1.13.2" versionName "1.13.2"
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
buildTypes { buildTypes {
release { release {
runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }
} }
} lintOptions {
lintOptions { abortOnError false
abortOnError false }
} packagingOptions {
packagingOptions { exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE.txt' }
} }
}
dependencies {
dependencies { compile fileTree(dir: 'libs', include: '*.jar')
compile fileTree(dir: 'libs', include: '*.jar') compile project(':libraries:sharedCode')
compile project(':libraries:sharedCode') compile 'com.google.android.gms:play-services:6.1.11'
compile 'com.google.android.gms:play-services:6.1.11' compile('com.crashlytics.sdk.android:crashlytics:2.+@aar') {
compile('com.crashlytics.sdk.android:crashlytics:2.+@aar') { transitive = true;
transitive = true; }
} }
}

View File

@ -1,17 +1,17 @@
# Add project specific ProGuard rules here. # Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified # By default, the flags in this file are appended to flags specified
# in C:\Users\Vlad\AppData\Local\Android\android-sdk/tools/proguard/proguard-android.txt # in C:\Users\Vlad\AppData\Local\Android\android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles # You can edit the include path and order by changing the proguardFiles
# directive in build.gradle. # directive in build.gradle.
# #
# For more details, see # For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html # http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here: # Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following # If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface # and specify the fully qualified class name to the JavaScript interface
# class: # class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *; # public *;
#} #}

View File

@ -1,32 +1,32 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.maskyn.fileeditor; package com.maskyn.fileeditor;
import android.app.Application; import android.app.Application;
import android.test.ApplicationTestCase; import android.test.ApplicationTestCase;
/** /**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/ */
public class ApplicationTest extends ApplicationTestCase<Application> { public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() { public ApplicationTest() {
super(Application.class); super(Application.class);
} }
} }

View File

@ -1,129 +1,129 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
~ Copyright (C) 2014 Vlad Mihalachi ~ Copyright (C) 2014 Vlad Mihalachi
~ ~
~ This file is part of Turbo Editor. ~ This file is part of Turbo Editor.
~ ~
~ Turbo Editor is free software: you can redistribute it and/or modify ~ Turbo Editor is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by ~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or ~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version. ~ (at your option) any later version.
~ ~
~ Turbo Editor is distributed in the hope that it will be useful, ~ Turbo Editor is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details. ~ GNU General Public License for more details.
~ ~
~ You should have received a copy of the GNU General Public License ~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maskyn.fileeditor" package="com.maskyn.fileeditor"
android:installLocation="auto"> android:installLocation="auto">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" /> <uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" /> <uses-permission android:name="com.android.vending.BILLING" />
<supports-screens <supports-screens
android:anyDensity="true" android:anyDensity="true"
android:largeScreens="true" android:largeScreens="true"
android:normalScreens="true" android:normalScreens="true"
android:resizeable="true" android:resizeable="true"
android:smallScreens="true" android:smallScreens="true"
android:xlargeScreens="true" /> android:xlargeScreens="true" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/nome_app_turbo_editor" android:label="@string/nome_app_turbo_editor"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:largeHeap="true" android:largeHeap="true"
android:supportsRtl="true" android:supportsRtl="true"
android:name="sharedcode.turboeditor.application.MyApp" android:name="sharedcode.turboeditor.application.MyApp"
> >
<!-- android:alwaysRetainTaskState="true" --> <!-- android:alwaysRetainTaskState="true" -->
<meta-data android:name="com.google.android.gms.version" <meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/> android:value="@integer/google_play_services_version"/>
<activity <activity
android:name=".HomeActivity" android:name=".HomeActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:launchMode="singleTop" android:launchMode="singleTop"
android:windowSoftInputMode="stateUnspecified|adjustResize" android:windowSoftInputMode="stateUnspecified|adjustResize"
android:theme="@style/AppThemeEditorDark"> android:theme="@style/AppThemeEditorDark">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" /> <category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" /> <action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" /> <data android:scheme="file" />
<data android:mimeType="text/*" /> <data android:mimeType="text/*" />
<data android:pathPattern="*.txt" /> <data android:pathPattern="*.txt" />
<data android:pathPattern="*.html" /> <data android:pathPattern="*.html" />
<data android:pathPattern="*.css" /> <data android:pathPattern="*.css" />
<data android:pathPattern="*.js" /> <data android:pathPattern="*.js" />
<data android:pathPattern="*.md"/> <data android:pathPattern="*.md"/>
<data android:pathPattern="*.php" /> <data android:pathPattern="*.php" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" /> <data android:mimeType="text/plain" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="sharedcode.turboeditor.activity.SelectFileActivity" android:name="sharedcode.turboeditor.activity.SelectFileActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/open_a_file" android:label="@string/open_a_file"
android:parentActivityName=".HomeActivity" android:parentActivityName=".HomeActivity"
android:theme="@style/AppThemeBaseLight"> android:theme="@style/AppThemeBaseLight">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".HomeActivity" /> android:value=".HomeActivity" />
</activity> </activity>
<activity <activity
android:name="sharedcode.turboeditor.preferences.ExtraSettingsActivity" android:name="sharedcode.turboeditor.preferences.ExtraSettingsActivity"
android:label="@string/extra_options" android:label="@string/extra_options"
android:parentActivityName=".HomeActivity"> android:parentActivityName=".HomeActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".HomeActivity" /> android:value=".HomeActivity" />
</activity> </activity>
<meta-data <meta-data
android:name="com.sec.android.support.multiwindow" android:name="com.sec.android.support.multiwindow"
android:value="true" /> android:value="true" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W"
android:value="632.0dip" /> android:value="632.0dip" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H"
android:value="598.0dip" /> android:value="598.0dip" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W"
android:value="632.0dip" /> android:value="632.0dip" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H"
android:value="598.0dip" /> android:value="598.0dip" />
<activity android:name="com.google.android.gms.ads.AdActivity" <activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<meta-data android:name="com.crashlytics.ApiKey" android:value="672ab7531ce1e2e83c2ec6d84e8e94f2fa692c2a"/> <meta-data android:name="com.crashlytics.ApiKey" android:value="672ab7531ce1e2e83c2ec6d84e8e94f2fa692c2a"/>
</application> </application>
</manifest> </manifest>

View File

@ -1,50 +1,45 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.maskyn.fileeditor; package com.maskyn.fileeditor;
import android.app.Activity; import android.app.Activity;
import android.preference.PreferenceManager;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.InterstitialAd;
public class AdsHelper {
import java.util.Calendar; private InterstitialAd interstitial;
import sharedcode.turboeditor.preferences.PreferenceHelper; public AdsHelper(Activity activity) {
public class AdsHelper { interstitial = new InterstitialAd(activity);
private InterstitialAd interstitial; interstitial.setAdUnitId("ca-app-pub-5679083452234719/7178038180");
public AdsHelper(Activity activity) { // Create ad request.
AdRequest adRequest = new AdRequest.Builder().build();
interstitial = new InterstitialAd(activity);
interstitial.setAdUnitId("ca-app-pub-5679083452234719/7178038180"); // Begin loading your interstitial.
interstitial.loadAd(adRequest);
// Create ad request. }
AdRequest adRequest = new AdRequest.Builder().build();
public void displayInterstitial() {
// Begin loading your interstitial. interstitial.show();
interstitial.loadAd(adRequest); }
} }
public void displayInterstitial() {
interstitial.show();
}
}

View File

@ -1,51 +1,56 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.maskyn.fileeditor; package com.maskyn.fileeditor;
import android.os.Bundle; import android.os.Bundle;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric; import io.fabric.sdk.android.Fabric;
import sharedcode.turboeditor.activity.MainActivity; import sharedcode.turboeditor.activity.MainActivity;
import sharedcode.turboeditor.preferences.PreferenceHelper;
import sharedcode.turboeditor.util.ProCheckUtils; public class HomeActivity extends MainActivity {
public class HomeActivity extends MainActivity { private AdsHelper adsHelper;
private AdsHelper adsHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
@Override super.onCreate(savedInstanceState);
protected void onCreate(Bundle savedInstanceState) { if(sharedcode.turboeditor.preferences.PreferenceHelper.getSendErrorReports(this))
super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics());
if(PreferenceHelper.getSendErrorReports(this)) // setup the ads
Fabric.with(this, new Crashlytics()); if(!sharedcode.turboeditor.util.ProCheckUtils.isPro(this))
// setup the ads adsHelper = new AdsHelper(this);
if(!ProCheckUtils.isPro(this)) }
adsHelper = new AdsHelper(this);
} @Override
public boolean showInterstitial() {
@Override if(adsHelper != null && !sharedcode.turboeditor.util.ProCheckUtils.isPro(this)) {
public void displayInterstitial() { adsHelper.displayInterstitial();
if(adsHelper != null && !ProCheckUtils.isPro(this)) return true;
adsHelper.displayInterstitial(); }
} else {
} return false;
}
}
}

View File

@ -1,38 +1,38 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:0.13.+' classpath 'com.android.tools.build:gradle:+'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }
} }
allprojects { allprojects {
repositories { repositories {
jcenter() jcenter()
} }
} }

View File

@ -1,287 +1,96 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<pre-dex-items> <items version="2" >
<item <item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\commons-io-2.4-63b64e68cd19031cd252ac65a3ef94421c1bf0f4.jar" jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.0\libs\internal_impl-21.0.0.jar"
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\2.4\b1b6ea3b7e4aa4f492509a4952029cd8e48019ad\commons-io-2.4.jar" jumboMode="false"
jumboMode="false" revision="21.0.2"
revision="21.0.2" sha1="1609e6d42d0480b0f4188e2c29f75388fa12a8f0">
sha1="b1b6ea3b7e4aa4f492509a4952029cd8e48019ad"/> <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\internal_impl-21.0.0-b15535acecaec42d04239e17e0a03ab072a43104.jar" />
<item </item>
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-8e5760a518ace60ad40fe7ea0fedc1faa57ee342.jar" <item
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.crashlytics.sdk.android\beta\1.0.1\classes.jar" jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\FloatingActionButton\unspecified\classes.jar"
jumboMode="false" jumboMode="false"
revision="21.0.2" revision="21.0.2"
sha1="ac8bb9f7af7ca5dae03650dc1b43a305e1df2f1b"/> sha1="d0b9fcf5ff71e9443e787fdeef87e6833f82498d">
<item <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-82d5b6cab7f16bad663de7c7008673037efb0e1b.jar" />
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-4dd6beddde59ff8bd6c22bd0d65ac974f7e489d2.jar" </item>
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\classes.jar" <item
jumboMode="false" jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.0\classes.jar"
revision="21.0.2" jumboMode="false"
sha1="7a292d3770cffc1bb19e8f0232954da498bb87ea"/> revision="21.0.2"
<item sha1="686344a780033e4ba22b926cd225f8d4941247e6">
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-40c5f3698ba688207904eaae4b4b57dbf850297e.jar" <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-e90e1f4e06d0f5aa27166f2f8f5fcea319efbd95.jar" />
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.crashlytics.sdk.android\answers\1.0.0\classes.jar" </item>
jumboMode="false" <item
revision="21.0.2" jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\classes.jar"
sha1="a8c73f3b98c2732c03ea09378ca322b56dea153a"/> jumboMode="false"
<item revision="21.0.2"
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\commons-lang3-3.1-84728078c80f2c8637e0c3fe426ad61433c75bb6.jar" sha1="95fd37732ec852e99f07eeb516a3650172f1d136">
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.1\905075e6c80f206bbe6cf1e809d2caa69f420c76\commons-lang3-3.1.jar" <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-fb4f15a411cfb0bffc51b68ad64a4794d3d67ae4.jar" />
jumboMode="false" </item>
revision="21.0.2" <item
sha1="905075e6c80f206bbe6cf1e809d2caa69f420c76"/> jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\2.4\b1b6ea3b7e4aa4f492509a4952029cd8e48019ad\commons-io-2.4.jar"
<item jumboMode="false"
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-515446996fed08836a9331ef47b508a0383ffa22.jar" revision="21.0.2"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\turbo-editor.libraries\RootCommands\unspecified\classes.jar" sha1="b1b6ea3b7e4aa4f492509a4952029cd8e48019ad">
jumboMode="false" <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\commons-io-2.4-63b64e68cd19031cd252ac65a3ef94421c1bf0f4.jar" />
revision="21.0.2" </item>
sha1="e3bacad84e40c773d40010a5520810920887a920"/> <item
<item jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3.jar"
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-52b3d51bec6ecfeacbc105275c0e6a98b8869b1b.jar" jumboMode="false"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.crashlytics.sdk.android\crashlytics\2.0.0\classes.jar" revision="21.0.2"
jumboMode="false" sha1="591d72211acc0b909b79c840e0b3ed9a0982d807">
revision="21.0.2" <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-65b2b356e3f2da4b67e00aba70923d6321852204.jar" />
sha1="832029c6f15447b2cb64ca4f8cf12172c9091857"/> </item>
<item <item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-9b612f0cb16e63277808158fe971bb4f40c98d29.jar" jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.1\905075e6c80f206bbe6cf1e809d2caa69f420c76\commons-lang3-3.1.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.github.gabrielemariotti.changeloglib\library\1.5.1\classes.jar" jumboMode="false"
jumboMode="false" revision="21.0.2"
revision="20.0.0" sha1="905075e6c80f206bbe6cf1e809d2caa69f420c76">
sha1="74a89f0f8b56d9f11d70b8d8134cf4109f4797dc"/> <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\commons-lang3-3.1-84728078c80f2c8637e0c3fe426ad61433c75bb6.jar" />
<item </item>
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-33698a085ac2060587beda19b5b3900d3dffd1e7.jar" <item
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.0\classes.jar" jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\classes.jar"
jumboMode="false" jumboMode="false"
revision="21.0.2" revision="21.0.2"
sha1="686344a780033e4ba22b926cd225f8d4941247e6"/> sha1="fe94ead11c648222804d49f12bbe257ed8d09c4d">
<item <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-bcfe21eb1248db73c27c811996e28274cf39b024.jar" />
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\library-2.4.0-6b043a8574fb97c742ca3065362b2a29e8f870bc.jar" </item>
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\com.nineoldandroids\library\2.4.0\e9b63380f3a242dbdbf103a2355ad7e43bad17cb\library-2.4.0.jar" <item
jumboMode="false" jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3-sources.jar"
revision="19.1.0" jumboMode="false"
sha1="e9b63380f3a242dbdbf103a2355ad7e43bad17cb"/> revision="21.0.2"
<item sha1="77979eaa98f90806f984155f44f63cc1fb60ac25">
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-65b2b356e3f2da4b67e00aba70923d6321852204.jar" <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-sources-58cfedaebe3b94ec0eaa2ede4e66aae8dbe309b0.jar" />
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3.jar" </item>
jumboMode="false" <item
revision="20.0.0" jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\com.nineoldandroids\library\2.4.0\e9b63380f3a242dbdbf103a2355ad7e43bad17cb\library-2.4.0.jar"
sha1="591d72211acc0b909b79c840e0b3ed9a0982d807"/> jumboMode="false"
<item revision="21.0.2"
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-82d5b6cab7f16bad663de7c7008673037efb0e1b.jar" sha1="e9b63380f3a242dbdbf103a2355ad7e43bad17cb">
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\FloatingActionButton\unspecified\classes.jar" <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\library-2.4.0-6b043a8574fb97c742ca3065362b2a29e8f870bc.jar" />
jumboMode="false" </item>
revision="21.0.2" <item
sha1="a1fbf4d4c1f1e1fe357b9ed1de15f4eea2217274"/> jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\RootCommands\unspecified\classes.jar"
<item jumboMode="false"
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-7a329e7f23515542bf02d96773d08da1d2333a7b.jar" revision="21.0.2"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\turbo-editor.libraries\FloatingActionButton\unspecified\classes.jar" sha1="f1cd6d34046095cac347407908d0d42858db410a">
jumboMode="false" <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-30cc9565ecef1e8ae8577530d7ddd41993d192d7.jar" />
revision="21.0.2" </item>
sha1="a1fbf4d4c1f1e1fe357b9ed1de15f4eea2217274"/> <item
<item jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.github.gabrielemariotti.changeloglib\library\1.5.1\classes.jar"
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\internal_impl-21.0.0-74269e33561519e0fdabab9550f16a5986255be9.jar" jumboMode="false"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.0\libs\internal_impl-21.0.0.jar" revision="21.0.2"
jumboMode="false" sha1="74a89f0f8b56d9f11d70b8d8134cf4109f4797dc">
revision="21.0.2" <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-9b612f0cb16e63277808158fe971bb4f40c98d29.jar" />
sha1="1609e6d42d0480b0f4188e2c29f75388fa12a8f0"/> </item>
<item <item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-30cc9565ecef1e8ae8577530d7ddd41993d192d7.jar" jar="C:\Users\Vlad\AppData\Local\Android\android-sdk\extras\android\m2repository\com\android\support\support-annotations\21.0.0\support-annotations-21.0.0.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\RootCommands\unspecified\classes.jar" jumboMode="false"
jumboMode="false" revision="21.0.2"
revision="21.0.2" sha1="1a578b9607b36266c63d43a4fa0ab5664dbe911e">
sha1="e3bacad84e40c773d40010a5520810920887a920"/> <dex dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\support-annotations-21.0.0-7b7e20ddbdfce40d4a29c1e68c2dbbc5bb512ab5.jar" />
<item </item>
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-d44090b77791e486eccbc4d8859b00a83623bf2b.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\6.1.11\classes.jar" </items>
jumboMode="false"
revision="21.0.2"
sha1="0f700f6802ba1a1f1fa7ac26d5db0666a89d75a6"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-bcfe21eb1248db73c27c811996e28274cf39b024.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\classes.jar"
jumboMode="false"
revision="19.1.0"
sha1="8203f36efafa2a6ef438b83fc86b9bdc469e7368"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-sources-436707958bb47977373cb4a2d842cdbf635fd840.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3-sources.jar"
jumboMode="false"
revision="21.0.2"
sha1="77979eaa98f90806f984155f44f63cc1fb60ac25"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-30cc9565ecef1e8ae8577530d7ddd41993d192d7.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\RootCommands\unspecified\classes.jar"
jumboMode="false"
revision="20.0.0"
sha1="85e7b55f468c5591965a5171179d3858b46822a9"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\support-annotations-21.0.0-7b7e20ddbdfce40d4a29c1e68c2dbbc5bb512ab5.jar"
jar="C:\Users\Vlad\AppData\Local\Android\android-sdk\extras\android\m2repository\com\android\support\support-annotations\21.0.0\support-annotations-21.0.0.jar"
jumboMode="false"
revision="21.0.2"
sha1="1a578b9607b36266c63d43a4fa0ab5664dbe911e"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-bcfe21eb1248db73c27c811996e28274cf39b024.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\classes.jar"
jumboMode="false"
revision="20.0.0"
sha1="991591ff9dbe9e472a47cf66fe6c120f89a68eaa"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-fb4f15a411cfb0bffc51b68ad64a4794d3d67ae4.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="95fd37732ec852e99f07eeb516a3650172f1d136"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-sources-58cfedaebe3b94ec0eaa2ede4e66aae8dbe309b0.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3-sources.jar"
jumboMode="false"
revision="19.1.0"
sha1="77979eaa98f90806f984155f44f63cc1fb60ac25"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-82d5b6cab7f16bad663de7c7008673037efb0e1b.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\FloatingActionButton\unspecified\classes.jar"
jumboMode="false"
revision="19.1.0"
sha1="2e2f6526f3c5fb34230d14e52bdc24addb67ea9f"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-65b2b356e3f2da4b67e00aba70923d6321852204.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3.jar"
jumboMode="false"
revision="21.0.2"
sha1="591d72211acc0b909b79c840e0b3ed9a0982d807"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-9db20cdcb8ae72104757d81297c98978c65bd91b.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3.jar"
jumboMode="false"
revision="21.0.2"
sha1="591d72211acc0b909b79c840e0b3ed9a0982d807"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-9b612f0cb16e63277808158fe971bb4f40c98d29.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.github.gabrielemariotti.changeloglib\library\1.5.1\classes.jar"
jumboMode="false"
revision="19.1.0"
sha1="74a89f0f8b56d9f11d70b8d8134cf4109f4797dc"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\library-2.4.0-6b043a8574fb97c742ca3065362b2a29e8f870bc.jar"
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\com.nineoldandroids\library\2.4.0\e9b63380f3a242dbdbf103a2355ad7e43bad17cb\library-2.4.0.jar"
jumboMode="false"
revision="21.0.2"
sha1="e9b63380f3a242dbdbf103a2355ad7e43bad17cb"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\commons-lang3-3.1-84728078c80f2c8637e0c3fe426ad61433c75bb6.jar"
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.1\905075e6c80f206bbe6cf1e809d2caa69f420c76\commons-lang3-3.1.jar"
jumboMode="false"
revision="20.0.0"
sha1="905075e6c80f206bbe6cf1e809d2caa69f420c76"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-e4e5a16633bd011fd3d270f1bcdf565f2bd9f2b3.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.crashlytics.sdk.android\beta\1.0.0\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="068f232cbc319d814ad6ad01fd0ed0ac6d6c5414"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-28f23d0edd8f234d170b23285799ff5873131bbe.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\io.fabric.sdk.android\fabric\1.0.1\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="7b46e0b1175dbb7d47f130d6ed14097340e1b77f"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-39edd57531ecc124992725bca5e8b42be236e3ec.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\io.fabric.sdk.android\fabric\1.0.0\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="20a6dfbe395a3557a58a3d9f4460c15b0ce04d1e"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\commons-io-2.4-63b64e68cd19031cd252ac65a3ef94421c1bf0f4.jar"
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\2.4\b1b6ea3b7e4aa4f492509a4952029cd8e48019ad\commons-io-2.4.jar"
jumboMode="false"
revision="19.1.0"
sha1="b1b6ea3b7e4aa4f492509a4952029cd8e48019ad"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-91de6979bb6be1b46cde32b462c23831eadd01d4.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.github.gabrielemariotti.changeloglib\library\1.5.1\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="74a89f0f8b56d9f11d70b8d8134cf4109f4797dc"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\library-2.4.0-6b043a8574fb97c742ca3065362b2a29e8f870bc.jar"
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\com.nineoldandroids\library\2.4.0\e9b63380f3a242dbdbf103a2355ad7e43bad17cb\library-2.4.0.jar"
jumboMode="false"
revision="20.0.0"
sha1="e9b63380f3a242dbdbf103a2355ad7e43bad17cb"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-sources-58cfedaebe3b94ec0eaa2ede4e66aae8dbe309b0.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3-sources.jar"
jumboMode="false"
revision="21.0.2"
sha1="77979eaa98f90806f984155f44f63cc1fb60ac25"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-65b2b356e3f2da4b67e00aba70923d6321852204.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3.jar"
jumboMode="false"
revision="19.1.0"
sha1="591d72211acc0b909b79c840e0b3ed9a0982d807"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-sources-58cfedaebe3b94ec0eaa2ede4e66aae8dbe309b0.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3-sources.jar"
jumboMode="false"
revision="20.0.0"
sha1="77979eaa98f90806f984155f44f63cc1fb60ac25"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-9b612f0cb16e63277808158fe971bb4f40c98d29.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.github.gabrielemariotti.changeloglib\library\1.5.1\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="74a89f0f8b56d9f11d70b8d8134cf4109f4797dc"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-5c418babb57b5fe1e6e82a2f3ba51f2da968ba87.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.crashlytics.sdk.android\crashlytics\2.0.1\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="1adf75e3d87301236c2d4de507b4a668092ff070"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-82d5b6cab7f16bad663de7c7008673037efb0e1b.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\FloatingActionButton\unspecified\classes.jar"
jumboMode="false"
revision="20.0.0"
sha1="df1a8540495d6724b8582db31fcdd49b04d8b707"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-30cc9565ecef1e8ae8577530d7ddd41993d192d7.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\RootCommands\unspecified\classes.jar"
jumboMode="false"
revision="19.1.0"
sha1="cb3d22565863773944a8c15de408e864e34d6da1"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\debug\classes-aa4ad551e94dc47c364b1b7f46bb2eb1b6ceed85.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="95fd37732ec852e99f07eeb516a3650172f1d136"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-e90e1f4e06d0f5aa27166f2f8f5fcea319efbd95.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.0\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="686344a780033e4ba22b926cd225f8d4941247e6"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-bcfe21eb1248db73c27c811996e28274cf39b024.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="7a292d3770cffc1bb19e8f0232954da498bb87ea"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\internal_impl-21.0.0-b15535acecaec42d04239e17e0a03ab072a43104.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.0\libs\internal_impl-21.0.0.jar"
jumboMode="false"
revision="21.0.2"
sha1="1609e6d42d0480b0f4188e2c29f75388fa12a8f0"/>
<item
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-354dd0849ce9caff8f6b5b0f6428cf9e2ccbe27e.jar"
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.crashlytics.sdk.android\answers\1.0.1\classes.jar"
jumboMode="false"
revision="21.0.2"
sha1="7363bd9461c166e18592b58547720fbad8d4b0bc"/>
</pre-dex-items>

Binary file not shown.

View File

@ -1,37 +1,37 @@
# #
# Copyright (C) 2014 Vlad Mihalachi # Copyright (C) 2014 Vlad Mihalachi
# #
# This file is part of Turbo Editor. # This file is part of Turbo Editor.
# #
# Turbo Editor is free software: you can redistribute it and/or modify # Turbo Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# Turbo Editor is distributed in the hope that it will be useful, # Turbo Editor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Project-wide Gradle settings. # Project-wide Gradle settings.
# IDE (e.g. Android Studio) users: # IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings # Settings specified in this file will override any Gradle settings
# configured through the IDE. # configured through the IDE.
# For more details on how to configure your build environment visit # For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m # Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # org.gradle.parallel=true

View File

@ -1,6 +1,6 @@
#Wed Oct 22 18:10:25 CEST 2014 #Wed Oct 22 18:10:25 CEST 2014
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip

328
gradlew vendored
View File

@ -1,164 +1,164 @@
#!/usr/bin/env bash #!/usr/bin/env bash
############################################################################## ##############################################################################
## ##
## Gradle start up script for UN*X ## Gradle start up script for UN*X
## ##
############################################################################## ##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS="" DEFAULT_JVM_OPTS=""
APP_NAME="Gradle" APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
warn ( ) { warn ( ) {
echo "$*" echo "$*"
} }
die ( ) { die ( ) {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} }
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
case "`uname`" in case "`uname`" in
CYGWIN* ) CYGWIN* )
cygwin=true cygwin=true
;; ;;
Darwin* ) Darwin* )
darwin=true darwin=true
;; ;;
MINGW* ) MINGW* )
msys=true msys=true
;; ;;
esac esac
# For Cygwin, ensure paths are in UNIX format before anything is touched. # For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi fi
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" PRG="$0"
# Need this for relative symlinks. # Need this for relative symlinks.
while [ -h "$PRG" ] ; do while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"` ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'` link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then if expr "$link" : '/.*' > /dev/null; then
PRG="$link" PRG="$link"
else else
PRG=`dirname "$PRG"`"/$link" PRG=`dirname "$PRG"`"/$link"
fi fi
done done
SAVED="`pwd`" SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&- cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`" APP_HOME="`pwd -P`"
cd "$SAVED" >&- cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD="$JAVA_HOME/jre/sh/java"
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD="$JAVA_HOME/bin/java"
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n` MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT" MAX_FD="$MAX_FD_LIMIT"
fi fi
ulimit -n $MAX_FD ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD" warn "Could not set maximum file descriptor limit: $MAX_FD"
fi fi
else else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi fi
fi fi
# For Darwin, add options to specify how the application appears in the dock # For Darwin, add options to specify how the application appears in the dock
if $darwin; then if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin, switch paths to Windows format before running java
if $cygwin ; then if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP="" SEP=""
for dir in $ROOTDIRSRAW ; do for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir" ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|" SEP="|"
done done
OURCYGPATTERN="(^($ROOTDIRS))" OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments # Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh # Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0 i=0
for arg in "$@" ; do for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else else
eval `echo args$i`="\"$arg\"" eval `echo args$i`="\"$arg\""
fi fi
i=$((i+1)) i=$((i+1))
done done
case $i in case $i in
(0) set -- ;; (0) set -- ;;
(1) set -- "$args0" ;; (1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;; (2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;; (3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;; (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() { function splitJvmOpts() {
JVM_OPTS=("$@") JVM_OPTS=("$@")
} }
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

180
gradlew.bat vendored
View File

@ -1,90 +1,90 @@
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto init
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto init
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:init :init
@rem Get command-line arguments, handling Windowz variants @rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
set CMD_LINE_ARGS= set CMD_LINE_ARGS=
set _SKIP=2 set _SKIP=2
:win9xME_args_slurp :win9xME_args_slurp
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
goto execute goto execute
:4NT_args :4NT_args
@rem Get arguments from the 4NT Shell from JP Software @rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$ set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if "%ERRORLEVEL%"=="0" goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1 exit /b 1
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal
:omega :omega

View File

@ -1,173 +1,173 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY. /* AUTO-GENERATED FILE. DO NOT MODIFY.
* *
* This class was automatically generated by the * This class was automatically generated by the
* aapt tool from the resource data it found. It * aapt tool from the resource data it found. It
* should not be modified by hand. * should not be modified by hand.
*/ */
package com.faizmalkani.floatingactionbutton; package com.faizmalkani.floatingactionbutton;
public final class R { public final class R {
public static final class attr { public static final class attr {
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int colour=0x7f010001; public static int colour=0x7f010001;
/** <p>Must be an integer value, such as "<code>100</code>". /** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int drawable=0x7f010000; public static int drawable=0x7f010000;
/** <p>Must be an integer value, such as "<code>100</code>". /** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int shadowColor=0x7f010005; public static int shadowColor=0x7f010005;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int shadowDx=0x7f010003; public static int shadowDx=0x7f010003;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int shadowDy=0x7f010004; public static int shadowDy=0x7f010004;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int shadowRadius=0x7f010002; public static int shadowRadius=0x7f010002;
} }
public static final class styleable { public static final class styleable {
/** Attributes that can be used with a FloatingActionButton. /** Attributes that can be used with a FloatingActionButton.
<p>Includes the following attributes:</p> <p>Includes the following attributes:</p>
<table> <table>
<colgroup align="left" /> <colgroup align="left" />
<colgroup align="left" /> <colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr> <tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #FloatingActionButton_colour com.faizmalkani.floatingactionbutton:colour}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_colour com.faizmalkani.floatingactionbutton:colour}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_drawable com.faizmalkani.floatingactionbutton:drawable}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_drawable com.faizmalkani.floatingactionbutton:drawable}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowColor com.faizmalkani.floatingactionbutton:shadowColor}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowColor com.faizmalkani.floatingactionbutton:shadowColor}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowDx com.faizmalkani.floatingactionbutton:shadowDx}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowDx com.faizmalkani.floatingactionbutton:shadowDx}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowDy com.faizmalkani.floatingactionbutton:shadowDy}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowDy com.faizmalkani.floatingactionbutton:shadowDy}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowRadius com.faizmalkani.floatingactionbutton:shadowRadius}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowRadius com.faizmalkani.floatingactionbutton:shadowRadius}</code></td><td></td></tr>
</table> </table>
@see #FloatingActionButton_colour @see #FloatingActionButton_colour
@see #FloatingActionButton_drawable @see #FloatingActionButton_drawable
@see #FloatingActionButton_shadowColor @see #FloatingActionButton_shadowColor
@see #FloatingActionButton_shadowDx @see #FloatingActionButton_shadowDx
@see #FloatingActionButton_shadowDy @see #FloatingActionButton_shadowDy
@see #FloatingActionButton_shadowRadius @see #FloatingActionButton_shadowRadius
*/ */
public static final int[] FloatingActionButton = { public static final int[] FloatingActionButton = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004, 0x7f010005 0x7f010004, 0x7f010005
}; };
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#colour} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#colour}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:colour @attr name com.faizmalkani.floatingactionbutton:colour
*/ */
public static int FloatingActionButton_colour = 1; public static int FloatingActionButton_colour = 1;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#drawable} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#drawable}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be an integer value, such as "<code>100</code>". <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:drawable @attr name com.faizmalkani.floatingactionbutton:drawable
*/ */
public static int FloatingActionButton_drawable = 0; public static int FloatingActionButton_drawable = 0;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowColor} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowColor}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be an integer value, such as "<code>100</code>". <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:shadowColor @attr name com.faizmalkani.floatingactionbutton:shadowColor
*/ */
public static int FloatingActionButton_shadowColor = 5; public static int FloatingActionButton_shadowColor = 5;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowDx} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowDx}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:shadowDx @attr name com.faizmalkani.floatingactionbutton:shadowDx
*/ */
public static int FloatingActionButton_shadowDx = 3; public static int FloatingActionButton_shadowDx = 3;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowDy} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowDy}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:shadowDy @attr name com.faizmalkani.floatingactionbutton:shadowDy
*/ */
public static int FloatingActionButton_shadowDy = 4; public static int FloatingActionButton_shadowDy = 4;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowRadius} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowRadius}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:shadowRadius @attr name com.faizmalkani.floatingactionbutton:shadowRadius
*/ */
public static int FloatingActionButton_shadowRadius = 2; public static int FloatingActionButton_shadowRadius = 2;
}; };
} }

View File

@ -1,173 +1,173 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY. /* AUTO-GENERATED FILE. DO NOT MODIFY.
* *
* This class was automatically generated by the * This class was automatically generated by the
* aapt tool from the resource data it found. It * aapt tool from the resource data it found. It
* should not be modified by hand. * should not be modified by hand.
*/ */
package com.faizmalkani.floatingactionbutton; package com.faizmalkani.floatingactionbutton;
public final class R { public final class R {
public static final class attr { public static final class attr {
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int colour=0x7f010001; public static int colour=0x7f010001;
/** <p>Must be an integer value, such as "<code>100</code>". /** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int drawable=0x7f010000; public static int drawable=0x7f010000;
/** <p>Must be an integer value, such as "<code>100</code>". /** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int shadowColor=0x7f010005; public static int shadowColor=0x7f010005;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int shadowDx=0x7f010003; public static int shadowDx=0x7f010003;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int shadowDy=0x7f010004; public static int shadowDy=0x7f010004;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static int shadowRadius=0x7f010002; public static int shadowRadius=0x7f010002;
} }
public static final class styleable { public static final class styleable {
/** Attributes that can be used with a FloatingActionButton. /** Attributes that can be used with a FloatingActionButton.
<p>Includes the following attributes:</p> <p>Includes the following attributes:</p>
<table> <table>
<colgroup align="left" /> <colgroup align="left" />
<colgroup align="left" /> <colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr> <tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #FloatingActionButton_colour com.faizmalkani.floatingactionbutton:colour}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_colour com.faizmalkani.floatingactionbutton:colour}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_drawable com.faizmalkani.floatingactionbutton:drawable}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_drawable com.faizmalkani.floatingactionbutton:drawable}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowColor com.faizmalkani.floatingactionbutton:shadowColor}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowColor com.faizmalkani.floatingactionbutton:shadowColor}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowDx com.faizmalkani.floatingactionbutton:shadowDx}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowDx com.faizmalkani.floatingactionbutton:shadowDx}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowDy com.faizmalkani.floatingactionbutton:shadowDy}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowDy com.faizmalkani.floatingactionbutton:shadowDy}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowRadius com.faizmalkani.floatingactionbutton:shadowRadius}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowRadius com.faizmalkani.floatingactionbutton:shadowRadius}</code></td><td></td></tr>
</table> </table>
@see #FloatingActionButton_colour @see #FloatingActionButton_colour
@see #FloatingActionButton_drawable @see #FloatingActionButton_drawable
@see #FloatingActionButton_shadowColor @see #FloatingActionButton_shadowColor
@see #FloatingActionButton_shadowDx @see #FloatingActionButton_shadowDx
@see #FloatingActionButton_shadowDy @see #FloatingActionButton_shadowDy
@see #FloatingActionButton_shadowRadius @see #FloatingActionButton_shadowRadius
*/ */
public static final int[] FloatingActionButton = { public static final int[] FloatingActionButton = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004, 0x7f010005 0x7f010004, 0x7f010005
}; };
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#colour} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#colour}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:colour @attr name com.faizmalkani.floatingactionbutton:colour
*/ */
public static int FloatingActionButton_colour = 1; public static int FloatingActionButton_colour = 1;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#drawable} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#drawable}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be an integer value, such as "<code>100</code>". <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:drawable @attr name com.faizmalkani.floatingactionbutton:drawable
*/ */
public static int FloatingActionButton_drawable = 0; public static int FloatingActionButton_drawable = 0;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowColor} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowColor}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be an integer value, such as "<code>100</code>". <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:shadowColor @attr name com.faizmalkani.floatingactionbutton:shadowColor
*/ */
public static int FloatingActionButton_shadowColor = 5; public static int FloatingActionButton_shadowColor = 5;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowDx} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowDx}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:shadowDx @attr name com.faizmalkani.floatingactionbutton:shadowDx
*/ */
public static int FloatingActionButton_shadowDx = 3; public static int FloatingActionButton_shadowDx = 3;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowDy} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowDy}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:shadowDy @attr name com.faizmalkani.floatingactionbutton:shadowDy
*/ */
public static int FloatingActionButton_shadowDy = 4; public static int FloatingActionButton_shadowDy = 4;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowRadius} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.R.attr#shadowRadius}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton:shadowRadius @attr name com.faizmalkani.floatingactionbutton:shadowRadius
*/ */
public static int FloatingActionButton_shadowRadius = 2; public static int FloatingActionButton_shadowRadius = 2;
}; };
} }

View File

@ -1,173 +1,173 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY. /* AUTO-GENERATED FILE. DO NOT MODIFY.
* *
* This class was automatically generated by the * This class was automatically generated by the
* aapt tool from the resource data it found. It * aapt tool from the resource data it found. It
* should not be modified by hand. * should not be modified by hand.
*/ */
package com.faizmalkani.floatingactionbutton.test; package com.faizmalkani.floatingactionbutton.test;
public final class R { public final class R {
public static final class attr { public static final class attr {
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static final int colour=0x7f010001; public static final int colour=0x7f010001;
/** <p>Must be an integer value, such as "<code>100</code>". /** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static final int drawable=0x7f010000; public static final int drawable=0x7f010000;
/** <p>Must be an integer value, such as "<code>100</code>". /** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static final int shadowColor=0x7f010005; public static final int shadowColor=0x7f010005;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static final int shadowDx=0x7f010003; public static final int shadowDx=0x7f010003;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static final int shadowDy=0x7f010004; public static final int shadowDy=0x7f010004;
/** <p>Must be a floating point value, such as "<code>1.2</code>". /** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
*/ */
public static final int shadowRadius=0x7f010002; public static final int shadowRadius=0x7f010002;
} }
public static final class styleable { public static final class styleable {
/** Attributes that can be used with a FloatingActionButton. /** Attributes that can be used with a FloatingActionButton.
<p>Includes the following attributes:</p> <p>Includes the following attributes:</p>
<table> <table>
<colgroup align="left" /> <colgroup align="left" />
<colgroup align="left" /> <colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr> <tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #FloatingActionButton_colour com.faizmalkani.floatingactionbutton.test:colour}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_colour com.faizmalkani.floatingactionbutton.test:colour}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_drawable com.faizmalkani.floatingactionbutton.test:drawable}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_drawable com.faizmalkani.floatingactionbutton.test:drawable}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowColor com.faizmalkani.floatingactionbutton.test:shadowColor}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowColor com.faizmalkani.floatingactionbutton.test:shadowColor}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowDx com.faizmalkani.floatingactionbutton.test:shadowDx}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowDx com.faizmalkani.floatingactionbutton.test:shadowDx}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowDy com.faizmalkani.floatingactionbutton.test:shadowDy}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowDy com.faizmalkani.floatingactionbutton.test:shadowDy}</code></td><td></td></tr>
<tr><td><code>{@link #FloatingActionButton_shadowRadius com.faizmalkani.floatingactionbutton.test:shadowRadius}</code></td><td></td></tr> <tr><td><code>{@link #FloatingActionButton_shadowRadius com.faizmalkani.floatingactionbutton.test:shadowRadius}</code></td><td></td></tr>
</table> </table>
@see #FloatingActionButton_colour @see #FloatingActionButton_colour
@see #FloatingActionButton_drawable @see #FloatingActionButton_drawable
@see #FloatingActionButton_shadowColor @see #FloatingActionButton_shadowColor
@see #FloatingActionButton_shadowDx @see #FloatingActionButton_shadowDx
@see #FloatingActionButton_shadowDy @see #FloatingActionButton_shadowDy
@see #FloatingActionButton_shadowRadius @see #FloatingActionButton_shadowRadius
*/ */
public static final int[] FloatingActionButton = { public static final int[] FloatingActionButton = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004, 0x7f010005 0x7f010004, 0x7f010005
}; };
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#colour} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#colour}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton.test:colour @attr name com.faizmalkani.floatingactionbutton.test:colour
*/ */
public static final int FloatingActionButton_colour = 1; public static final int FloatingActionButton_colour = 1;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#drawable} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#drawable}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be an integer value, such as "<code>100</code>". <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton.test:drawable @attr name com.faizmalkani.floatingactionbutton.test:drawable
*/ */
public static final int FloatingActionButton_drawable = 0; public static final int FloatingActionButton_drawable = 0;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#shadowColor} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#shadowColor}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be an integer value, such as "<code>100</code>". <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton.test:shadowColor @attr name com.faizmalkani.floatingactionbutton.test:shadowColor
*/ */
public static final int FloatingActionButton_shadowColor = 5; public static final int FloatingActionButton_shadowColor = 5;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#shadowDx} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#shadowDx}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton.test:shadowDx @attr name com.faizmalkani.floatingactionbutton.test:shadowDx
*/ */
public static final int FloatingActionButton_shadowDx = 3; public static final int FloatingActionButton_shadowDx = 3;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#shadowDy} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#shadowDy}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton.test:shadowDy @attr name com.faizmalkani.floatingactionbutton.test:shadowDy
*/ */
public static final int FloatingActionButton_shadowDy = 4; public static final int FloatingActionButton_shadowDy = 4;
/** /**
<p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#shadowRadius} <p>This symbol is the offset where the {@link com.faizmalkani.floatingactionbutton.test.R.attr#shadowRadius}
attribute's value can be found in the {@link #FloatingActionButton} array. attribute's value can be found in the {@link #FloatingActionButton} array.
<p>Must be a floating point value, such as "<code>1.2</code>". <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form <p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type. containing a value of this type.
@attr name com.faizmalkani.floatingactionbutton.test:shadowRadius @attr name com.faizmalkani.floatingactionbutton.test:shadowRadius
*/ */
public static final int FloatingActionButton_shadowRadius = 2; public static final int FloatingActionButton_shadowRadius = 2;
}; };
} }

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.faizmalkani.floatingactionbutton" package="com.faizmalkani.floatingactionbutton"
android:versionCode="1" android:versionCode="1"
android:versionName="1.0" > android:versionName="1.0" >
<uses-sdk <uses-sdk
android:minSdkVersion="7" android:minSdkVersion="7"
android:targetSdkVersion="21" /> android:targetSdkVersion="21" />
<application android:allowBackup="true" > <application android:allowBackup="true" >
</application> </application>
</manifest> </manifest>

View File

@ -1,13 +1,13 @@
int attr colour 0x7f010001 int attr colour 0x7f010001
int attr drawable 0x7f010000 int attr drawable 0x7f010000
int attr shadowColor 0x7f010005 int attr shadowColor 0x7f010005
int attr shadowDx 0x7f010003 int attr shadowDx 0x7f010003
int attr shadowDy 0x7f010004 int attr shadowDy 0x7f010004
int attr shadowRadius 0x7f010002 int attr shadowRadius 0x7f010002
int[] styleable FloatingActionButton { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005 } int[] styleable FloatingActionButton { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005 }
int styleable FloatingActionButton_colour 1 int styleable FloatingActionButton_colour 1
int styleable FloatingActionButton_drawable 0 int styleable FloatingActionButton_drawable 0
int styleable FloatingActionButton_shadowColor 5 int styleable FloatingActionButton_shadowColor 5
int styleable FloatingActionButton_shadowDx 3 int styleable FloatingActionButton_shadowDx 3
int styleable FloatingActionButton_shadowDy 4 int styleable FloatingActionButton_shadowDy 4
int styleable FloatingActionButton_shadowRadius 2 int styleable FloatingActionButton_shadowRadius 2

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.faizmalkani.floatingactionbutton" package="com.faizmalkani.floatingactionbutton"
android:versionCode="1" android:versionCode="1"
android:versionName="1.0" > android:versionName="1.0" >
<uses-sdk <uses-sdk
android:minSdkVersion="7" android:minSdkVersion="7"
android:targetSdkVersion="21" /> android:targetSdkVersion="21" />
<application android:allowBackup="true" > <application android:allowBackup="true" >
</application> </application>
</manifest> </manifest>

View File

@ -1,13 +1,13 @@
int attr colour 0x7f010001 int attr colour 0x7f010001
int attr drawable 0x7f010000 int attr drawable 0x7f010000
int attr shadowColor 0x7f010005 int attr shadowColor 0x7f010005
int attr shadowDx 0x7f010003 int attr shadowDx 0x7f010003
int attr shadowDy 0x7f010004 int attr shadowDy 0x7f010004
int attr shadowRadius 0x7f010002 int attr shadowRadius 0x7f010002
int[] styleable FloatingActionButton { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005 } int[] styleable FloatingActionButton { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005 }
int styleable FloatingActionButton_colour 1 int styleable FloatingActionButton_colour 1
int styleable FloatingActionButton_drawable 0 int styleable FloatingActionButton_drawable 0
int styleable FloatingActionButton_shadowColor 5 int styleable FloatingActionButton_shadowColor 5
int styleable FloatingActionButton_shadowDx 3 int styleable FloatingActionButton_shadowDx 3
int styleable FloatingActionButton_shadowDy 4 int styleable FloatingActionButton_shadowDy 4
int styleable FloatingActionButton_shadowRadius 2 int styleable FloatingActionButton_shadowRadius 2

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.faizmalkani.floatingactionbutton.test" > package="com.faizmalkani.floatingactionbutton.test" >
<uses-sdk <uses-sdk
android:minSdkVersion="7" android:minSdkVersion="7"
android:targetSdkVersion="21" /> android:targetSdkVersion="21" />
<instrumentation <instrumentation
android:name="android.test.InstrumentationTestRunner" android:name="android.test.InstrumentationTestRunner"
android:functionalTest="false" android:functionalTest="false"
android:handleProfiling="false" android:handleProfiling="false"
android:label="Tests for com.faizmalkani.floatingactionbutton.test" android:label="Tests for com.faizmalkani.floatingactionbutton.test"
android:targetPackage="com.faizmalkani.floatingactionbutton.test" /> android:targetPackage="com.faizmalkani.floatingactionbutton.test" />
<application android:allowBackup="true" > <application android:allowBackup="true" >
<uses-library android:name="android.test.runner" /> <uses-library android:name="android.test.runner" />
</application> </application>
</manifest> </manifest>

View File

@ -1,13 +1,13 @@
int attr colour 0x7f010001 int attr colour 0x7f010001
int attr drawable 0x7f010000 int attr drawable 0x7f010000
int attr shadowColor 0x7f010005 int attr shadowColor 0x7f010005
int attr shadowDx 0x7f010003 int attr shadowDx 0x7f010003
int attr shadowDy 0x7f010004 int attr shadowDy 0x7f010004
int attr shadowRadius 0x7f010002 int attr shadowRadius 0x7f010002
int[] styleable FloatingActionButton { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005 } int[] styleable FloatingActionButton { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005 }
int styleable FloatingActionButton_colour 1 int styleable FloatingActionButton_colour 1
int styleable FloatingActionButton_drawable 0 int styleable FloatingActionButton_drawable 0
int styleable FloatingActionButton_shadowColor 5 int styleable FloatingActionButton_shadowColor 5
int styleable FloatingActionButton_shadowDx 3 int styleable FloatingActionButton_shadowDx 3
int styleable FloatingActionButton_shadowDy 4 int styleable FloatingActionButton_shadowDy 4
int styleable FloatingActionButton_shadowRadius 2 int styleable FloatingActionButton_shadowRadius 2

View File

@ -1,2 +1,2 @@
Manifest-Version: 1.0 Manifest-Version: 1.0

View File

@ -1,2 +1,2 @@
Manifest-Version: 1.0 Manifest-Version: 1.0

View File

@ -1,33 +1,33 @@
#Android specific #Android specific
bin bin
gen gen
obj obj
libs/armeabi libs/armeabi
lint.xml lint.xml
local.properties local.properties
release.properties release.properties
ant.properties ant.properties
*.class *.class
*.apk *.apk
#Gradle #Gradle
.gradle .gradle
build build
gradle.properties gradle.properties
gradlew gradlew
gradlew.bat gradlew.bat
gradle gradle
#Maven #Maven
target target
pom.xml.* pom.xml.*
#Eclipse #Eclipse
.project .project
.classpath .classpath
.settings .settings
.metadata .metadata
#IntelliJ IDEA #IntelliJ IDEA
.idea .idea
*.iml *.iml

View File

@ -1,30 +1,30 @@
buildscript { buildscript {
repositories { repositories {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:0.12.+' classpath 'com.android.tools.build:gradle:0.12.+'
} }
} }
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
dependencies { dependencies {
} }
android { android {
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion '21.0.2' buildToolsVersion '21.0.2'
defaultConfig { defaultConfig {
minSdkVersion 7 minSdkVersion 7
targetSdkVersion 21 targetSdkVersion 21
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
} }

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sufficientlysecure.rootcommands" package="org.sufficientlysecure.rootcommands"
android:versionCode="3" android:versionCode="3"
android:versionName="1.2" > android:versionName="1.2" >
<uses-sdk <uses-sdk
android:minSdkVersion="7" android:minSdkVersion="7"
android:targetSdkVersion="17" /> android:targetSdkVersion="17" />
<application /> <application />
</manifest> </manifest>

View File

@ -1,43 +1,43 @@
package org.sufficientlysecure.rootcommands; package org.sufficientlysecure.rootcommands;
import java.io.File; import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
public class Mount { public class Mount {
protected final File mDevice; protected final File mDevice;
protected final File mMountPoint; protected final File mMountPoint;
protected final String mType; protected final String mType;
protected final Set<String> mFlags; protected final Set<String> mFlags;
Mount(File device, File path, String type, String flagsStr) { Mount(File device, File path, String type, String flagsStr) {
mDevice = device; mDevice = device;
mMountPoint = path; mMountPoint = path;
mType = type; mType = type;
mFlags = new HashSet<String>(Arrays.asList(flagsStr.split(","))); mFlags = new HashSet<String>(Arrays.asList(flagsStr.split(",")));
} }
public File getDevice() { public File getDevice() {
return mDevice; return mDevice;
} }
public File getMountPoint() { public File getMountPoint() {
return mMountPoint; return mMountPoint;
} }
public String getType() { public String getType() {
return mType; return mType;
} }
public Set<String> getFlags() { public Set<String> getFlags() {
return mFlags; return mFlags;
} }
@Override @Override
public String toString() { public String toString() {
return String.format("%s on %s type %s %s", mDevice, mMountPoint, mType, mFlags); return String.format("%s on %s type %s %s", mDevice, mMountPoint, mType, mFlags);
} }
} }

View File

@ -1,176 +1,176 @@
package org.sufficientlysecure.rootcommands; package org.sufficientlysecure.rootcommands;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.LineNumberReader; import java.io.LineNumberReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import org.sufficientlysecure.rootcommands.command.SimpleCommand; import org.sufficientlysecure.rootcommands.command.SimpleCommand;
import org.sufficientlysecure.rootcommands.util.Log; import org.sufficientlysecure.rootcommands.util.Log;
//no modifier, this means it is package-private. Only our internal classes can use this. //no modifier, this means it is package-private. Only our internal classes can use this.
class Remounter { class Remounter {
private Shell shell; private Shell shell;
public Remounter(Shell shell) { public Remounter(Shell shell) {
super(); super();
this.shell = shell; this.shell = shell;
} }
/** /**
* This will take a path, which can contain the file name as well, and attempt to remount the * This will take a path, which can contain the file name as well, and attempt to remount the
* underlying partition. * underlying partition.
* <p/> * <p/>
* For example, passing in the following string: * For example, passing in the following string:
* "/system/bin/some/directory/that/really/would/never/exist" will result in /system ultimately * "/system/bin/some/directory/that/really/would/never/exist" will result in /system ultimately
* being remounted. However, keep in mind that the longer the path you supply, the more work * being remounted. However, keep in mind that the longer the path you supply, the more work
* this has to do, and the slower it will run. * this has to do, and the slower it will run.
* *
* @param file * @param file
* file path * file path
* @param mountType * @param mountType
* mount type: pass in RO (Read only) or RW (Read Write) * mount type: pass in RO (Read only) or RW (Read Write)
* @return a <code>boolean</code> which indicates whether or not the partition has been * @return a <code>boolean</code> which indicates whether or not the partition has been
* remounted as specified. * remounted as specified.
*/ */
protected boolean remount(String file, String mountType) { protected boolean remount(String file, String mountType) {
// if the path has a trailing slash get rid of it. // if the path has a trailing slash get rid of it.
if (file.endsWith("/") && !file.equals("/")) { if (file.endsWith("/") && !file.equals("/")) {
file = file.substring(0, file.lastIndexOf("/")); file = file.substring(0, file.lastIndexOf("/"));
} }
// Make sure that what we are trying to remount is in the mount list. // Make sure that what we are trying to remount is in the mount list.
boolean foundMount = false; boolean foundMount = false;
while (!foundMount) { while (!foundMount) {
try { try {
for (Mount mount : getMounts()) { for (Mount mount : getMounts()) {
Log.d(RootCommands.TAG, mount.getMountPoint().toString()); Log.d(RootCommands.TAG, mount.getMountPoint().toString());
if (file.equals(mount.getMountPoint().toString())) { if (file.equals(mount.getMountPoint().toString())) {
foundMount = true; foundMount = true;
break; break;
} }
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(RootCommands.TAG, "Exception", e); Log.e(RootCommands.TAG, "Exception", e);
return false; return false;
} }
if (!foundMount) { if (!foundMount) {
try { try {
file = (new File(file).getParent()).toString(); file = (new File(file).getParent()).toString();
} catch (Exception e) { } catch (Exception e) {
Log.e(RootCommands.TAG, "Exception", e); Log.e(RootCommands.TAG, "Exception", e);
return false; return false;
} }
} }
} }
Mount mountPoint = findMountPointRecursive(file); Mount mountPoint = findMountPointRecursive(file);
Log.d(RootCommands.TAG, "Remounting " + mountPoint.getMountPoint().getAbsolutePath() Log.d(RootCommands.TAG, "Remounting " + mountPoint.getMountPoint().getAbsolutePath()
+ " as " + mountType.toLowerCase(Locale.US)); + " as " + mountType.toLowerCase(Locale.US));
final boolean isMountMode = mountPoint.getFlags().contains(mountType.toLowerCase(Locale.US)); final boolean isMountMode = mountPoint.getFlags().contains(mountType.toLowerCase(Locale.US));
if (!isMountMode) { if (!isMountMode) {
// grab an instance of the internal class // grab an instance of the internal class
try { try {
SimpleCommand command = new SimpleCommand("busybox mount -o remount," SimpleCommand command = new SimpleCommand("busybox mount -o remount,"
+ mountType.toLowerCase(Locale.US) + " " + mountPoint.getDevice().getAbsolutePath() + mountType.toLowerCase(Locale.US) + " " + mountPoint.getDevice().getAbsolutePath()
+ " " + mountPoint.getMountPoint().getAbsolutePath(), + " " + mountPoint.getMountPoint().getAbsolutePath(),
"toolbox mount -o remount," + mountType.toLowerCase(Locale.US) + " " "toolbox mount -o remount," + mountType.toLowerCase(Locale.US) + " "
+ mountPoint.getDevice().getAbsolutePath() + " " + mountPoint.getDevice().getAbsolutePath() + " "
+ mountPoint.getMountPoint().getAbsolutePath(), "mount -o remount," + mountPoint.getMountPoint().getAbsolutePath(), "mount -o remount,"
+ mountType.toLowerCase(Locale.US) + " " + mountType.toLowerCase(Locale.US) + " "
+ mountPoint.getDevice().getAbsolutePath() + " " + mountPoint.getDevice().getAbsolutePath() + " "
+ mountPoint.getMountPoint().getAbsolutePath(), + mountPoint.getMountPoint().getAbsolutePath(),
"/system/bin/toolbox mount -o remount," + mountType.toLowerCase(Locale.US) + " " "/system/bin/toolbox mount -o remount," + mountType.toLowerCase(Locale.US) + " "
+ mountPoint.getDevice().getAbsolutePath() + " " + mountPoint.getDevice().getAbsolutePath() + " "
+ mountPoint.getMountPoint().getAbsolutePath()); + mountPoint.getMountPoint().getAbsolutePath());
// execute on shell // execute on shell
shell.add(command).waitForFinish(); shell.add(command).waitForFinish();
} catch (Exception e) { } catch (Exception e) {
} }
mountPoint = findMountPointRecursive(file); mountPoint = findMountPointRecursive(file);
} }
if (mountPoint != null) { if (mountPoint != null) {
Log.d(RootCommands.TAG, mountPoint.getFlags() + " AND " + mountType.toLowerCase(Locale.US)); Log.d(RootCommands.TAG, mountPoint.getFlags() + " AND " + mountType.toLowerCase(Locale.US));
if (mountPoint.getFlags().contains(mountType.toLowerCase(Locale.US))) { if (mountPoint.getFlags().contains(mountType.toLowerCase(Locale.US))) {
Log.d(RootCommands.TAG, mountPoint.getFlags().toString()); Log.d(RootCommands.TAG, mountPoint.getFlags().toString());
return true; return true;
} else { } else {
Log.d(RootCommands.TAG, mountPoint.getFlags().toString()); Log.d(RootCommands.TAG, mountPoint.getFlags().toString());
} }
} else { } else {
Log.d(RootCommands.TAG, "mountPoint is null"); Log.d(RootCommands.TAG, "mountPoint is null");
} }
return false; return false;
} }
private Mount findMountPointRecursive(String file) { private Mount findMountPointRecursive(String file) {
try { try {
ArrayList<Mount> mounts = getMounts(); ArrayList<Mount> mounts = getMounts();
for (File path = new File(file); path != null;) { for (File path = new File(file); path != null;) {
for (Mount mount : mounts) { for (Mount mount : mounts) {
if (mount.getMountPoint().equals(path)) { if (mount.getMountPoint().equals(path)) {
return mount; return mount;
} }
} }
} }
return null; return null;
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (Exception e) { } catch (Exception e) {
Log.e(RootCommands.TAG, "Exception", e); Log.e(RootCommands.TAG, "Exception", e);
} }
return null; return null;
} }
/** /**
* This will return an ArrayList of the class Mount. The class mount contains the following * This will return an ArrayList of the class Mount. The class mount contains the following
* property's: device mountPoint type flags * property's: device mountPoint type flags
* <p/> * <p/>
* These will provide you with any information you need to work with the mount points. * These will provide you with any information you need to work with the mount points.
* *
* @return <code>ArrayList<Mount></code> an ArrayList of the class Mount. * @return <code>ArrayList<Mount></code> an ArrayList of the class Mount.
* @throws Exception * @throws Exception
* if we cannot return the mount points. * if we cannot return the mount points.
*/ */
protected static ArrayList<Mount> getMounts() throws Exception { protected static ArrayList<Mount> getMounts() throws Exception {
final String tempFile = "/data/local/RootToolsMounts"; final String tempFile = "/data/local/RootToolsMounts";
// copy /proc/mounts to tempfile. Directly reading it does not work on 4.3 // copy /proc/mounts to tempfile. Directly reading it does not work on 4.3
Shell shell = Shell.startRootShell(); Shell shell = Shell.startRootShell();
Toolbox tb = new Toolbox(shell); Toolbox tb = new Toolbox(shell);
tb.copyFile("/proc/mounts", tempFile, false, false); tb.copyFile("/proc/mounts", tempFile, false, false);
tb.setFilePermissions(tempFile, "777"); tb.setFilePermissions(tempFile, "777");
shell.close(); shell.close();
LineNumberReader lnr = null; LineNumberReader lnr = null;
lnr = new LineNumberReader(new FileReader(tempFile)); lnr = new LineNumberReader(new FileReader(tempFile));
String line; String line;
ArrayList<Mount> mounts = new ArrayList<Mount>(); ArrayList<Mount> mounts = new ArrayList<Mount>();
while ((line = lnr.readLine()) != null) { while ((line = lnr.readLine()) != null) {
Log.d(RootCommands.TAG, line); Log.d(RootCommands.TAG, line);
String[] fields = line.split(" "); String[] fields = line.split(" ");
mounts.add(new Mount(new File(fields[0]), // device mounts.add(new Mount(new File(fields[0]), // device
new File(fields[1]), // mountPoint new File(fields[1]), // mountPoint
fields[2], // fstype fields[2], // fstype
fields[3] // flags fields[3] // flags
)); ));
} }
lnr.close(); lnr.close();
return mounts; return mounts;
} }
} }

View File

@ -1,36 +1,36 @@
package org.sufficientlysecure.rootcommands; package org.sufficientlysecure.rootcommands;
import org.sufficientlysecure.rootcommands.util.Log; import org.sufficientlysecure.rootcommands.util.Log;
public class RootCommands { public class RootCommands {
public static boolean DEBUG = false; public static boolean DEBUG = false;
public static int DEFAULT_TIMEOUT = 10000; public static int DEFAULT_TIMEOUT = 10000;
public static final String TAG = "RootCommands"; public static final String TAG = "RootCommands";
/** /**
* General method to check if user has su binary and accepts root access for this program! * General method to check if user has su binary and accepts root access for this program!
* *
* @return true if everything worked * @return true if everything worked
*/ */
public static boolean rootAccessGiven() { public static boolean rootAccessGiven() {
boolean rootAccess = false; boolean rootAccess = false;
try { try {
Shell rootShell = Shell.startRootShell(); Shell rootShell = Shell.startRootShell();
Toolbox tb = new Toolbox(rootShell); Toolbox tb = new Toolbox(rootShell);
if (tb.isRootAccessGiven()) { if (tb.isRootAccessGiven()) {
rootAccess = true; rootAccess = true;
} }
rootShell.close(); rootShell.close();
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Problem while checking for root access!", e); Log.e(TAG, "Problem while checking for root access!", e);
} }
return rootAccess; return rootAccess;
} }
} }

View File

@ -1,331 +1,331 @@
package org.sufficientlysecure.rootcommands; package org.sufficientlysecure.rootcommands;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.Closeable; import java.io.Closeable;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.sufficientlysecure.rootcommands.command.Command; import org.sufficientlysecure.rootcommands.command.Command;
import org.sufficientlysecure.rootcommands.util.Log; import org.sufficientlysecure.rootcommands.util.Log;
import org.sufficientlysecure.rootcommands.util.RootAccessDeniedException; import org.sufficientlysecure.rootcommands.util.RootAccessDeniedException;
import org.sufficientlysecure.rootcommands.util.Utils; import org.sufficientlysecure.rootcommands.util.Utils;
public class Shell implements Closeable { public class Shell implements Closeable {
private final Process shellProcess; private final Process shellProcess;
private final BufferedReader stdOutErr; private final BufferedReader stdOutErr;
private final DataOutputStream outputStream; private final DataOutputStream outputStream;
private final List<Command> commands = new ArrayList<Command>(); private final List<Command> commands = new ArrayList<Command>();
private boolean close = false; private boolean close = false;
private static final String LD_LIBRARY_PATH = System.getenv("LD_LIBRARY_PATH"); private static final String LD_LIBRARY_PATH = System.getenv("LD_LIBRARY_PATH");
private static final String token = "F*D^W@#FGF"; private static final String token = "F*D^W@#FGF";
/** /**
* Start root shell * Start root shell
* *
* @param customEnv * @param customEnv
* @param baseDirectory * @param baseDirectory
* @return * @return
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public static Shell startRootShell(ArrayList<String> customEnv, String baseDirectory) public static Shell startRootShell(ArrayList<String> customEnv, String baseDirectory)
throws IOException, RootAccessDeniedException { throws IOException, RootAccessDeniedException {
Log.d(RootCommands.TAG, "Starting Root Shell!"); Log.d(RootCommands.TAG, "Starting Root Shell!");
// On some versions of Android (ICS) LD_LIBRARY_PATH is unset when using su // On some versions of Android (ICS) LD_LIBRARY_PATH is unset when using su
// We need to pass LD_LIBRARY_PATH over su for some commands to work correctly. // We need to pass LD_LIBRARY_PATH over su for some commands to work correctly.
if (customEnv == null) { if (customEnv == null) {
customEnv = new ArrayList<String>(); customEnv = new ArrayList<String>();
} }
customEnv.add("LD_LIBRARY_PATH=" + LD_LIBRARY_PATH); customEnv.add("LD_LIBRARY_PATH=" + LD_LIBRARY_PATH);
Shell shell = new Shell(Utils.getSuPath(), customEnv, baseDirectory); Shell shell = new Shell(Utils.getSuPath(), customEnv, baseDirectory);
return shell; return shell;
} }
/** /**
* Start root shell without custom environment and base directory * Start root shell without custom environment and base directory
* *
* @return * @return
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public static Shell startRootShell() throws IOException, RootAccessDeniedException { public static Shell startRootShell() throws IOException, RootAccessDeniedException {
return startRootShell(null, null); return startRootShell(null, null);
} }
/** /**
* Start default sh shell * Start default sh shell
* *
* @param customEnv * @param customEnv
* @param baseDirectory * @param baseDirectory
* @return * @return
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public static Shell startShell(ArrayList<String> customEnv, String baseDirectory) public static Shell startShell(ArrayList<String> customEnv, String baseDirectory)
throws IOException { throws IOException {
Log.d(RootCommands.TAG, "Starting Shell!"); Log.d(RootCommands.TAG, "Starting Shell!");
Shell shell = new Shell("sh", customEnv, baseDirectory); Shell shell = new Shell("sh", customEnv, baseDirectory);
return shell; return shell;
} }
/** /**
* Start default sh shell without custom environment and base directory * Start default sh shell without custom environment and base directory
* *
* @return * @return
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public static Shell startShell() throws IOException { public static Shell startShell() throws IOException {
return startShell(null, null); return startShell(null, null);
} }
/** /**
* Start custom shell defined by shellPath * Start custom shell defined by shellPath
* *
* @param shellPath * @param shellPath
* @param customEnv * @param customEnv
* @param baseDirectory * @param baseDirectory
* @return * @return
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public static Shell startCustomShell(String shellPath, ArrayList<String> customEnv, public static Shell startCustomShell(String shellPath, ArrayList<String> customEnv,
String baseDirectory) throws IOException { String baseDirectory) throws IOException {
Log.d(RootCommands.TAG, "Starting Custom Shell!"); Log.d(RootCommands.TAG, "Starting Custom Shell!");
Shell shell = new Shell(shellPath, customEnv, baseDirectory); Shell shell = new Shell(shellPath, customEnv, baseDirectory);
return shell; return shell;
} }
/** /**
* Start custom shell without custom environment and base directory * Start custom shell without custom environment and base directory
* *
* @param shellPath * @param shellPath
* @return * @return
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public static Shell startCustomShell(String shellPath) throws IOException { public static Shell startCustomShell(String shellPath) throws IOException {
return startCustomShell(shellPath, null, null); return startCustomShell(shellPath, null, null);
} }
private Shell(String shell, ArrayList<String> customEnv, String baseDirectory) private Shell(String shell, ArrayList<String> customEnv, String baseDirectory)
throws IOException, RootAccessDeniedException { throws IOException, RootAccessDeniedException {
Log.d(RootCommands.TAG, "Starting shell: " + shell); Log.d(RootCommands.TAG, "Starting shell: " + shell);
// start shell process! // start shell process!
shellProcess = Utils.runWithEnv(shell, customEnv, baseDirectory); shellProcess = Utils.runWithEnv(shell, customEnv, baseDirectory);
// StdErr is redirected to StdOut, defined in Command.getCommand() // StdErr is redirected to StdOut, defined in Command.getCommand()
stdOutErr = new BufferedReader(new InputStreamReader(shellProcess.getInputStream())); stdOutErr = new BufferedReader(new InputStreamReader(shellProcess.getInputStream()));
outputStream = new DataOutputStream(shellProcess.getOutputStream()); outputStream = new DataOutputStream(shellProcess.getOutputStream());
outputStream.write("echo Started\n".getBytes()); outputStream.write("echo Started\n".getBytes());
outputStream.flush(); outputStream.flush();
while (true) { while (true) {
String line = stdOutErr.readLine(); String line = stdOutErr.readLine();
if (line == null) if (line == null)
throw new RootAccessDeniedException( throw new RootAccessDeniedException(
"stdout line is null! Access was denied or this executeable is not a shell!"); "stdout line is null! Access was denied or this executeable is not a shell!");
if ("".equals(line)) if ("".equals(line))
continue; continue;
if ("Started".equals(line)) if ("Started".equals(line))
break; break;
destroyShellProcess(); destroyShellProcess();
throw new IOException("Unable to start shell, unexpected output \"" + line + "\""); throw new IOException("Unable to start shell, unexpected output \"" + line + "\"");
} }
new Thread(inputRunnable, "Shell Input").start(); new Thread(inputRunnable, "Shell Input").start();
new Thread(outputRunnable, "Shell Output").start(); new Thread(outputRunnable, "Shell Output").start();
} }
private Runnable inputRunnable = new Runnable() { private Runnable inputRunnable = new Runnable() {
public void run() { public void run() {
try { try {
writeCommands(); writeCommands();
} catch (IOException e) { } catch (IOException e) {
Log.e(RootCommands.TAG, "IO Exception", e); Log.e(RootCommands.TAG, "IO Exception", e);
} }
} }
}; };
private Runnable outputRunnable = new Runnable() { private Runnable outputRunnable = new Runnable() {
public void run() { public void run() {
try { try {
readOutput(); readOutput();
} catch (IOException e) { } catch (IOException e) {
Log.e(RootCommands.TAG, "IOException", e); Log.e(RootCommands.TAG, "IOException", e);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Log.e(RootCommands.TAG, "InterruptedException", e); Log.e(RootCommands.TAG, "InterruptedException", e);
} }
} }
}; };
/** /**
* Destroy shell process considering that the process could already be terminated * Destroy shell process considering that the process could already be terminated
*/ */
private void destroyShellProcess() { private void destroyShellProcess() {
try { try {
// Yes, this really is the way to check if the process is // Yes, this really is the way to check if the process is
// still running. // still running.
shellProcess.exitValue(); shellProcess.exitValue();
} catch (IllegalThreadStateException e) { } catch (IllegalThreadStateException e) {
// Only call destroy() if the process is still running; // Only call destroy() if the process is still running;
// Calling it for a terminated process will not crash, but // Calling it for a terminated process will not crash, but
// (starting with at least ICS/4.0) spam the log with INFO // (starting with at least ICS/4.0) spam the log with INFO
// messages ala "Failed to destroy process" and "kill // messages ala "Failed to destroy process" and "kill
// failed: ESRCH (No such process)". // failed: ESRCH (No such process)".
shellProcess.destroy(); shellProcess.destroy();
} }
Log.d(RootCommands.TAG, "Shell destroyed"); Log.d(RootCommands.TAG, "Shell destroyed");
} }
/** /**
* Writes queued commands one after another into the opened shell. After an execution a token is * Writes queued commands one after another into the opened shell. After an execution a token is
* written to seperate command output on read * written to seperate command output on read
* *
* @throws java.io.IOException * @throws java.io.IOException
*/ */
private void writeCommands() throws IOException { private void writeCommands() throws IOException {
try { try {
int commandIndex = 0; int commandIndex = 0;
while (true) { while (true) {
DataOutputStream out; DataOutputStream out;
synchronized (commands) { synchronized (commands) {
while (!close && commandIndex >= commands.size()) { while (!close && commandIndex >= commands.size()) {
commands.wait(); commands.wait();
} }
out = this.outputStream; out = this.outputStream;
} }
if (commandIndex < commands.size()) { if (commandIndex < commands.size()) {
Command next = commands.get(commandIndex); Command next = commands.get(commandIndex);
next.writeCommand(out); next.writeCommand(out);
String line = "\necho " + token + " " + commandIndex + " $?\n"; String line = "\necho " + token + " " + commandIndex + " $?\n";
out.write(line.getBytes()); out.write(line.getBytes());
out.flush(); out.flush();
commandIndex++; commandIndex++;
} else if (close) { } else if (close) {
out.write("\nexit 0\n".getBytes()); out.write("\nexit 0\n".getBytes());
out.flush(); out.flush();
out.close(); out.close();
Log.d(RootCommands.TAG, "Closing shell"); Log.d(RootCommands.TAG, "Closing shell");
return; return;
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
Log.e(RootCommands.TAG, "interrupted while writing command", e); Log.e(RootCommands.TAG, "interrupted while writing command", e);
} }
} }
/** /**
* Reads output line by line, seperated by token written after every command * Reads output line by line, seperated by token written after every command
* *
* @throws java.io.IOException * @throws java.io.IOException
* @throws InterruptedException * @throws InterruptedException
*/ */
private void readOutput() throws IOException, InterruptedException { private void readOutput() throws IOException, InterruptedException {
Command command = null; Command command = null;
// index of current command // index of current command
int commandIndex = 0; int commandIndex = 0;
while (true) { while (true) {
String lineStdOut = stdOutErr.readLine(); String lineStdOut = stdOutErr.readLine();
// terminate on EOF // terminate on EOF
if (lineStdOut == null) if (lineStdOut == null)
break; break;
if (command == null) { if (command == null) {
// break on close after last command // break on close after last command
if (commandIndex >= commands.size()) { if (commandIndex >= commands.size()) {
if (close) if (close)
break; break;
continue; continue;
} }
// get current command // get current command
command = commands.get(commandIndex); command = commands.get(commandIndex);
} }
int pos = lineStdOut.indexOf(token); int pos = lineStdOut.indexOf(token);
if (pos > 0) { if (pos > 0) {
command.processOutput(lineStdOut.substring(0, pos)); command.processOutput(lineStdOut.substring(0, pos));
} }
if (pos >= 0) { if (pos >= 0) {
lineStdOut = lineStdOut.substring(pos); lineStdOut = lineStdOut.substring(pos);
String fields[] = lineStdOut.split(" "); String fields[] = lineStdOut.split(" ");
int id = Integer.parseInt(fields[1]); int id = Integer.parseInt(fields[1]);
if (id == commandIndex) { if (id == commandIndex) {
command.setExitCode(Integer.parseInt(fields[2])); command.setExitCode(Integer.parseInt(fields[2]));
// go to next command // go to next command
commandIndex++; commandIndex++;
command = null; command = null;
continue; continue;
} }
} }
command.processOutput(lineStdOut); command.processOutput(lineStdOut);
} }
Log.d(RootCommands.TAG, "Read all output"); Log.d(RootCommands.TAG, "Read all output");
shellProcess.waitFor(); shellProcess.waitFor();
destroyShellProcess(); destroyShellProcess();
while (commandIndex < commands.size()) { while (commandIndex < commands.size()) {
if (command == null) { if (command == null) {
command = commands.get(commandIndex); command = commands.get(commandIndex);
} }
command.terminated("Unexpected Termination!"); command.terminated("Unexpected Termination!");
commandIndex++; commandIndex++;
command = null; command = null;
} }
} }
/** /**
* Add command to shell queue * Add command to shell queue
* *
* @param command * @param command
* @return * @return
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public Command add(Command command) throws IOException { public Command add(Command command) throws IOException {
if (close) if (close)
throw new IOException("Unable to add commands to a closed shell"); throw new IOException("Unable to add commands to a closed shell");
synchronized (commands) { synchronized (commands) {
commands.add(command); commands.add(command);
// set shell on the command object, to know where the command is running on // set shell on the command object, to know where the command is running on
command.addedToShell(this, (commands.size() - 1)); command.addedToShell(this, (commands.size() - 1));
commands.notifyAll(); commands.notifyAll();
} }
return command; return command;
} }
/** /**
* Close shell * Close shell
* *
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public void close() throws IOException { public void close() throws IOException {
synchronized (commands) { synchronized (commands) {
this.close = true; this.close = true;
commands.notifyAll(); commands.notifyAll();
} }
} }
/** /**
* Returns number of queued commands * Returns number of queued commands
* *
* @return * @return
*/ */
public int getCommandsSize() { public int getCommandsSize() {
return commands.size(); return commands.size();
} }
} }

View File

@ -1,108 +1,108 @@
package org.sufficientlysecure.rootcommands; package org.sufficientlysecure.rootcommands;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.location.LocationManager; import android.location.LocationManager;
import android.os.PowerManager; import android.os.PowerManager;
import android.provider.Settings; import android.provider.Settings;
/** /**
* This methods work when the apk is installed as a system app (under /system/app) * This methods work when the apk is installed as a system app (under /system/app)
*/ */
public class SystemCommands { public class SystemCommands {
Context context; Context context;
public SystemCommands(Context context) { public SystemCommands(Context context) {
super(); super();
this.context = context; this.context = context;
} }
/** /**
* Get GPS status * Get GPS status
* *
* @return * @return
*/ */
public boolean getGPS() { public boolean getGPS() {
return ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE)) return ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE))
.isProviderEnabled(LocationManager.GPS_PROVIDER); .isProviderEnabled(LocationManager.GPS_PROVIDER);
} }
/** /**
* Enable/Disable GPS * Enable/Disable GPS
* *
* @param value * @param value
*/ */
@TargetApi(8) @TargetApi(8)
public void setGPS(boolean value) { public void setGPS(boolean value) {
ContentResolver localContentResolver = context.getContentResolver(); ContentResolver localContentResolver = context.getContentResolver();
Settings.Secure.setLocationProviderEnabled(localContentResolver, Settings.Secure.setLocationProviderEnabled(localContentResolver,
LocationManager.GPS_PROVIDER, value); LocationManager.GPS_PROVIDER, value);
} }
/** /**
* TODO: Not ready yet * TODO: Not ready yet
*/ */
@TargetApi(8) @TargetApi(8)
public void reboot() { public void reboot() {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
pm.reboot("recovery"); pm.reboot("recovery");
pm.reboot(null); pm.reboot(null);
// not working: // not working:
// reboot(null); // reboot(null);
} }
/** /**
* Reboot the device immediately, passing 'reason' (may be null) to the underlying __reboot * Reboot the device immediately, passing 'reason' (may be null) to the underlying __reboot
* system call. Should not return. * system call. Should not return.
* *
* Taken from com.android.server.PowerManagerService.reboot * Taken from com.android.server.PowerManagerService.reboot
*/ */
// public void reboot(String reason) { // public void reboot(String reason) {
// //
// // final String finalReason = reason; // // final String finalReason = reason;
// Runnable runnable = new Runnable() { // Runnable runnable = new Runnable() {
// public void run() { // public void run() {
// synchronized (this) { // synchronized (this) {
// // ShutdownThread.reboot(mContext, finalReason, false); // // ShutdownThread.reboot(mContext, finalReason, false);
// try { // try {
// Class<?> clazz = Class.forName("com.android.internal.app.ShutdownThread"); // Class<?> clazz = Class.forName("com.android.internal.app.ShutdownThread");
// //
// // if (mReboot) { // // if (mReboot) {
// Method method = clazz.getMethod("reboot", Context.class, String.class, // Method method = clazz.getMethod("reboot", Context.class, String.class,
// Boolean.TYPE); // Boolean.TYPE);
// method.invoke(null, context, null, false); // method.invoke(null, context, null, false);
// //
// // if (mReboot) { // // if (mReboot) {
// // Method method = clazz.getMethod("reboot", Context.class, String.class, // // Method method = clazz.getMethod("reboot", Context.class, String.class,
// // Boolean.TYPE); // // Boolean.TYPE);
// // method.invoke(null, mContext, mReason, mConfirm); // // method.invoke(null, mContext, mReason, mConfirm);
// // } else { // // } else {
// // Method method = clazz.getMethod("shutdown", Context.class, Boolean.TYPE); // // Method method = clazz.getMethod("shutdown", Context.class, Boolean.TYPE);
// // method.invoke(null, mContext, mConfirm); // // method.invoke(null, mContext, mConfirm);
// // } // // }
// } catch (Exception e) { // } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
// } // }
// } // }
// //
// } // }
// }; // };
// // ShutdownThread must run on a looper capable of displaying the UI. // // ShutdownThread must run on a looper capable of displaying the UI.
// mHandler.post(runnable); // mHandler.post(runnable);
// //
// // PowerManager.reboot() is documented not to return so just wait for the inevitable. // // PowerManager.reboot() is documented not to return so just wait for the inevitable.
// // synchronized (runnable) { // // synchronized (runnable) {
// // while (true) { // // while (true) {
// // try { // // try {
// // runnable.wait(); // // runnable.wait();
// // } catch (InterruptedException e) { // // } catch (InterruptedException e) {
// // } // // }
// // } // // }
// // } // // }
// } // }
} }

View File

@ -1,155 +1,155 @@
package org.sufficientlysecure.rootcommands.command; package org.sufficientlysecure.rootcommands.command;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.sufficientlysecure.rootcommands.RootCommands; import org.sufficientlysecure.rootcommands.RootCommands;
import org.sufficientlysecure.rootcommands.Shell; import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.util.BrokenBusyboxException; import org.sufficientlysecure.rootcommands.util.BrokenBusyboxException;
import org.sufficientlysecure.rootcommands.util.Log; import org.sufficientlysecure.rootcommands.util.Log;
public abstract class Command { public abstract class Command {
final String command[]; final String command[];
boolean finished = false; boolean finished = false;
boolean brokenBusyboxDetected = false; boolean brokenBusyboxDetected = false;
int exitCode; int exitCode;
int id; int id;
int timeout = RootCommands.DEFAULT_TIMEOUT; int timeout = RootCommands.DEFAULT_TIMEOUT;
Shell shell = null; Shell shell = null;
public Command(String... command) { public Command(String... command) {
this.command = command; this.command = command;
} }
public Command(int timeout, String... command) { public Command(int timeout, String... command) {
this.command = command; this.command = command;
this.timeout = timeout; this.timeout = timeout;
} }
/** /**
* This is called from Shell after adding it * This is called from Shell after adding it
* *
* @param shell * @param shell
* @param id * @param id
*/ */
public void addedToShell(Shell shell, int id) { public void addedToShell(Shell shell, int id) {
this.shell = shell; this.shell = shell;
this.id = id; this.id = id;
} }
/** /**
* Gets command string executed on the shell * Gets command string executed on the shell
* *
* @return * @return
*/ */
public String getCommand() { public String getCommand() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < command.length; i++) { for (int i = 0; i < command.length; i++) {
// redirect stderr to stdout // redirect stderr to stdout
sb.append(command[i] + " 2>&1"); sb.append(command[i] + " 2>&1");
sb.append('\n'); sb.append('\n');
} }
Log.d(RootCommands.TAG, "Sending command(s): " + sb.toString()); Log.d(RootCommands.TAG, "Sending command(s): " + sb.toString());
return sb.toString(); return sb.toString();
} }
public void writeCommand(OutputStream out) throws IOException { public void writeCommand(OutputStream out) throws IOException {
out.write(getCommand().getBytes()); out.write(getCommand().getBytes());
} }
public void processOutput(String line) { public void processOutput(String line) {
Log.d(RootCommands.TAG, "ID: " + id + ", Output: " + line); Log.d(RootCommands.TAG, "ID: " + id + ", Output: " + line);
/* /*
* Try to detect broken toolbox/busybox binaries (see * Try to detect broken toolbox/busybox binaries (see
* https://code.google.com/p/busybox-android/issues/detail?id=1) * https://code.google.com/p/busybox-android/issues/detail?id=1)
* *
* It is giving "Value too large for defined data type" on certain file operations (e.g. ls * It is giving "Value too large for defined data type" on certain file operations (e.g. ls
* and chown) in certain directories (e.g. /data/data) * and chown) in certain directories (e.g. /data/data)
*/ */
if (line.contains("Value too large for defined data type")) { if (line.contains("Value too large for defined data type")) {
Log.e(RootCommands.TAG, "Busybox is broken with high probability due to line: " + line); Log.e(RootCommands.TAG, "Busybox is broken with high probability due to line: " + line);
brokenBusyboxDetected = true; brokenBusyboxDetected = true;
} }
// now execute specific output parsing // now execute specific output parsing
output(id, line); output(id, line);
} }
public abstract void output(int id, String line); public abstract void output(int id, String line);
public void processAfterExecution(int exitCode) { public void processAfterExecution(int exitCode) {
Log.d(RootCommands.TAG, "ID: " + id + ", ExitCode: " + exitCode); Log.d(RootCommands.TAG, "ID: " + id + ", ExitCode: " + exitCode);
afterExecution(id, exitCode); afterExecution(id, exitCode);
} }
public abstract void afterExecution(int id, int exitCode); public abstract void afterExecution(int id, int exitCode);
public void commandFinished(int id) { public void commandFinished(int id) {
Log.d(RootCommands.TAG, "Command " + id + " finished."); Log.d(RootCommands.TAG, "Command " + id + " finished.");
} }
public void setExitCode(int code) { public void setExitCode(int code) {
synchronized (this) { synchronized (this) {
exitCode = code; exitCode = code;
finished = true; finished = true;
commandFinished(id); commandFinished(id);
this.notifyAll(); this.notifyAll();
} }
} }
/** /**
* Close the shell * Close the shell
* *
* @param reason * @param reason
*/ */
public void terminate(String reason) { public void terminate(String reason) {
try { try {
shell.close(); shell.close();
Log.d(RootCommands.TAG, "Terminating the shell."); Log.d(RootCommands.TAG, "Terminating the shell.");
terminated(reason); terminated(reason);
} catch (IOException e) { } catch (IOException e) {
} }
} }
public void terminated(String reason) { public void terminated(String reason) {
setExitCode(-1); setExitCode(-1);
Log.d(RootCommands.TAG, "Command " + id + " did not finish, because of " + reason); Log.d(RootCommands.TAG, "Command " + id + " did not finish, because of " + reason);
} }
/** /**
* Waits for this command to finish and forwards exitCode into afterExecution method * Waits for this command to finish and forwards exitCode into afterExecution method
* *
* @param timeout * @param timeout
* @throws java.util.concurrent.TimeoutException * @throws java.util.concurrent.TimeoutException
* @throws BrokenBusyboxException * @throws BrokenBusyboxException
*/ */
public void waitForFinish() throws TimeoutException, BrokenBusyboxException { public void waitForFinish() throws TimeoutException, BrokenBusyboxException {
synchronized (this) { synchronized (this) {
while (!finished) { while (!finished) {
try { try {
this.wait(timeout); this.wait(timeout);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Log.e(RootCommands.TAG, "InterruptedException in waitForFinish()", e); Log.e(RootCommands.TAG, "InterruptedException in waitForFinish()", e);
} }
if (!finished) { if (!finished) {
finished = true; finished = true;
terminate("Timeout"); terminate("Timeout");
throw new TimeoutException("Timeout has occurred."); throw new TimeoutException("Timeout has occurred.");
} }
} }
if (brokenBusyboxDetected) { if (brokenBusyboxDetected) {
throw new BrokenBusyboxException(); throw new BrokenBusyboxException();
} }
processAfterExecution(exitCode); processAfterExecution(exitCode);
} }
} }
} }

View File

@ -1,51 +1,51 @@
package org.sufficientlysecure.rootcommands.command; package org.sufficientlysecure.rootcommands.command;
import java.io.File; import java.io.File;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
public abstract class ExecutableCommand extends Command { public abstract class ExecutableCommand extends Command {
public static final String EXECUTABLE_PREFIX = "lib"; public static final String EXECUTABLE_PREFIX = "lib";
public static final String EXECUTABLE_SUFFIX = "_exec.so"; public static final String EXECUTABLE_SUFFIX = "_exec.so";
/** /**
* This class provides a way to use your own binaries! * This class provides a way to use your own binaries!
* *
* Include your own executables, renamed from * to lib*_exec.so, in your libs folder under the * Include your own executables, renamed from * to lib*_exec.so, in your libs folder under the
* architecture directories. Now they will be deployed by Android the same way libraries are * architecture directories. Now they will be deployed by Android the same way libraries are
* deployed! * deployed!
* *
* See README for more information how to use your own executables! * See README for more information how to use your own executables!
* *
* @param context * @param context
* @param executableName * @param executableName
* @param parameters * @param parameters
*/ */
public ExecutableCommand(Context context, String executableName, String parameters) { public ExecutableCommand(Context context, String executableName, String parameters) {
super(getLibDirectory(context) + File.separator + EXECUTABLE_PREFIX + executableName super(getLibDirectory(context) + File.separator + EXECUTABLE_PREFIX + executableName
+ EXECUTABLE_SUFFIX + " " + parameters); + EXECUTABLE_SUFFIX + " " + parameters);
} }
/** /**
* Get full path to lib directory of app * Get full path to lib directory of app
* *
* @return dir as String * @return dir as String
*/ */
@SuppressLint("NewApi") @SuppressLint("NewApi")
private static String getLibDirectory(Context context) { private static String getLibDirectory(Context context) {
if (Build.VERSION.SDK_INT >= 9) { if (Build.VERSION.SDK_INT >= 9) {
return context.getApplicationInfo().nativeLibraryDir; return context.getApplicationInfo().nativeLibraryDir;
} else { } else {
return context.getApplicationInfo().dataDir + File.separator + "lib"; return context.getApplicationInfo().dataDir + File.separator + "lib";
} }
} }
public abstract void output(int id, String line); public abstract void output(int id, String line);
public abstract void afterExecution(int id, int exitCode); public abstract void afterExecution(int id, int exitCode);
} }

View File

@ -1,29 +1,29 @@
package org.sufficientlysecure.rootcommands.command; package org.sufficientlysecure.rootcommands.command;
public class SimpleCommand extends Command { public class SimpleCommand extends Command {
private StringBuilder sb = new StringBuilder(); private StringBuilder sb = new StringBuilder();
public SimpleCommand(String... command) { public SimpleCommand(String... command) {
super(command); super(command);
} }
@Override @Override
public void output(int id, String line) { public void output(int id, String line) {
sb.append(line).append('\n'); sb.append(line).append('\n');
} }
@Override @Override
public void afterExecution(int id, int exitCode) { public void afterExecution(int id, int exitCode) {
} }
public String getOutput() { public String getOutput() {
return sb.toString(); return sb.toString();
} }
public int getExitCode() { public int getExitCode() {
return exitCode; return exitCode;
} }
} }

View File

@ -1,31 +1,31 @@
package org.sufficientlysecure.rootcommands.command; package org.sufficientlysecure.rootcommands.command;
import android.content.Context; import android.content.Context;
public class SimpleExecutableCommand extends ExecutableCommand { public class SimpleExecutableCommand extends ExecutableCommand {
private StringBuilder sb = new StringBuilder(); private StringBuilder sb = new StringBuilder();
public SimpleExecutableCommand(Context context, String executableName, String parameters) { public SimpleExecutableCommand(Context context, String executableName, String parameters) {
super(context, executableName, parameters); super(context, executableName, parameters);
} }
@Override @Override
public void output(int id, String line) { public void output(int id, String line) {
sb.append(line).append('\n'); sb.append(line).append('\n');
} }
@Override @Override
public void afterExecution(int id, int exitCode) { public void afterExecution(int id, int exitCode) {
} }
public String getOutput() { public String getOutput() {
return sb.toString(); return sb.toString();
} }
public int getExitCode() { public int getExitCode() {
return exitCode; return exitCode;
} }
} }

View File

@ -1,18 +1,18 @@
package org.sufficientlysecure.rootcommands.util; package org.sufficientlysecure.rootcommands.util;
import java.io.IOException; import java.io.IOException;
public class BrokenBusyboxException extends IOException { public class BrokenBusyboxException extends IOException {
private static final long serialVersionUID = 8337358201589488409L; private static final long serialVersionUID = 8337358201589488409L;
public BrokenBusyboxException() { public BrokenBusyboxException() {
super(); super();
} }
public BrokenBusyboxException(String detailMessage) { public BrokenBusyboxException(String detailMessage) {
super(detailMessage); super(detailMessage);
} }
} }

View File

@ -1,69 +1,69 @@
package org.sufficientlysecure.rootcommands.util; package org.sufficientlysecure.rootcommands.util;
import org.sufficientlysecure.rootcommands.RootCommands; import org.sufficientlysecure.rootcommands.RootCommands;
/** /**
* Wraps Android Logging to enable or disable debug output using Constants * Wraps Android Logging to enable or disable debug output using Constants
* *
*/ */
public final class Log { public final class Log {
public static void v(String tag, String msg) { public static void v(String tag, String msg) {
if (RootCommands.DEBUG) { if (RootCommands.DEBUG) {
android.util.Log.v(tag, msg); android.util.Log.v(tag, msg);
} }
} }
public static void v(String tag, String msg, Throwable tr) { public static void v(String tag, String msg, Throwable tr) {
if (RootCommands.DEBUG) { if (RootCommands.DEBUG) {
android.util.Log.v(tag, msg, tr); android.util.Log.v(tag, msg, tr);
} }
} }
public static void d(String tag, String msg) { public static void d(String tag, String msg) {
if (RootCommands.DEBUG) { if (RootCommands.DEBUG) {
android.util.Log.d(tag, msg); android.util.Log.d(tag, msg);
} }
} }
public static void d(String tag, String msg, Throwable tr) { public static void d(String tag, String msg, Throwable tr) {
if (RootCommands.DEBUG) { if (RootCommands.DEBUG) {
android.util.Log.d(tag, msg, tr); android.util.Log.d(tag, msg, tr);
} }
} }
public static void i(String tag, String msg) { public static void i(String tag, String msg) {
if (RootCommands.DEBUG) { if (RootCommands.DEBUG) {
android.util.Log.i(tag, msg); android.util.Log.i(tag, msg);
} }
} }
public static void i(String tag, String msg, Throwable tr) { public static void i(String tag, String msg, Throwable tr) {
if (RootCommands.DEBUG) { if (RootCommands.DEBUG) {
android.util.Log.i(tag, msg, tr); android.util.Log.i(tag, msg, tr);
} }
} }
public static void w(String tag, String msg) { public static void w(String tag, String msg) {
android.util.Log.w(tag, msg); android.util.Log.w(tag, msg);
} }
public static void w(String tag, String msg, Throwable tr) { public static void w(String tag, String msg, Throwable tr) {
android.util.Log.w(tag, msg, tr); android.util.Log.w(tag, msg, tr);
} }
public static void w(String tag, Throwable tr) { public static void w(String tag, Throwable tr) {
android.util.Log.w(tag, tr); android.util.Log.w(tag, tr);
} }
public static void e(String tag, String msg) { public static void e(String tag, String msg) {
android.util.Log.e(tag, msg); android.util.Log.e(tag, msg);
} }
public static void e(String tag, String msg, Throwable tr) { public static void e(String tag, String msg, Throwable tr) {
android.util.Log.e(tag, msg, tr); android.util.Log.e(tag, msg, tr);
} }
} }

View File

@ -1,18 +1,18 @@
package org.sufficientlysecure.rootcommands.util; package org.sufficientlysecure.rootcommands.util;
import java.io.IOException; import java.io.IOException;
public class RootAccessDeniedException extends IOException { public class RootAccessDeniedException extends IOException {
private static final long serialVersionUID = 9088998884166225540L; private static final long serialVersionUID = 9088998884166225540L;
public RootAccessDeniedException() { public RootAccessDeniedException() {
super(); super();
} }
public RootAccessDeniedException(String detailMessage) { public RootAccessDeniedException(String detailMessage) {
super(detailMessage); super(detailMessage);
} }
} }

View File

@ -1,16 +1,16 @@
package org.sufficientlysecure.rootcommands.util; package org.sufficientlysecure.rootcommands.util;
public class UnsupportedArchitectureException extends Exception { public class UnsupportedArchitectureException extends Exception {
private static final long serialVersionUID = 7826528799780001655L; private static final long serialVersionUID = 7826528799780001655L;
public UnsupportedArchitectureException() { public UnsupportedArchitectureException() {
super(); super();
} }
public UnsupportedArchitectureException(String detailMessage) { public UnsupportedArchitectureException(String detailMessage) {
super(detailMessage); super(detailMessage);
} }
} }

View File

@ -1,89 +1,89 @@
package org.sufficientlysecure.rootcommands.util; package org.sufficientlysecure.rootcommands.util;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map; import java.util.Map;
import org.sufficientlysecure.rootcommands.RootCommands; import org.sufficientlysecure.rootcommands.RootCommands;
public class Utils { public class Utils {
/* /*
* The emulator and ADP1 device both have a su binary in /system/xbin/su, but it doesn't allow * The emulator and ADP1 device both have a su binary in /system/xbin/su, but it doesn't allow
* apps to use it (su app_29 $ su su: uid 10029 not allowed to su). * apps to use it (su app_29 $ su su: uid 10029 not allowed to su).
* *
* Cyanogen used to have su in /system/bin/su, in newer versions it's a symlink to * Cyanogen used to have su in /system/bin/su, in newer versions it's a symlink to
* /system/xbin/su. * /system/xbin/su.
* *
* The Archos tablet has it in /data/bin/su, since they don't have write access to /system yet. * The Archos tablet has it in /data/bin/su, since they don't have write access to /system yet.
*/ */
static final String[] BinaryPlaces = { "/data/bin/", "/system/bin/", "/system/xbin/", "/sbin/", static final String[] BinaryPlaces = { "/data/bin/", "/system/bin/", "/system/xbin/", "/sbin/",
"/data/local/xbin/", "/data/local/bin/", "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/xbin/", "/data/local/bin/", "/system/sd/xbin/", "/system/bin/failsafe/",
"/data/local/" }; "/data/local/" };
/** /**
* Determine the path of the su executable. * Determine the path of the su executable.
* *
* Code from https://github.com/miracle2k/android-autostarts, use under Apache License was * Code from https://github.com/miracle2k/android-autostarts, use under Apache License was
* agreed by Michael Elsdörfer * agreed by Michael Elsdörfer
*/ */
public static String getSuPath() { public static String getSuPath() {
for (String p : BinaryPlaces) { for (String p : BinaryPlaces) {
File su = new File(p + "su"); File su = new File(p + "su");
if (su.exists()) { if (su.exists()) {
Log.d(RootCommands.TAG, "su found at: " + p); Log.d(RootCommands.TAG, "su found at: " + p);
return su.getAbsolutePath(); return su.getAbsolutePath();
} else { } else {
Log.v(RootCommands.TAG, "No su in: " + p); Log.v(RootCommands.TAG, "No su in: " + p);
} }
} }
Log.d(RootCommands.TAG, "No su found in a well-known location, " + "will just use \"su\"."); Log.d(RootCommands.TAG, "No su found in a well-known location, " + "will just use \"su\".");
return "su"; return "su";
} }
/** /**
* This code is adapted from java.lang.ProcessBuilder.start(). * This code is adapted from java.lang.ProcessBuilder.start().
* *
* The problem is that Android doesn't allow us to modify the map returned by * The problem is that Android doesn't allow us to modify the map returned by
* ProcessBuilder.environment(), even though the docstring indicates that it should. This is * ProcessBuilder.environment(), even though the docstring indicates that it should. This is
* because it simply returns the SystemEnvironment object that System.getenv() gives us. The * because it simply returns the SystemEnvironment object that System.getenv() gives us. The
* relevant portion in the source code is marked as "// android changed", so presumably it's not * relevant portion in the source code is marked as "// android changed", so presumably it's not
* the case in the original version of the Apache Harmony project. * the case in the original version of the Apache Harmony project.
* *
* Note that simply passing the environment variables we want to Process.exec won't be good * Note that simply passing the environment variables we want to Process.exec won't be good
* enough, since that would override the environment we inherited completely. * enough, since that would override the environment we inherited completely.
* *
* We needed to be able to set a CLASSPATH environment variable for our new process in order to * We needed to be able to set a CLASSPATH environment variable for our new process in order to
* use the "app_process" command directly. Note: "app_process" takes arguments passed on to the * use the "app_process" command directly. Note: "app_process" takes arguments passed on to the
* Dalvik VM as well; this might be an alternative way to set the class path. * Dalvik VM as well; this might be an alternative way to set the class path.
* *
* Code from https://github.com/miracle2k/android-autostarts, use under Apache License was * Code from https://github.com/miracle2k/android-autostarts, use under Apache License was
* agreed by Michael Elsdörfer * agreed by Michael Elsdörfer
*/ */
public static Process runWithEnv(String command, ArrayList<String> customAddedEnv, public static Process runWithEnv(String command, ArrayList<String> customAddedEnv,
String baseDirectory) throws IOException { String baseDirectory) throws IOException {
Map<String, String> environment = System.getenv(); Map<String, String> environment = System.getenv();
String[] envArray = new String[environment.size() String[] envArray = new String[environment.size()
+ (customAddedEnv != null ? customAddedEnv.size() : 0)]; + (customAddedEnv != null ? customAddedEnv.size() : 0)];
int i = 0; int i = 0;
for (Map.Entry<String, String> entry : environment.entrySet()) { for (Map.Entry<String, String> entry : environment.entrySet()) {
envArray[i++] = entry.getKey() + "=" + entry.getValue(); envArray[i++] = entry.getKey() + "=" + entry.getValue();
} }
if (customAddedEnv != null) { if (customAddedEnv != null) {
for (String entry : customAddedEnv) { for (String entry : customAddedEnv) {
envArray[i++] = entry; envArray[i++] = entry;
} }
} }
Process process; Process process;
if (baseDirectory == null) { if (baseDirectory == null) {
process = Runtime.getRuntime().exec(command, envArray, null); process = Runtime.getRuntime().exec(command, envArray, null);
} else { } else {
process = Runtime.getRuntime().exec(command, envArray, new File(baseDirectory)); process = Runtime.getRuntime().exec(command, envArray, new File(baseDirectory));
} }
return process; return process;
} }
} }

View File

@ -1 +1 @@
/build /build

View File

@ -1,78 +1,77 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
lintOptions { lintOptions {
disable 'MissingTranslation', 'ExtraTranslation' disable 'MissingTranslation', 'ExtraTranslation'
} }
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion '21.0.2' buildToolsVersion '21.0.2'
defaultConfig { defaultConfig {
applicationId "sharedcode.turboeditor" applicationId "sharedcode.turboeditor"
minSdkVersion 11 minSdkVersion 11
targetSdkVersion 21 targetSdkVersion 21
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
buildTypes { buildTypes {
release { release {
runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }
} }
}
lintOptions {
lintOptions { abortOnError false
abortOnError false }
}
packagingOptions {
packagingOptions { exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE.txt' }
} }
}
dependencies {
dependencies { compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':libraries:RootCommands')
compile project(':libraries:RootCommands') compile project(':libraries:FloatingActionButton')
compile project(':libraries:FloatingActionButton') //compile('de.greenrobot:eventbus:2.2.1') {
//compile('de.greenrobot:eventbus:2.2.1') { // exclude module: 'support-v4'
// exclude module: 'support-v4' // }
// } // compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
// compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3' compile 'org.apache.commons:commons-lang3:3.1'
compile 'org.apache.commons:commons-lang3:3.1' compile files('libs/juniversalchardet-1.0.3.jar')
compile files('libs/juniversalchardet-1.0.3.jar') compile ("com.android.support:appcompat-v7:21.+") {
compile ("com.android.support:appcompat-v7:21.+") { exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-v4' }
} compile 'com.android.support:support-v4:21.+'
compile 'com.android.support:support-v4:21.+' compile 'com.github.gabrielemariotti.changeloglib:library:1.5.1'
compile 'com.github.gabrielemariotti.changeloglib:library:1.5.1' compile 'commons-io:commons-io:2.4'
compile 'commons-io:commons-io:2.4' compile 'com.android.support:support-annotations:20.0.0'
compile 'com.android.support:support-annotations:20.0.0' }
}

View File

@ -1,17 +1,17 @@
# Add project specific ProGuard rules here. # Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified # By default, the flags in this file are appended to flags specified
# in C:/Users/Vlad/AppData/Local/Android/android-sdk/tools/proguard/proguard-android.txt # in C:/Users/Vlad/AppData/Local/Android/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles # You can edit the include path and order by changing the proguardFiles
# directive in build.gradle. # directive in build.gradle.
# #
# For more details, see # For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html # http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here: # Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following # If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface # and specify the fully qualified class name to the JavaScript interface
# class: # class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *; # public *;
#} #}

View File

@ -1,32 +1,32 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor; package sharedcode.turboeditor;
import android.app.Application; import android.app.Application;
import android.test.ApplicationTestCase; import android.test.ApplicationTestCase;
/** /**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/ */
public class ApplicationTest extends ApplicationTestCase<Application> { public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() { public ApplicationTest() {
super(Application.class); super(Application.class);
} }
} }

View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
~ Copyright (C) 2014 Vlad Mihalachi ~ Copyright (C) 2014 Vlad Mihalachi
~ ~
~ This file is part of Turbo Editor. ~ This file is part of Turbo Editor.
~ ~
~ Turbo Editor is free software: you can redistribute it and/or modify ~ Turbo Editor is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by ~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or ~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version. ~ (at your option) any later version.
~ ~
~ Turbo Editor is distributed in the hope that it will be useful, ~ Turbo Editor is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details. ~ GNU General Public License for more details.
~ ~
~ You should have received a copy of the GNU General Public License ~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sharedcode.turboeditor" > package="sharedcode.turboeditor" >
</manifest> </manifest>

View File

@ -1,389 +1,389 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.activity; package sharedcode.turboeditor.activity;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.SearchView; import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.Filter; import android.widget.Filter;
import android.widget.ListView; import android.widget.ListView;
import android.widget.PopupMenu; import android.widget.PopupMenu;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.faizmalkani.floatingactionbutton.FloatingActionButton; import com.faizmalkani.floatingactionbutton.FloatingActionButton;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.sufficientlysecure.rootcommands.Shell; import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.Toolbox; import org.sufficientlysecure.rootcommands.Toolbox;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.adapter.AdapterDetailedList; import sharedcode.turboeditor.adapter.AdapterDetailedList;
import sharedcode.turboeditor.dialogfragment.EditTextDialog; import sharedcode.turboeditor.dialogfragment.EditTextDialog;
import sharedcode.turboeditor.preferences.PreferenceHelper; import sharedcode.turboeditor.preferences.PreferenceHelper;
import sharedcode.turboeditor.root.RootUtils; import sharedcode.turboeditor.root.RootUtils;
import sharedcode.turboeditor.util.AlphanumComparator; import sharedcode.turboeditor.util.AlphanumComparator;
import sharedcode.turboeditor.util.Build; import sharedcode.turboeditor.util.Build;
import sharedcode.turboeditor.util.ThemeUtils; import sharedcode.turboeditor.util.ThemeUtils;
public class SelectFileActivity extends ActionBarActivity implements SearchView.OnQueryTextListener, AdapterView.OnItemClickListener, EditTextDialog.EditDialogListener { public class SelectFileActivity extends ActionBarActivity implements SearchView.OnQueryTextListener, AdapterView.OnItemClickListener, EditTextDialog.EditDialogListener {
private String currentFolder = PreferenceHelper.SD_CARD_ROOT; private String currentFolder = PreferenceHelper.SD_CARD_ROOT;
private ListView listView; private ListView listView;
private boolean wantAFile = true; private boolean wantAFile = true;
private MenuItem mSearchViewMenuItem; private MenuItem mSearchViewMenuItem;
private SearchView mSearchView; private SearchView mSearchView;
private Filter filter; private Filter filter;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
ThemeUtils.setTheme(this); ThemeUtils.setTheme(this);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_file); setContentView(R.layout.activity_select_file);
Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final Actions action = (Actions) getIntent().getExtras().getSerializable("action"); final Actions action = (Actions) getIntent().getExtras().getSerializable("action");
wantAFile = action == Actions.SelectFile; wantAFile = action == Actions.SelectFile;
listView = (ListView) findViewById(android.R.id.list); listView = (ListView) findViewById(android.R.id.list);
listView.setOnItemClickListener(this); listView.setOnItemClickListener(this);
listView.setTextFilterEnabled(true); listView.setTextFilterEnabled(true);
FloatingActionButton mFab = (FloatingActionButton) findViewById(R.id.fabbutton); FloatingActionButton mFab = (FloatingActionButton) findViewById(R.id.fabbutton);
mFab.setColor(getResources().getColor(R.color.fab_light)); mFab.setColor(getResources().getColor(R.color.fab_light));
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_add)); mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_add));
mFab.setOnClickListener(new View.OnClickListener() { mFab.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
PopupMenu popup = new PopupMenu(SelectFileActivity.this, v); PopupMenu popup = new PopupMenu(SelectFileActivity.this, v);
popup.getMenuInflater().inflate(R.menu.popup_new_file, popup.getMenu()); popup.getMenuInflater().inflate(R.menu.popup_new_file, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
int i = item.getItemId(); int i = item.getItemId();
if (i == R.id.im_new_file) { if (i == R.id.im_new_file) {
EditTextDialog.newInstance(EditTextDialog.Actions.NewFile).show(getFragmentManager().beginTransaction(), "dialog"); EditTextDialog.newInstance(EditTextDialog.Actions.NewFile).show(getFragmentManager().beginTransaction(), "dialog");
return true; return true;
} else if (i == R.id.im_new_folder) { } else if (i == R.id.im_new_folder) {
EditTextDialog.newInstance(EditTextDialog.Actions.NewFolder).show(getFragmentManager().beginTransaction(), "dialog"); EditTextDialog.newInstance(EditTextDialog.Actions.NewFolder).show(getFragmentManager().beginTransaction(), "dialog");
return true; return true;
} else { } else {
return false; return false;
} }
} }
}); });
popup.show(); popup.show();
} }
}); });
mFab.listenTo(listView); mFab.listenTo(listView);
String lastNavigatedPath = PreferenceHelper.getWorkingFolder(this); String lastNavigatedPath = PreferenceHelper.getWorkingFolder(this);
File file = new File(lastNavigatedPath); File file = new File(lastNavigatedPath);
if (!file.exists()) { if (!file.exists()) {
PreferenceHelper.setWorkingFolder(this, PreferenceHelper.SD_CARD_ROOT); PreferenceHelper.setWorkingFolder(this, PreferenceHelper.SD_CARD_ROOT);
file = new File(PreferenceHelper.SD_CARD_ROOT); file = new File(PreferenceHelper.SD_CARD_ROOT);
} }
new UpdateList().execute(file.getAbsolutePath()); new UpdateList().execute(file.getAbsolutePath());
} }
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (currentFolder.isEmpty() || currentFolder.equals("/")) { if (currentFolder.isEmpty() || currentFolder.equals("/")) {
finish(); finish();
} else { } else {
File file = new File(currentFolder); File file = new File(currentFolder);
String parentFolder = file.getParent(); String parentFolder = file.getParent();
new UpdateList().execute(parentFolder); new UpdateList().execute(parentFolder);
} }
} }
public boolean onQueryTextChange(String newText) { public boolean onQueryTextChange(String newText) {
if (filter == null) if (filter == null)
return true; return true;
if (TextUtils.isEmpty(newText)) { if (TextUtils.isEmpty(newText)) {
filter.filter(null); filter.filter(null);
} else { } else {
filter.filter(newText); filter.filter(newText);
} }
return true; return true;
} }
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
return false; return false;
} }
void returnData(String path) { void returnData(String path) {
final Intent returnIntent = new Intent(); final Intent returnIntent = new Intent();
returnIntent.putExtra("path", path); returnIntent.putExtra("path", path);
setResult(RESULT_OK, returnIntent); setResult(RESULT_OK, returnIntent);
// finish the activity // finish the activity
finish(); finish();
} }
@Override @Override
public void onItemClick(AdapterView<?> parent, public void onItemClick(AdapterView<?> parent,
View view, int position, long id) { View view, int position, long id) {
final String name = ((TextView) view.findViewById(android.R.id.text1)).getText().toString(); final String name = ((TextView) view.findViewById(android.R.id.text1)).getText().toString();
if (name.equals("..")) { if (name.equals("..")) {
if (currentFolder.equals("/")) { if (currentFolder.equals("/")) {
new UpdateList().execute(PreferenceHelper.getWorkingFolder(this)); new UpdateList().execute(PreferenceHelper.getWorkingFolder(this));
} else { } else {
File tempFile = new File(currentFolder); File tempFile = new File(currentFolder);
if (tempFile.isFile()) { if (tempFile.isFile()) {
tempFile = tempFile.getParentFile() tempFile = tempFile.getParentFile()
.getParentFile(); .getParentFile();
} else { } else {
tempFile = tempFile.getParentFile(); tempFile = tempFile.getParentFile();
} }
new UpdateList().execute(tempFile.getAbsolutePath()); new UpdateList().execute(tempFile.getAbsolutePath());
} }
return; return;
} else if (name.equals(getString(R.string.home))) { } else if (name.equals(getString(R.string.home))) {
new UpdateList().execute(PreferenceHelper.getWorkingFolder(this)); new UpdateList().execute(PreferenceHelper.getWorkingFolder(this));
return; return;
} }
final File selectedFile = new File(currentFolder, name); final File selectedFile = new File(currentFolder, name);
if (selectedFile.isFile() && wantAFile) { if (selectedFile.isFile() && wantAFile) {
returnData(selectedFile.getAbsolutePath()); returnData(selectedFile.getAbsolutePath());
} else if (selectedFile.isDirectory()) { } else if (selectedFile.isDirectory()) {
new UpdateList().execute(selectedFile.getAbsolutePath()); new UpdateList().execute(selectedFile.getAbsolutePath());
} }
} }
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_select_file, menu); getMenuInflater().inflate(R.menu.activity_select_file, menu);
mSearchViewMenuItem = menu.findItem(R.id.im_search); mSearchViewMenuItem = menu.findItem(R.id.im_search);
mSearchView = (SearchView) MenuItemCompat.getActionView(mSearchViewMenuItem); mSearchView = (SearchView) MenuItemCompat.getActionView(mSearchViewMenuItem);
mSearchView.setIconifiedByDefault(true); mSearchView.setIconifiedByDefault(true);
mSearchView.setOnQueryTextListener(this); mSearchView.setOnQueryTextListener(this);
mSearchView.setSubmitButtonEnabled(false); mSearchView.setSubmitButtonEnabled(false);
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
@Override @Override
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {
// menu items // menu items
MenuItem imSetAsWorkingFolder = menu.findItem(R.id.im_set_as_working_folder); MenuItem imSetAsWorkingFolder = menu.findItem(R.id.im_set_as_working_folder);
MenuItem imIsWorkingFolder = menu.findItem(R.id.im_is_working_folder); MenuItem imIsWorkingFolder = menu.findItem(R.id.im_is_working_folder);
MenuItem imSelectFolder = menu.findItem(R.id.im_select_folder); MenuItem imSelectFolder = menu.findItem(R.id.im_select_folder);
if (imSetAsWorkingFolder != null) { if (imSetAsWorkingFolder != null) {
// set the imSetAsWorkingFolder visible only if the two folder dont concide // set the imSetAsWorkingFolder visible only if the two folder dont concide
imSetAsWorkingFolder.setVisible(!currentFolder.equals(PreferenceHelper.getWorkingFolder(SelectFileActivity.this))); imSetAsWorkingFolder.setVisible(!currentFolder.equals(PreferenceHelper.getWorkingFolder(SelectFileActivity.this)));
} }
if (imIsWorkingFolder != null) { if (imIsWorkingFolder != null) {
// set visible is the other is invisible // set visible is the other is invisible
imIsWorkingFolder.setVisible(!imSetAsWorkingFolder.isVisible()); imIsWorkingFolder.setVisible(!imSetAsWorkingFolder.isVisible());
} }
if (imSelectFolder != null) { if (imSelectFolder != null) {
imSelectFolder.setVisible(!wantAFile); imSelectFolder.setVisible(!wantAFile);
} }
return super.onPrepareOptionsMenu(menu); return super.onPrepareOptionsMenu(menu);
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
int i = item.getItemId(); int i = item.getItemId();
if (i == android.R.id.home) { if (i == android.R.id.home) {
finish(); finish();
return true; return true;
} else if (i == R.id.im_set_as_working_folder) { } else if (i == R.id.im_set_as_working_folder) {
PreferenceHelper.setWorkingFolder(SelectFileActivity.this, currentFolder); PreferenceHelper.setWorkingFolder(SelectFileActivity.this, currentFolder);
invalidateOptionsMenu(); invalidateOptionsMenu();
return true; return true;
} else if (i == R.id.im_is_working_folder) { } else if (i == R.id.im_is_working_folder) {
Toast.makeText(getBaseContext(), R.string.is_the_working_folder, Toast.LENGTH_SHORT).show(); Toast.makeText(getBaseContext(), R.string.is_the_working_folder, Toast.LENGTH_SHORT).show();
return true; return true;
} else if (i == R.id.im_select_folder) { } else if (i == R.id.im_select_folder) {
returnData(currentFolder); returnData(currentFolder);
return true; return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Override @Override
public void onFinishEditDialog(final String inputText, final String hint, final EditTextDialog.Actions actions) { public void onFinishEditDialog(final String inputText, final String hint, final EditTextDialog.Actions actions) {
if (actions == EditTextDialog.Actions.NewFile && !TextUtils.isEmpty(inputText)) { if (actions == EditTextDialog.Actions.NewFile && !TextUtils.isEmpty(inputText)) {
File file = new File(currentFolder, inputText); File file = new File(currentFolder, inputText);
returnData(file.getAbsolutePath()); returnData(file.getAbsolutePath());
} else if (actions == EditTextDialog.Actions.NewFolder && !TextUtils.isEmpty(inputText)) { } else if (actions == EditTextDialog.Actions.NewFolder && !TextUtils.isEmpty(inputText)) {
File file = new File(currentFolder, inputText); File file = new File(currentFolder, inputText);
file.mkdirs(); file.mkdirs();
new UpdateList().execute(currentFolder); new UpdateList().execute(currentFolder);
} }
} }
public enum Actions { public enum Actions {
SelectFile, SelectFolder SelectFile, SelectFolder
} }
private class UpdateList extends AsyncTask<String, Void, LinkedList<AdapterDetailedList.FileDetail>> { private class UpdateList extends AsyncTask<String, Void, LinkedList<AdapterDetailedList.FileDetail>> {
String exceptionMessage; String exceptionMessage;
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
super.onPreExecute(); super.onPreExecute();
if (mSearchView != null) { if (mSearchView != null) {
mSearchView.setIconified(true); mSearchView.setIconified(true);
MenuItemCompat.collapseActionView(mSearchViewMenuItem); MenuItemCompat.collapseActionView(mSearchViewMenuItem);
mSearchView.setQuery("", false); mSearchView.setQuery("", false);
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected LinkedList<AdapterDetailedList.FileDetail> doInBackground(final String... params) { protected LinkedList<AdapterDetailedList.FileDetail> doInBackground(final String... params) {
try { try {
final String path = params[0]; final String path = params[0];
if (TextUtils.isEmpty(path)) { if (TextUtils.isEmpty(path)) {
return null; return null;
} }
File tempFile = new File(path); File tempFile = new File(path);
if (tempFile.isFile()) { if (tempFile.isFile()) {
tempFile = tempFile.getParentFile(); tempFile = tempFile.getParentFile();
} }
String[] unopenableExtensions = {"apk", "mp3", "mp4", "png", "jpg", "jpeg"}; String[] unopenableExtensions = {"apk", "mp3", "mp4", "png", "jpg", "jpeg"};
final LinkedList<AdapterDetailedList.FileDetail> fileDetails = new LinkedList<>(); final LinkedList<AdapterDetailedList.FileDetail> fileDetails = new LinkedList<>();
final LinkedList<AdapterDetailedList.FileDetail> folderDetails = new LinkedList<>(); final LinkedList<AdapterDetailedList.FileDetail> folderDetails = new LinkedList<>();
final ArrayList<File> files; final ArrayList<File> files;
currentFolder = tempFile.getAbsolutePath(); currentFolder = tempFile.getAbsolutePath();
boolean isRoot = false; boolean isRoot = false;
if (!tempFile.canRead()) { if (!tempFile.canRead()) {
try { try {
Shell shell = null; Shell shell = null;
shell = Shell.startRootShell(); shell = Shell.startRootShell();
Toolbox tb = new Toolbox(shell); Toolbox tb = new Toolbox(shell);
isRoot = tb.isRootAccessGiven(); isRoot = tb.isRootAccessGiven();
} catch (IOException | TimeoutException e) { } catch (IOException | TimeoutException e) {
e.printStackTrace(); e.printStackTrace();
isRoot = false; isRoot = false;
} }
} }
files = RootUtils.getFileList(currentFolder, isRoot); files = RootUtils.getFileList(currentFolder, isRoot);
Collections.sort(files, getFileNameComparator()); Collections.sort(files, getFileNameComparator());
if (files != null) { if (files != null) {
for (final File f : files) { for (final File f : files) {
if (f.isDirectory()) { if (f.isDirectory()) {
folderDetails.add(new AdapterDetailedList.FileDetail(f.getName(), folderDetails.add(new AdapterDetailedList.FileDetail(f.getName(),
getString(R.string.folder), getString(R.string.folder),
"")); ""));
} else if (f.isFile() } else if (f.isFile()
&& !FilenameUtils.isExtension(f.getName().toLowerCase(), unopenableExtensions) && !FilenameUtils.isExtension(f.getName().toLowerCase(), unopenableExtensions)
&& FileUtils.sizeOf(f) <= Build.MAX_FILE_SIZE * FileUtils.ONE_KB) { && FileUtils.sizeOf(f) <= Build.MAX_FILE_SIZE * FileUtils.ONE_KB) {
final long fileSize = f.length(); final long fileSize = f.length();
SimpleDateFormat format = new SimpleDateFormat("MMM dd, yyyy hh:mm a"); SimpleDateFormat format = new SimpleDateFormat("MMM dd, yyyy hh:mm a");
String date = format.format(f.lastModified()); String date = format.format(f.lastModified());
fileDetails.add(new AdapterDetailedList.FileDetail(f.getName(), fileDetails.add(new AdapterDetailedList.FileDetail(f.getName(),
FileUtils.byteCountToDisplaySize(fileSize), date)); FileUtils.byteCountToDisplaySize(fileSize), date));
} }
} }
} }
folderDetails.addAll(fileDetails); folderDetails.addAll(fileDetails);
return folderDetails; return folderDetails;
} catch (Exception e) { } catch (Exception e) {
exceptionMessage = e.getMessage(); exceptionMessage = e.getMessage();
return null; return null;
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected void onPostExecute(final LinkedList<AdapterDetailedList.FileDetail> names) { protected void onPostExecute(final LinkedList<AdapterDetailedList.FileDetail> names) {
if (names != null) { if (names != null) {
boolean isRoot = currentFolder.equals("/"); boolean isRoot = currentFolder.equals("/");
AdapterDetailedList mAdapter = new AdapterDetailedList(getBaseContext(), names, isRoot); AdapterDetailedList mAdapter = new AdapterDetailedList(getBaseContext(), names, isRoot);
listView.setAdapter(mAdapter); listView.setAdapter(mAdapter);
filter = mAdapter.getFilter(); filter = mAdapter.getFilter();
} }
if (exceptionMessage != null) { if (exceptionMessage != null) {
Toast.makeText(SelectFileActivity.this, exceptionMessage, Toast.LENGTH_SHORT).show(); Toast.makeText(SelectFileActivity.this, exceptionMessage, Toast.LENGTH_SHORT).show();
} }
invalidateOptionsMenu(); invalidateOptionsMenu();
super.onPostExecute(names); super.onPostExecute(names);
} }
public final Comparator<File> getFileNameComparator() { public final Comparator<File> getFileNameComparator() {
return new AlphanumComparator() { return new AlphanumComparator() {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public String getTheString(Object obj) { public String getTheString(Object obj) {
return ((File) obj).getName() return ((File) obj).getName()
.toLowerCase(); .toLowerCase();
} }
}; };
} }
} }
} }

View File

@ -1,204 +1,204 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.adapter; package sharedcode.turboeditor.adapter;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Filter; import android.widget.Filter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.util.MimeTypes; import sharedcode.turboeditor.util.MimeTypes;
public class AdapterDetailedList extends public class AdapterDetailedList extends
ArrayAdapter<AdapterDetailedList.FileDetail> { ArrayAdapter<AdapterDetailedList.FileDetail> {
// Layout Inflater // Layout Inflater
private final LayoutInflater inflater; private final LayoutInflater inflater;
private final LinkedList<FileDetail> orig; private final LinkedList<FileDetail> orig;
private CustomFilter customFilter; private CustomFilter customFilter;
// List of file details // List of file details
private LinkedList<FileDetail> fileDetails; private LinkedList<FileDetail> fileDetails;
public AdapterDetailedList(final Context context, public AdapterDetailedList(final Context context,
final LinkedList<FileDetail> fileDetails, final LinkedList<FileDetail> fileDetails,
final boolean isRoot) { final boolean isRoot) {
super(context, R.layout.item_file_list, fileDetails); super(context, R.layout.item_file_list, fileDetails);
this.fileDetails = fileDetails; this.fileDetails = fileDetails;
this.orig = fileDetails; this.orig = fileDetails;
this.inflater = LayoutInflater.from(context); this.inflater = LayoutInflater.from(context);
if (!isRoot) { if (!isRoot) {
this.fileDetails.addFirst(new FileDetail("..", context.getString(R.string.folder), "")); this.fileDetails.addFirst(new FileDetail("..", context.getString(R.string.folder), ""));
} else { } else {
this.fileDetails.addFirst(new FileDetail(context.getString(R.string.home), context.getString(R.string.folder), "")); this.fileDetails.addFirst(new FileDetail(context.getString(R.string.home), context.getString(R.string.folder), ""));
} }
} }
@Override @Override
public View getView(final int position, public View getView(final int position,
View convertView, final ViewGroup parent) { View convertView, final ViewGroup parent) {
if (convertView == null) { if (convertView == null) {
convertView = this.inflater convertView = this.inflater
.inflate(R.layout.item_file_list, .inflate(R.layout.item_file_list,
null); null);
final ViewHolder hold = new ViewHolder(); final ViewHolder hold = new ViewHolder();
hold.nameLabel = (TextView) convertView.findViewById(android.R.id.text1); hold.nameLabel = (TextView) convertView.findViewById(android.R.id.text1);
hold.detailLabel = (TextView) convertView.findViewById(android.R.id.text2); hold.detailLabel = (TextView) convertView.findViewById(android.R.id.text2);
hold.icon = (ImageView) convertView.findViewById(android.R.id.icon); hold.icon = (ImageView) convertView.findViewById(android.R.id.icon);
convertView.setTag(hold); convertView.setTag(hold);
final FileDetail fileDetail = fileDetails.get(position); final FileDetail fileDetail = fileDetails.get(position);
final String fileName = fileDetail.getName(); final String fileName = fileDetail.getName();
setIcon(hold, fileDetail); setIcon(hold, fileDetail);
hold.nameLabel.setText(fileName); hold.nameLabel.setText(fileName);
hold.detailLabel.setText(fileDetail.getSize() + "\t\t" + fileDetail.getDateModified()); hold.detailLabel.setText(fileDetail.getSize() + "\t\t" + fileDetail.getDateModified());
} else { } else {
final ViewHolder hold = ((ViewHolder) convertView.getTag()); final ViewHolder hold = ((ViewHolder) convertView.getTag());
final FileDetail fileDetail = fileDetails.get(position); final FileDetail fileDetail = fileDetails.get(position);
final String fileName = fileDetail.getName(); final String fileName = fileDetail.getName();
setIcon(hold, fileDetail); setIcon(hold, fileDetail);
hold.nameLabel.setText(fileName); hold.nameLabel.setText(fileName);
hold.detailLabel.setText(fileDetail.getSize() + "\t\t" + fileDetail.getDateModified()); hold.detailLabel.setText(fileDetail.getSize() + "\t\t" + fileDetail.getDateModified());
} }
return convertView; return convertView;
} }
@Override @Override
public int getCount() { public int getCount() {
return fileDetails.size(); return fileDetails.size();
} }
private void setIcon(final ViewHolder viewHolder, final FileDetail fileDetail) { private void setIcon(final ViewHolder viewHolder, final FileDetail fileDetail) {
final String fileName = fileDetail.getName(); final String fileName = fileDetail.getName();
final String ext = FilenameUtils.getExtension(fileName); final String ext = FilenameUtils.getExtension(fileName);
if (fileDetail.isFolder()) { if (fileDetail.isFolder()) {
viewHolder.icon.setImageResource(R.color.file_folder); viewHolder.icon.setImageResource(R.color.file_folder);
} else if (Arrays.asList(MimeTypes.MIME_HTML).contains(ext) || ext.endsWith("html")) { } else if (Arrays.asList(MimeTypes.MIME_HTML).contains(ext) || ext.endsWith("html")) {
viewHolder.icon.setImageResource(R.color.file_html); viewHolder.icon.setImageResource(R.color.file_html);
} else if (Arrays.asList(MimeTypes.MIME_CODE).contains(ext) } else if (Arrays.asList(MimeTypes.MIME_CODE).contains(ext)
|| fileName.endsWith("css") || fileName.endsWith("css")
|| fileName.endsWith("js")) { || fileName.endsWith("js")) {
viewHolder.icon.setImageResource(R.color.file_code); viewHolder.icon.setImageResource(R.color.file_code);
} else if (Arrays.asList(MimeTypes.MIME_ARCHIVE).contains(ext)) { } else if (Arrays.asList(MimeTypes.MIME_ARCHIVE).contains(ext)) {
viewHolder.icon.setImageResource(R.color.file_archive); viewHolder.icon.setImageResource(R.color.file_archive);
} else if (Arrays.asList(MimeTypes.MIME_MUSIC) } else if (Arrays.asList(MimeTypes.MIME_MUSIC)
.contains(ext)) { .contains(ext)) {
viewHolder.icon.setImageResource(R.color.file_media_music); viewHolder.icon.setImageResource(R.color.file_media_music);
} else if (Arrays.asList(MimeTypes.MIME_PICTURE).contains(ext)) { } else if (Arrays.asList(MimeTypes.MIME_PICTURE).contains(ext)) {
viewHolder.icon.setImageResource(R.color.file_media_picture); viewHolder.icon.setImageResource(R.color.file_media_picture);
} else if (Arrays.asList(MimeTypes.MIME_VIDEO).contains(ext)) { } else if (Arrays.asList(MimeTypes.MIME_VIDEO).contains(ext)) {
viewHolder.icon.setImageResource(R.color.file_media_video); viewHolder.icon.setImageResource(R.color.file_media_video);
} else { } else {
viewHolder.icon.setImageResource(R.color.file_text); viewHolder.icon.setImageResource(R.color.file_text);
} }
} }
@Override @Override
public Filter getFilter() { public Filter getFilter() {
if (customFilter == null) { if (customFilter == null) {
customFilter = new CustomFilter(); customFilter = new CustomFilter();
} }
return customFilter; return customFilter;
} }
public static class ViewHolder { public static class ViewHolder {
// Name of the file // Name of the file
public TextView nameLabel; public TextView nameLabel;
// Size of the file // Size of the file
public TextView detailLabel; public TextView detailLabel;
// Icon of the file // Icon of the file
public ImageView icon; public ImageView icon;
} }
public static class FileDetail { public static class FileDetail {
private final String name; private final String name;
private final String size; private final String size;
private final String dateModified; private final String dateModified;
private final boolean isFolder; private final boolean isFolder;
public FileDetail(String name, String size, public FileDetail(String name, String size,
String dateModified) { String dateModified) {
this.name = name; this.name = name;
this.size = size; this.size = size;
this.dateModified = dateModified; this.dateModified = dateModified;
isFolder = TextUtils.isEmpty(dateModified); isFolder = TextUtils.isEmpty(dateModified);
} }
public String getDateModified() { public String getDateModified() {
return dateModified; return dateModified;
} }
public String getSize() { public String getSize() {
return size; return size;
} }
public String getName() { public String getName() {
return name; return name;
} }
public boolean isFolder() { public boolean isFolder() {
return isFolder; return isFolder;
} }
} }
private class CustomFilter extends Filter { private class CustomFilter extends Filter {
@Override @Override
protected FilterResults performFiltering(CharSequence constraint) { protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults(); FilterResults results = new FilterResults();
if (constraint == null || constraint.length() == 0) { if (constraint == null || constraint.length() == 0) {
results.values = orig; results.values = orig;
results.count = orig.size(); results.count = orig.size();
} else { } else {
LinkedList<FileDetail> nHolderList = new LinkedList<>(); LinkedList<FileDetail> nHolderList = new LinkedList<>();
for (FileDetail h : orig) { for (FileDetail h : orig) {
if (h.getName().toLowerCase().contains(constraint.toString().toLowerCase())) if (h.getName().toLowerCase().contains(constraint.toString().toLowerCase()))
nHolderList.add(h); nHolderList.add(h);
} }
results.values = nHolderList; results.values = nHolderList;
results.count = nHolderList.size(); results.count = nHolderList.size();
} }
return results; return results;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
protected void publishResults(CharSequence constraint, protected void publishResults(CharSequence constraint,
FilterResults results) { FilterResults results) {
fileDetails = (LinkedList<FileDetail>) results.values; fileDetails = (LinkedList<FileDetail>) results.values;
notifyDataSetChanged(); notifyDataSetChanged();
} }
} }
} }

View File

@ -1,130 +1,130 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.adapter; package sharedcode.turboeditor.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
public class AdapterDrawer extends public class AdapterDrawer extends
ArrayAdapter<File> { ArrayAdapter<File> {
private final Callbacks callbacks; private final Callbacks callbacks;
// Layout Inflater // Layout Inflater
private final LayoutInflater inflater; private final LayoutInflater inflater;
// List of file details // List of file details
private final List<File> files; private final List<File> files;
private String selectedPath = ""; private String selectedPath = "";
public AdapterDrawer(Context context, public AdapterDrawer(Context context,
List<File> files, List<File> files,
Callbacks callbacks) { Callbacks callbacks) {
super(context, R.layout.item_file_list, files); super(context, R.layout.item_file_list, files);
this.files = files; this.files = files;
this.inflater = LayoutInflater.from(context); this.inflater = LayoutInflater.from(context);
this.callbacks = callbacks; this.callbacks = callbacks;
} }
@Override @Override
public View getView(final int position, public View getView(final int position,
View convertView, final ViewGroup parent) { View convertView, final ViewGroup parent) {
if (convertView == null) { if (convertView == null) {
convertView = this.inflater convertView = this.inflater
.inflate(R.layout.item_drawer_list, .inflate(R.layout.item_drawer_list,
parent, false); parent, false);
final ViewHolder hold = new ViewHolder(); final ViewHolder hold = new ViewHolder();
hold.nameLabel = (TextView) convertView.findViewById(android.R.id.text1); hold.nameLabel = (TextView) convertView.findViewById(android.R.id.text1);
hold.cancelButton = (ImageView) convertView.findViewById(R.id.button_remove_from_list); hold.cancelButton = (ImageView) convertView.findViewById(R.id.button_remove_from_list);
convertView.setTag(hold); convertView.setTag(hold);
final String fileName = files.get(position).getName(); final String fileName = files.get(position).getName();
hold.nameLabel.setText(fileName); hold.nameLabel.setText(fileName);
hold.cancelButton.setOnClickListener(new View.OnClickListener() { hold.cancelButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
boolean closeOpenedFile = TextUtils.equals(selectedPath, files.get(position).getAbsolutePath()); boolean closeOpenedFile = TextUtils.equals(selectedPath, files.get(position).getAbsolutePath());
callbacks.CancelItem(position, closeOpenedFile); callbacks.CancelItem(position, closeOpenedFile);
if (closeOpenedFile) if (closeOpenedFile)
selectedPath = ""; selectedPath = "";
} }
}); });
if (TextUtils.equals(selectedPath, files.get(position).getAbsolutePath())) { if (TextUtils.equals(selectedPath, files.get(position).getAbsolutePath())) {
hold.nameLabel.setTypeface(null, Typeface.BOLD); hold.nameLabel.setTypeface(null, Typeface.BOLD);
} else { } else {
hold.nameLabel.setTypeface(null, Typeface.NORMAL); hold.nameLabel.setTypeface(null, Typeface.NORMAL);
} }
} else { } else {
final ViewHolder hold = ((ViewHolder) convertView.getTag()); final ViewHolder hold = ((ViewHolder) convertView.getTag());
final String fileName = files.get(position).getName(); final String fileName = files.get(position).getName();
hold.nameLabel.setText(fileName); hold.nameLabel.setText(fileName);
hold.cancelButton.setOnClickListener(new View.OnClickListener() { hold.cancelButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
boolean closeOpenedFile = TextUtils.equals(selectedPath, files.get(position).getAbsolutePath()); boolean closeOpenedFile = TextUtils.equals(selectedPath, files.get(position).getAbsolutePath());
callbacks.CancelItem(position, closeOpenedFile); callbacks.CancelItem(position, closeOpenedFile);
if (closeOpenedFile) if (closeOpenedFile)
selectedPath = ""; selectedPath = "";
} }
}); });
if (TextUtils.equals(selectedPath, files.get(position).getAbsolutePath())) { if (TextUtils.equals(selectedPath, files.get(position).getAbsolutePath())) {
hold.nameLabel.setTypeface(null, Typeface.BOLD); hold.nameLabel.setTypeface(null, Typeface.BOLD);
} else { } else {
hold.nameLabel.setTypeface(null, Typeface.NORMAL); hold.nameLabel.setTypeface(null, Typeface.NORMAL);
} }
} }
return convertView; return convertView;
} }
public void selectView(String selectedPath) { public void selectView(String selectedPath) {
//callbacks.ItemSelected(selectedPath); //callbacks.ItemSelected(selectedPath);
this.selectedPath = selectedPath; this.selectedPath = selectedPath;
notifyDataSetChanged(); notifyDataSetChanged();
} }
public interface Callbacks { public interface Callbacks {
void CancelItem(int position, boolean andCloseOpenedFile); void CancelItem(int position, boolean andCloseOpenedFile);
//void ItemSelected(String path); //void ItemSelected(String path);
} }
public static class ViewHolder { public static class ViewHolder {
// Name of the file // Name of the file
public TextView nameLabel; public TextView nameLabel;
public ImageView cancelButton; public ImageView cancelButton;
} }
} }

View File

@ -1,75 +1,75 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.adapter; package sharedcode.turboeditor.adapter;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.TextView; import android.widget.TextView;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
public class AdapterTwoItem extends public class AdapterTwoItem extends
ArrayAdapter<String> { ArrayAdapter<String> {
private final LayoutInflater inflater; private final LayoutInflater inflater;
private final String[] lines1; private final String[] lines1;
private final String[] lines2; private final String[] lines2;
public AdapterTwoItem(Context context, public AdapterTwoItem(Context context,
String[] lines1, String[] lines1,
String[] lines2) { String[] lines2) {
super(context, R.layout.item_two_lines, lines1); super(context, R.layout.item_two_lines, lines1);
this.lines1 = lines1; this.lines1 = lines1;
this.lines2 = lines2; this.lines2 = lines2;
this.inflater = LayoutInflater.from(context); this.inflater = LayoutInflater.from(context);
} }
@Override @Override
public View getView(final int position, public View getView(final int position,
View convertView, final ViewGroup parent) { View convertView, final ViewGroup parent) {
if (convertView == null) { if (convertView == null) {
convertView = this.inflater convertView = this.inflater
.inflate(R.layout.item_two_lines, .inflate(R.layout.item_two_lines,
parent, false); parent, false);
final ViewHolder hold = new ViewHolder(); final ViewHolder hold = new ViewHolder();
hold.line1 = (TextView) convertView.findViewById(android.R.id.text1); hold.line1 = (TextView) convertView.findViewById(android.R.id.text1);
hold.line2 = (TextView) convertView.findViewById(android.R.id.text2); hold.line2 = (TextView) convertView.findViewById(android.R.id.text2);
convertView.setTag(hold); convertView.setTag(hold);
hold.line1.setText(lines1[position]); hold.line1.setText(lines1[position]);
hold.line2.setText(lines2[position]); hold.line2.setText(lines2[position]);
} else { } else {
final ViewHolder hold = ((ViewHolder) convertView.getTag()); final ViewHolder hold = ((ViewHolder) convertView.getTag());
hold.line1.setText(lines1[position]); hold.line1.setText(lines1[position]);
hold.line2.setText(lines2[position]); hold.line2.setText(lines2[position]);
} }
return convertView; return convertView;
} }
public static class ViewHolder { public static class ViewHolder {
public TextView line1; public TextView line1;
public TextView line2; public TextView line2;
} }
} }

View File

@ -1,44 +1,44 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.application; package sharedcode.turboeditor.application;
import android.app.Application; import android.app.Application;
import android.view.ViewConfiguration; import android.view.ViewConfiguration;
import java.lang.reflect.Field; import java.lang.reflect.Field;
public class MyApp extends Application { public class MyApp extends Application {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
// force to sow the overflow menu icon // force to sow the overflow menu icon
try { try {
ViewConfiguration config = ViewConfiguration.get(this); ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) { if (menuKeyField != null) {
menuKeyField.setAccessible(true); menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false); menuKeyField.setBoolean(config, false);
} }
} catch (Exception ex) { } catch (Exception ex) {
// Ignore // Ignore
} }
} }
} }

View File

@ -1,91 +1,91 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.dialogfragment; package sharedcode.turboeditor.dialogfragment;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentManager; import android.app.FragmentManager;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import it.gmariotti.changelibs.library.view.ChangeLogListView; import it.gmariotti.changelibs.library.view.ChangeLogListView;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.util.Build; import sharedcode.turboeditor.util.Build;
public class ChangelogDialog extends DialogFragment { public class ChangelogDialog extends DialogFragment {
public static void showChangeLogDialog(FragmentManager fragmentManager) { public static void showChangeLogDialog(FragmentManager fragmentManager) {
ChangelogDialog changelogDialog = new ChangelogDialog(); ChangelogDialog changelogDialog = new ChangelogDialog();
FragmentTransaction ft = fragmentManager.beginTransaction(); FragmentTransaction ft = fragmentManager.beginTransaction();
Fragment prev = fragmentManager.findFragmentByTag("changelogdemo_dialog"); Fragment prev = fragmentManager.findFragmentByTag("changelogdemo_dialog");
if (prev != null) { if (prev != null) {
ft.remove(prev); ft.remove(prev);
} }
ft.addToBackStack(null); ft.addToBackStack(null);
changelogDialog.show(ft, "changelogdemo_dialog"); changelogDialog.show(ft, "changelogdemo_dialog");
} }
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater layoutInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater layoutInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ChangeLogListView chgList = (ChangeLogListView) layoutInflater.inflate(R.layout.demo_changelog_fragment_dialogstandard, null); ChangeLogListView chgList = (ChangeLogListView) layoutInflater.inflate(R.layout.demo_changelog_fragment_dialogstandard, null);
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setTitle(R.string.changelog) .setTitle(R.string.changelog)
.setView(chgList) .setView(chgList)
.setNegativeButton(android.R.string.cancel, .setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss(); dialog.dismiss();
} }
} }
) )
.setPositiveButton(R.string.vota, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.vota, new DialogInterface.OnClickListener() {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void onClick(final DialogInterface dialog, final int which) { public void onClick(final DialogInterface dialog, final int which) {
try { try {
if (Build.FOR_AMAZON) { if (Build.FOR_AMAZON) {
String url = "amzn://apps/android?p=com.maskyn.fileeditor"; String url = "amzn://apps/android?p=com.maskyn.fileeditor";
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)) startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
} else { } else {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.maskyn.fileeditor")) startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.maskyn.fileeditor"))
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
} }
} catch (Exception e) { } catch (Exception e) {
} }
} }
}) })
.create(); .create();
} }
} }

View File

@ -1,132 +1,132 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.dialogfragment; package sharedcode.turboeditor.dialogfragment;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.views.DialogHelper; import sharedcode.turboeditor.views.DialogHelper;
// ... // ...
public class EditTextDialog extends DialogFragment implements TextView.OnEditorActionListener { public class EditTextDialog extends DialogFragment implements TextView.OnEditorActionListener {
private EditText mEditText; private EditText mEditText;
public static EditTextDialog newInstance(final Actions action) { public static EditTextDialog newInstance(final Actions action) {
return EditTextDialog.newInstance(action, ""); return EditTextDialog.newInstance(action, "");
} }
public static EditTextDialog newInstance(final Actions action, final String hint) { public static EditTextDialog newInstance(final Actions action, final String hint) {
final EditTextDialog f = new EditTextDialog(); final EditTextDialog f = new EditTextDialog();
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putSerializable("action", action); args.putSerializable("action", action);
args.putString("hint", hint); args.putString("hint", hint);
f.setArguments(args); f.setArguments(args);
return f; return f;
} }
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final Actions action = (Actions) getArguments().getSerializable("action"); final Actions action = (Actions) getArguments().getSerializable("action");
final String title; final String title;
switch (action) { switch (action) {
case NewFile: case NewFile:
title = getString(R.string.file); title = getString(R.string.file);
break; break;
case NewFolder: case NewFolder:
title = getString(R.string.folder); title = getString(R.string.folder);
break; break;
default: default:
title = null; title = null;
break; break;
} }
View view = new DialogHelper.Builder(getActivity()) View view = new DialogHelper.Builder(getActivity())
.setTitle(title) .setTitle(title)
.setView(R.layout.dialog_fragment_edittext) .setView(R.layout.dialog_fragment_edittext)
.createSkeletonView(); .createSkeletonView();
this.mEditText = (EditText) view.findViewById(android.R.id.edit); this.mEditText = (EditText) view.findViewById(android.R.id.edit);
this.mEditText.setHint(R.string.name); this.mEditText.setHint(R.string.name);
// Show soft keyboard automatically // Show soft keyboard automatically
this.mEditText.setText(getArguments().getString("hint")); this.mEditText.setText(getArguments().getString("hint"));
this.mEditText.requestFocus(); this.mEditText.requestFocus();
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
this.mEditText.setOnEditorActionListener(this); this.mEditText.setOnEditorActionListener(this);
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setView(view) .setView(view)
.setPositiveButton(android.R.string.ok, .setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
returnData(); returnData();
} }
} }
) )
.setNegativeButton(android.R.string.cancel, .setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
} }
} }
) )
.create(); .create();
} }
void returnData() { void returnData() {
EditDialogListener target = (EditDialogListener) getTargetFragment(); EditDialogListener target = (EditDialogListener) getTargetFragment();
if (target == null) { if (target == null) {
target = (EditDialogListener) getActivity(); target = (EditDialogListener) getActivity();
} }
target.onFinishEditDialog(this.mEditText.getText().toString(), getArguments().getString("hint"), target.onFinishEditDialog(this.mEditText.getText().toString(), getArguments().getString("hint"),
(Actions) getArguments().getSerializable("action")); (Actions) getArguments().getSerializable("action"));
this.dismiss(); this.dismiss();
} }
@Override @Override
public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) { public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) { if (EditorInfo.IME_ACTION_DONE == actionId) {
returnData(); returnData();
return true; return true;
} }
return false; return false;
} }
public enum Actions { public enum Actions {
NewFile, NewFolder NewFile, NewFolder
} }
public interface EditDialogListener { public interface EditDialogListener {
void onFinishEditDialog(String result, String hint, Actions action); void onFinishEditDialog(String result, String hint, Actions action);
} }
} }

View File

@ -1,120 +1,120 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.dialogfragment; package sharedcode.turboeditor.dialogfragment;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.SwitchCompat; import android.support.v7.widget.SwitchCompat;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ListView; import android.widget.ListView;
import org.mozilla.universalchardet.Constants; import org.mozilla.universalchardet.Constants;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.preferences.PreferenceHelper; import sharedcode.turboeditor.preferences.PreferenceHelper;
public class EncodingDialog extends DialogFragment implements AdapterView.OnItemClickListener { public class EncodingDialog extends DialogFragment implements AdapterView.OnItemClickListener {
private final String[] encodings = new String[]{ private final String[] encodings = new String[]{
Constants.CHARSET_BIG5, Constants.CHARSET_BIG5,
Constants.CHARSET_EUC_JP, Constants.CHARSET_EUC_JP,
Constants.CHARSET_EUC_KR, Constants.CHARSET_EUC_KR,
Constants.CHARSET_EUC_TW, Constants.CHARSET_EUC_TW,
Constants.CHARSET_GB18030, Constants.CHARSET_GB18030,
"GB2312", "GB2312",
Constants.CHARSET_IBM855, Constants.CHARSET_IBM855,
Constants.CHARSET_IBM866, Constants.CHARSET_IBM866,
Constants.CHARSET_ISO_2022_CN, Constants.CHARSET_ISO_2022_CN,
Constants.CHARSET_ISO_2022_JP, Constants.CHARSET_ISO_2022_JP,
Constants.CHARSET_ISO_2022_KR, Constants.CHARSET_ISO_2022_KR,
Constants.CHARSET_ISO_8859_5, Constants.CHARSET_ISO_8859_5,
Constants.CHARSET_ISO_8859_7, Constants.CHARSET_ISO_8859_7,
Constants.CHARSET_ISO_8859_8, Constants.CHARSET_ISO_8859_8,
Constants.CHARSET_KOI8_R, Constants.CHARSET_KOI8_R,
Constants.CHARSET_MACCYRILLIC, Constants.CHARSET_MACCYRILLIC,
Constants.CHARSET_SHIFT_JIS, Constants.CHARSET_SHIFT_JIS,
Constants.CHARSET_UTF_16BE, Constants.CHARSET_UTF_16BE,
Constants.CHARSET_UTF_16LE, Constants.CHARSET_UTF_16LE,
Constants.CHARSET_UTF_32BE, Constants.CHARSET_UTF_32BE,
Constants.CHARSET_UTF_32LE, Constants.CHARSET_UTF_32LE,
Constants.CHARSET_UTF_8, Constants.CHARSET_UTF_8,
Constants.CHARSET_WINDOWS_1251, Constants.CHARSET_WINDOWS_1251,
Constants.CHARSET_WINDOWS_1252, Constants.CHARSET_WINDOWS_1252,
Constants.CHARSET_WINDOWS_1253, Constants.CHARSET_WINDOWS_1253,
Constants.CHARSET_WINDOWS_1255 Constants.CHARSET_WINDOWS_1255
}; };
private ListView list; private ListView list;
public static EncodingDialog newInstance() { public static EncodingDialog newInstance() {
final EncodingDialog f = new EncodingDialog(); final EncodingDialog f = new EncodingDialog();
return f; return f;
} }
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_encoding_list, null); final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_encoding_list, null);
list = (ListView) view.findViewById(android.R.id.list); list = (ListView) view.findViewById(android.R.id.list);
SwitchCompat autoencoding = (SwitchCompat) view.findViewById(android.R.id.checkbox); SwitchCompat autoencoding = (SwitchCompat) view.findViewById(android.R.id.checkbox);
autoencoding.setChecked(PreferenceHelper.getAutoEncoding(getActivity())); autoencoding.setChecked(PreferenceHelper.getAutoEncoding(getActivity()));
autoencoding.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { autoencoding.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setAutoencoding(getActivity(), isChecked); PreferenceHelper.setAutoencoding(getActivity(), isChecked);
} }
}); });
list.setAdapter(new ArrayAdapter<>(getActivity(), R.layout.item_single_choice, encodings)); list.setAdapter(new ArrayAdapter<>(getActivity(), R.layout.item_single_choice, encodings));
list.setOnItemClickListener(this); list.setOnItemClickListener(this);
String currentEncoding = PreferenceHelper.getEncoding(getActivity()); String currentEncoding = PreferenceHelper.getEncoding(getActivity());
for (int i = 0; i < encodings.length; i++) { for (int i = 0; i < encodings.length; i++) {
if (currentEncoding.equals(encodings[i])) { if (currentEncoding.equals(encodings[i])) {
list.setItemChecked(i, true); list.setItemChecked(i, true);
} }
} }
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setView(view) .setView(view)
.create(); .create();
} }
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DialogListener target = (DialogListener) getTargetFragment(); DialogListener target = (DialogListener) getTargetFragment();
if (target == null) { if (target == null) {
target = (DialogListener) getActivity(); target = (DialogListener) getActivity();
} }
target.onEncodingSelected(encodings[position]); target.onEncodingSelected(encodings[position]);
this.dismiss(); this.dismiss();
} }
public interface DialogListener { public interface DialogListener {
void onEncodingSelected(String result); void onEncodingSelected(String result);
} }
} }

View File

@ -1,97 +1,97 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.dialogfragment; package sharedcode.turboeditor.dialogfragment;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.ListView; import android.widget.ListView;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import java.io.File; import java.io.File;
import java.util.Date; import java.util.Date;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.adapter.AdapterTwoItem; import sharedcode.turboeditor.adapter.AdapterTwoItem;
import sharedcode.turboeditor.views.DialogHelper; import sharedcode.turboeditor.views.DialogHelper;
// ... // ...
public class FileInfoDialog extends DialogFragment { public class FileInfoDialog extends DialogFragment {
public static FileInfoDialog newInstance(String filePath) { public static FileInfoDialog newInstance(String filePath) {
final FileInfoDialog f = new FileInfoDialog(); final FileInfoDialog f = new FileInfoDialog();
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putString("filePath", filePath); args.putString("filePath", filePath);
f.setArguments(args); f.setArguments(args);
return f; return f;
} }
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = new DialogHelper.Builder(getActivity()) View view = new DialogHelper.Builder(getActivity())
.setTitle(R.string.info) .setTitle(R.string.info)
.setView(R.layout.dialog_fragment_file_info) .setView(R.layout.dialog_fragment_file_info)
.createSkeletonView(); .createSkeletonView();
//final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_fragment_file_info, null); //final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_fragment_file_info, null);
ListView list = (ListView) view.findViewById(android.R.id.list); ListView list = (ListView) view.findViewById(android.R.id.list);
File file = new File(getArguments().getString("filePath")); File file = new File(getArguments().getString("filePath"));
// Get the last modification information. // Get the last modification information.
Long lastModified = file.lastModified(); Long lastModified = file.lastModified();
// Create a new date object and pass last modified information // Create a new date object and pass last modified information
// to the date object. // to the date object.
Date date = new Date(lastModified); Date date = new Date(lastModified);
String[] lines1 = { String[] lines1 = {
getString(R.string.name), getString(R.string.name),
getString(R.string.folder), getString(R.string.folder),
getString(R.string.size), getString(R.string.size),
getString(R.string.modification_date) getString(R.string.modification_date)
}; };
String[] lines2 = { String[] lines2 = {
file.getName(), file.getName(),
file.getParent(), file.getParent(),
FileUtils.byteCountToDisplaySize(file.length()), FileUtils.byteCountToDisplaySize(file.length()),
date.toString() date.toString()
}; };
list.setAdapter(new AdapterTwoItem(getActivity(), lines1, lines2)); list.setAdapter(new AdapterTwoItem(getActivity(), lines1, lines2));
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setView(view) .setView(view)
.setPositiveButton(android.R.string.ok, .setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
} }
} }
) )
.create(); .create();
} }
} }

View File

@ -1,207 +1,207 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.dialogfragment; package sharedcode.turboeditor.dialogfragment;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.texteditor.SearchResult; import sharedcode.turboeditor.texteditor.SearchResult;
import sharedcode.turboeditor.views.DialogHelper; import sharedcode.turboeditor.views.DialogHelper;
// ... // ...
public class FindTextDialog extends DialogFragment { public class FindTextDialog extends DialogFragment {
private EditText textToFind, textToReplace; private EditText textToFind, textToReplace;
private CheckBox regexCheck, replaceCheck, matchCaseCheck; private CheckBox regexCheck, replaceCheck, matchCaseCheck;
public static FindTextDialog newInstance(String allText) { public static FindTextDialog newInstance(String allText) {
final FindTextDialog f = new FindTextDialog(); final FindTextDialog f = new FindTextDialog();
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putString("allText", allText); args.putString("allText", allText);
f.setArguments(args); f.setArguments(args);
return f; return f;
} }
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
//final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_fragment_find_text, null); //final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_fragment_find_text, null);
View view = new DialogHelper.Builder(getActivity()) View view = new DialogHelper.Builder(getActivity())
.setTitle(R.string.find) .setTitle(R.string.find)
.setView(R.layout.dialog_fragment_find_text) .setView(R.layout.dialog_fragment_find_text)
.createSkeletonView(); .createSkeletonView();
this.textToFind = (EditText) view.findViewById(R.id.text_to_find); this.textToFind = (EditText) view.findViewById(R.id.text_to_find);
this.textToReplace = (EditText) view.findViewById(R.id.text_to_replace); this.textToReplace = (EditText) view.findViewById(R.id.text_to_replace);
this.regexCheck = (CheckBox) view.findViewById(R.id.regex_check); this.regexCheck = (CheckBox) view.findViewById(R.id.regex_check);
this.replaceCheck = (CheckBox) view.findViewById(R.id.replace_check); this.replaceCheck = (CheckBox) view.findViewById(R.id.replace_check);
this.matchCaseCheck = (CheckBox) view.findViewById(R.id.match_case_check); this.matchCaseCheck = (CheckBox) view.findViewById(R.id.match_case_check);
replaceCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { replaceCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
textToReplace.setVisibility(isChecked ? View.VISIBLE : View.GONE); textToReplace.setVisibility(isChecked ? View.VISIBLE : View.GONE);
} }
}); });
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setView(view) .setView(view)
.setPositiveButton(R.string.find, .setPositiveButton(R.string.find,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
} }
} }
) )
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.create(); .create();
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point
AlertDialog d = (AlertDialog) getDialog(); AlertDialog d = (AlertDialog) getDialog();
if (d != null) { if (d != null) {
Button positiveButton = (Button) d.getButton(Dialog.BUTTON_POSITIVE); Button positiveButton = (Button) d.getButton(Dialog.BUTTON_POSITIVE);
positiveButton.setText(getString(R.string.find)); positiveButton.setText(getString(R.string.find));
positiveButton.setOnClickListener(new View.OnClickListener() { positiveButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
returnData(); returnData();
} }
}); });
Button negativeButton = (Button) d.getButton(Dialog.BUTTON_NEGATIVE); Button negativeButton = (Button) d.getButton(Dialog.BUTTON_NEGATIVE);
negativeButton.setText(getString(android.R.string.cancel)); negativeButton.setText(getString(android.R.string.cancel));
negativeButton.setOnClickListener(new View.OnClickListener() { negativeButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
dismiss(); dismiss();
} }
}); });
} }
} }
void returnData() { void returnData() {
if (textToFind.getText().toString().isEmpty()) { if (textToFind.getText().toString().isEmpty()) {
this.dismiss(); this.dismiss();
} else { } else {
// we disable the okButton while we search // we disable the okButton while we search
new SearchTask().execute(); new SearchTask().execute();
} }
} }
public interface SearchDialogInterface { public interface SearchDialogInterface {
void onSearchDone(SearchResult searchResult); void onSearchDone(SearchResult searchResult);
} }
private class SearchTask extends AsyncTask<Void, Void, Void> { private class SearchTask extends AsyncTask<Void, Void, Void> {
LinkedList<Integer> foundIndex; LinkedList<Integer> foundIndex;
boolean foundSomething; boolean foundSomething;
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
String allText = getArguments().getString("allText"); String allText = getArguments().getString("allText");
String whatToSearch = textToFind.getText().toString(); String whatToSearch = textToFind.getText().toString();
boolean caseSensitive = matchCaseCheck.isChecked(); boolean caseSensitive = matchCaseCheck.isChecked();
boolean isRegex = regexCheck.isChecked(); boolean isRegex = regexCheck.isChecked();
foundIndex = new LinkedList<>(); foundIndex = new LinkedList<>();
Matcher matcher = null; Matcher matcher = null;
foundSomething = false; foundSomething = false;
if (isRegex) { if (isRegex) {
try { try {
if (caseSensitive) if (caseSensitive)
matcher = Pattern.compile(whatToSearch, Pattern.MULTILINE).matcher(allText); matcher = Pattern.compile(whatToSearch, Pattern.MULTILINE).matcher(allText);
else else
matcher = Pattern.compile(whatToSearch, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE).matcher(allText); matcher = Pattern.compile(whatToSearch, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE).matcher(allText);
} catch (Exception e) { } catch (Exception e) {
isRegex = false; isRegex = false;
} }
} }
if (isRegex) { if (isRegex) {
while (matcher.find()) { while (matcher.find()) {
foundSomething = true; foundSomething = true;
foundIndex.add(matcher.start()); foundIndex.add(matcher.start());
} }
} else { } else {
if (caseSensitive == false) { // by default is case sensitive if (caseSensitive == false) { // by default is case sensitive
whatToSearch = whatToSearch.toLowerCase(); whatToSearch = whatToSearch.toLowerCase();
allText = allText.toLowerCase(); allText = allText.toLowerCase();
} }
int index = allText.indexOf(whatToSearch); int index = allText.indexOf(whatToSearch);
while (index >= 0) { while (index >= 0) {
foundSomething = true; foundSomething = true;
foundIndex.add(index); foundIndex.add(index);
index = allText.indexOf(whatToSearch, index + 1); index = allText.indexOf(whatToSearch, index + 1);
} }
} }
return null; return null;
} }
@Override @Override
protected void onPostExecute(Void aVoid) { protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid); super.onPostExecute(aVoid);
if (foundSomething) { if (foundSomething) {
// the class that called this Dialog should implement the SearchDialogIterface // the class that called this Dialog should implement the SearchDialogIterface
SearchDialogInterface searchDialogInterface; SearchDialogInterface searchDialogInterface;
searchDialogInterface = ((SearchDialogInterface) getTargetFragment()); searchDialogInterface = ((SearchDialogInterface) getTargetFragment());
if (searchDialogInterface == null) if (searchDialogInterface == null)
searchDialogInterface = ((SearchDialogInterface) getActivity()); searchDialogInterface = ((SearchDialogInterface) getActivity());
// if who called this has not implemented the interface we return nothing // if who called this has not implemented the interface we return nothing
if (searchDialogInterface == null) if (searchDialogInterface == null)
return; return;
// else we return positions and other things // else we return positions and other things
else { else {
SearchResult searchResult = new SearchResult(foundIndex, textToFind.length(), replaceCheck.isChecked(), textToReplace.getText().toString()); SearchResult searchResult = new SearchResult(foundIndex, textToFind.length(), replaceCheck.isChecked(), textToReplace.getText().toString());
searchDialogInterface.onSearchDone(searchResult); searchDialogInterface.onSearchDone(searchResult);
} }
} else { } else {
} }
Toast.makeText(getActivity(), String.format(getString(R.string.occurrences_found), foundIndex.size()), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), String.format(getString(R.string.occurrences_found), foundIndex.size()), Toast.LENGTH_SHORT).show();
// dismiss the dialog // dismiss the dialog
FindTextDialog.this.dismiss(); FindTextDialog.this.dismiss();
} }
} }
} }

View File

@ -1,98 +1,98 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.dialogfragment; package sharedcode.turboeditor.dialogfragment;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.EditText; import android.widget.EditText;
import java.io.File; import java.io.File;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.activity.MainActivity; import sharedcode.turboeditor.activity.MainActivity;
import sharedcode.turboeditor.preferences.PreferenceHelper; import sharedcode.turboeditor.preferences.PreferenceHelper;
import sharedcode.turboeditor.task.SaveFileTask; import sharedcode.turboeditor.task.SaveFileTask;
import sharedcode.turboeditor.views.DialogHelper; import sharedcode.turboeditor.views.DialogHelper;
// ... // ...
public class NewFileDetailsDialog extends DialogFragment { public class NewFileDetailsDialog extends DialogFragment {
private EditText mName; private EditText mName;
private EditText mFolder; private EditText mFolder;
public static NewFileDetailsDialog newInstance(String fileText, String fileEncoding) { public static NewFileDetailsDialog newInstance(String fileText, String fileEncoding) {
final NewFileDetailsDialog f = new NewFileDetailsDialog(); final NewFileDetailsDialog f = new NewFileDetailsDialog();
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putString("fileText", fileText); args.putString("fileText", fileText);
args.putString("fileEncoding", fileEncoding); args.putString("fileEncoding", fileEncoding);
f.setArguments(args); f.setArguments(args);
return f; return f;
} }
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = new DialogHelper.Builder(getActivity()) View view = new DialogHelper.Builder(getActivity())
.setTitle(R.string.file) .setTitle(R.string.file)
.setView(R.layout.dialog_fragment_new_file_details) .setView(R.layout.dialog_fragment_new_file_details)
.createSkeletonView(); .createSkeletonView();
this.mName = (EditText) view.findViewById(android.R.id.text1); this.mName = (EditText) view.findViewById(android.R.id.text1);
this.mFolder = (EditText) view.findViewById(android.R.id.text2); this.mFolder = (EditText) view.findViewById(android.R.id.text2);
this.mName.setText(".txt"); this.mName.setText(".txt");
this.mFolder.setText(PreferenceHelper.getWorkingFolder(getActivity())); this.mFolder.setText(PreferenceHelper.getWorkingFolder(getActivity()));
// Show soft keyboard automatically // Show soft keyboard automatically
this.mName.requestFocus(); this.mName.requestFocus();
this.mName.setSelection(0); this.mName.setSelection(0);
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setView(view) .setView(view)
.setPositiveButton(android.R.string.ok, .setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (!mName.getText().toString().isEmpty() && !mFolder.getText().toString().isEmpty()) { if (!mName.getText().toString().isEmpty() && !mFolder.getText().toString().isEmpty()) {
File file = new File(mFolder.getText().toString(), mName.getText().toString()); File file = new File(mFolder.getText().toString(), mName.getText().toString());
new SaveFileTask((MainActivity) getActivity(), file.getPath(), getArguments().getString("fileText"), getArguments().getString("fileEncoding")).execute(); new SaveFileTask((MainActivity) getActivity(), file.getPath(), getArguments().getString("fileText"), getArguments().getString("fileEncoding")).execute();
PreferenceHelper.setWorkingFolder(getActivity(), file.getParent()); PreferenceHelper.setWorkingFolder(getActivity(), file.getParent());
} }
} }
} }
) )
.setNegativeButton(android.R.string.cancel, .setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
} }
} }
) )
.create(); .create();
} }
} }

View File

@ -1,123 +1,123 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.dialogfragment; package sharedcode.turboeditor.dialogfragment;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.NumberPicker; import android.widget.NumberPicker;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.views.DialogHelper; import sharedcode.turboeditor.views.DialogHelper;
// ... // ...
public class NumberPickerDialog extends DialogFragment { public class NumberPickerDialog extends DialogFragment {
private NumberPicker mSeekBar; private NumberPicker mSeekBar;
public static NumberPickerDialog newInstance(final Actions action) { public static NumberPickerDialog newInstance(final Actions action) {
return NumberPickerDialog.newInstance(action, 0, 50, 100); return NumberPickerDialog.newInstance(action, 0, 50, 100);
} }
public static NumberPickerDialog newInstance(final Actions action, final int min, final int current, final int max) { public static NumberPickerDialog newInstance(final Actions action, final int min, final int current, final int max) {
final NumberPickerDialog f = new NumberPickerDialog(); final NumberPickerDialog f = new NumberPickerDialog();
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putSerializable("action", action); args.putSerializable("action", action);
args.putInt("min", min); args.putInt("min", min);
args.putInt("current", current); args.putInt("current", current);
args.putInt("max", max); args.putInt("max", max);
f.setArguments(args); f.setArguments(args);
return f; return f;
} }
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
Actions action = (Actions) getArguments().getSerializable("action"); Actions action = (Actions) getArguments().getSerializable("action");
int title; int title;
switch (action){ switch (action){
case FontSize: case FontSize:
title = R.string.font_size; title = R.string.font_size;
break; break;
case SelectPage: case SelectPage:
title = R.string.goto_page; title = R.string.goto_page;
break; break;
case GoToLine: case GoToLine:
title = R.string.goto_line; title = R.string.goto_line;
break; break;
default: default:
title = R.string.nome_app_turbo_editor; title = R.string.nome_app_turbo_editor;
break; break;
} }
View view = new DialogHelper.Builder(getActivity()) View view = new DialogHelper.Builder(getActivity())
.setTitle(title) .setTitle(title)
.setView(R.layout.dialog_fragment_seekbar) .setView(R.layout.dialog_fragment_seekbar)
.createSkeletonView(); .createSkeletonView();
this.mSeekBar = (NumberPicker) view.findViewById(android.R.id.input); this.mSeekBar = (NumberPicker) view.findViewById(android.R.id.input);
this.mSeekBar.setMaxValue(getArguments().getInt("max")); this.mSeekBar.setMaxValue(getArguments().getInt("max"));
this.mSeekBar.setMinValue(getArguments().getInt("min")); this.mSeekBar.setMinValue(getArguments().getInt("min"));
this.mSeekBar.setValue(getArguments().getInt("current")); this.mSeekBar.setValue(getArguments().getInt("current"));
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
//.setTitle(title) //.setTitle(title)
.setView(view) .setView(view)
.setPositiveButton(android.R.string.ok, .setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
returnData(); returnData();
} }
} }
) )
.setNegativeButton(android.R.string.cancel, .setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
} }
} }
) )
.create(); .create();
} }
void returnData() { void returnData() {
INumberPickerDialog target = (INumberPickerDialog) getTargetFragment(); INumberPickerDialog target = (INumberPickerDialog) getTargetFragment();
if (target == null) { if (target == null) {
target = (INumberPickerDialog) getActivity(); target = (INumberPickerDialog) getActivity();
} }
target.onNumberPickerDialogDismissed( target.onNumberPickerDialogDismissed(
(Actions) getArguments().getSerializable("action"), (Actions) getArguments().getSerializable("action"),
mSeekBar.getValue() mSeekBar.getValue()
); );
this.dismiss(); this.dismiss();
} }
public enum Actions { public enum Actions {
FontSize, SelectPage, GoToLine FontSize, SelectPage, GoToLine
} }
public interface INumberPickerDialog { public interface INumberPickerDialog {
void onNumberPickerDialogDismissed(Actions action, int value); void onNumberPickerDialogDismissed(Actions action, int value);
} }
} }

View File

@ -1,113 +1,113 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.dialogfragment; package sharedcode.turboeditor.dialogfragment;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import java.io.File; import java.io.File;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.activity.MainActivity; import sharedcode.turboeditor.activity.MainActivity;
import sharedcode.turboeditor.task.SaveFileTask; import sharedcode.turboeditor.task.SaveFileTask;
import sharedcode.turboeditor.views.DialogHelper; import sharedcode.turboeditor.views.DialogHelper;
public class SaveFileDialog extends DialogFragment { public class SaveFileDialog extends DialogFragment {
public static SaveFileDialog newInstance(String filePath, String text, String encoding) { public static SaveFileDialog newInstance(String filePath, String text, String encoding) {
return newInstance(filePath, text, encoding, false, ""); return newInstance(filePath, text, encoding, false, "");
} }
public static SaveFileDialog newInstance(String filePath, String text, String encoding, boolean openNewFileAfter, String pathOfNewFile) { public static SaveFileDialog newInstance(String filePath, String text, String encoding, boolean openNewFileAfter, String pathOfNewFile) {
SaveFileDialog frag = new SaveFileDialog(); SaveFileDialog frag = new SaveFileDialog();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("filePath", filePath); args.putString("filePath", filePath);
args.putString("text", text); args.putString("text", text);
args.putString("encoding", encoding); args.putString("encoding", encoding);
args.putBoolean("openNewFileAfter", openNewFileAfter); args.putBoolean("openNewFileAfter", openNewFileAfter);
args.putString("pathOfNewFile", pathOfNewFile); args.putString("pathOfNewFile", pathOfNewFile);
frag.setArguments(args); frag.setArguments(args);
return frag; return frag;
} }
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final String filePath = getArguments().getString("filePath"); final String filePath = getArguments().getString("filePath");
final String text = getArguments().getString("text"); final String text = getArguments().getString("text");
final String encoding = getArguments().getString("encoding"); final String encoding = getArguments().getString("encoding");
final String fileName = FilenameUtils.getName(filePath); final String fileName = FilenameUtils.getName(filePath);
final File file = new File(filePath); final File file = new File(filePath);
View view = new DialogHelper.Builder(getActivity()) View view = new DialogHelper.Builder(getActivity())
.setIcon(getResources().getDrawable(R.drawable.ic_action_save)) .setIcon(getResources().getDrawable(R.drawable.ic_action_save))
.setTitle(R.string.salva) .setTitle(R.string.salva)
.setMessage(String.format(getString(R.string.save_changes), fileName)) .setMessage(String.format(getString(R.string.save_changes), fileName))
.createCommonView(); .createCommonView();
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setView(view) .setView(view)
.setPositiveButton(R.string.salva, .setPositiveButton(R.string.salva,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (!fileName.isEmpty()) if (!fileName.isEmpty())
new SaveFileTask((MainActivity) getActivity(), filePath, text, new SaveFileTask((MainActivity) getActivity(), filePath, text,
encoding).execute(); encoding).execute();
else { else {
NewFileDetailsDialog dialogFrag = NewFileDetailsDialog dialogFrag =
NewFileDetailsDialog.newInstance(text, NewFileDetailsDialog.newInstance(text,
encoding); encoding);
dialogFrag.show(getFragmentManager().beginTransaction(), dialogFrag.show(getFragmentManager().beginTransaction(),
"dialog"); "dialog");
} }
} }
} }
) )
.setNeutralButton(android.R.string.cancel, null) .setNeutralButton(android.R.string.cancel, null)
.setNegativeButton(R.string.no, .setNegativeButton(R.string.no,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
ISaveDialog target = (ISaveDialog) getTargetFragment(); ISaveDialog target = (ISaveDialog) getTargetFragment();
if (target == null) { if (target == null) {
target = (ISaveDialog) getActivity(); target = (ISaveDialog) getActivity();
} }
target.userDoesntWantToSave( target.userDoesntWantToSave(
getArguments().getBoolean("openNewFileAfter"), getArguments().getBoolean("openNewFileAfter"),
getArguments().getString("pathOfNewFile") getArguments().getString("pathOfNewFile")
); );
} }
} }
) )
.create(); .create();
} }
public interface ISaveDialog { public interface ISaveDialog {
void userDoesntWantToSave(boolean openNewFile, String pathOfNewFile); void userDoesntWantToSave(boolean openNewFile, String pathOfNewFile);
} }
} }

View File

@ -1,188 +1,188 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.preferences; package sharedcode.turboeditor.preferences;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Environment; import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
public final class PreferenceHelper { public final class PreferenceHelper {
public static final String SD_CARD_ROOT = Environment.getExternalStorageDirectory().getAbsolutePath(); public static final String SD_CARD_ROOT = Environment.getExternalStorageDirectory().getAbsolutePath();
private PreferenceHelper() { private PreferenceHelper() {
} }
// Getter Methods // Getter Methods
private static SharedPreferences getPrefs(Context context) { private static SharedPreferences getPrefs(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context); return PreferenceManager.getDefaultSharedPreferences(context);
} }
private static SharedPreferences.Editor getEditor(Context context) { private static SharedPreferences.Editor getEditor(Context context) {
return getPrefs(context).edit(); return getPrefs(context).edit();
} }
public static boolean getUseMonospace(Context context) { public static boolean getUseMonospace(Context context) {
return getPrefs(context).getBoolean("use_monospace", false); return getPrefs(context).getBoolean("use_monospace", false);
} }
public static boolean getLineNumbers(Context context) { public static boolean getLineNumbers(Context context) {
return getPrefs(context).getBoolean("editor_line_numbers", true); return getPrefs(context).getBoolean("editor_line_numbers", true);
} }
public static boolean getSyntaxHighlight(Context context) { public static boolean getSyntaxHighlight(Context context) {
return getPrefs(context).getBoolean("editor_syntax_highlight", false); return getPrefs(context).getBoolean("editor_syntax_highlight", false);
} }
public static boolean getWrapContent(Context context) { public static boolean getWrapContent(Context context) {
return getPrefs(context).getBoolean("editor_wrap_content", true); return getPrefs(context).getBoolean("editor_wrap_content", true);
} }
public static boolean getLightTheme(Context context) { public static boolean getLightTheme(Context context) {
return getPrefs(context).getBoolean("light_theme", false); return getPrefs(context).getBoolean("light_theme", false);
} }
public static boolean getSuggestionActive(Context context) { public static boolean getSuggestionActive(Context context) {
return getPrefs(context).getBoolean("suggestion_active", false); return getPrefs(context).getBoolean("suggestion_active", false);
} }
public static boolean getAutoEncoding(Context context) { public static boolean getAutoEncoding(Context context) {
return getPrefs(context).getBoolean("autoencoding", true); return getPrefs(context).getBoolean("autoencoding", true);
} }
public static boolean getSendErrorReports(Context context) { public static boolean getSendErrorReports(Context context) {
return getPrefs(context).getBoolean("send_error_reports", true); return getPrefs(context).getBoolean("send_error_reports", true);
} }
public static String getEncoding(Context context) { public static String getEncoding(Context context) {
return getPrefs(context).getString("editor_encoding", "UTF-8"); return getPrefs(context).getString("editor_encoding", "UTF-8");
} }
public static int getFontSize(Context context) { public static int getFontSize(Context context) {
return getPrefs(context).getInt("font_size", 16); return getPrefs(context).getInt("font_size", 16);
} }
public static String getWorkingFolder(Context context) { public static String getWorkingFolder(Context context) {
return getPrefs(context).getString("working_folder", SD_CARD_ROOT); return getPrefs(context).getString("working_folder", SD_CARD_ROOT);
} }
public static String[] getSavedPaths(Context context) { public static String[] getSavedPaths(Context context) {
return getPrefs(context).getString("savedPaths", "").split(","); return getPrefs(context).getString("savedPaths", "").split(",");
} }
public static boolean getPageSystemButtonsPopupShown(Context context) { public static boolean getPageSystemButtonsPopupShown(Context context) {
return getPrefs(context).getBoolean("page_system_button_popup_shown", false); return getPrefs(context).getBoolean("page_system_button_popup_shown", false);
} }
public static boolean getAutoSave(Context context) { public static boolean getAutoSave(Context context) {
return getPrefs(context).getBoolean("auto_save", false); return getPrefs(context).getBoolean("auto_save", false);
} }
public static boolean getReadOnly(Context context) { public static boolean getReadOnly(Context context) {
return getPrefs(context).getBoolean("read_only", false); return getPrefs(context).getBoolean("read_only", false);
} }
public static boolean getIgnoreBackButton(Context context) { public static boolean getIgnoreBackButton(Context context) {
return getPrefs(context).getBoolean("ignore_back_button", false); return getPrefs(context).getBoolean("ignore_back_button", false);
} }
public static boolean getSplitText(Context context) { public static boolean getSplitText(Context context) {
return getPrefs(context).getBoolean("page_system_active", true); return getPrefs(context).getBoolean("page_system_active", true);
} }
public static boolean hasDonated(Context context) { public static boolean hasDonated(Context context) {
return getPrefs(context).getBoolean("has_donated", false); return getPrefs(context).getBoolean("has_donated", false);
} }
// Setter methods // Setter methods
public static void setUseMonospace(Context context, boolean value) { public static void setUseMonospace(Context context, boolean value) {
getEditor(context).putBoolean("use_monospace", value).commit(); getEditor(context).putBoolean("use_monospace", value).commit();
} }
public static void setLineNumbers(Context context, boolean value) { public static void setLineNumbers(Context context, boolean value) {
getEditor(context).putBoolean("editor_line_numbers", value).commit(); getEditor(context).putBoolean("editor_line_numbers", value).commit();
} }
public static void setSyntaxHighlight(Context context, boolean value) { public static void setSyntaxHighlight(Context context, boolean value) {
getEditor(context).putBoolean("editor_syntax_highlight", value).commit(); getEditor(context).putBoolean("editor_syntax_highlight", value).commit();
} }
public static void setWrapContent(Context context, boolean value) { public static void setWrapContent(Context context, boolean value) {
getEditor(context).putBoolean("editor_wrap_content", value).commit(); getEditor(context).putBoolean("editor_wrap_content", value).commit();
} }
public static void setAutoencoding(Context context, boolean value) { public static void setAutoencoding(Context context, boolean value) {
getEditor(context).putBoolean("autoencoding", value).commit(); getEditor(context).putBoolean("autoencoding", value).commit();
} }
public static void setFontSize(Context context, int value) { public static void setFontSize(Context context, int value) {
getEditor(context).putInt("font_size", value).commit(); getEditor(context).putInt("font_size", value).commit();
} }
public static void setWorkingFolder(Context context, String value) { public static void setWorkingFolder(Context context, String value) {
getEditor(context).putString("working_folder", value).commit(); getEditor(context).putString("working_folder", value).commit();
} }
public static void setSavedPaths(Context context, StringBuilder stringBuilder) { public static void setSavedPaths(Context context, StringBuilder stringBuilder) {
getEditor(context).putString("savedPaths", stringBuilder.toString()).commit(); getEditor(context).putString("savedPaths", stringBuilder.toString()).commit();
} }
public static void setPageSystemButtonsPopupShown(Context context, boolean value) { public static void setPageSystemButtonsPopupShown(Context context, boolean value) {
getEditor(context).putBoolean("page_system_button_popup_shown", value).commit(); getEditor(context).putBoolean("page_system_button_popup_shown", value).commit();
} }
public static void setReadOnly(Context context, boolean value) { public static void setReadOnly(Context context, boolean value) {
getEditor(context).putBoolean("read_only", value).commit(); getEditor(context).putBoolean("read_only", value).commit();
} }
public static void setHasDonated(Context context, boolean value) { public static void setHasDonated(Context context, boolean value) {
getEditor(context).putBoolean("has_donated", value).commit(); getEditor(context).putBoolean("has_donated", value).commit();
} }
public static void setLightTheme(Context context, boolean value) { public static void setLightTheme(Context context, boolean value) {
getEditor(context).putBoolean("light_theme", value).commit(); getEditor(context).putBoolean("light_theme", value).commit();
} }
public static void setSuggestionsActive(Context context, boolean value) { public static void setSuggestionsActive(Context context, boolean value) {
getEditor(context).putBoolean("suggestion_active", value).commit(); getEditor(context).putBoolean("suggestion_active", value).commit();
} }
public static void setAutoSave(Context context, boolean value) { public static void setAutoSave(Context context, boolean value) {
getEditor(context).putBoolean("auto_save", value).commit(); getEditor(context).putBoolean("auto_save", value).commit();
} }
public static void setIgnoreBackButton(Context context, boolean value) { public static void setIgnoreBackButton(Context context, boolean value) {
getEditor(context).putBoolean("ignore_back_button", value).commit(); getEditor(context).putBoolean("ignore_back_button", value).commit();
} }
public static void setSplitText(Context context, boolean value) { public static void setSplitText(Context context, boolean value) {
getEditor(context).putBoolean("page_system_active", value).commit(); getEditor(context).putBoolean("page_system_active", value).commit();
} }
public static void setSendErrorReport(Context context, boolean value) { public static void setSendErrorReport(Context context, boolean value) {
getEditor(context).putBoolean("ignore_back_button", value).commit(); getEditor(context).putBoolean("ignore_back_button", value).commit();
} }
public static void setEncoding(Context context, String value) { public static void setEncoding(Context context, String value) {
getEditor(context).putString("editor_encoding", value).commit(); getEditor(context).putString("editor_encoding", value).commit();
} }
} }

View File

@ -1,269 +1,269 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.preferences; package sharedcode.turboeditor.preferences;
import android.app.Fragment; import android.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.SwitchCompat; import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.TextView; import android.widget.TextView;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.activity.MainActivity; import sharedcode.turboeditor.activity.MainActivity;
import sharedcode.turboeditor.dialogfragment.EncodingDialog; import sharedcode.turboeditor.dialogfragment.EncodingDialog;
import sharedcode.turboeditor.dialogfragment.NumberPickerDialog; import sharedcode.turboeditor.dialogfragment.NumberPickerDialog;
import sharedcode.turboeditor.util.ProCheckUtils; import sharedcode.turboeditor.util.ProCheckUtils;
import sharedcode.turboeditor.util.ViewUtils; import sharedcode.turboeditor.util.ViewUtils;
import sharedcode.turboeditor.views.DialogHelper; import sharedcode.turboeditor.views.DialogHelper;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.ENCODING; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.ENCODING;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.FONT_SIZE; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.FONT_SIZE;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.LINE_NUMERS; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.LINE_NUMERS;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.MONOSPACE; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.MONOSPACE;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.READ_ONLY; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.READ_ONLY;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.SYNTAX; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.SYNTAX;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.TEXT_SUGGESTIONS; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.TEXT_SUGGESTIONS;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.THEME_CHANGE; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.THEME_CHANGE;
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.WRAP_CONTENT; import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.WRAP_CONTENT;
public class SettingsFragment extends Fragment implements NumberPickerDialog.INumberPickerDialog, EncodingDialog.DialogListener { public class SettingsFragment extends Fragment implements NumberPickerDialog.INumberPickerDialog, EncodingDialog.DialogListener {
// Editor Variables // Editor Variables
private boolean sLineNumbers; private boolean sLineNumbers;
private boolean sColorSyntax; private boolean sColorSyntax;
private boolean sWrapContent; private boolean sWrapContent;
private boolean sUseMonospace; private boolean sUseMonospace;
private boolean sReadOnly; private boolean sReadOnly;
private boolean sLightTheme; private boolean sLightTheme;
private boolean sSuggestions; private boolean sSuggestions;
private boolean sAutoSave; private boolean sAutoSave;
private boolean sIgnoreBackButton; private boolean sIgnoreBackButton;
private boolean sSplitText; private boolean sSplitText;
private boolean sErrorReports; private boolean sErrorReports;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
sUseMonospace = PreferenceHelper.getUseMonospace(getActivity()); sUseMonospace = PreferenceHelper.getUseMonospace(getActivity());
sColorSyntax = PreferenceHelper.getSyntaxHighlight(getActivity()); sColorSyntax = PreferenceHelper.getSyntaxHighlight(getActivity());
sWrapContent = PreferenceHelper.getWrapContent(getActivity()); sWrapContent = PreferenceHelper.getWrapContent(getActivity());
sLineNumbers = PreferenceHelper.getLineNumbers(getActivity()); sLineNumbers = PreferenceHelper.getLineNumbers(getActivity());
sReadOnly = PreferenceHelper.getReadOnly(getActivity()); sReadOnly = PreferenceHelper.getReadOnly(getActivity());
sLightTheme = PreferenceHelper.getLightTheme(getActivity()); sLightTheme = PreferenceHelper.getLightTheme(getActivity());
sSuggestions = PreferenceHelper.getSuggestionActive(getActivity()); sSuggestions = PreferenceHelper.getSuggestionActive(getActivity());
sAutoSave = PreferenceHelper.getAutoSave(getActivity()); sAutoSave = PreferenceHelper.getAutoSave(getActivity());
sIgnoreBackButton = PreferenceHelper.getIgnoreBackButton(getActivity()); sIgnoreBackButton = PreferenceHelper.getIgnoreBackButton(getActivity());
sSplitText = PreferenceHelper.getSplitText(getActivity()); sSplitText = PreferenceHelper.getSplitText(getActivity());
sErrorReports = PreferenceHelper.getSendErrorReports(getActivity()); sErrorReports = PreferenceHelper.getSendErrorReports(getActivity());
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Our custom layout // Our custom layout
final View rootView = inflater.inflate(R.layout.fragment_settings, container, false); final View rootView = inflater.inflate(R.layout.fragment_settings, container, false);
final SwitchCompat swLineNumbers, swSyntax, swWrapContent, swMonospace, swReadOnly; final SwitchCompat swLineNumbers, swSyntax, swWrapContent, swMonospace, swReadOnly;
final SwitchCompat swLightTheme, swSuggestions, swAutoSave, swIgnoreBackButton, swSplitText, swErrorReports; final SwitchCompat swLightTheme, swSuggestions, swAutoSave, swIgnoreBackButton, swSplitText, swErrorReports;
swLineNumbers = (SwitchCompat) rootView.findViewById(R.id.switch_line_numbers); swLineNumbers = (SwitchCompat) rootView.findViewById(R.id.switch_line_numbers);
swSyntax = (SwitchCompat) rootView.findViewById(R.id.switch_syntax); swSyntax = (SwitchCompat) rootView.findViewById(R.id.switch_syntax);
swWrapContent = (SwitchCompat) rootView.findViewById(R.id.switch_wrap_content); swWrapContent = (SwitchCompat) rootView.findViewById(R.id.switch_wrap_content);
swMonospace = (SwitchCompat) rootView.findViewById(R.id.switch_monospace); swMonospace = (SwitchCompat) rootView.findViewById(R.id.switch_monospace);
swReadOnly = (SwitchCompat) rootView.findViewById(R.id.switch_read_only); swReadOnly = (SwitchCompat) rootView.findViewById(R.id.switch_read_only);
swLightTheme = (SwitchCompat) rootView.findViewById(R.id.switch_light_theme); swLightTheme = (SwitchCompat) rootView.findViewById(R.id.switch_light_theme);
swSuggestions = (SwitchCompat) rootView.findViewById(R.id.switch_suggestions_active); swSuggestions = (SwitchCompat) rootView.findViewById(R.id.switch_suggestions_active);
swAutoSave = (SwitchCompat) rootView.findViewById(R.id.switch_auto_save); swAutoSave = (SwitchCompat) rootView.findViewById(R.id.switch_auto_save);
swIgnoreBackButton = (SwitchCompat) rootView.findViewById(R.id.switch_ignore_backbutton); swIgnoreBackButton = (SwitchCompat) rootView.findViewById(R.id.switch_ignore_backbutton);
swSplitText = (SwitchCompat) rootView.findViewById(R.id.switch_page_system); swSplitText = (SwitchCompat) rootView.findViewById(R.id.switch_page_system);
swErrorReports = (SwitchCompat) rootView.findViewById(R.id.switch_send_error_reports); swErrorReports = (SwitchCompat) rootView.findViewById(R.id.switch_send_error_reports);
swLineNumbers.setChecked(sLineNumbers); swLineNumbers.setChecked(sLineNumbers);
swSyntax.setChecked(sColorSyntax); swSyntax.setChecked(sColorSyntax);
swWrapContent.setChecked(sWrapContent); swWrapContent.setChecked(sWrapContent);
swMonospace.setChecked(sUseMonospace); swMonospace.setChecked(sUseMonospace);
swReadOnly.setChecked(sReadOnly); swReadOnly.setChecked(sReadOnly);
swLightTheme.setChecked(sLightTheme); swLightTheme.setChecked(sLightTheme);
swSuggestions.setChecked(sSuggestions); swSuggestions.setChecked(sSuggestions);
swAutoSave.setChecked(sAutoSave); swAutoSave.setChecked(sAutoSave);
swIgnoreBackButton.setChecked(sIgnoreBackButton); swIgnoreBackButton.setChecked(sIgnoreBackButton);
swSplitText.setChecked(sSplitText); swSplitText.setChecked(sSplitText);
swErrorReports.setChecked(sErrorReports); swErrorReports.setChecked(sErrorReports);
TextView fontSizeView, encodingView, donateView, extraOptionsView; TextView fontSizeView, encodingView, donateView, extraOptionsView;
fontSizeView = (TextView) rootView.findViewById(R.id.drawer_button_font_size); fontSizeView = (TextView) rootView.findViewById(R.id.drawer_button_font_size);
encodingView = (TextView) rootView.findViewById(R.id.drawer_button_encoding); encodingView = (TextView) rootView.findViewById(R.id.drawer_button_encoding);
extraOptionsView = (TextView) rootView.findViewById(R.id.drawer_button_extra_options); extraOptionsView = (TextView) rootView.findViewById(R.id.drawer_button_extra_options);
donateView = (TextView) rootView.findViewById(R.id.drawer_button_go_pro); donateView = (TextView) rootView.findViewById(R.id.drawer_button_go_pro);
if(ProCheckUtils.isPro(getActivity(), false)) if(ProCheckUtils.isPro(getActivity(), false))
ViewUtils.setVisible(donateView, false); ViewUtils.setVisible(donateView, false);
swLineNumbers.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swLineNumbers.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setLineNumbers(getActivity(), isChecked); PreferenceHelper.setLineNumbers(getActivity(), isChecked);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(LINE_NUMERS)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(LINE_NUMERS));
} }
}); });
swSyntax.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swSyntax.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
sColorSyntax = isChecked; sColorSyntax = isChecked;
PreferenceHelper.setSyntaxHighlight(getActivity(), isChecked); PreferenceHelper.setSyntaxHighlight(getActivity(), isChecked);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(SYNTAX)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(SYNTAX));
} }
}); });
swWrapContent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swWrapContent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setWrapContent(getActivity(), isChecked); PreferenceHelper.setWrapContent(getActivity(), isChecked);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(WRAP_CONTENT)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(WRAP_CONTENT));
} }
}); });
swMonospace.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swMonospace.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
sUseMonospace = isChecked; sUseMonospace = isChecked;
PreferenceHelper.setUseMonospace(getActivity(), isChecked); PreferenceHelper.setUseMonospace(getActivity(), isChecked);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(MONOSPACE)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(MONOSPACE));
} }
}); });
swReadOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swReadOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setReadOnly(getActivity(), isChecked); PreferenceHelper.setReadOnly(getActivity(), isChecked);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(READ_ONLY)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(READ_ONLY));
} }
}); });
fontSizeView.setOnClickListener(new View.OnClickListener() { fontSizeView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
int fontMax = 36; int fontMax = 36;
int fontCurrent = //(int) (mEditor.getTextSize() / scaledDensity); int fontCurrent = //(int) (mEditor.getTextSize() / scaledDensity);
//fontMax / 2; //fontMax / 2;
PreferenceHelper.getFontSize(getActivity()); PreferenceHelper.getFontSize(getActivity());
NumberPickerDialog dialogFrag = NumberPickerDialog.newInstance(NumberPickerDialog NumberPickerDialog dialogFrag = NumberPickerDialog.newInstance(NumberPickerDialog
.Actions .Actions
.FontSize, 1, fontCurrent, fontMax); .FontSize, 1, fontCurrent, fontMax);
dialogFrag.setTargetFragment(SettingsFragment.this, 0); dialogFrag.setTargetFragment(SettingsFragment.this, 0);
dialogFrag.show(getFragmentManager().beginTransaction(), "dialog"); dialogFrag.show(getFragmentManager().beginTransaction(), "dialog");
} }
}); });
encodingView.setOnClickListener(new View.OnClickListener() { encodingView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
EncodingDialog dialogFrag = EncodingDialog.newInstance(); EncodingDialog dialogFrag = EncodingDialog.newInstance();
dialogFrag.setTargetFragment(SettingsFragment.this, 0); dialogFrag.setTargetFragment(SettingsFragment.this, 0);
dialogFrag.show(getFragmentManager().beginTransaction(), "dialog"); dialogFrag.show(getFragmentManager().beginTransaction(), "dialog");
} }
}); });
extraOptionsView.setOnClickListener(new View.OnClickListener() { extraOptionsView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
View otherOptions = rootView.findViewById(R.id.other_options); View otherOptions = rootView.findViewById(R.id.other_options);
boolean isVisible = otherOptions.getVisibility() == View.VISIBLE; boolean isVisible = otherOptions.getVisibility() == View.VISIBLE;
ViewUtils.setVisible(otherOptions, !isVisible); ViewUtils.setVisible(otherOptions, !isVisible);
} }
}); });
donateView.setOnClickListener(new View.OnClickListener() { donateView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
DialogHelper.showDonateDialog(getActivity()); DialogHelper.showDonateDialog(getActivity());
} }
}); });
swLightTheme.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swLightTheme.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setLightTheme(getActivity(), isChecked); PreferenceHelper.setLightTheme(getActivity(), isChecked);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(THEME_CHANGE)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(THEME_CHANGE));
} }
}); });
swSuggestions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swSuggestions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setSuggestionsActive(getActivity(), isChecked); PreferenceHelper.setSuggestionsActive(getActivity(), isChecked);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(TEXT_SUGGESTIONS)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(TEXT_SUGGESTIONS));
} }
}); });
swAutoSave.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swAutoSave.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setAutoSave(getActivity(), isChecked); PreferenceHelper.setAutoSave(getActivity(), isChecked);
} }
}); });
swIgnoreBackButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swIgnoreBackButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setIgnoreBackButton(getActivity(), isChecked); PreferenceHelper.setIgnoreBackButton(getActivity(), isChecked);
} }
}); });
swSplitText.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swSplitText.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setSplitText(getActivity(), isChecked); PreferenceHelper.setSplitText(getActivity(), isChecked);
} }
}); });
swErrorReports.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swErrorReports.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
PreferenceHelper.setSendErrorReport(getActivity(), isChecked); PreferenceHelper.setSendErrorReport(getActivity(), isChecked);
} }
}); });
return rootView; return rootView;
} }
@Override @Override
public void onNumberPickerDialogDismissed(NumberPickerDialog.Actions action, int value) { public void onNumberPickerDialogDismissed(NumberPickerDialog.Actions action, int value) {
PreferenceHelper.setFontSize(getActivity(), value); PreferenceHelper.setFontSize(getActivity(), value);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(FONT_SIZE)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(FONT_SIZE));
} }
@Override @Override
public void onEncodingSelected(String result) { public void onEncodingSelected(String result) {
PreferenceHelper.setEncoding(getActivity(), result); PreferenceHelper.setEncoding(getActivity(), result);
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(ENCODING)); ((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(ENCODING));
} }
} }

View File

@ -1,77 +1,77 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.root; package sharedcode.turboeditor.root;
import android.util.Log; import android.util.Log;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class LinuxShell { public class LinuxShell {
private static final String UNIX_ESCAPE_EXPRESSION = "(\\(|\\)|\\[|\\]|\\s|\'|\"|`|\\{|\\}|&|\\\\|\\?)"; private static final String UNIX_ESCAPE_EXPRESSION = "(\\(|\\)|\\[|\\]|\\s|\'|\"|`|\\{|\\}|&|\\\\|\\?)";
public static String getCommandLineString(String input) { public static String getCommandLineString(String input) {
return input.replaceAll(UNIX_ESCAPE_EXPRESSION, "\\\\$1"); return input.replaceAll(UNIX_ESCAPE_EXPRESSION, "\\\\$1");
} }
public static BufferedReader execute(String cmd) { public static BufferedReader execute(String cmd) {
BufferedReader reader = null; BufferedReader reader = null;
try { try {
Process process = Runtime.getRuntime().exec("su"); Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream( DataOutputStream os = new DataOutputStream(
process.getOutputStream()); process.getOutputStream());
os.writeBytes(cmd + "\n"); os.writeBytes(cmd + "\n");
os.writeBytes("exit\n"); os.writeBytes("exit\n");
reader = new BufferedReader(new InputStreamReader( reader = new BufferedReader(new InputStreamReader(
process.getInputStream())); process.getInputStream()));
String err = (new BufferedReader(new InputStreamReader( String err = (new BufferedReader(new InputStreamReader(
process.getErrorStream()))).readLine(); process.getErrorStream()))).readLine();
os.flush(); os.flush();
if (process.waitFor() != 0 || (!"".equals(err) && null != err) if (process.waitFor() != 0 || (!"".equals(err) && null != err)
&& containsIllegals(err) != true) { && containsIllegals(err) != true) {
Log.e("Root Error, cmd: " + cmd, err); Log.e("Root Error, cmd: " + cmd, err);
return null; return null;
} }
return reader; return reader;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
public static boolean containsIllegals(String toExamine) { public static boolean containsIllegals(String toExamine) {
// checks for "+" sign so the program doesn't throw an error when its // checks for "+" sign so the program doesn't throw an error when its
// not erroring. // not erroring.
Pattern pattern = Pattern.compile("[+]"); Pattern pattern = Pattern.compile("[+]");
Matcher matcher = pattern.matcher(toExamine); Matcher matcher = pattern.matcher(toExamine);
return matcher.find(); return matcher.find();
} }
} }

View File

@ -1,101 +1,101 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* 920 Text Editor is free software: you can redistribute it and/or modify * 920 Text Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* 920 Text Editor is distributed in the hope that it will be useful, * 920 Text Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with 920 Text Editor. If not, see <http://www.gnu.org/licenses/>. * along with 920 Text Editor. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.root; package sharedcode.turboeditor.root;
import android.content.Context; import android.content.Context;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.sufficientlysecure.rootcommands.Shell; import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.Toolbox; import org.sufficientlysecure.rootcommands.Toolbox;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
public class RootUtils { public class RootUtils {
public static void writeFile(Context context, String path, String text, String encoding, boolean isRoot) throws Exception { public static void writeFile(Context context, String path, String text, String encoding, boolean isRoot) throws Exception {
File file = new File(path); File file = new File(path);
if (!file.canWrite() && isRoot) { if (!file.canWrite() && isRoot) {
File appFolder = context.getFilesDir(); File appFolder = context.getFilesDir();
File tempFile = new File(appFolder, "temp.root.file"); File tempFile = new File(appFolder, "temp.root.file");
if (!tempFile.exists()) if (!tempFile.exists())
tempFile.createNewFile(); tempFile.createNewFile();
FileUtils.write(tempFile, text, encoding); FileUtils.write(tempFile, text, encoding);
Shell shell = Shell.startRootShell(); Shell shell = Shell.startRootShell();
Toolbox tb = new Toolbox(shell); Toolbox tb = new Toolbox(shell);
String mount = tb.getFilePermissions(path); String mount = tb.getFilePermissions(path);
tb.copyFile(tempFile.getAbsolutePath(), path, true, false); tb.copyFile(tempFile.getAbsolutePath(), path, true, false);
tb.setFilePermissions(path, mount); tb.setFilePermissions(path, mount);
tempFile.delete(); tempFile.delete();
} else { } else {
FileUtils.write(file, FileUtils.write(file,
text, text,
encoding); encoding);
} }
} }
public static ArrayList<File> getFileList(String path, boolean runAtRoot) { public static ArrayList<File> getFileList(String path, boolean runAtRoot) {
ArrayList<File> filesList = new ArrayList<File>(); ArrayList<File> filesList = new ArrayList<File>();
if (runAtRoot == false) { if (runAtRoot == false) {
File base = new File(path); File base = new File(path);
File[] files = base.listFiles(); File[] files = base.listFiles();
if (files == null) if (files == null)
return null; return null;
Collections.addAll(filesList, files); Collections.addAll(filesList, files);
} else { } else {
BufferedReader reader = null; //errReader = null; BufferedReader reader = null; //errReader = null;
try { try {
LinuxShell.execute("ls -a " + LinuxShell.getCommandLineString(path)); LinuxShell.execute("ls -a " + LinuxShell.getCommandLineString(path));
if (reader == null) if (reader == null)
return null; return null;
File f; File f;
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
f = new File(line.substring(2)); f = new File(line.substring(2));
filesList.add(f); filesList.add(f);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return filesList; return filesList;
} }
} }

View File

@ -1,106 +1,106 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.task; package sharedcode.turboeditor.task;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.widget.Toast; import android.widget.Toast;
import org.sufficientlysecure.rootcommands.Shell; import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.Toolbox; import org.sufficientlysecure.rootcommands.Toolbox;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
import sharedcode.turboeditor.activity.MainActivity; import sharedcode.turboeditor.activity.MainActivity;
import sharedcode.turboeditor.root.RootUtils; import sharedcode.turboeditor.root.RootUtils;
import sharedcode.turboeditor.util.EventBusEvents; import sharedcode.turboeditor.util.EventBusEvents;
public class SaveFileTask extends AsyncTask<Void, Void, Void> { public class SaveFileTask extends AsyncTask<Void, Void, Void> {
private final MainActivity activity; private final MainActivity activity;
private final String filePath; private final String filePath;
private final String text; private final String text;
private final String encoding; private final String encoding;
private File file; private File file;
private String message; private String message;
private String positiveMessage; private String positiveMessage;
public SaveFileTask(MainActivity activity, String filePath, String text, String encoding) { public SaveFileTask(MainActivity activity, String filePath, String text, String encoding) {
this.activity = activity; this.activity = activity;
this.filePath = filePath; this.filePath = filePath;
this.text = text; this.text = text;
this.encoding = encoding; this.encoding = encoding;
} }
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
super.onPreExecute(); super.onPreExecute();
file = new File(filePath); file = new File(filePath);
positiveMessage = String.format(activity.getString(R.string.file_saved_with_success), file.getName()); positiveMessage = String.format(activity.getString(R.string.file_saved_with_success), file.getName());
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected Void doInBackground(final Void... voids) { protected Void doInBackground(final Void... voids) {
try { try {
if (!file.exists()) { if (!file.exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
file.createNewFile(); file.createNewFile();
} }
boolean isRoot = false; boolean isRoot = false;
if (!file.canWrite()) { if (!file.canWrite()) {
try { try {
Shell shell = null; Shell shell = null;
shell = Shell.startRootShell(); shell = Shell.startRootShell();
Toolbox tb = new Toolbox(shell); Toolbox tb = new Toolbox(shell);
isRoot = tb.isRootAccessGiven(); isRoot = tb.isRootAccessGiven();
} catch (IOException | TimeoutException e) { } catch (IOException | TimeoutException e) {
e.printStackTrace(); e.printStackTrace();
isRoot = false; isRoot = false;
} }
} }
RootUtils.writeFile(activity, file.getAbsolutePath(), text, encoding, isRoot); RootUtils.writeFile(activity, file.getAbsolutePath(), text, encoding, isRoot);
message = positiveMessage; message = positiveMessage;
} catch (Exception e) { } catch (Exception e) {
message = e.getMessage(); message = e.getMessage();
} }
return null; return null;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected void onPostExecute(final Void aVoid) { protected void onPostExecute(final Void aVoid) {
super.onPostExecute(aVoid); super.onPostExecute(aVoid);
Toast.makeText(activity, message, Toast.LENGTH_LONG).show(); Toast.makeText(activity, message, Toast.LENGTH_LONG).show();
if (message.equals(positiveMessage)) if (message.equals(positiveMessage))
activity.onEvent(new EventBusEvents.SavedAFile(filePath)); activity.onEvent(new EventBusEvents.SavedAFile(filePath));
} }
} }

View File

@ -1,39 +1,39 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.texteditor; package sharedcode.turboeditor.texteditor;
import android.content.Context; import android.content.Context;
import sharedcode.turboeditor.util.PixelDipConverter; import sharedcode.turboeditor.util.PixelDipConverter;
public class EditTextPadding { public class EditTextPadding {
public static int getPaddingWithoutLineNumbers(Context context) { public static int getPaddingWithoutLineNumbers(Context context) {
return (int) PixelDipConverter.convertDpToPixel(5, context); return (int) PixelDipConverter.convertDpToPixel(5, context);
} }
public static int getPaddingWithLineNumbers(Context context, float fontSize) { public static int getPaddingWithLineNumbers(Context context, float fontSize) {
return (int) PixelDipConverter.convertDpToPixel(fontSize * 2f, context); return (int) PixelDipConverter.convertDpToPixel(fontSize * 2f, context);
} }
public static int getPaddingTop(Context context) { public static int getPaddingTop(Context context) {
return getPaddingWithoutLineNumbers(context); return getPaddingWithoutLineNumbers(context);
} }
} }

View File

@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.texteditor; package sharedcode.turboeditor.texteditor;
import org.mozilla.universalchardet.UniversalDetector; import org.mozilla.universalchardet.UniversalDetector;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
public class FileUtils { public class FileUtils {
public static String getDetectedEncoding(File file) { public static String getDetectedEncoding(File file) {
InputStream is = null; InputStream is = null;
String encoding = null; String encoding = null;
try { try {
is = new FileInputStream(file); is = new FileInputStream(file);
UniversalDetector detector = new UniversalDetector(null); UniversalDetector detector = new UniversalDetector(null);
byte[] buf = new byte[4096]; byte[] buf = new byte[4096];
int nread; int nread;
while ((nread = is.read(buf)) > 0 && !detector.isDone()) { while ((nread = is.read(buf)) > 0 && !detector.isDone()) {
detector.handleData(buf, 0, nread); detector.handleData(buf, 0, nread);
} }
detector.dataEnd(); detector.dataEnd();
encoding = detector.getDetectedCharset(); encoding = detector.getDetectedCharset();
} catch (IOException e) { } catch (IOException e) {
// nothing to do // nothing to do
} finally { } finally {
try { try {
is.close(); is.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (encoding == null) { if (encoding == null) {
return Charset.defaultCharset().name(); return Charset.defaultCharset().name();
} }
} }
return encoding; return encoding;
} }
} }

View File

@ -1,133 +1,136 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.texteditor; package sharedcode.turboeditor.texteditor;
import android.text.Layout; import android.text.Layout;
import android.text.TextUtils; import android.text.TextUtils;
import android.widget.ScrollView; import android.widget.ScrollView;
public class LineUtils { public class LineUtils {
private boolean[] toCountLinesArray; private boolean[] toCountLinesArray;
private int[] realLines; private int[] realLines;
public boolean[] getToCountLinesArray() { public boolean[] getToCountLinesArray() {
return toCountLinesArray; return toCountLinesArray;
} }
public int[] getRealLines() { public int[] getRealLines() {
return realLines; return realLines;
} }
public static int getYAtLine(ScrollView scrollView, int lineCount, int line) { public static int getYAtLine(ScrollView scrollView, int lineCount, int line) {
return scrollView.getChildAt(0).getHeight() / lineCount * line; return scrollView.getChildAt(0).getHeight() / lineCount * line;
} }
public static int getFirstVisibleLine(ScrollView scrollView, int childHeight, int lineCount) throws ArithmeticException { public static int getFirstVisibleLine(ScrollView scrollView, int childHeight, int lineCount) throws ArithmeticException {
int line = (scrollView.getScrollY() * lineCount) / childHeight; int line = (scrollView.getScrollY() * lineCount) / childHeight;
if (line < 0) line = 0; if (line < 0) line = 0;
return line; return line;
} }
public static int getLastVisibleLine(ScrollView scrollView, int childHeight, int lineCount, int deviceHeight) { public static int getLastVisibleLine(ScrollView scrollView, int childHeight, int lineCount, int deviceHeight) {
int line = ((scrollView.getScrollY() + deviceHeight) * lineCount) / childHeight; int line = ((scrollView.getScrollY() + deviceHeight) * lineCount) / childHeight;
if (line > lineCount) line = lineCount; if (line > lineCount) line = lineCount;
return line; return line;
} }
public void updateHasNewLineArray(int startingLine, int lineCount, Layout layout, String text) { public void updateHasNewLineArray(int startingLine, int lineCount, Layout layout, String text) {
boolean[] hasNewLineArray = new boolean[lineCount]; boolean[] hasNewLineArray = new boolean[lineCount];
toCountLinesArray = new boolean[lineCount]; toCountLinesArray = new boolean[lineCount];
realLines = new int[lineCount]; realLines = new int[lineCount];
if(TextUtils.isEmpty(text)) if(TextUtils.isEmpty(text)) {
return; toCountLinesArray[0] = false;
realLines[0] = 1;
int i; return;
}
// for every line on the edittext
for (i = 0; i < lineCount; i++) { int i;
// check if this line contains "\n"
//hasNewLineArray[i] = text.substring(layout.getLineStart(i), layout.getLineEnd(i)).endsWith("\n"); // for every line on the edittext
hasNewLineArray[i] = text.charAt(layout.getLineEnd(i) - 1) == '\n'; for (i = 0; i < lineCount; i++) {
// if true // check if this line contains "\n"
if (hasNewLineArray[i]) { //hasNewLineArray[i] = text.substring(layout.getLineStart(i), layout.getLineEnd(i)).endsWith("\n");
int j = i - 1; hasNewLineArray[i] = text.charAt(layout.getLineEnd(i) - 1) == '\n';
while (j > -1 && !hasNewLineArray[j]) { // if true
j--; if (hasNewLineArray[i]) {
} int j = i - 1;
toCountLinesArray[j + 1] = true; while (j > -1 && !hasNewLineArray[j]) {
j--;
} }
} toCountLinesArray[j + 1] = true;
int realLine = startingLine; // the first line is not 0, is 1. We start counting from 1 }
}
for (i = 0; i < toCountLinesArray.length; i++) {
if (toCountLinesArray[i]) { int realLine = startingLine; // the first line is not 0, is 1. We start counting from 1
realLine++;
} for (i = 0; i < toCountLinesArray.length; i++) {
realLines[i] = realLine; if (toCountLinesArray[i]) {
} realLine++;
} }
realLines[i] = realLine;
/** }
* Gets the line from the index of the letter in the text }
*
* @param index /**
* @param lineCount * Gets the line from the index of the letter in the text
* @param layout *
* @return * @param index
*/ * @param lineCount
public static int getLineFromIndex(int index, int lineCount, Layout layout) { * @param layout
int line; * @return
int currentIndex = 0; */
public static int getLineFromIndex(int index, int lineCount, Layout layout) {
for (line = 0; line < lineCount; line++) { int line;
currentIndex += layout.getLineEnd(line) - layout.getLineStart(line); int currentIndex = 0;
if (currentIndex > index) {
break; for (line = 0; line < lineCount; line++) {
} currentIndex += layout.getLineEnd(line) - layout.getLineStart(line);
} if (currentIndex > index) {
break;
return line; }
} }
public int firstReadLine() { return line;
return realLines[0]; }
}
public int firstReadLine() {
public int lastReadLine() { return realLines[0];
return realLines[realLines.length - 1]; }
}
public int lastReadLine() {
public int fakeLineFromRealLine(int realLine) { return realLines[realLines.length - 1];
int i; }
int fakeLine = 0;
for (i = 0; i < realLines.length; i++) { public int fakeLineFromRealLine(int realLine) {
if (realLine == realLines[i]) { int i;
fakeLine = i; int fakeLine = 0;
break; for (i = 0; i < realLines.length; i++) {
} if (realLine == realLines[i]) {
} fakeLine = i;
return fakeLine; break;
} }
}
return fakeLine;
}
} }

View File

@ -1,183 +1,185 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.texteditor; package sharedcode.turboeditor.texteditor;
import android.content.Context; import android.content.Context;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import java.io.File; import java.io.File;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import sharedcode.turboeditor.preferences.PreferenceHelper; import sharedcode.turboeditor.preferences.PreferenceHelper;
public class PageSystem { public class PageSystem {
private List<String> pages; private List<String> pages;
private int[] startingLines; private int[] startingLines;
private int currentPage = 0; private int currentPage = 0;
private PageSystemInterface pageSystemInterface; private PageSystemInterface pageSystemInterface;
public PageSystem(Context context, PageSystemInterface pageSystemInterface, String text, @Nullable File file) { public PageSystem(Context context, PageSystemInterface pageSystemInterface, String text, @Nullable File file) {
final int charForPage = 15000; final int charForPage = 15000;
final int MAX_KBs_WITHOUT_PAGE_SYSTEM = 50; final int MAX_KBs_WITHOUT_PAGE_SYSTEM = 50;
this.pageSystemInterface = pageSystemInterface; this.pageSystemInterface = pageSystemInterface;
pages = new LinkedList<>(); pages = new LinkedList<>();
final boolean dimensionOverLimit; final boolean dimensionOverLimit;
if(file != null && file.exists() && file.isFile()) if(file != null && file.exists() && file.isFile())
dimensionOverLimit = FileUtils.sizeOf(file) >= MAX_KBs_WITHOUT_PAGE_SYSTEM * FileUtils.ONE_KB; dimensionOverLimit = FileUtils.sizeOf(file) >= MAX_KBs_WITHOUT_PAGE_SYSTEM * FileUtils.ONE_KB;
else else
dimensionOverLimit = false; dimensionOverLimit = false;
int i = 0; int i = 0;
int to; int to;
int nextIndexOfReturn; int nextIndexOfReturn;
final int textLength = text.length(); final int textLength = text.length();
boolean pageSystemEnabled = PreferenceHelper.getSplitText(context); boolean pageSystemEnabled = PreferenceHelper.getSplitText(context);
if (pageSystemEnabled && dimensionOverLimit) { if (pageSystemEnabled && dimensionOverLimit) {
while (i < textLength) { while (i < textLength) {
to = i + charForPage; to = i + charForPage;
nextIndexOfReturn = text.indexOf("\n", to); nextIndexOfReturn = text.indexOf("\n", to);
if (nextIndexOfReturn > to) to = nextIndexOfReturn; if (nextIndexOfReturn > to) to = nextIndexOfReturn;
if (to > text.length()) to = text.length(); if (to > text.length()) to = text.length();
pages.add(text.substring(i, to)); pages.add(text.substring(i, to));
i = to + 1; i = to + 1;
} }
if (i == 0) if (i == 0)
pages.add(""); pages.add("");
} else { } else {
pages.add(text); pages.add(text);
} }
startingLines = new int[pages.size()]; startingLines = new int[pages.size()];
setStartingLines(); setStartingLines();
} }
public int getStartingLine() { public int getStartingLine() {
return startingLines[currentPage]; return startingLines[currentPage];
} }
public String getCurrentPageText() { public String getCurrentPageText() {
return pages.get(currentPage); return pages.get(currentPage);
} }
public String getTextOfNextPages(boolean includeCurrent, int nOfPages) { public String getTextOfNextPages(boolean includeCurrent, int nOfPages) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
int i; int i;
for (i = includeCurrent ? 0 : 1; i < nOfPages; i++) { for (i = includeCurrent ? 0 : 1; i < nOfPages; i++) {
if (pages.size() > (currentPage + i)) { if (pages.size() > (currentPage + i)) {
stringBuilder.append(pages.get(currentPage + 1)); stringBuilder.append(pages.get(currentPage + 1));
} }
} }
return stringBuilder.toString(); return stringBuilder.toString();
} }
public void savePage(String currentText) { public void savePage(String currentText) {
pages.set(currentPage, currentText); pages.set(currentPage, currentText);
} }
public void nextPage() { public void nextPage() {
if (!canReadNextPage()) return; if (!canReadNextPage()) return;
goToPage(currentPage + 1); goToPage(currentPage + 1);
} }
public void prevPage() { public void prevPage() {
if (!canReadPrevPage()) return; if (!canReadPrevPage()) return;
goToPage(currentPage - 1); goToPage(currentPage - 1);
} }
public void goToPage(int page) { public void goToPage(int page) {
if (page >= pages.size()) page = pages.size() - 1; if (page >= pages.size()) page = pages.size() - 1;
if (page < 0) page = 0; if (page < 0) page = 0;
boolean shouldUpdateLines = page > currentPage && canReadNextPage(); boolean shouldUpdateLines = page > currentPage && canReadNextPage();
if (shouldUpdateLines) { if (shouldUpdateLines) {
String text = getCurrentPageText(); String text = getCurrentPageText();
int nOfNewLineNow = (text.length() - text.replace("\n", "").length()) + 1; // normally the last line is not counted so we have to add 1 int nOfNewLineNow = (text.length() - text.replace("\n", "").length()) + 1; // normally the last line is not counted so we have to add 1
int nOfNewLineBefore = startingLines[currentPage + 1] - startingLines[currentPage]; int nOfNewLineBefore = startingLines[currentPage + 1] - startingLines[currentPage];
int difference = nOfNewLineNow - nOfNewLineBefore; int difference = nOfNewLineNow - nOfNewLineBefore;
updateStartingLines(currentPage + 1, difference); updateStartingLines(currentPage + 1, difference);
} }
currentPage = page; currentPage = page;
pageSystemInterface.onPageChanged(page); pageSystemInterface.onPageChanged(page);
} }
public void setStartingLines() { public void setStartingLines() {
int i; int i;
int startingLine; int startingLine;
int nOfNewLines; int nOfNewLines;
String text; String text;
startingLines[0] = 0; startingLines[0] = 0;
for (i = 1; i < pages.size(); i++) { for (i = 1; i < pages.size(); i++) {
text = pages.get(i - 1); text = pages.get(i - 1);
nOfNewLines = text.length() - text.replace("\n", "").length() + 1; nOfNewLines = text.length() - text.replace("\n", "").length() + 1;
startingLine = startingLines[i - 1] + nOfNewLines; startingLine = startingLines[i - 1] + nOfNewLines;
startingLines[i] = startingLine; startingLines[i] = startingLine;
} }
} }
public void updateStartingLines(int fromPage, int difference) { public void updateStartingLines(int fromPage, int difference) {
if (difference == 0) if (difference == 0)
return; return;
int i; int i;
if (fromPage < 1) fromPage = 1; if (fromPage < 1) fromPage = 1;
for (i = fromPage; i < pages.size(); i++) { for (i = fromPage; i < pages.size(); i++) {
startingLines[i] += difference; startingLines[i] += difference;
} }
} }
public int getMaxPage() { public int getMaxPage() {
return pages.size() - 1; return pages.size() - 1;
} }
public int getCurrentPage() { public int getCurrentPage() {
return currentPage; return currentPage;
} }
public String getAllText(String currentPageText) { public String getAllText(String currentPageText) {
pages.set(currentPage, currentPageText); pages.set(currentPage, currentPageText);
int i; int i;
StringBuilder allText = new StringBuilder(); StringBuilder allText = new StringBuilder();
for (i = 0; i < pages.size(); i++) { for (i = 0; i < pages.size(); i++) {
allText.append(pages.get(i)).append("\n"); allText.append(pages.get(i));
} if(i < pages.size() - 1)
return allText.toString(); allText.append("\n");
} }
return allText.toString();
public boolean canReadNextPage() { }
return currentPage < pages.size() - 1;
} public boolean canReadNextPage() {
return currentPage < pages.size() - 1;
public boolean canReadPrevPage() { }
return currentPage >= 1;
} public boolean canReadPrevPage() {
return currentPage >= 1;
public interface PageSystemInterface { }
void onPageChanged(int page);
} public interface PageSystemInterface {
} void onPageChanged(int page);
}
}

View File

@ -1,134 +1,134 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.texteditor; package sharedcode.turboeditor.texteditor;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.view.View; import android.view.View;
import com.faizmalkani.floatingactionbutton.FloatingActionButton; import com.faizmalkani.floatingactionbutton.FloatingActionButton;
import sharedcode.turboeditor.R; import sharedcode.turboeditor.R;
public class PageSystemButtons { public class PageSystemButtons {
private static final int TIME_TO_SHOW_FABS = 2000; private static final int TIME_TO_SHOW_FABS = 2000;
final Handler handler = new Handler(); final Handler handler = new Handler();
final Runnable runnable = new Runnable() { final Runnable runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
PageSystemButtons.this.next.setVisibility(View.GONE); PageSystemButtons.this.next.setVisibility(View.GONE);
PageSystemButtons.this.prev.setVisibility(View.GONE); PageSystemButtons.this.prev.setVisibility(View.GONE);
} }
}; };
FloatingActionButton prev, next; FloatingActionButton prev, next;
PageButtonsInterface pageButtonsInterface; PageButtonsInterface pageButtonsInterface;
public PageSystemButtons(Context context, final PageButtonsInterface pageButtonsInterface, FloatingActionButton prev, FloatingActionButton next) { public PageSystemButtons(Context context, final PageButtonsInterface pageButtonsInterface, FloatingActionButton prev, FloatingActionButton next) {
this.prev = prev; this.prev = prev;
this.next = next; this.next = next;
this.pageButtonsInterface = pageButtonsInterface; this.pageButtonsInterface = pageButtonsInterface;
this.next.setColor(context.getResources().getColor(R.color.fab_light)); this.next.setColor(context.getResources().getColor(R.color.fab_light));
this.next.setDrawable(context.getResources().getDrawable(R.drawable.ic_keyboard_arrow_right)); this.next.setDrawable(context.getResources().getDrawable(R.drawable.ic_keyboard_arrow_right));
this.prev.setColor(context.getResources().getColor(R.color.fab_light)); this.prev.setColor(context.getResources().getColor(R.color.fab_light));
this.prev.setDrawable(context.getResources().getDrawable(R.drawable.ic_keyboard_arrow_left)); this.prev.setDrawable(context.getResources().getDrawable(R.drawable.ic_keyboard_arrow_left));
if (pageButtonsInterface.canReadNextPage()) if (pageButtonsInterface.canReadNextPage())
next.setVisibility(View.VISIBLE); next.setVisibility(View.VISIBLE);
if (pageButtonsInterface.canReadPrevPage()) if (pageButtonsInterface.canReadPrevPage())
prev.setVisibility(View.VISIBLE); prev.setVisibility(View.VISIBLE);
this.next.setOnClickListener(new View.OnClickListener() { this.next.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
pageButtonsInterface.nextPageClicked(); pageButtonsInterface.nextPageClicked();
} }
}); });
this.next.setOnLongClickListener(new View.OnLongClickListener() { this.next.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
pageButtonsInterface.pageSystemButtonLongClicked(); pageButtonsInterface.pageSystemButtonLongClicked();
return true; return true;
} }
}); });
this.prev.setOnClickListener(new View.OnClickListener() { this.prev.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
pageButtonsInterface.prevPageClicked(); pageButtonsInterface.prevPageClicked();
} }
}); });
this.prev.setOnLongClickListener(new View.OnLongClickListener() { this.prev.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
pageButtonsInterface.pageSystemButtonLongClicked(); pageButtonsInterface.pageSystemButtonLongClicked();
return true; return true;
} }
}); });
} }
public void updateVisibility(boolean autoHide) { public void updateVisibility(boolean autoHide) {
if (pageButtonsInterface.canReadNextPage()) if (pageButtonsInterface.canReadNextPage())
PageSystemButtons.this.next.setVisibility(View.VISIBLE); PageSystemButtons.this.next.setVisibility(View.VISIBLE);
else else
PageSystemButtons.this.next.setVisibility(View.GONE); PageSystemButtons.this.next.setVisibility(View.GONE);
if (pageButtonsInterface.canReadPrevPage()) if (pageButtonsInterface.canReadPrevPage())
PageSystemButtons.this.prev.setVisibility(View.VISIBLE); PageSystemButtons.this.prev.setVisibility(View.VISIBLE);
else else
PageSystemButtons.this.prev.setVisibility(View.GONE); PageSystemButtons.this.prev.setVisibility(View.GONE);
/*if(pageButtonsInterface.hasNext()) /*if(pageButtonsInterface.hasNext())
next.showFab(); next.showFab();
else else
next.hideFab(); next.hideFab();
if(pageButtonsInterface.hasPrev()) if(pageButtonsInterface.hasPrev())
prev.showFab(); prev.showFab();
else else
prev.hideFab();*/ prev.hideFab();*/
if (autoHide) { if (autoHide) {
handler.removeCallbacks(runnable); handler.removeCallbacks(runnable);
handler.postDelayed(runnable, TIME_TO_SHOW_FABS); handler.postDelayed(runnable, TIME_TO_SHOW_FABS);
} else { } else {
handler.removeCallbacks(runnable); handler.removeCallbacks(runnable);
} }
} }
public interface PageButtonsInterface { public interface PageButtonsInterface {
public void nextPageClicked(); public void nextPageClicked();
public void prevPageClicked(); public void prevPageClicked();
public void pageSystemButtonLongClicked(); public void pageSystemButtonLongClicked();
public boolean canReadNextPage(); public boolean canReadNextPage();
public boolean canReadPrevPage(); public boolean canReadPrevPage();
} }
} }

View File

@ -1,92 +1,92 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.texteditor; package sharedcode.turboeditor.texteditor;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class Patterns { public class Patterns {
/* /*
public static final int COLOR_NUMBER = 0xffff6600; public static final int COLOR_NUMBER = 0xffff6600;
public static final int COLOR_KEYWORD = 0xff2f6f9f; public static final int COLOR_KEYWORD = 0xff2f6f9f;
public static final int COLOR_ATTR = 0xff4f9fcf; public static final int COLOR_ATTR = 0xff4f9fcf;
public static final int COLOR_ATTR_VALUE = 0xffd44950; public static final int COLOR_ATTR_VALUE = 0xffd44950;
public static final int COLOR_STRING = 0xffd44950; public static final int COLOR_STRING = 0xffd44950;
public static final int COLOR_COMMENT = 0xff999999; public static final int COLOR_COMMENT = 0xff999999;
*/ */
// Strings // Strings
public static final Pattern GENERAL_STRINGS = Pattern.compile("\"(.*?)\"|'(.*?)'"); public static final Pattern GENERAL_STRINGS = Pattern.compile("\"(.*?)\"|'(.*?)'");
public static final Pattern HTML_OPEN_TAGS = Pattern.compile( public static final Pattern HTML_OPEN_TAGS = Pattern.compile(
"<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>"); "<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>");
public static final Pattern HTML_CLOSE_TAGS = Pattern.compile( public static final Pattern HTML_CLOSE_TAGS = Pattern.compile(
"</([A-Za-z][A-Za-z0-9]*)\\b[^>]*>"); "</([A-Za-z][A-Za-z0-9]*)\\b[^>]*>");
public static final Pattern HTML_ATTRS = Pattern.compile( public static final Pattern HTML_ATTRS = Pattern.compile(
"(\\S+)=[\"']?((?:.(?![\"']?\\s+(?:\\S+)=|[>\"']))+.)[\"']?"); "(\\S+)=[\"']?((?:.(?![\"']?\\s+(?:\\S+)=|[>\"']))+.)[\"']?");
//static final Pattern CSS_STYLE_NAME= Pattern.compile( //static final Pattern CSS_STYLE_NAME= Pattern.compile(
// "[ \\t\\n\\r\\f](.+?)\\{([^\\)]+)\\}"); // "[ \\t\\n\\r\\f](.+?)\\{([^\\)]+)\\}");
public static final Pattern CSS_ATTRS = Pattern.compile( public static final Pattern CSS_ATTRS = Pattern.compile(
"(.+?):(.+?);"); "(.+?):(.+?);");
public static final Pattern CSS_ATTR_VALUE = Pattern.compile( public static final Pattern CSS_ATTR_VALUE = Pattern.compile(
":[ \t](.+?);"); ":[ \t](.+?);");
public static final Pattern NUMBERS = Pattern.compile( public static final Pattern NUMBERS = Pattern.compile(
"(\\b(\\d*[.]?\\d+)\\b)"); "(\\b(\\d*[.]?\\d+)\\b)");
//public static final Pattern CSS_NUMBERS = Pattern.compile( //public static final Pattern CSS_NUMBERS = Pattern.compile(
// "/^auto$|^[+-]?[0-9]+\\.?([0-9]+)?(px|em|ex|%|in|cm|mm|pt|pc)?$/ig"); // "/^auto$|^[+-]?[0-9]+\\.?([0-9]+)?(px|em|ex|%|in|cm|mm|pt|pc)?$/ig");
public static final Pattern SYMBOLS = Pattern.compile( public static final Pattern SYMBOLS = Pattern.compile(
"(!|,|\\(|\\)|\\+|\\-|\\*|<|>|=|\\.|\\?|;|\\{|\\}|\\[|\\])"); "(!|,|\\(|\\)|\\+|\\-|\\*|<|>|=|\\.|\\?|;|\\{|\\}|\\[|\\])");
public static final Pattern NUMBERS_OR_SYMBOLS = Pattern.compile(NUMBERS.pattern()+"|"+SYMBOLS.pattern()); public static final Pattern NUMBERS_OR_SYMBOLS = Pattern.compile(NUMBERS.pattern()+"|"+SYMBOLS.pattern());
public static final Pattern GENERAL_KEYWORDS = Pattern.compile( public static final Pattern GENERAL_KEYWORDS = Pattern.compile(
"\\b(alignas|alignof|and|and_eq|asm|auto|bitand|bitorbool|break|case|catch|char|" "\\b(alignas|alignof|and|and_eq|asm|auto|bitand|bitorbool|break|case|catch|char|"
+ "char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype" + "char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype"
+ "|default|delete|do|double|dynamic_cast|echo|else|enum|explicit|export|extern|" + "|default|delete|do|double|dynamic_cast|echo|else|enum|explicit|export|extern|"
+ "false|float|for|friend|function|goto|if|inline|int|mutable|namespace|new|noexcept|" + "false|float|for|friend|function|goto|if|inline|int|mutable|namespace|new|noexcept|"
+ "not|not_eq|null|nullptr|operator|or|or_eq|private|protected|public|register|" + "not|not_eq|null|nullptr|operator|or|or_eq|private|protected|public|register|"
+ "reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast" + "reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast"
+ "|struct|switch|template|this|thread_local|throw|true|try|typedef|typeid|typename|undefined" + "|struct|switch|template|this|thread_local|throw|true|try|typedef|typeid|typename|undefined"
+ "|union|unsigned|using|var|virtual|void|volatile|wchar_t|while|xor|xor_eq|)\\b", Pattern.CASE_INSENSITIVE); + "|union|unsigned|using|var|virtual|void|volatile|wchar_t|while|xor|xor_eq|)\\b", Pattern.CASE_INSENSITIVE);
public static final Pattern PY_KEYWORDS = Pattern.compile( public static final Pattern PY_KEYWORDS = Pattern.compile(
"\\b(int|float|long|complex|str|unicode|list|tuple|bytearray|buffer|xrange|set|frozenset|dict|bool)|(True|False|None|self|NotImplemented|Ellipsis|__debug__|__file__)|(and|del|from|not|while|as|elif|global|or|with|assert|else|if|pass|yield|break|except|import|print|class|exec|in|raise|continue|finally|is|return|def|for|lambda|try)|(ArithmeticError|AssertionError|AttributeError|BaseException|DeprecationWarning|EnvironmentError|EOFError|Exception|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplementedError|OSError|OverflowError|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TypeError|UnboundLocalError|UserWarning|UnicodeError|UnicodeWarning|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|Warning|WindowsError|ZeroDivisionError)\\b", Pattern.CASE_INSENSITIVE); "\\b(int|float|long|complex|str|unicode|list|tuple|bytearray|buffer|xrange|set|frozenset|dict|bool)|(True|False|None|self|NotImplemented|Ellipsis|__debug__|__file__)|(and|del|from|not|while|as|elif|global|or|with|assert|else|if|pass|yield|break|except|import|print|class|exec|in|raise|continue|finally|is|return|def|for|lambda|try)|(ArithmeticError|AssertionError|AttributeError|BaseException|DeprecationWarning|EnvironmentError|EOFError|Exception|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplementedError|OSError|OverflowError|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TypeError|UnboundLocalError|UserWarning|UnicodeError|UnicodeWarning|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|Warning|WindowsError|ZeroDivisionError)\\b", Pattern.CASE_INSENSITIVE);
public static final Pattern LUA_KEYWORDS = Pattern.compile( public static final Pattern LUA_KEYWORDS = Pattern.compile(
"@[A-Za-z0-9_\\.]*|\\b(local|global|boolean|number|userdata)\\b|\\b(true|false|nil)\\b|\\b(return|then|while|and|break|do|else|elseif|end|for|function|if|in|not|or|repeat|until|thread|table)\\b" + "@[A-Za-z0-9_\\.]*|\\b(local|global|boolean|number|userdata)\\b|\\b(true|false|nil)\\b|\\b(return|then|while|and|break|do|else|elseif|end|for|function|if|in|not|or|repeat|until|thread|table)\\b" +
"|(?i)\\b(editsetText|editText|inkey|touch|system.exit|system.expCall|system.getAppPath|system.getCardMnt|system.getSec|system.impCallActionSend|system.impCallActionView|system.setrun|system.setScreen|system.version|El_Psy_Congroo|canvas.drawCircle|canvas.drawCls|canvas.drawLine|canvas.drawRect|canvas.getBmpSize|canvas.getColor|canvas.getg|canvas.getviewSize|canvas.loadBmp|canvas.putCircle|canvas.putCls|canvas.putflush|canvas.putg|canvas.putLine|canvas.putRect|canvas.putrotg|canvas.putWork|canvas.saveBmp|canvas.setMainBmp|canvas.setWorkBmp|canvas.workCls|canvas.workflush|color|canvas.drawText|canvas.drawTextBox|canvas.drawTextCenter|canvas.drawTextRotate|canvas.putText|canvas.putTextBox|canvas.putTextRotate|http.addHeader|http.addParam|http.clrHeader|http.clrParam|http.get|http.post|http.setContentType|http.setPostFile|http.status|dialog|item.add|item.check|item.clear|item.list|item.radio|toast|sensor.getAccel|sensor.setdevAccel|sensor.setdevMagnet|sensor.setdevOrient|sensor.getGdirection|sensor.getMagnet|sensor.getOrient|sound.beep|sound.isPlay|sound.pause|sound.restart|sound.setSoundFile|sound.start|sound.stop|zip.addFile|zip.exec|zip.status|sock.close|sock.connectOpen|sock.getAddress|sock.listenOpen|sock.recv|sock.send|sprite.clear|sprite.define|sprite.init|sprite.move|sprite.put)\\b" + "|(?i)\\b(editsetText|editText|inkey|touch|system.exit|system.expCall|system.getAppPath|system.getCardMnt|system.getSec|system.impCallActionSend|system.impCallActionView|system.setrun|system.setScreen|system.version|El_Psy_Congroo|canvas.drawCircle|canvas.drawCls|canvas.drawLine|canvas.drawRect|canvas.getBmpSize|canvas.getColor|canvas.getg|canvas.getviewSize|canvas.loadBmp|canvas.putCircle|canvas.putCls|canvas.putflush|canvas.putg|canvas.putLine|canvas.putRect|canvas.putrotg|canvas.putWork|canvas.saveBmp|canvas.setMainBmp|canvas.setWorkBmp|canvas.workCls|canvas.workflush|color|canvas.drawText|canvas.drawTextBox|canvas.drawTextCenter|canvas.drawTextRotate|canvas.putText|canvas.putTextBox|canvas.putTextRotate|http.addHeader|http.addParam|http.clrHeader|http.clrParam|http.get|http.post|http.setContentType|http.setPostFile|http.status|dialog|item.add|item.check|item.clear|item.list|item.radio|toast|sensor.getAccel|sensor.setdevAccel|sensor.setdevMagnet|sensor.setdevOrient|sensor.getGdirection|sensor.getMagnet|sensor.getOrient|sound.beep|sound.isPlay|sound.pause|sound.restart|sound.setSoundFile|sound.start|sound.stop|zip.addFile|zip.exec|zip.status|sock.close|sock.connectOpen|sock.getAddress|sock.listenOpen|sock.recv|sock.send|sprite.clear|sprite.define|sprite.init|sprite.move|sprite.put)\\b" +
"|(?i)\\b(assert|collectgarbage|coroutine.create|coroutine.resume|coroutine.running|coroutine.status|coroutine.wrap|coroutine.yield|debug.debug|debug.getfenv|debug.gethook|debug.getinfo|debug.getlocal|debug.getmetatable|debug.getregistry|debug.getupvalue|debug.setfenv|debug.sethook|debug.setlocal|debug.setmetatable|debug.setupvalue|debug.traceback|dofile|error|file:close|file:flush|file:lines|file:read|file:seek|file:setvbuf|file:write|getfenv|getmetatable|io.close|io.flush|io.input|io.lines|io.open|io.output|io.popen|io.read|io.tmpfile|io.type|io.write|ipairs|load|loadfile|loadstring|math.abs|math.acos|math.asin|math.atan2|math.atan|math.ceil|math.cosh|math.cos|math.deg|math.exp|math.floor|math.fmod|math.frexp|math.ldexp|math.log10|math.log|math.max|math.min|math.modf|math.pow|math.rad|math.random|math.randomseed|math.sinh|math.sin|math.sqrt|math.tanh|math.tan|module|next|os.clock|os.date|os.difftime|os.execute|os.exit|os.getenv|os.remove|os.rename|os.setlocale|os.time|os.tmpname|package.cpath|package.loaded|package.loadlib|package.path|package.preload|package.seeal|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|string.byte|string.char|string.dump|string.find|string.format|string.gmatch|string.gsub|string.len|string.lower|string.match|string.rep|string.reverse|string.sub|string.upper|table.concat|table.insert|table.maxn|table.remove|table.sort|tonumber|tostring|type|unpack|xpcall)\\b" "|(?i)\\b(assert|collectgarbage|coroutine.create|coroutine.resume|coroutine.running|coroutine.status|coroutine.wrap|coroutine.yield|debug.debug|debug.getfenv|debug.gethook|debug.getinfo|debug.getlocal|debug.getmetatable|debug.getregistry|debug.getupvalue|debug.setfenv|debug.sethook|debug.setlocal|debug.setmetatable|debug.setupvalue|debug.traceback|dofile|error|file:close|file:flush|file:lines|file:read|file:seek|file:setvbuf|file:write|getfenv|getmetatable|io.close|io.flush|io.input|io.lines|io.open|io.output|io.popen|io.read|io.tmpfile|io.type|io.write|ipairs|load|loadfile|loadstring|math.abs|math.acos|math.asin|math.atan2|math.atan|math.ceil|math.cosh|math.cos|math.deg|math.exp|math.floor|math.fmod|math.frexp|math.ldexp|math.log10|math.log|math.max|math.min|math.modf|math.pow|math.rad|math.random|math.randomseed|math.sinh|math.sin|math.sqrt|math.tanh|math.tan|module|next|os.clock|os.date|os.difftime|os.execute|os.exit|os.getenv|os.remove|os.rename|os.setlocale|os.time|os.tmpname|package.cpath|package.loaded|package.loadlib|package.path|package.preload|package.seeal|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|string.byte|string.char|string.dump|string.find|string.format|string.gmatch|string.gsub|string.len|string.lower|string.match|string.rep|string.reverse|string.sub|string.upper|table.concat|table.insert|table.maxn|table.remove|table.sort|tonumber|tostring|type|unpack|xpcall)\\b"
); );
public static final Pattern PHP_VARIABLES = Pattern.compile("\\$\\s*(\\w+)"); public static final Pattern PHP_VARIABLES = Pattern.compile("\\$\\s*(\\w+)");
// Comments // Comments
public static final Pattern XML_COMMENTS = Pattern.compile("(?s)<!--.*?-->"); public static final Pattern XML_COMMENTS = Pattern.compile("(?s)<!--.*?-->");
public static final Pattern GENERAL_COMMENTS = Pattern.compile( public static final Pattern GENERAL_COMMENTS = Pattern.compile(
"/\\*(?:.|[\\n\\r])*?\\*/|(?<!:)//.*|#.*"); "/\\*(?:.|[\\n\\r])*?\\*/|(?<!:)//.*|#.*");
// same as GENERAL_COMMENTS but without -> // // same as GENERAL_COMMENTS but without -> //
public static final Pattern GENERAL_COMMENTS_NO_SLASH = Pattern.compile( public static final Pattern GENERAL_COMMENTS_NO_SLASH = Pattern.compile(
"/\\*(?:.|[\\n\\r])*?\\*/|#.*"); "/\\*(?:.|[\\n\\r])*?\\*/|#.*");
public static final Pattern SQL_KEYWORDS = Pattern.compile( public static final Pattern SQL_KEYWORDS = Pattern.compile(
"\\b(ADD|EXCEPT|PERCENT|ALL|EXEC|PLAN|ALTER|EXECUTE|PRECISION|AND|EXISTS|PRIMARY|ANY|EXIT|PRINT|AS|FETCH|PROC|ASC|FILE|PROCEDURE|AUTHORIZATION|FILLFACTOR|PUBLIC|BACKUP|FOR|RAISERROR|BEGIN|FOREIGN|READ|BETWEEN|FREETEXT|READTEXT|BREAK|FREETEXTTABLE|RECONFIGURE|BROWSE|FROM|REFERENCES|BULK|FULL|REPLICATION|BY|FUNCTION|RESTORE|CASCADE|GOTO|RESTRICT|CASE|GRANT|RETURN|CHECK|GROUP|REVOKE|CHECKPOINT|HAVING|RIGHT|CLOSE|HOLDLOCK|ROLLBACK|CLUSTERED|IDENTITY|ROWCOUNT|COALESCE|IDENTITY_INSERT|ROWGUIDCOL|COLLATE|IDENTITYCOL|RULE|COLUMN|IF|SAVE|COMMIT|IN|SCHEMA|COMPUTE|INDEX|SELECT|CONSTRAINT|INNER|SESSION_USER|CONTAINS|INSERT|SET|CONTAINSTABLE|INTERSECT|SETUSER|CONTINUE|INTO|SHUTDOWN|CONVERT|IS|SOME|CREATE|JOIN|STATISTICS|CROSS|KEY|SYSTEM_USER|CURRENT|KILL|TABLE|CURRENT_DATE|LEFT|TEXTSIZE|CURRENT_TIME|LIKE|THEN|CURRENT_TIMESTAMP|LINENO|TO|CURRENT_USER|LOAD|TOP|CURSOR|NATIONAL|TRAN|DATABASE|NOCHECK|TRANSACTION|DBCC|NONCLUSTERED|TRIGGER|DEALLOCATE|NOT|TRUNCATE|DECLARE|NULL|TSEQUAL|DEFAULT|NULLIF|UNION|DELETE|OF|UNIQUE|DENY|OFF|UPDATE|DESC|OFFSETS|UPDATETEXT|DISK|ON|USE|DISTINCT|OPEN|USER|DISTRIBUTED|OPENDATASOURCE|VALUES|DOUBLE|OPENQUERY|VARYING|DROP|OPENROWSET|VIEW|DUMMY|OPENXML|WAITFOR|DUMP|OPTION|WHEN|ELSE|OR|WHERE|END|ORDER|WHILE|ERRLVL|OUTER|WITH|ESCAPE|OVER|WRITETEXT)\\b", Pattern.CASE_INSENSITIVE); "\\b(ADD|EXCEPT|PERCENT|ALL|EXEC|PLAN|ALTER|EXECUTE|PRECISION|AND|EXISTS|PRIMARY|ANY|EXIT|PRINT|AS|FETCH|PROC|ASC|FILE|PROCEDURE|AUTHORIZATION|FILLFACTOR|PUBLIC|BACKUP|FOR|RAISERROR|BEGIN|FOREIGN|READ|BETWEEN|FREETEXT|READTEXT|BREAK|FREETEXTTABLE|RECONFIGURE|BROWSE|FROM|REFERENCES|BULK|FULL|REPLICATION|BY|FUNCTION|RESTORE|CASCADE|GOTO|RESTRICT|CASE|GRANT|RETURN|CHECK|GROUP|REVOKE|CHECKPOINT|HAVING|RIGHT|CLOSE|HOLDLOCK|ROLLBACK|CLUSTERED|IDENTITY|ROWCOUNT|COALESCE|IDENTITY_INSERT|ROWGUIDCOL|COLLATE|IDENTITYCOL|RULE|COLUMN|IF|SAVE|COMMIT|IN|SCHEMA|COMPUTE|INDEX|SELECT|CONSTRAINT|INNER|SESSION_USER|CONTAINS|INSERT|SET|CONTAINSTABLE|INTERSECT|SETUSER|CONTINUE|INTO|SHUTDOWN|CONVERT|IS|SOME|CREATE|JOIN|STATISTICS|CROSS|KEY|SYSTEM_USER|CURRENT|KILL|TABLE|CURRENT_DATE|LEFT|TEXTSIZE|CURRENT_TIME|LIKE|THEN|CURRENT_TIMESTAMP|LINENO|TO|CURRENT_USER|LOAD|TOP|CURSOR|NATIONAL|TRAN|DATABASE|NOCHECK|TRANSACTION|DBCC|NONCLUSTERED|TRIGGER|DEALLOCATE|NOT|TRUNCATE|DECLARE|NULL|TSEQUAL|DEFAULT|NULLIF|UNION|DELETE|OF|UNIQUE|DENY|OFF|UPDATE|DESC|OFFSETS|UPDATETEXT|DISK|ON|USE|DISTINCT|OPEN|USER|DISTRIBUTED|OPENDATASOURCE|VALUES|DOUBLE|OPENQUERY|VARYING|DROP|OPENROWSET|VIEW|DUMMY|OPENXML|WAITFOR|DUMP|OPTION|WHEN|ELSE|OR|WHERE|END|ORDER|WHILE|ERRLVL|OUTER|WITH|ESCAPE|OVER|WRITETEXT)\\b", Pattern.CASE_INSENSITIVE);
public static final Pattern LINK = android.util.Patterns.WEB_URL; public static final Pattern LINK = android.util.Patterns.WEB_URL;
} }

View File

@ -1,63 +1,63 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.texteditor; package sharedcode.turboeditor.texteditor;
import java.util.LinkedList; import java.util.LinkedList;
public class SearchResult { public class SearchResult {
// list of index // list of index
public LinkedList<Integer> foundIndex; public LinkedList<Integer> foundIndex;
public int textLength; public int textLength;
public boolean isReplace; public boolean isReplace;
public String textToReplace; public String textToReplace;
public int index; public int index;
public SearchResult(LinkedList<Integer> foundIndex, int textLength, boolean isReplace, String textToReplace) { public SearchResult(LinkedList<Integer> foundIndex, int textLength, boolean isReplace, String textToReplace) {
this.foundIndex = foundIndex; this.foundIndex = foundIndex;
this.textLength = textLength; this.textLength = textLength;
this.isReplace = isReplace; this.isReplace = isReplace;
this.textToReplace = textToReplace; this.textToReplace = textToReplace;
} }
public void doneReplace() { public void doneReplace() {
foundIndex.remove(index); foundIndex.remove(index);
int i; int i;
for (i = index; i < foundIndex.size(); i++) { for (i = index; i < foundIndex.size(); i++) {
foundIndex.set(i, foundIndex.get(i) + textToReplace.length() - textLength); foundIndex.set(i, foundIndex.get(i) + textToReplace.length() - textLength);
} }
index--; // an element was removed so we decrease the index index--; // an element was removed so we decrease the index
} }
public int numberOfResults() { public int numberOfResults() {
return foundIndex.size(); return foundIndex.size();
} }
public boolean hasNext() { public boolean hasNext() {
return index < foundIndex.size() - 1; return index < foundIndex.size() - 1;
} }
public boolean hasPrevious() { public boolean hasPrevious() {
return index > 0; return index > 0;
} }
public boolean canReplaceSomething() { public boolean canReplaceSomething() {
return isReplace && foundIndex.size() > 0; return isReplace && foundIndex.size() > 0;
} }
} }

View File

@ -1,208 +1,208 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.util; package sharedcode.turboeditor.util;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.ContentUris; import android.content.ContentUris;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.provider.DocumentsContract; import android.provider.DocumentsContract;
import android.provider.MediaStore; import android.provider.MediaStore;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
public class AccessStorageApi { public class AccessStorageApi {
public static Bitmap loadPrescaledBitmap(String filename) throws IOException { public static Bitmap loadPrescaledBitmap(String filename) throws IOException {
// Facebook image size // Facebook image size
final int IMAGE_MAX_SIZE = 630; final int IMAGE_MAX_SIZE = 630;
File file = null; File file = null;
FileInputStream fis; FileInputStream fis;
BitmapFactory.Options opts; BitmapFactory.Options opts;
int resizeScale; int resizeScale;
Bitmap bmp; Bitmap bmp;
file = new File(filename); file = new File(filename);
// This bit determines only the width/height of the bitmap without loading the contents // This bit determines only the width/height of the bitmap without loading the contents
opts = new BitmapFactory.Options(); opts = new BitmapFactory.Options();
opts.inJustDecodeBounds = true; opts.inJustDecodeBounds = true;
fis = new FileInputStream(file); fis = new FileInputStream(file);
BitmapFactory.decodeStream(fis, null, opts); BitmapFactory.decodeStream(fis, null, opts);
fis.close(); fis.close();
// Find the correct scale value. It should be a power of 2 // Find the correct scale value. It should be a power of 2
resizeScale = 1; resizeScale = 1;
if (opts.outHeight > IMAGE_MAX_SIZE || opts.outWidth > IMAGE_MAX_SIZE) { if (opts.outHeight > IMAGE_MAX_SIZE || opts.outWidth > IMAGE_MAX_SIZE) {
resizeScale = (int) Math.pow(2, (int) Math.round(Math.log(IMAGE_MAX_SIZE / (double) Math.max(opts.outHeight, opts.outWidth)) / Math.log(0.5))); resizeScale = (int) Math.pow(2, (int) Math.round(Math.log(IMAGE_MAX_SIZE / (double) Math.max(opts.outHeight, opts.outWidth)) / Math.log(0.5)));
} }
// Load pre-scaled bitmap // Load pre-scaled bitmap
opts = new BitmapFactory.Options(); opts = new BitmapFactory.Options();
opts.inSampleSize = resizeScale; opts.inSampleSize = resizeScale;
fis = new FileInputStream(file); fis = new FileInputStream(file);
bmp = BitmapFactory.decodeStream(fis, null, opts); bmp = BitmapFactory.decodeStream(fis, null, opts);
fis.close(); fis.close();
return bmp; return bmp;
} }
/** /**
* Get a file path from a Uri. This will get the the path for Storage Access * Get a file path from a Uri. This will get the the path for Storage Access
* Framework Documents, as well as the _data field for the MediaStore and * Framework Documents, as well as the _data field for the MediaStore and
* other file-based ContentProviders. * other file-based ContentProviders.
* *
* @param context The context. * @param context The context.
* @param uri The Uri to query. * @param uri The Uri to query.
* @author paulburke * @author paulburke
*/ */
@SuppressLint("NewApi") @SuppressLint("NewApi")
public static String getPath(final Context context, final Uri uri) { public static String getPath(final Context context, final Uri uri) {
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider // DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider // ExternalStorageProvider
if (isExternalStorageDocument(uri)) { if (isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri); final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":"); final String[] split = docId.split(":");
final String type = split[0]; final String type = split[0];
if ("primary".equalsIgnoreCase(type)) { if ("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1]; return Environment.getExternalStorageDirectory() + "/" + split[1];
} }
// TODO handle non-primary volumes // TODO handle non-primary volumes
} }
// DownloadsProvider // DownloadsProvider
else if (isDownloadsDocument(uri)) { else if (isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri); final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId( final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null); return getDataColumn(context, contentUri, null, null);
} }
// MediaProvider // MediaProvider
else if (isMediaDocument(uri)) { else if (isMediaDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri); final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":"); final String[] split = docId.split(":");
final String type = split[0]; final String type = split[0];
Uri contentUri = null; Uri contentUri = null;
if ("image".equals(type)) { if ("image".equals(type)) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if ("video".equals(type)) { } else if ("video".equals(type)) {
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
} else if ("audio".equals(type)) { } else if ("audio".equals(type)) {
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
} }
final String selection = "_id=?"; final String selection = "_id=?";
final String[] selectionArgs = new String[]{ final String[] selectionArgs = new String[]{
split[1] split[1]
}; };
return getDataColumn(context, contentUri, selection, selectionArgs); return getDataColumn(context, contentUri, selection, selectionArgs);
} }
} }
// MediaStore (and general) // MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme())) { else if ("content".equalsIgnoreCase(uri.getScheme())) {
return getDataColumn(context, uri, null, null); return getDataColumn(context, uri, null, null);
} }
// File // File
else if ("file".equalsIgnoreCase(uri.getScheme())) { else if ("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath(); return uri.getPath();
} }
return null; return null;
} }
/** /**
* Get the value of the data column for this Uri. This is useful for * Get the value of the data column for this Uri. This is useful for
* MediaStore Uris, and other file-based ContentProviders. * MediaStore Uris, and other file-based ContentProviders.
* *
* @param context The context. * @param context The context.
* @param uri The Uri to query. * @param uri The Uri to query.
* @param selection (Optional) Filter used in the query. * @param selection (Optional) Filter used in the query.
* @param selectionArgs (Optional) Selection arguments used in the query. * @param selectionArgs (Optional) Selection arguments used in the query.
* @return The value of the _data column, which is typically a file path. * @return The value of the _data column, which is typically a file path.
*/ */
public static String getDataColumn(Context context, Uri uri, String selection, public static String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) { String[] selectionArgs) {
Cursor cursor = null; Cursor cursor = null;
final String column = "_data"; final String column = "_data";
final String[] projection = { final String[] projection = {
column column
}; };
try { try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null); null);
if (cursor != null && cursor.moveToFirst()) { if (cursor != null && cursor.moveToFirst()) {
final int column_index = cursor.getColumnIndexOrThrow(column); final int column_index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(column_index); return cursor.getString(column_index);
} }
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
} }
return null; return null;
} }
/** /**
* @param uri The Uri to check. * @param uri The Uri to check.
* @return Whether the Uri authority is ExternalStorageProvider. * @return Whether the Uri authority is ExternalStorageProvider.
*/ */
public static boolean isExternalStorageDocument(Uri uri) { public static boolean isExternalStorageDocument(Uri uri) {
return "com.android.externalstorage.documents".equals(uri.getAuthority()); return "com.android.externalstorage.documents".equals(uri.getAuthority());
} }
/** /**
* @param uri The Uri to check. * @param uri The Uri to check.
* @return Whether the Uri authority is DownloadsProvider. * @return Whether the Uri authority is DownloadsProvider.
*/ */
public static boolean isDownloadsDocument(Uri uri) { public static boolean isDownloadsDocument(Uri uri) {
return "com.android.providers.downloads.documents".equals(uri.getAuthority()); return "com.android.providers.downloads.documents".equals(uri.getAuthority());
} }
/** /**
* @param uri The Uri to check. * @param uri The Uri to check.
* @return Whether the Uri authority is MediaProvider. * @return Whether the Uri authority is MediaProvider.
*/ */
public static boolean isMediaDocument(Uri uri) { public static boolean isMediaDocument(Uri uri) {
return "com.android.providers.media.documents".equals(uri.getAuthority()); return "com.android.providers.media.documents".equals(uri.getAuthority());
} }
} }

View File

@ -1,138 +1,138 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.util;/* package sharedcode.turboeditor.util;/*
* The Alphanum Algorithm is an improved sorting algorithm for strings * The Alphanum Algorithm is an improved sorting algorithm for strings
* containing numbers. Instead of sorting numbers in ASCII order like * containing numbers. Instead of sorting numbers in ASCII order like
* a standard sort, this algorithm sorts numbers in numeric order. * a standard sort, this algorithm sorts numbers in numeric order.
* *
* The Alphanum Algorithm is discussed at http://www.DaveKoelle.com * The Alphanum Algorithm is discussed at http://www.DaveKoelle.com
* *
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version. * version 2.1 of the License, or any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
import java.util.Comparator; import java.util.Comparator;
/** /**
* This is an updated version with enhancements made by Daniel Migowski, Andre Bogus, and David * This is an updated version with enhancements made by Daniel Migowski, Andre Bogus, and David
* Koelle * Koelle
* <p/> * <p/>
* To convert to use Templates (Java 1.5+): - Change "implements Comparator" to "implements * To convert to use Templates (Java 1.5+): - Change "implements Comparator" to "implements
* Comparator<String>" - Change "compare(Object o1, Object o2)" to "compare(String s1, String s2)" - * Comparator<String>" - Change "compare(Object o1, Object o2)" to "compare(String s1, String s2)" -
* Remove the type checking and casting in compare(). * Remove the type checking and casting in compare().
* <p/> * <p/>
* To use this class: Use the static "sort" method from the java.util.Collections class: * To use this class: Use the static "sort" method from the java.util.Collections class:
* Collections.sort(your list, new AlphanumComparator()); * Collections.sort(your list, new AlphanumComparator());
*/ */
public class AlphanumComparator implements Comparator { public class AlphanumComparator implements Comparator {
private boolean isDigit(char ch) { private boolean isDigit(char ch) {
return ch >= 48 && ch <= 57; return ch >= 48 && ch <= 57;
} }
/** /**
* Length of string is passed in for improved efficiency (only need to calculate it once) * * Length of string is passed in for improved efficiency (only need to calculate it once) *
*/ */
private String getChunk(String s, int slength, int marker) { private String getChunk(String s, int slength, int marker) {
StringBuilder chunk = new StringBuilder(); StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker); char c = s.charAt(marker);
chunk.append(c); chunk.append(c);
marker++; marker++;
if (isDigit(c)) { if (isDigit(c)) {
while (marker < slength) { while (marker < slength) {
c = s.charAt(marker); c = s.charAt(marker);
if (!isDigit(c)) { if (!isDigit(c)) {
break; break;
} }
chunk.append(c); chunk.append(c);
marker++; marker++;
} }
} else { } else {
while (marker < slength) { while (marker < slength) {
c = s.charAt(marker); c = s.charAt(marker);
if (isDigit(c)) { if (isDigit(c)) {
break; break;
} }
chunk.append(c); chunk.append(c);
marker++; marker++;
} }
} }
return chunk.toString(); return chunk.toString();
} }
public String getTheString(Object obj) { public String getTheString(Object obj) {
return (String) obj; return (String) obj;
} }
public int compare(Object o1, Object o2) { public int compare(Object o1, Object o2) {
String s1 = getTheString(o1); String s1 = getTheString(o1);
String s2 = getTheString(o2); String s2 = getTheString(o2);
int thisMarker = 0; int thisMarker = 0;
int thatMarker = 0; int thatMarker = 0;
int s1Length = s1.length(); int s1Length = s1.length();
int s2Length = s2.length(); int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length) { while (thisMarker < s1Length && thatMarker < s2Length) {
String thisChunk = getChunk(s1, s1Length, thisMarker); String thisChunk = getChunk(s1, s1Length, thisMarker);
thisMarker += thisChunk.length(); thisMarker += thisChunk.length();
String thatChunk = getChunk(s2, s2Length, thatMarker); String thatChunk = getChunk(s2, s2Length, thatMarker);
thatMarker += thatChunk.length(); thatMarker += thatChunk.length();
// If both chunks contain numeric characters, sort them numerically // If both chunks contain numeric characters, sort them numerically
int result = 0; int result = 0;
if (isDigit(thisChunk.charAt(0)) && isDigit(thatChunk.charAt(0))) { if (isDigit(thisChunk.charAt(0)) && isDigit(thatChunk.charAt(0))) {
// Simple chunk comparison by length. // Simple chunk comparison by length.
int thisChunkLength = thisChunk.length(); int thisChunkLength = thisChunk.length();
result = thisChunkLength - thatChunk.length(); result = thisChunkLength - thatChunk.length();
// If equal, the first different number counts // If equal, the first different number counts
if (result == 0) { if (result == 0) {
for (int i = 0; i < thisChunkLength; i++) { for (int i = 0; i < thisChunkLength; i++) {
result = thisChunk.charAt(i) - thatChunk.charAt(i); result = thisChunk.charAt(i) - thatChunk.charAt(i);
if (result != 0) { if (result != 0) {
return result; return result;
} }
} }
} }
} else { } else {
result = thisChunk.compareTo(thatChunk); result = thisChunk.compareTo(thatChunk);
} }
if (result != 0) { if (result != 0) {
return result; return result;
} }
} }
return s1Length - s2Length; return s1Length - s2Length;
} }
} }

View File

@ -1,52 +1,52 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.util; package sharedcode.turboeditor.util;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.ActivityOptionsCompat; import android.support.v4.app.ActivityOptionsCompat;
import android.view.View; import android.view.View;
public class AnimationUtils { public class AnimationUtils {
public static Bundle getScaleBundle(View view) { public static Bundle getScaleBundle(View view) {
return ActivityOptionsCompat.makeScaleUpAnimation( return ActivityOptionsCompat.makeScaleUpAnimation(
view, 0, 0, view.getWidth(), view.getHeight()).toBundle(); view, 0, 0, view.getWidth(), view.getHeight()).toBundle();
} }
public static void startActivityWithScale(@NonNull Activity startActivity, @NonNull Intent subActivity, @NonNull boolean forResult, @Nullable int code, @NonNull View view) { public static void startActivityWithScale(@NonNull Activity startActivity, @NonNull Intent subActivity, @NonNull boolean forResult, @Nullable int code, @NonNull View view) {
if(forResult){ if(forResult){
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN)
startActivity.startActivityForResult(subActivity, code, AnimationUtils.getScaleBundle startActivity.startActivityForResult(subActivity, code, AnimationUtils.getScaleBundle
(view)); (view));
else else
startActivity.startActivityForResult(subActivity, code); startActivity.startActivityForResult(subActivity, code);
} }
else { else {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN)
startActivity.startActivity(subActivity, AnimationUtils.getScaleBundle startActivity.startActivity(subActivity, AnimationUtils.getScaleBundle
(view)); (view));
else else
startActivity.startActivity(subActivity); startActivity.startActivity(subActivity);
} }
} }
} }

View File

@ -1,42 +1,42 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.util; package sharedcode.turboeditor.util;
import android.content.Context; import android.content.Context;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
public class AppInfoHelper { public class AppInfoHelper {
public static String getApplicationName(final Context context) { public static String getApplicationName(final Context context) {
final ApplicationInfo applicationInfo = context.getApplicationInfo(); final ApplicationInfo applicationInfo = context.getApplicationInfo();
return context.getString(applicationInfo.labelRes); return context.getString(applicationInfo.labelRes);
} }
public static String getCurrentVersion(final Context context) { public static String getCurrentVersion(final Context context) {
try { try {
final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(),
0); 0);
return packageInfo.versionName; return packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
return ""; return "";
} }
} }
} }

View File

@ -1,115 +1,115 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.util; package sharedcode.turboeditor.util;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
public class EventBusEvents { public class EventBusEvents {
public static class CannotOpenAFile { public static class CannotOpenAFile {
} }
public static class NewFileToOpen { public static class NewFileToOpen {
private final File file; private final File file;
private final String fileText; private final String fileText;
public NewFileToOpen(File file) { public NewFileToOpen(File file) {
this.file = file; this.file = file;
this.fileText = ""; this.fileText = "";
} }
public NewFileToOpen(String fileText) { public NewFileToOpen(String fileText) {
this.file = new File(""); this.file = new File("");
this.fileText = fileText; this.fileText = fileText;
} }
public File getFile() { public File getFile() {
return file; return file;
} }
public String getFileText() { public String getFileText() {
return fileText; return fileText;
} }
} }
public static class AFileIsSelected { public static class AFileIsSelected {
private final String path; private final String path;
public AFileIsSelected(String path) { public AFileIsSelected(String path) {
this.path = path; this.path = path;
} }
public String getPath() { public String getPath() {
return path; return path;
} }
} }
public static class APreferenceValueWasChanged { public static class APreferenceValueWasChanged {
private Type type; private Type type;
private List<Type> types; private List<Type> types;
public APreferenceValueWasChanged(Type type) { public APreferenceValueWasChanged(Type type) {
this.type = type; this.type = type;
} }
public APreferenceValueWasChanged(List<Type> types) { public APreferenceValueWasChanged(List<Type> types) {
this.types = types; this.types = types;
} }
public boolean hasType(Type value) { public boolean hasType(Type value) {
if (type != null) { if (type != null) {
return value == type; return value == type;
} else { } else {
return types.contains(value); return types.contains(value);
} }
} }
public enum Type { public enum Type {
FONT_SIZE, ENCODING, SYNTAX, WRAP_CONTENT, MONOSPACE, LINE_NUMERS, THEME_CHANGE, TEXT_SUGGESTIONS, READ_ONLY, FONT_SIZE, ENCODING, SYNTAX, WRAP_CONTENT, MONOSPACE, LINE_NUMERS, THEME_CHANGE, TEXT_SUGGESTIONS, READ_ONLY,
} }
} }
public static class SaveAFile { public static class SaveAFile {
} }
public static class SavedAFile { public static class SavedAFile {
private final String path; private final String path;
public SavedAFile(String path) { public SavedAFile(String path) {
this.path = path; this.path = path;
} }
public String getPath() { public String getPath() {
return path; return path;
} }
} }
public static class ClosedAFile { public static class ClosedAFile {
} }
public static class InvalideTheMenu { public static class InvalideTheMenu {
} }
} }

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2014 Vlad Mihalachi
*
* This file is part of Turbo Editor.
*
* Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package sharedcode.turboeditor.util;
public interface IHomeActivity {
public abstract boolean showInterstitial();
}

View File

@ -1,57 +1,57 @@
/* /*
* Copyright (C) 2014 Vlad Mihalachi * Copyright (C) 2014 Vlad Mihalachi
* *
* This file is part of Turbo Editor. * This file is part of Turbo Editor.
* *
* Turbo Editor is free software: you can redistribute it and/or modify * Turbo Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Turbo Editor is distributed in the hope that it will be useful, * Turbo Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package sharedcode.turboeditor.util; package sharedcode.turboeditor.util;
public class MimeTypes { public class MimeTypes {
public static final String[] MIME_TEXT = { public static final String[] MIME_TEXT = {
"ajx", "am", "asa", "asc", "asp", "aspx", "awk", "bat", "c", "cdf", "cf", "cfg", "cfm", "cgi", "cnf", "conf", "ajx", "am", "asa", "asc", "asp", "aspx", "awk", "bat", "c", "cdf", "cf", "cfg", "cfm", "cgi", "cnf", "conf",
"cc", "cpp", "css", "csv", "ctl", "dat", "dhtml", "diz", "file", "forward", "grp", "h", "hh", "hpp", "hqx", "hta", "htaccess", "cc", "cpp", "css", "csv", "ctl", "dat", "dhtml", "diz", "file", "forward", "grp", "h", "hh", "hpp", "hqx", "hta", "htaccess",
"htc", "htm", "html", "htpasswd", "htt", "htx", "in", "inc", "info", "ini", "ink", "java", "js", "jsp", "key", "latex", "log", "htc", "htm", "html", "htpasswd", "htt", "htx", "in", "inc", "info", "ini", "ink", "java", "js", "jsp", "key", "latex", "log",
"logfile", "m3u", "m4", "m4a", "mak", "map", "md", "markdown", "model", "msg", "nfo", "nsi", "info", "old", "pas", "patch", "perl", "logfile", "m3u", "m4", "m4a", "mak", "map", "md", "markdown", "model", "msg", "nfo", "nsi", "info", "old", "pas", "patch", "perl",
"php", "php2", "php3", "php4", "php5", "php6", "phtml", "pix", "pl", "pm", "po", "pwd", "py", "qmail", "rb", "rbl", "rbw", "php", "php2", "php3", "php4", "php5", "php6", "phtml", "pix", "pl", "pm", "po", "pwd", "py", "qmail", "rb", "rbl", "rbw",
"readme", "reg", "rss", "rtf", "ruby", "session", "setup", "sh", "shtm", "shtml", "sql", "ssh", "stm", "style", "svg", "tcl", "readme", "reg", "rss", "rtf", "ruby", "session", "setup", "sh", "shtm", "shtml", "sql", "ssh", "stm", "style", "svg", "tcl",
"tex", "text", "threads", "tmpl", "tpl", "txt", "ubb", "vbs", "xhtml", "xml", "xrc", "xsl" "tex", "text", "threads", "tmpl", "tpl", "txt", "ubb", "vbs", "xhtml", "xml", "xrc", "xsl"
}; };
public static final String[] MIME_CODE = { public static final String[] MIME_CODE = {
"cs", "php", "js", "java", "py", "rb", "aspx", "cshtml", "vbhtml", "go", "c", "h", "cc", "cpp", "hh", "hpp", "pl", "pm", "t", "pod", "cs", "php", "js", "java", "py", "rb", "aspx", "cshtml", "vbhtml", "go", "c", "h", "cc", "cpp", "hh", "hpp", "pl", "pm", "t", "pod",
"m", "f", "for", "f90", "f95", "asp", "json", "wiki", "lua", "r" "m", "f", "for", "f90", "f95", "asp", "json", "wiki", "lua", "r"
}; };
public static final String[] MIME_HTML = { public static final String[] MIME_HTML = {
"htm", "html", "xhtml" "htm", "html", "xhtml"
}; };
public static final String[] MIME_PICTURE = { public static final String[] MIME_PICTURE = {
"bmp", "eps", "png", "jpeg", "jpg", "ico", "gif", "tiff", "webp" "bmp", "eps", "png", "jpeg", "jpg", "ico", "gif", "tiff", "webp"
}; };
public static final String[] MIME_MUSIC = { public static final String[] MIME_MUSIC = {
"aac", "flac", "mp3", "mpga", "oga", "ogg", "opus", "webma", "wav" "aac", "flac", "mp3", "mpga", "oga", "ogg", "opus", "webma", "wav"
}; };
public static final String[] MIME_VIDEO = { public static final String[] MIME_VIDEO = {
"avi", "mp4", "mkv", "wmw", "ogv", "webm" "avi", "mp4", "mkv", "wmw", "ogv", "webm"
}; };
public static final String[] MIME_ARCHIVE = { public static final String[] MIME_ARCHIVE = {
"7z", "arj", "bz2", "gz", "rar", "tar", "tgz", "zip", "xz" "7z", "arj", "bz2", "gz", "rar", "tar", "tgz", "zip", "xz"
}; };
public static final String[] MIME_SQL = { public static final String[] MIME_SQL = {
"sql", "mdf", "ndf", "ldf" "sql", "mdf", "ndf", "ldf"
}; };
public static final String[] MIME_MARKDOWN = { public static final String[] MIME_MARKDOWN = {
"md", "mdown", "markdown", "md", "mdown", "markdown",
}; };
} }

Some files were not shown because too many files have changed in this diff Show More