Compare commits
61 Commits
Author | SHA1 | Date | |
---|---|---|---|
a500092625 | |||
05e3600504 | |||
0b24c89307 | |||
f8491fefdb | |||
4885aa9df6 | |||
0dd894a777 | |||
01e7a2674c | |||
8838fbd5a9 | |||
ddd99e48e5 | |||
b4da74dea1 | |||
24e7fc5904 | |||
6ef85c45b5 | |||
2c55929f9f | |||
e45665ece1 | |||
97f1be558b | |||
2ee5a8e904 | |||
c56b0f8054 | |||
7a6d0d3eba | |||
ef533e6e44 | |||
23d09e05c9 | |||
a35d95b799 | |||
39c7dd956c | |||
12c539738a | |||
68e8c4235a | |||
b7f84409db | |||
79d6cb6172 | |||
c1d658ffb1 | |||
a3624e6b2e | |||
cd20b586f1 | |||
02492c8d83 | |||
871b2cfc11 | |||
401814cb22 | |||
0269d9c210 | |||
46ad99aa46 | |||
9408fba5dd | |||
ebce0bd69b | |||
ce2c2d8b0f | |||
0de5a82cdf | |||
69f8f2b0c7 | |||
245b9f4230 | |||
3db0519ec6 | |||
9b7de55f55 | |||
66a86dc513 | |||
38123fd510 | |||
481fe94eb9 | |||
6a965ca560 | |||
a1e82b65d4 | |||
e399a217e5 | |||
68ad318388 | |||
1f3ad1ab12 | |||
2414192638 | |||
1cd94a5310 | |||
ce4d1756fb | |||
3234597537 | |||
5f77e6d7b5 | |||
60395106e5 | |||
3ee11e0bfb | |||
b71d27aeaa | |||
05e4157bed | |||
89673216e8 | |||
7a86540c60 |
25
.fdroid.yml
Normal file
@ -0,0 +1,25 @@
|
||||
Categories:
|
||||
- Writing
|
||||
License: GPL-3.0-or-later
|
||||
WebSite: https://github.com/adrianmalacoda/text-editor-8000
|
||||
SourceCode: https://github.com/adrianmalacoda/text-editor-8000
|
||||
IssueTracker: https://github.com/adrianmalacoda/text-editor-8000/issues
|
||||
|
||||
AutoName: Text Editor 8000
|
||||
Summary: Simple text editor
|
||||
Description: Simple, yet powerful editor for text files.
|
||||
|
||||
RepoType: git
|
||||
Repo: .
|
||||
|
||||
builds:
|
||||
- versionName: "1.20"
|
||||
versionCode: 48
|
||||
commit: HEAD
|
||||
subdir: app
|
||||
gradle: yes
|
||||
|
||||
AutoUpdateMode: None
|
||||
UpdateCheckMode: RepoManifest
|
||||
CurrentVersion: 1.20
|
||||
CurrentVersion Code: 48
|
1
.gitignore
vendored
@ -12,6 +12,7 @@
|
||||
bin/
|
||||
gen/
|
||||
doc/
|
||||
/build
|
||||
|
||||
# Proguard folder generated by Eclipse
|
||||
proguard/
|
||||
|
10
.gitlab-ci.yml
Normal file
@ -0,0 +1,10 @@
|
||||
image: fdroidbuild:latest
|
||||
|
||||
build-apk:
|
||||
script:
|
||||
- fdroid build
|
||||
- fdroid nightly
|
||||
artifacts:
|
||||
paths:
|
||||
- unsigned/*.apk
|
||||
- unsigned/*.tar.gz
|
174
.idea/codeStyleSettings.xml
generated
@ -1,174 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value>
|
||||
<option name="CLASS_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">
|
||||
<value />
|
||||
</option>
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="com" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="junit" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="net" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="org" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="java" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="javax" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
</value>
|
||||
</option>
|
||||
<option name="RIGHT_MARGIN" value="100" />
|
||||
<AndroidXmlCodeStyleSettings>
|
||||
<option name="USE_CUSTOM_SETTINGS" value="true" />
|
||||
</AndroidXmlCodeStyleSettings>
|
||||
<XML>
|
||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||
</XML>
|
||||
<codeStyleSettings language="XML">
|
||||
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
</value>
|
||||
</option>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
||||
</component>
|
||||
</project>
|
||||
|
9
.idea/copyright/Copyright_Vlad_Mihalachi.xml
generated
@ -1,9 +0,0 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="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/>." />
|
||||
<option name="keyword" value="Copyright" />
|
||||
<option name="allowReplaceKeyword" value="Copyright" />
|
||||
<option name="myName" value="Copyright Vlad Mihalachi" />
|
||||
<option name="myLocal" value="true" />
|
||||
</copyright>
|
||||
</component>
|
6
.idea/gradle.xml
generated
@ -3,8 +3,9 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="C:\Android\android-studio\gradle\gradle-2.10" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
@ -12,12 +13,11 @@
|
||||
<option value="$PROJECT_DIR$/app-pro" />
|
||||
<option value="$PROJECT_DIR$/libraries" />
|
||||
<option value="$PROJECT_DIR$/libraries/FloatingActionButton" />
|
||||
<option value="$PROJECT_DIR$/libraries/RootCommands" />
|
||||
<option value="$PROJECT_DIR$/libraries/sharedCode" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
14
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,14 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0" is_locked="false">
|
||||
<option name="myName" value="Project Default" />
|
||||
<option name="myLocal" value="false" />
|
||||
<inspection_tool class="AndroidLintMissingQuantity" 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="AndroidLintUnusedQuantity" 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="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
7
.idea/inspectionProfiles/profiles_settings.xml
generated
@ -1,7 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
64
README.md
@ -1,60 +1,14 @@
|
||||
# Turbo Editor
|
||||
[](https://crowdin.com/project/turbo-client)
|
||||
# Text Editor 8000
|
||||
Text editor for Android. Forked from [Turbo Editor](https://github.com/vmihalachi/turbo-editor) by Vlad Mihalachi.
|
||||
|
||||
Simple, powerful and Open Source text editor for Android licensed under the GPLv3 license.
|
||||
Currently this fork includes a fix for hardware keyboards, as well as an updated [CommonMark](http://commonmark.org/) Markdown renderer.
|
||||
|
||||
### Download
|
||||
[](http://play.google.com/store/apps/details?id=com.maskyn.fileeditorpro)
|
||||
## Notice
|
||||
This project undergoes sporadic bursts of activity. There's no timeframe for a release, and stuff gets worked on when it gets worked on.
|
||||
|
||||
[](https://f-droid.org/repository/browse/?fdid=com.maskyn.fileeditorpro)
|
||||
The general policy is that master is always buildable and should run fine, but there's no guarantees.
|
||||
|
||||
### Contribute
|
||||
You can contribute to this project in many ways:
|
||||
* Browse our issues, comment on proposals, report bugs.
|
||||
* Help to translate the application on [Crowdin][crowdin]
|
||||
* Be a part of the Google Plus [Community][community googleplus]
|
||||
* Discuss with us on [XDA thread][xda thread]
|
||||
* Help to maintain this project active and [Donate][donate]
|
||||
Also, [build artifacts](https://gitlab.monarch-pass.net/malacoda/text-editor-8000/-/jobs/artifacts/master/download?job=build-apk) from master are available on the Monarch Pass GitLab. Note that as of now these builds are not signed so you'll need to sign them yourself before installing them. Use at your own risk!
|
||||
|
||||
------
|
||||
|
||||
###Donate
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=26VWS2TSAMUJA)
|
||||
|
||||
[](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
|
||||

|
||||
------
|
||||
|
||||
### Developer
|
||||
[Vlad Mihalachi][developer site]
|
||||
|
||||
------
|
||||
|
||||
### A special thanks to..
|
||||
* [Dumitru Grubii][contributor dumitru grubii] for the icon
|
||||
* All the translators
|
||||
* You?
|
||||
|
||||
------
|
||||
|
||||
### License
|
||||
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.
|
||||
|
||||
[gplv3]: http://www.gnu.org/licenses/gpl.html
|
||||
[license]: https://github.com/vmihalachi/turbo-editor/LICENSE
|
||||
[donate]: https://github.com/vmihalachi/turbo-editor#donate
|
||||
[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
|
||||
[community googleplus]: https://plus.google.com/u/0/communities/111974095419108178946
|
||||
[crowdin]: https://crowdin.net/project/turbo-client
|
||||
[developer site]: http://vmihalachi.com/
|
||||
[crowdin]: https://crowdin.net/project/turbo-client
|
||||
[contributor dumitru grubii]: https://twitter.com/DumitruGrubii
|
||||
[project issues]: https://github.com/vmihalachi/turbo-editor/issues
|
||||
[project wiki]: https://github.com/vmihalachi/turbo-editor/wiki
|
||||
## License
|
||||
GNU General Public License version 3, see [LICENSE](./license).
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion '21.0.2'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.maskyn.fileeditorpro"
|
||||
minSdkVersion 11
|
||||
targetSdkVersion 21
|
||||
versionCode 35
|
||||
versionName "1.13.2"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
runProguard false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE.txt'
|
||||
exclude 'META-INF/NOTICE.txt'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile project(':libraries:sharedCode')
|
||||
}
|
17
app-pro/proguard-rules.pro
vendored
@ -1,17 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# 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
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
@ -1,120 +0,0 @@
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.maskyn.fileeditorpro"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
|
||||
|
||||
<supports-screens
|
||||
android:anyDensity="true"
|
||||
android:largeScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:resizeable="true"
|
||||
android:smallScreens="true"
|
||||
android:xlargeScreens="true" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/nome_app_turbo_editor"
|
||||
android:hardwareAccelerated="true"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="true"
|
||||
android:name="sharedcode.turboeditor.application.MyApp"
|
||||
>
|
||||
|
||||
<!-- android:alwaysRetainTaskState="true" -->
|
||||
|
||||
<activity
|
||||
android:name=".HomeActivity"
|
||||
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
|
||||
android:launchMode="singleTop"
|
||||
android:windowSoftInputMode="stateUnspecified|adjustResize"
|
||||
android:theme="@style/AppThemeEditorDark">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.EDIT" />
|
||||
<action android:name="android.intent.action.PICK" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="text/*" />
|
||||
<data android:pathPattern="*.txt" />
|
||||
<data android:pathPattern="*.html" />
|
||||
<data android:pathPattern="*.css" />
|
||||
<data android:pathPattern="*.js" />
|
||||
<data android:pathPattern="*.md"/>
|
||||
<data android:pathPattern="*.php" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="text/plain" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="sharedcode.turboeditor.activity.SelectFileActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/open_a_file"
|
||||
android:parentActivityName=".HomeActivity"
|
||||
android:theme="@style/AppThemeBaseLight">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".HomeActivity" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="sharedcode.turboeditor.preferences.ExtraSettingsActivity"
|
||||
android:label="@string/extra_options"
|
||||
android:parentActivityName=".HomeActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".HomeActivity" />
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="com.sec.android.support.multiwindow"
|
||||
android:value="true" />
|
||||
<meta-data
|
||||
android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W"
|
||||
android:value="632.0dip" />
|
||||
<meta-data
|
||||
android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H"
|
||||
android:value="598.0dip" />
|
||||
<meta-data
|
||||
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W"
|
||||
android:value="632.0dip" />
|
||||
<meta-data
|
||||
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H"
|
||||
android:value="598.0dip" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
1
app/.gitignore
vendored
@ -1 +1,2 @@
|
||||
/build
|
||||
manifest-merger-release-report.txt
|
||||
|
@ -1,14 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Adrian Malacoda
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,45 +18,33 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.fabric.io/repo' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'io.fabric.tools:gradle:1.+'
|
||||
}
|
||||
|
||||
}
|
||||
import java.util.regex.Pattern
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'io.fabric'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.fabric.io/repo' }
|
||||
}
|
||||
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion '21.0.2'
|
||||
defaultConfig {
|
||||
applicationId "com.maskyn.fileeditor"
|
||||
minSdkVersion 11
|
||||
targetSdkVersion 21
|
||||
versionCode 35
|
||||
versionName "1.13.2"
|
||||
lintOptions {
|
||||
disable 'MissingTranslation', 'ExtraTranslation'
|
||||
}
|
||||
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion '22.0.1'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "net.monarchpass.android.texteditor8000"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 22
|
||||
versionCode 48
|
||||
versionName "1.20"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
runProguard false
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
@ -69,10 +58,32 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: '*.jar')
|
||||
compile project(':libraries:sharedCode')
|
||||
compile 'com.google.android.gms:play-services:6.1.11'
|
||||
compile('com.crashlytics.sdk.android:crashlytics:2.+@aar') {
|
||||
transitive = true;
|
||||
//compile 'com.spazedog.lib:rootfw_gen4:+@aar'
|
||||
compile project(':libraries:FloatingActionButton')
|
||||
compile 'org.apache.commons:commons-lang3:+'
|
||||
compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
|
||||
compile('com.android.support:appcompat-v7:22.+') {
|
||||
exclude group: 'com.android.support', module: 'support-v4'
|
||||
}
|
||||
compile 'com.android.support:support-v4:22.+'
|
||||
compile 'com.github.gabrielemariotti.changeloglib:library:+'
|
||||
compile 'commons-io:commons-io:2.4'
|
||||
compile 'com.android.support:support-annotations:+'
|
||||
compile 'com.atlassian.commonmark:commonmark:0.11.0'
|
||||
}
|
||||
|
||||
task incrementVersionCode << {
|
||||
println(":incrementVersionCode - Incrementing Version Code...")
|
||||
def buildGradleFile = file("build.gradle")
|
||||
def patternVersionCode = Pattern.compile("versionCode (\\d+)")
|
||||
def buildGradleFileText = buildGradleFile.getText()
|
||||
def matcherVersionCode = patternVersionCode.matcher(buildGradleFileText)
|
||||
matcherVersionCode.find()
|
||||
def mVersionCode = Integer.parseInt(matcherVersionCode.group(1))
|
||||
def mNextVersionCode = mVersionCode + 1
|
||||
def manifestContent = matcherVersionCode.replaceAll("versionCode " + mNextVersionCode)
|
||||
println(":incrementVersionCode - current versionCode=" + mVersionCode);
|
||||
println(":incrementVersionCode - next versionCode=" + mNextVersionCode);
|
||||
buildGradleFile.write(manifestContent)
|
||||
}
|
||||
|
0
app/private/cache/retriever/catalog.xml
vendored
Normal file
2
app/proguard-rules.pro
vendored
@ -1,6 +1,6 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# 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
|
||||
# directive in build.gradle.
|
||||
#
|
||||
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
@ -1,15 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2014 Vlad Mihalachi
|
||||
~
|
||||
~ This file is part of Turbo Editor.
|
||||
~ This file is part of Text Editor 8000.
|
||||
~
|
||||
~ Turbo Editor is free software: you can redistribute it and/or modify
|
||||
~ Text Editor 8000 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,
|
||||
~ Text Editor 8000 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.
|
||||
@ -19,14 +18,11 @@
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.maskyn.fileeditor"
|
||||
package="com.maskyn.fileeditorpro"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
|
||||
<supports-screens
|
||||
android:anyDensity="true"
|
||||
@ -43,13 +39,12 @@
|
||||
android:hardwareAccelerated="true"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="true"
|
||||
android:name="sharedcode.turboeditor.application.MyApp"
|
||||
android:name="com.maskyn.fileeditorpro.application.MyApp"
|
||||
tools:replace="android:label"
|
||||
>
|
||||
|
||||
<!-- android:alwaysRetainTaskState="true" -->
|
||||
|
||||
<meta-data android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version"/>
|
||||
<activity
|
||||
android:name=".HomeActivity"
|
||||
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
|
||||
@ -64,20 +59,58 @@
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.EDIT" />
|
||||
<action android:name="android.intent.action.PICK" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:host="*" />
|
||||
<data android:pathPattern=".*\\.txt" />
|
||||
<data android:pathPattern=".*\\.html" />
|
||||
<data android:pathPattern=".*\\.xml" />
|
||||
<data android:pathPattern=".*\\.css" />
|
||||
<data android:pathPattern=".*\\.js" />
|
||||
<data android:pathPattern=".*\\.md"/>
|
||||
<data android:pathPattern=".*\\.markdown"/>
|
||||
<data android:pathPattern=".*\\.php" />
|
||||
<data android:pathPattern=".*\\.py" />
|
||||
<data android:pathPattern=".*\\.script" />
|
||||
<data android:pathPattern=".*\\.cs" />
|
||||
<data android:pathPattern=".*\\.java" />
|
||||
<data android:pathPattern=".*\\.rb" />
|
||||
<data android:pathPattern=".*\\.aspx" />
|
||||
<data android:pathPattern=".*\\.cshtml" />
|
||||
<data android:pathPattern=".*\\.vbhtml" />
|
||||
<data android:pathPattern=".*\\.go" />
|
||||
<data android:pathPattern=".*\\.c" />
|
||||
<data android:pathPattern=".*\\.h" />
|
||||
<data android:pathPattern=".*\\.cc" />
|
||||
<data android:pathPattern=".*\\.cpp" />
|
||||
<data android:pathPattern=".*\\.hh" />
|
||||
<data android:pathPattern=".*\\.hpp" />
|
||||
<data android:pathPattern=".*\\.pl" />
|
||||
<data android:pathPattern=".*\\.pm" />
|
||||
<data android:pathPattern=".*\\.t" />
|
||||
<data android:pathPattern=".*\\.pod" />
|
||||
<data android:pathPattern=".*\\.m" />
|
||||
<data android:pathPattern=".*\\.f" />
|
||||
<data android:pathPattern=".*\\.for" />
|
||||
<data android:pathPattern=".*\\.f90" />
|
||||
<data android:pathPattern=".*\\.f95" />
|
||||
<data android:pathPattern=".*\\.asp" />
|
||||
<data android:pathPattern=".*\\.json" />
|
||||
<data android:pathPattern=".*\\.wiki" />
|
||||
<data android:pathPattern=".*\\.lua" />
|
||||
<data android:pathPattern=".*\\.r" />
|
||||
<data android:pathPattern=".*\\.key" />
|
||||
<data android:pathPattern=".*\\.log" />
|
||||
</intent-filter>
|
||||
<intent-filter >
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="text/*" />
|
||||
<data android:pathPattern="*.txt" />
|
||||
<data android:pathPattern="*.html" />
|
||||
<data android:pathPattern="*.css" />
|
||||
<data android:pathPattern="*.js" />
|
||||
<data android:pathPattern="*.md"/>
|
||||
<data android:pathPattern="*.php" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
@ -86,23 +119,24 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="sharedcode.turboeditor.activity.SelectFileActivity"
|
||||
android:name="com.maskyn.fileeditorpro.activity.SelectFileActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/open_a_file"
|
||||
android:exported="true"
|
||||
android:parentActivityName=".HomeActivity"
|
||||
android:theme="@style/AppThemeBaseLight">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".HomeActivity" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="sharedcode.turboeditor.preferences.ExtraSettingsActivity"
|
||||
android:label="@string/extra_options"
|
||||
android:parentActivityName=".HomeActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".HomeActivity" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.OPENABLE" />
|
||||
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
@ -121,9 +155,8 @@
|
||||
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H"
|
||||
android:value="598.0dip" />
|
||||
|
||||
<activity android:name="com.google.android.gms.ads.AdActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
|
||||
<meta-data android:name="com.crashlytics.ApiKey" android:value="672ab7531ce1e2e83c2ec6d84e8e94f2fa692c2a"/>
|
||||
<activity android:name="com.maskyn.fileeditorpro.activity.MarkdownActivity" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
112
app/src/main/assets/classic_theme_markdown.css
Normal file
@ -0,0 +1,112 @@
|
||||
@charset "utf-8";
|
||||
|
||||
/**
|
||||
* markdown.css
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program 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 Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see http://gnu.org/licenses/lgpl.txt.
|
||||
*
|
||||
* @project Weblog and Open Source Projects of Florian Wolters
|
||||
* @version GIT: $Id$
|
||||
* @package xhtml-css
|
||||
* @author Florian Wolters <florian.wolters.85@googlemail.com>
|
||||
* @copyright 2012 Florian Wolters
|
||||
* @cssdoc version 1.0-pre
|
||||
* @license http://gnu.org/licenses/lgpl.txt GNU Lesser General Public License
|
||||
* @link http://github.com/FlorianWolters/jekyll-bootstrap-theme
|
||||
* @media all
|
||||
* @valid true
|
||||
*/
|
||||
|
||||
body {
|
||||
font-family: Helvetica, Arial, Freesans, clean, sans-serif;
|
||||
padding:1em;
|
||||
margin:auto;
|
||||
max-width:42em;
|
||||
background:#fefefe;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #000000;
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
border-bottom: 1px solid #CCCCCC;
|
||||
color: #000000;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
h6 {
|
||||
color: #777777;
|
||||
background-color: inherit;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 0.2em;
|
||||
border: 0;
|
||||
color: #CCCCCC;
|
||||
background-color: #CCCCCC;
|
||||
}
|
||||
|
||||
p, blockquote, ul, ol, dl, li, table, pre {
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
code, pre {
|
||||
border-radius: 3px;
|
||||
background-color: #F8F8F8;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
code {
|
||||
border: 1px solid #EAEAEA;
|
||||
margin: 0 2px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
pre {
|
||||
border: 1px solid #CCCCCC;
|
||||
line-height: 1.25em;
|
||||
overflow: auto;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
pre > code {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a, a:visited {
|
||||
color: #4183C4;
|
||||
background-color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* 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 com.maskyn.fileeditor;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.InterstitialAd;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
|
||||
public class AdsHelper {
|
||||
private InterstitialAd interstitial;
|
||||
|
||||
public AdsHelper(Activity activity) {
|
||||
|
||||
interstitial = new InterstitialAd(activity);
|
||||
interstitial.setAdUnitId("ca-app-pub-5679083452234719/7178038180");
|
||||
|
||||
// Create ad request.
|
||||
AdRequest adRequest = new AdRequest.Builder().build();
|
||||
|
||||
// Begin loading your interstitial.
|
||||
interstitial.loadAd(adRequest);
|
||||
}
|
||||
|
||||
public void displayInterstitial() {
|
||||
interstitial.show();
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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 com.maskyn.fileeditor;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import sharedcode.turboeditor.activity.MainActivity;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.util.ProCheckUtils;
|
||||
|
||||
public class HomeActivity extends MainActivity {
|
||||
|
||||
private AdsHelper adsHelper;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if(PreferenceHelper.getSendErrorReports(this))
|
||||
Fabric.with(this, new Crashlytics());
|
||||
// setup the ads
|
||||
if(!ProCheckUtils.isPro(this))
|
||||
adsHelper = new AdsHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayInterstitial() {
|
||||
if(adsHelper != null && !ProCheckUtils.isPro(this))
|
||||
adsHelper.displayInterstitial();
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -19,12 +19,13 @@
|
||||
|
||||
package com.maskyn.fileeditorpro;
|
||||
|
||||
import sharedcode.turboeditor.activity.MainActivity;
|
||||
import com.maskyn.fileeditorpro.activity.MainActivity;
|
||||
|
||||
public class HomeActivity extends MainActivity {
|
||||
|
||||
@Override
|
||||
public void displayInterstitial() {
|
||||
public boolean showInterstitial() {
|
||||
// nothing to do here
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
* Copyright (C) 2018 Adrian Malacoda
|
||||
*
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Text Editor 8000 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.
|
||||
*
|
||||
* Text Editor 8000 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 com.maskyn.fileeditorpro.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import org.commonmark.node.Node;
|
||||
import org.commonmark.parser.Parser;
|
||||
import org.commonmark.renderer.html.HtmlRenderer;
|
||||
|
||||
public class MarkdownActivity extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
MarkdownView webView = new MarkdownView(this);
|
||||
setContentView(webView);
|
||||
webView.loadMarkdown(getIntent().getStringExtra("text"), "file:///android_asset/classic_theme_markdown.css");
|
||||
}
|
||||
|
||||
private static class MarkdownView extends WebView {
|
||||
private static final String CSS_LINK = "<link rel='stylesheet' type='text/css' href='%s'>";
|
||||
private final Parser parser;
|
||||
private final HtmlRenderer renderer;
|
||||
|
||||
MarkdownView (Context context) {
|
||||
super(context);
|
||||
parser = Parser.builder().build();
|
||||
renderer = HtmlRenderer.builder().build();
|
||||
}
|
||||
|
||||
public void loadMarkdown(String content, String cssUri) {
|
||||
String html = String.format(CSS_LINK, cssUri);
|
||||
html = html += renderer.render(parser.parse(content));
|
||||
loadDataWithBaseURL(null, html, "text/html", null, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,9 +17,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.activity;
|
||||
package com.maskyn.fileeditorpro.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
@ -38,42 +39,42 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.faizmalkani.floatingactionbutton.FloatingActionButton;
|
||||
import com.spazedog.lib.rootfw4.RootFW;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.sufficientlysecure.rootcommands.Shell;
|
||||
import org.sufficientlysecure.rootcommands.Toolbox;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.adapter.AdapterDetailedList;
|
||||
import sharedcode.turboeditor.dialogfragment.EditTextDialog;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.root.RootUtils;
|
||||
import sharedcode.turboeditor.util.AlphanumComparator;
|
||||
import sharedcode.turboeditor.util.Build;
|
||||
import sharedcode.turboeditor.util.ThemeUtils;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.adapter.AdapterDetailedList;
|
||||
import com.maskyn.fileeditorpro.dialogfragment.EditTextDialog;
|
||||
import com.maskyn.fileeditorpro.preferences.PreferenceHelper;
|
||||
import com.maskyn.fileeditorpro.util.AlphanumComparator;
|
||||
import com.maskyn.fileeditorpro.util.Build;
|
||||
import com.maskyn.fileeditorpro.util.ThemeUtils;
|
||||
|
||||
public class SelectFileActivity extends ActionBarActivity implements SearchView.OnQueryTextListener, AdapterView.OnItemClickListener, EditTextDialog.EditDialogListener {
|
||||
private String currentFolder = PreferenceHelper.SD_CARD_ROOT;
|
||||
private String currentFolder;
|
||||
private ListView listView;
|
||||
private boolean wantAFile = true;
|
||||
private MenuItem mSearchViewMenuItem;
|
||||
private SearchView mSearchView;
|
||||
private Filter filter;
|
||||
|
||||
private int prevposition = 0;
|
||||
private FloatingActionButton mFab;
|
||||
private boolean mfabOkMode = false;
|
||||
private File selectedFile;
|
||||
private boolean folderOpenMode = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
currentFolder = PreferenceHelper.defaultFolder(this);
|
||||
|
||||
ThemeUtils.setTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -84,41 +85,50 @@ public class SelectFileActivity extends ActionBarActivity implements SearchView.
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
final Actions action = (Actions) getIntent().getExtras().getSerializable("action");
|
||||
wantAFile = action == Actions.SelectFile;
|
||||
//final Actions action = (Actions) getIntent().getExtras().getSerializable("action");
|
||||
wantAFile = true; //action == Actions.SelectFile;
|
||||
mfabOkMode = false;
|
||||
folderOpenMode = getIntent().getBooleanExtra("foldermode", false);
|
||||
if(folderOpenMode)
|
||||
setTitle("Open Folder");
|
||||
|
||||
listView = (ListView) findViewById(android.R.id.list);
|
||||
listView.setOnItemClickListener(this);
|
||||
listView.setTextFilterEnabled(true);
|
||||
|
||||
FloatingActionButton mFab = (FloatingActionButton) findViewById(R.id.fabbutton);
|
||||
mFab = (FloatingActionButton) findViewById(R.id.fabbutton);
|
||||
mFab.setColor(getResources().getColor(R.color.fab_light));
|
||||
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_add));
|
||||
|
||||
mFab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PopupMenu popup = new PopupMenu(SelectFileActivity.this, v);
|
||||
if (!mfabOkMode) {
|
||||
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() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
int i = item.getItemId();
|
||||
if (i == R.id.im_new_file) {
|
||||
EditTextDialog.newInstance(EditTextDialog.Actions.NewFile).show(getFragmentManager().beginTransaction(), "dialog");
|
||||
return true;
|
||||
} else if (i == R.id.im_new_folder) {
|
||||
EditTextDialog.newInstance(EditTextDialog.Actions.NewFolder).show(getFragmentManager().beginTransaction(), "dialog");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
int i = item.getItemId();
|
||||
if (i == R.id.im_new_file) {
|
||||
EditTextDialog.newInstance(EditTextDialog.Actions.NewFile).show(getFragmentManager().beginTransaction(), "dialog");
|
||||
return true;
|
||||
} else if (i == R.id.im_new_folder) {
|
||||
EditTextDialog.newInstance(EditTextDialog.Actions.NewFolder).show(getFragmentManager().beginTransaction(), "dialog");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
popup.show();
|
||||
popup.show();
|
||||
}
|
||||
if (mfabOkMode) {
|
||||
finishWithResult(selectedFile);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -129,8 +139,8 @@ public class SelectFileActivity extends ActionBarActivity implements SearchView.
|
||||
File file = new File(lastNavigatedPath);
|
||||
|
||||
if (!file.exists()) {
|
||||
PreferenceHelper.setWorkingFolder(this, PreferenceHelper.SD_CARD_ROOT);
|
||||
file = new File(PreferenceHelper.SD_CARD_ROOT);
|
||||
PreferenceHelper.setWorkingFolder(this, PreferenceHelper.defaultFolder(this));
|
||||
file = new File(PreferenceHelper.defaultFolder(this));
|
||||
}
|
||||
|
||||
new UpdateList().execute(file.getAbsolutePath());
|
||||
@ -163,18 +173,28 @@ public class SelectFileActivity extends ActionBarActivity implements SearchView.
|
||||
return false;
|
||||
}
|
||||
|
||||
void returnData(String path) {
|
||||
final Intent returnIntent = new Intent();
|
||||
returnIntent.putExtra("path", path);
|
||||
setResult(RESULT_OK, returnIntent);
|
||||
// finish the activity
|
||||
finish();
|
||||
/**
|
||||
* Finish this Activity with a result code and URI of the selected file.
|
||||
*
|
||||
* @param file The file selected.
|
||||
*/
|
||||
private void finishWithResult(File file) {
|
||||
if (file != null) {
|
||||
Uri uri = Uri.fromFile(file);
|
||||
//Toast.makeText(this, uri.toString(), Toast.LENGTH_SHORT).show();
|
||||
setResult(RESULT_OK, new Intent().setData(uri));
|
||||
finish();
|
||||
} else {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent,
|
||||
View view, int position, long id) {
|
||||
|
||||
final String name = ((TextView) view.findViewById(android.R.id.text1)).getText().toString();
|
||||
if (name.equals("..")) {
|
||||
if (currentFolder.equals("/")) {
|
||||
@ -186,21 +206,67 @@ public class SelectFileActivity extends ActionBarActivity implements SearchView.
|
||||
.getParentFile();
|
||||
} else {
|
||||
tempFile = tempFile.getParentFile();
|
||||
|
||||
}
|
||||
new UpdateList().execute(tempFile.getAbsolutePath());
|
||||
}
|
||||
if (mfabOkMode) {
|
||||
prevposition = 0;
|
||||
mfabOkMode = false;
|
||||
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_add));
|
||||
}
|
||||
return;
|
||||
} else if (name.equals(getString(R.string.home))) {
|
||||
new UpdateList().execute(PreferenceHelper.getWorkingFolder(this));
|
||||
Toast.makeText(this, "test", Toast.LENGTH_SHORT).show();
|
||||
if (mfabOkMode) {
|
||||
prevposition = 0;
|
||||
mfabOkMode = false;
|
||||
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_add));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final File selectedFile = new File(currentFolder, name);
|
||||
//final File selectedFile = new File(currentFolder, name);
|
||||
selectedFile = new File(currentFolder, name);
|
||||
|
||||
if (selectedFile.isFile() && wantAFile) {
|
||||
returnData(selectedFile.getAbsolutePath());
|
||||
} else if (selectedFile.isDirectory()) {
|
||||
new UpdateList().execute(selectedFile.getAbsolutePath());
|
||||
if (!folderOpenMode) {
|
||||
if (selectedFile.isFile() && wantAFile) {
|
||||
if (prevposition == position)
|
||||
finishWithResult(selectedFile);
|
||||
else {
|
||||
prevposition = position;
|
||||
mfabOkMode = true;
|
||||
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_ok));
|
||||
view.setSelected(true);
|
||||
}
|
||||
} else if (selectedFile.isDirectory()) {
|
||||
//Toast.makeText(this, "its folder", Toast.LENGTH_SHORT).show();
|
||||
if (mfabOkMode) {
|
||||
prevposition = 0;
|
||||
mfabOkMode = false;
|
||||
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_add));
|
||||
}
|
||||
new UpdateList().execute(selectedFile.getAbsolutePath());
|
||||
}
|
||||
} else if (folderOpenMode) {
|
||||
if (selectedFile.isDirectory()) {
|
||||
if (prevposition == position) {
|
||||
new UpdateList().execute(selectedFile.getAbsolutePath());
|
||||
if (mfabOkMode) {
|
||||
prevposition = 0;
|
||||
mfabOkMode = false;
|
||||
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_add));
|
||||
}
|
||||
} else {
|
||||
prevposition = position;
|
||||
mfabOkMode = true;
|
||||
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_ok));
|
||||
view.setSelected(true);
|
||||
}
|
||||
} else if (selectedFile.isFile()) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,7 +316,7 @@ public class SelectFileActivity extends ActionBarActivity implements SearchView.
|
||||
Toast.makeText(getBaseContext(), R.string.is_the_working_folder, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
} else if (i == R.id.im_select_folder) {
|
||||
returnData(currentFolder);
|
||||
finishWithResult(new File(currentFolder));
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
@ -258,10 +324,15 @@ public class SelectFileActivity extends ActionBarActivity implements SearchView.
|
||||
|
||||
|
||||
@Override
|
||||
public void onFinishEditDialog(final String inputText, final String hint, final EditTextDialog.Actions actions) {
|
||||
public void onEdittextDialogEnded(final String inputText, final String hint, final EditTextDialog.Actions actions) {
|
||||
if (actions == EditTextDialog.Actions.NewFile && !TextUtils.isEmpty(inputText)) {
|
||||
File file = new File(currentFolder, inputText);
|
||||
returnData(file.getAbsolutePath());
|
||||
try {
|
||||
file.createNewFile();
|
||||
finishWithResult(file);
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(SelectFileActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else if (actions == EditTextDialog.Actions.NewFolder && !TextUtils.isEmpty(inputText)) {
|
||||
File file = new File(currentFolder, inputText);
|
||||
file.mkdirs();
|
||||
@ -300,49 +371,59 @@ public class SelectFileActivity extends ActionBarActivity implements SearchView.
|
||||
return null;
|
||||
}
|
||||
|
||||
File tempFile = new File(path);
|
||||
if (tempFile.isFile()) {
|
||||
tempFile = tempFile.getParentFile();
|
||||
File tempFolder = new File(path);
|
||||
if (tempFolder.isFile()) {
|
||||
tempFolder = tempFolder.getParentFile();
|
||||
}
|
||||
|
||||
String[] unopenableExtensions = {"apk", "mp3", "mp4", "png", "jpg", "jpeg"};
|
||||
|
||||
final LinkedList<AdapterDetailedList.FileDetail> fileDetails = new LinkedList<>();
|
||||
final LinkedList<AdapterDetailedList.FileDetail> folderDetails = new LinkedList<>();
|
||||
final ArrayList<File> files;
|
||||
currentFolder = tempFile.getAbsolutePath();
|
||||
currentFolder = tempFolder.getAbsolutePath();
|
||||
|
||||
boolean isRoot = false;
|
||||
if (!tempFile.canRead()) {
|
||||
try {
|
||||
Shell shell = null;
|
||||
shell = Shell.startRootShell();
|
||||
Toolbox tb = new Toolbox(shell);
|
||||
isRoot = tb.isRootAccessGiven();
|
||||
} catch (IOException | TimeoutException e) {
|
||||
e.printStackTrace();
|
||||
isRoot = false;
|
||||
if (!tempFolder.canRead()) {
|
||||
if (RootFW.connect()) {
|
||||
com.spazedog.lib.rootfw4.utils.File folder = RootFW.getFile(currentFolder);
|
||||
com.spazedog.lib.rootfw4.utils.File.FileStat[] stats = folder.getDetailedList();
|
||||
|
||||
if (stats != null) {
|
||||
for (com.spazedog.lib.rootfw4.utils.File.FileStat stat : stats) {
|
||||
if (stat.type().equals("d")) {
|
||||
folderDetails.add(new AdapterDetailedList.FileDetail(stat.name(),
|
||||
getString(R.string.folder),
|
||||
""));
|
||||
} else if (!FilenameUtils.isExtension(stat.name().toLowerCase(), unopenableExtensions)
|
||||
&& stat.size() <= Build.MAX_FILE_SIZE * FileUtils.ONE_KB) {
|
||||
final long fileSize = stat.size();
|
||||
//SimpleDateFormat format = new SimpleDateFormat("MMM dd, yyyy hh:mm a");
|
||||
//String date = format.format("");
|
||||
fileDetails.add(new AdapterDetailedList.FileDetail(stat.name(),
|
||||
FileUtils.byteCountToDisplaySize(fileSize), ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
File[] files = tempFolder.listFiles();
|
||||
|
||||
files = RootUtils.getFileList(currentFolder, isRoot);
|
||||
Arrays.sort(files, getFileNameComparator());
|
||||
|
||||
Collections.sort(files, getFileNameComparator());
|
||||
|
||||
if (files != null) {
|
||||
for (final File f : files) {
|
||||
if (f.isDirectory()) {
|
||||
folderDetails.add(new AdapterDetailedList.FileDetail(f.getName(),
|
||||
getString(R.string.folder),
|
||||
""));
|
||||
} else if (f.isFile()
|
||||
&& !FilenameUtils.isExtension(f.getName().toLowerCase(), unopenableExtensions)
|
||||
&& FileUtils.sizeOf(f) <= Build.MAX_FILE_SIZE * FileUtils.ONE_KB) {
|
||||
final long fileSize = f.length();
|
||||
SimpleDateFormat format = new SimpleDateFormat("MMM dd, yyyy hh:mm a");
|
||||
String date = format.format(f.lastModified());
|
||||
fileDetails.add(new AdapterDetailedList.FileDetail(f.getName(),
|
||||
FileUtils.byteCountToDisplaySize(fileSize), date));
|
||||
if (files != null) {
|
||||
for (final File f : files) {
|
||||
if (f.isDirectory()) {
|
||||
folderDetails.add(new AdapterDetailedList.FileDetail(f.getName(),
|
||||
getString(R.string.folder),
|
||||
""));
|
||||
} else if (f.isFile()
|
||||
&& !FilenameUtils.isExtension(f.getName().toLowerCase(), unopenableExtensions)
|
||||
&& FileUtils.sizeOf(f) <= Build.MAX_FILE_SIZE * FileUtils.ONE_KB) {
|
||||
final long fileSize = f.length();
|
||||
SimpleDateFormat format = new SimpleDateFormat("MMM dd, yyyy hh:mm a");
|
||||
String date = format.format(f.lastModified());
|
||||
fileDetails.add(new AdapterDetailedList.FileDetail(f.getName(),
|
||||
FileUtils.byteCountToDisplaySize(fileSize), date));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.adapter;
|
||||
package com.maskyn.fileeditorpro.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
@ -34,8 +34,8 @@ import org.apache.commons.io.FilenameUtils;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.util.MimeTypes;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.util.MimeTypes;
|
||||
|
||||
public class AdapterDetailedList extends
|
||||
ArrayAdapter<AdapterDetailedList.FileDetail> {
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,11 +17,11 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.adapter;
|
||||
package com.maskyn.fileeditorpro.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.text.TextUtils;
|
||||
import android.net.Uri;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -29,26 +29,26 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.util.GreatUri;
|
||||
|
||||
public class AdapterDrawer extends
|
||||
ArrayAdapter<File> {
|
||||
ArrayAdapter<GreatUri> {
|
||||
|
||||
private final Callbacks callbacks;
|
||||
// Layout Inflater
|
||||
private final LayoutInflater inflater;
|
||||
// List of file details
|
||||
private final List<File> files;
|
||||
private String selectedPath = "";
|
||||
private final LinkedList<GreatUri> greatUris;
|
||||
private GreatUri selectedGreatUri = new GreatUri(Uri.EMPTY, "", "");
|
||||
|
||||
public AdapterDrawer(Context context,
|
||||
List<File> files,
|
||||
LinkedList<GreatUri> greatUris,
|
||||
Callbacks callbacks) {
|
||||
super(context, R.layout.item_file_list, files);
|
||||
this.files = files;
|
||||
super(context, R.layout.item_file_list, greatUris);
|
||||
this.greatUris = greatUris;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.callbacks = callbacks;
|
||||
}
|
||||
@ -66,20 +66,21 @@ public class AdapterDrawer extends
|
||||
hold.cancelButton = (ImageView) convertView.findViewById(R.id.button_remove_from_list);
|
||||
convertView.setTag(hold);
|
||||
|
||||
final String fileName = files.get(position).getName();
|
||||
final GreatUri greatUri = greatUris.get(position);
|
||||
final String fileName = greatUri.getFileName();
|
||||
hold.nameLabel.setText(fileName);
|
||||
hold.cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean closeOpenedFile = TextUtils.equals(selectedPath, files.get(position).getAbsolutePath());
|
||||
boolean closeOpenedFile = selectedGreatUri.getUri().equals(greatUri.getUri());
|
||||
callbacks.CancelItem(position, closeOpenedFile);
|
||||
if (closeOpenedFile)
|
||||
selectedPath = "";
|
||||
selectPosition(new GreatUri(Uri.EMPTY, "", ""));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (TextUtils.equals(selectedPath, files.get(position).getAbsolutePath())) {
|
||||
if (selectedGreatUri.getUri().equals(greatUri.getUri())) {
|
||||
hold.nameLabel.setTypeface(null, Typeface.BOLD);
|
||||
} else {
|
||||
hold.nameLabel.setTypeface(null, Typeface.NORMAL);
|
||||
@ -87,30 +88,33 @@ public class AdapterDrawer extends
|
||||
|
||||
} else {
|
||||
final ViewHolder hold = ((ViewHolder) convertView.getTag());
|
||||
final String fileName = files.get(position).getName();
|
||||
final GreatUri greatUri = greatUris.get(position);
|
||||
final String fileName = greatUri.getFileName();
|
||||
hold.nameLabel.setText(fileName);
|
||||
hold.cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean closeOpenedFile = TextUtils.equals(selectedPath, files.get(position).getAbsolutePath());
|
||||
boolean closeOpenedFile = selectedGreatUri.getUri().equals(greatUri.getUri());
|
||||
callbacks.CancelItem(position, closeOpenedFile);
|
||||
if (closeOpenedFile)
|
||||
selectedPath = "";
|
||||
selectPosition(new GreatUri(Uri.EMPTY, "", ""));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (TextUtils.equals(selectedPath, files.get(position).getAbsolutePath())) {
|
||||
if (selectedGreatUri.getUri().equals(greatUri.getUri())) {
|
||||
hold.nameLabel.setTypeface(null, Typeface.BOLD);
|
||||
} else {
|
||||
hold.nameLabel.setTypeface(null, Typeface.NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public void selectView(String selectedPath) {
|
||||
public void selectPosition(GreatUri greatUri) {
|
||||
//callbacks.ItemSelected(selectedPath);
|
||||
this.selectedPath = selectedPath;
|
||||
this.selectedGreatUri = greatUri;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.adapter;
|
||||
package com.maskyn.fileeditorpro.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
@ -26,7 +26,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
|
||||
public class AdapterTwoItem extends
|
||||
ArrayAdapter<String> {
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.application;
|
||||
package com.maskyn.fileeditorpro.application;
|
||||
|
||||
import android.app.Application;
|
||||
import android.view.ViewConfiguration;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@ -30,8 +30,8 @@ import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.views.DialogHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.views.DialogHelper;
|
||||
|
||||
/**
|
||||
* Dialog fragment that shows some info about this application.
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@ -27,14 +27,11 @@ import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import it.gmariotti.changelibs.library.view.ChangeLogListView;
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.util.Build;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
|
||||
public class ChangelogDialog extends DialogFragment {
|
||||
|
||||
@ -66,25 +63,6 @@ public class ChangelogDialog extends DialogFragment {
|
||||
}
|
||||
}
|
||||
)
|
||||
.setPositiveButton(R.string.vota, new DialogInterface.OnClickListener() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int which) {
|
||||
try {
|
||||
if (Build.FOR_AMAZON) {
|
||||
String url = "amzn://apps/android?p=com.maskyn.fileeditor";
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
} else {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.maskyn.fileeditor"))
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
})
|
||||
.create();
|
||||
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@ -31,8 +31,8 @@ import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.views.DialogHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.views.DialogHelper;
|
||||
|
||||
// ...
|
||||
public class EditTextDialog extends DialogFragment implements TextView.OnEditorActionListener {
|
||||
@ -64,6 +64,9 @@ public class EditTextDialog extends DialogFragment implements TextView.OnEditorA
|
||||
case NewFolder:
|
||||
title = getString(R.string.folder);
|
||||
break;
|
||||
case Rename:
|
||||
title = getString(R.string.rinomina);
|
||||
break;
|
||||
default:
|
||||
title = null;
|
||||
break;
|
||||
@ -108,7 +111,7 @@ public class EditTextDialog extends DialogFragment implements TextView.OnEditorA
|
||||
if (target == null) {
|
||||
target = (EditDialogListener) getActivity();
|
||||
}
|
||||
target.onFinishEditDialog(this.mEditText.getText().toString(), getArguments().getString("hint"),
|
||||
target.onEdittextDialogEnded(this.mEditText.getText().toString(), getArguments().getString("hint"),
|
||||
(Actions) getArguments().getSerializable("action"));
|
||||
this.dismiss();
|
||||
}
|
||||
@ -123,10 +126,10 @@ public class EditTextDialog extends DialogFragment implements TextView.OnEditorA
|
||||
}
|
||||
|
||||
public enum Actions {
|
||||
NewFile, NewFolder
|
||||
NewFile, NewFolder, Rename
|
||||
}
|
||||
|
||||
public interface EditDialogListener {
|
||||
void onFinishEditDialog(String result, String hint, Actions action);
|
||||
void onEdittextDialogEnded(String result, String hint, Actions action);
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@ -32,8 +32,8 @@ import android.widget.ListView;
|
||||
|
||||
import org.mozilla.universalchardet.Constants;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.preferences.PreferenceHelper;
|
||||
|
||||
public class EncodingDialog extends DialogFragment implements AdapterView.OnItemClickListener {
|
||||
|
||||
@ -49,6 +49,7 @@ public class EncodingDialog extends DialogFragment implements AdapterView.OnItem
|
||||
Constants.CHARSET_ISO_2022_CN,
|
||||
Constants.CHARSET_ISO_2022_JP,
|
||||
Constants.CHARSET_ISO_2022_KR,
|
||||
"ISO-8859-2",
|
||||
Constants.CHARSET_ISO_8859_5,
|
||||
Constants.CHARSET_ISO_8859_7,
|
||||
Constants.CHARSET_ISO_8859_8,
|
||||
@ -60,6 +61,7 @@ public class EncodingDialog extends DialogFragment implements AdapterView.OnItem
|
||||
Constants.CHARSET_UTF_32BE,
|
||||
Constants.CHARSET_UTF_32LE,
|
||||
Constants.CHARSET_UTF_8,
|
||||
"UTF-16",
|
||||
Constants.CHARSET_WINDOWS_1251,
|
||||
Constants.CHARSET_WINDOWS_1252,
|
||||
Constants.CHARSET_WINDOWS_1253,
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,13 +17,15 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.provider.DocumentFile;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
|
||||
@ -32,17 +34,19 @@ import org.apache.commons.io.FileUtils;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.adapter.AdapterTwoItem;
|
||||
import sharedcode.turboeditor.views.DialogHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.adapter.AdapterTwoItem;
|
||||
import com.maskyn.fileeditorpro.util.AccessStorageApi;
|
||||
import com.maskyn.fileeditorpro.util.Device;
|
||||
import com.maskyn.fileeditorpro.views.DialogHelper;
|
||||
|
||||
// ...
|
||||
public class FileInfoDialog extends DialogFragment {
|
||||
|
||||
public static FileInfoDialog newInstance(String filePath) {
|
||||
public static FileInfoDialog newInstance(Uri uri) {
|
||||
final FileInfoDialog f = new FileInfoDialog();
|
||||
final Bundle args = new Bundle();
|
||||
args.putString("filePath", filePath);
|
||||
args.putParcelable("uri", uri);
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
@ -58,7 +62,11 @@ public class FileInfoDialog extends DialogFragment {
|
||||
|
||||
ListView list = (ListView) view.findViewById(android.R.id.list);
|
||||
|
||||
File file = new File(getArguments().getString("filePath"));
|
||||
DocumentFile file = DocumentFile.fromFile(new File(AccessStorageApi.getPath(getActivity(), (Uri) getArguments().getParcelable("uri"))));
|
||||
|
||||
if (file == null && Device.hasKitKatApi()) {
|
||||
file = DocumentFile.fromSingleUri(getActivity(), (Uri) getArguments().getParcelable("uri"));
|
||||
}
|
||||
|
||||
// Get the last modification information.
|
||||
Long lastModified = file.lastModified();
|
||||
@ -69,13 +77,13 @@ public class FileInfoDialog extends DialogFragment {
|
||||
|
||||
String[] lines1 = {
|
||||
getString(R.string.name),
|
||||
getString(R.string.folder),
|
||||
//getString(R.string.folder),
|
||||
getString(R.string.size),
|
||||
getString(R.string.modification_date)
|
||||
};
|
||||
String[] lines2 = {
|
||||
file.getName(),
|
||||
file.getParent(),
|
||||
//file.getParent(),
|
||||
FileUtils.byteCountToDisplaySize(file.length()),
|
||||
date.toString()
|
||||
};
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@ -36,9 +36,9 @@ import java.util.LinkedList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.texteditor.SearchResult;
|
||||
import sharedcode.turboeditor.views.DialogHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.texteditor.SearchResult;
|
||||
import com.maskyn.fileeditorpro.views.DialogHelper;
|
||||
|
||||
// ...
|
||||
public class FindTextDialog extends DialogFragment {
|
||||
@ -193,7 +193,7 @@ public class FindTextDialog extends DialogFragment {
|
||||
return;
|
||||
// else we return positions and other things
|
||||
else {
|
||||
SearchResult searchResult = new SearchResult(foundIndex, textToFind.length(), replaceCheck.isChecked(), textToReplace.getText().toString());
|
||||
SearchResult searchResult = new SearchResult(foundIndex, textToFind.length(), replaceCheck.isChecked(), textToFind.getText().toString(), textToReplace.getText().toString(), regexCheck.isChecked());
|
||||
searchDialogInterface.onSearchDone(searchResult);
|
||||
}
|
||||
} else {
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,53 +17,71 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.activity.MainActivity;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.task.SaveFileTask;
|
||||
import sharedcode.turboeditor.views.DialogHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.activity.MainActivity;
|
||||
import com.maskyn.fileeditorpro.preferences.PreferenceHelper;
|
||||
import com.maskyn.fileeditorpro.task.SaveFileTask;
|
||||
import com.maskyn.fileeditorpro.util.GreatUri;
|
||||
import com.maskyn.fileeditorpro.views.DialogHelper;
|
||||
|
||||
// ...
|
||||
@SuppressLint("ValidFragment")
|
||||
public class NewFileDetailsDialog extends DialogFragment {
|
||||
|
||||
private EditText mName;
|
||||
private EditText mFolder;
|
||||
|
||||
public static NewFileDetailsDialog newInstance(String fileText, String fileEncoding) {
|
||||
final NewFileDetailsDialog f = new NewFileDetailsDialog();
|
||||
final Bundle args = new Bundle();
|
||||
args.putString("fileText", fileText);
|
||||
args.putString("fileEncoding", fileEncoding);
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
GreatUri currentUri;
|
||||
String fileText;
|
||||
String fileEncoding;
|
||||
|
||||
public NewFileDetailsDialog(GreatUri currentUri, String fileText, String fileEncoding) {
|
||||
this.currentUri = currentUri;
|
||||
this.fileText = fileText;
|
||||
this.fileEncoding = fileEncoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
View view = new DialogHelper.Builder(getActivity())
|
||||
.setTitle(R.string.file)
|
||||
.setTitle(R.string.save_as)
|
||||
.setView(R.layout.dialog_fragment_new_file_details)
|
||||
.createSkeletonView();
|
||||
|
||||
this.mName = (EditText) view.findViewById(android.R.id.text1);
|
||||
this.mFolder = (EditText) view.findViewById(android.R.id.text2);
|
||||
|
||||
this.mName.setText(".txt");
|
||||
this.mFolder.setText(PreferenceHelper.getWorkingFolder(getActivity()));
|
||||
boolean noName = TextUtils.isEmpty(currentUri.getFileName());
|
||||
boolean noPath = TextUtils.isEmpty(currentUri.getFilePath());
|
||||
|
||||
if (noName) {
|
||||
this.mName.setText(".txt");
|
||||
} else {
|
||||
this.mName.setText(currentUri.getFileName());
|
||||
}
|
||||
if (noPath) {
|
||||
this.mFolder.setText(PreferenceHelper.getWorkingFolder(getActivity()));
|
||||
} else {
|
||||
this.mFolder.setText(currentUri.getParentFolder());
|
||||
}
|
||||
|
||||
// Show soft keyboard automatically
|
||||
this.mName.requestFocus();
|
||||
@ -76,10 +94,27 @@ public class NewFileDetailsDialog extends DialogFragment {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
if (!mName.getText().toString().isEmpty() && !mFolder.getText().toString().isEmpty()) {
|
||||
|
||||
File file = new File(mFolder.getText().toString(), mName.getText().toString());
|
||||
new SaveFileTask((MainActivity) getActivity(), file.getPath(), getArguments().getString("fileText"), getArguments().getString("fileEncoding")).execute();
|
||||
PreferenceHelper.setWorkingFolder(getActivity(), file.getParent());
|
||||
try {
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
final GreatUri newUri = new GreatUri(Uri.fromFile(file), file.getAbsolutePath(), file.getName());
|
||||
|
||||
new SaveFileTask((MainActivity) getActivity(), newUri, fileText, fileEncoding, new SaveFileTask.SaveFileInterface() {
|
||||
@Override
|
||||
public void fileSaved(Boolean success) {
|
||||
if (getActivity() != null) {
|
||||
((MainActivity) getActivity()).savedAFile(newUri, true);
|
||||
}
|
||||
}
|
||||
}).execute();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@ -27,8 +27,8 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.NumberPicker;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.views.DialogHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.views.DialogHelper;
|
||||
|
||||
// ...
|
||||
public class NumberPickerDialog extends DialogFragment {
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,56 +17,57 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.dialogfragment;
|
||||
package com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.activity.MainActivity;
|
||||
import sharedcode.turboeditor.task.SaveFileTask;
|
||||
import sharedcode.turboeditor.views.DialogHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.activity.MainActivity;
|
||||
import com.maskyn.fileeditorpro.task.SaveFileTask;
|
||||
import com.maskyn.fileeditorpro.util.GreatUri;
|
||||
import com.maskyn.fileeditorpro.views.DialogHelper;
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public class SaveFileDialog extends DialogFragment {
|
||||
|
||||
public static SaveFileDialog newInstance(String filePath, String text, String encoding) {
|
||||
return newInstance(filePath, text, encoding, false, "");
|
||||
GreatUri uri;
|
||||
String text;
|
||||
String encoding;
|
||||
boolean openNewFileAfter;
|
||||
GreatUri newUri;
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public SaveFileDialog(GreatUri uri, String text, String encoding) {
|
||||
this.uri = uri;
|
||||
this.text = text;
|
||||
this.encoding = encoding;
|
||||
this.openNewFileAfter = false;
|
||||
this.newUri = new GreatUri(Uri.EMPTY, "", "");
|
||||
}
|
||||
|
||||
public static SaveFileDialog newInstance(String filePath, String text, String encoding, boolean openNewFileAfter, String pathOfNewFile) {
|
||||
SaveFileDialog frag = new SaveFileDialog();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("filePath", filePath);
|
||||
args.putString("text", text);
|
||||
args.putString("encoding", encoding);
|
||||
args.putBoolean("openNewFileAfter", openNewFileAfter);
|
||||
args.putString("pathOfNewFile", pathOfNewFile);
|
||||
frag.setArguments(args);
|
||||
return frag;
|
||||
@SuppressLint("ValidFragment")
|
||||
public SaveFileDialog(GreatUri uri, String text, String encoding, boolean openNewFileAfter, GreatUri newUri) {
|
||||
this.uri = uri;
|
||||
this.text = text;
|
||||
this.encoding = encoding;
|
||||
this.openNewFileAfter = openNewFileAfter;
|
||||
this.newUri = newUri;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final String filePath = getArguments().getString("filePath");
|
||||
final String text = getArguments().getString("text");
|
||||
final String encoding = getArguments().getString("encoding");
|
||||
final String fileName = FilenameUtils.getName(filePath);
|
||||
final File file = new File(filePath);
|
||||
|
||||
View view = new DialogHelper.Builder(getActivity())
|
||||
.setIcon(getResources().getDrawable(R.drawable.ic_action_save))
|
||||
.setTitle(R.string.salva)
|
||||
.setMessage(String.format(getString(R.string.save_changes), fileName))
|
||||
.setMessage(String.format(getString(R.string.save_changes), uri.getFileName()))
|
||||
.createCommonView();
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
@ -75,15 +76,22 @@ public class SaveFileDialog extends DialogFragment {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (!fileName.isEmpty())
|
||||
new SaveFileTask((MainActivity) getActivity(), filePath, text,
|
||||
encoding).execute();
|
||||
else {
|
||||
if (uri.getFileName().isEmpty()) {
|
||||
NewFileDetailsDialog dialogFrag =
|
||||
NewFileDetailsDialog.newInstance(text,
|
||||
new NewFileDetailsDialog(uri,text,
|
||||
encoding);
|
||||
dialogFrag.show(getFragmentManager().beginTransaction(),
|
||||
"dialog");
|
||||
} else {
|
||||
new SaveFileTask((MainActivity) getActivity(), uri, text,
|
||||
encoding, new SaveFileTask.SaveFileInterface() {
|
||||
@Override
|
||||
public void fileSaved(Boolean success) {
|
||||
if (getActivity() != null) {
|
||||
((MainActivity) getActivity()).savedAFile(uri, true);
|
||||
}
|
||||
}
|
||||
}).execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,8 +106,7 @@ public class SaveFileDialog extends DialogFragment {
|
||||
target = (ISaveDialog) getActivity();
|
||||
}
|
||||
target.userDoesntWantToSave(
|
||||
getArguments().getBoolean("openNewFileAfter"),
|
||||
getArguments().getString("pathOfNewFile")
|
||||
openNewFileAfter, newUri
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -108,6 +115,6 @@ public class SaveFileDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
public interface ISaveDialog {
|
||||
void userDoesntWantToSave(boolean openNewFile, String pathOfNewFile);
|
||||
void userDoesntWantToSave(boolean openNewFile, GreatUri newUri);
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Text Editor 8000 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.
|
||||
*
|
||||
* Text Editor 8000 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 com.maskyn.fileeditorpro.dialogfragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.preferences.PreferenceHelper;
|
||||
|
||||
public class ThemeDialog extends DialogFragment implements AdapterView.OnItemClickListener {
|
||||
|
||||
private ListView list;
|
||||
|
||||
public static ThemeDialog newInstance() {
|
||||
final ThemeDialog f = new ThemeDialog();
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_theme_list, null);
|
||||
list = (ListView) view.findViewById(android.R.id.list);
|
||||
|
||||
String[] themes = {
|
||||
getString(R.string.theme_dark), getString(R.string.light_theme), getString(R.string.theme_black)
|
||||
};
|
||||
|
||||
list.setAdapter(new ArrayAdapter<>(getActivity(), R.layout.item_single_choice, themes));
|
||||
list.setOnItemClickListener(this);
|
||||
|
||||
int currentTheme = PreferenceHelper.getTheme(getActivity());
|
||||
|
||||
for (int i = 0; i < themes.length; i++) {
|
||||
if (i == currentTheme)
|
||||
list.setItemChecked(i, true);
|
||||
}
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setView(view)
|
||||
.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
DialogListener target = (DialogListener) getTargetFragment();
|
||||
if (target == null) {
|
||||
target = (DialogListener) getActivity();
|
||||
}
|
||||
target.onThemeSelected(position);
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
public interface DialogListener {
|
||||
void onThemeSelected(int result);
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,16 +17,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maskyn.fileeditor;
|
||||
package com.maskyn.fileeditorpro.preferences;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
||||
public enum PreferenceChangeType {
|
||||
FONT_SIZE, ENCODING, SYNTAX, WRAP_CONTENT, MONOSPACE, LINE_NUMERS, THEME_CHANGE, TEXT_SUGGESTIONS, READ_ONLY, ACCESSORY_VIEW
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,16 +17,20 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.preferences;
|
||||
package com.maskyn.fileeditorpro.preferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.maskyn.fileeditorpro.util.Device;
|
||||
|
||||
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() {
|
||||
}
|
||||
@ -45,6 +49,14 @@ public final class PreferenceHelper {
|
||||
return getPrefs(context).getBoolean("use_monospace", false);
|
||||
}
|
||||
|
||||
public static boolean getUseAccessoryView(Context context) {
|
||||
return getPrefs(context).getBoolean("accessory_view", true);
|
||||
}
|
||||
|
||||
public static boolean getUseStorageAccessFramework(Context context) {
|
||||
return getPrefs(context).getBoolean("storage_access_framework", false);
|
||||
}
|
||||
|
||||
public static boolean getLineNumbers(Context context) {
|
||||
return getPrefs(context).getBoolean("editor_line_numbers", true);
|
||||
}
|
||||
@ -57,8 +69,20 @@ public final class PreferenceHelper {
|
||||
return getPrefs(context).getBoolean("editor_wrap_content", true);
|
||||
}
|
||||
|
||||
public static int getTheme(Context context) {
|
||||
return getPrefs(context).getInt("theme", 0);
|
||||
}
|
||||
|
||||
public static boolean getDarkTheme(Context context) {
|
||||
return getPrefs(context).getInt("theme", 0) == 0;
|
||||
}
|
||||
|
||||
public static boolean getLightTheme(Context context) {
|
||||
return getPrefs(context).getBoolean("light_theme", false);
|
||||
return getPrefs(context).getInt("theme", 0) == 1;
|
||||
}
|
||||
|
||||
public static boolean getBlackTheme(Context context) {
|
||||
return getPrefs(context).getInt("theme", 0) == 2;
|
||||
}
|
||||
|
||||
public static boolean getSuggestionActive(Context context) {
|
||||
@ -74,19 +98,33 @@ public final class PreferenceHelper {
|
||||
}
|
||||
|
||||
public static String getEncoding(Context context) {
|
||||
return getPrefs(context).getString("editor_encoding", "UTF-8");
|
||||
return getPrefs(context).getString("editor_encoding", "UTF-16");
|
||||
}
|
||||
|
||||
public static int getFontSize(Context context) {
|
||||
return getPrefs(context).getInt("font_size", 16);
|
||||
}
|
||||
|
||||
public static String defaultFolder(Context context) {
|
||||
String folder;
|
||||
File externalFolder = context.getExternalFilesDir(null);
|
||||
|
||||
if (externalFolder != null && Device.isKitKatApi()) {
|
||||
folder = externalFolder.getAbsolutePath();
|
||||
} else {
|
||||
folder = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
}
|
||||
//folder = context.getExternalFilesDir(null).getAbsolutePath();
|
||||
//folder = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
return folder;
|
||||
}
|
||||
|
||||
public static String getWorkingFolder(Context context) {
|
||||
return getPrefs(context).getString("working_folder", SD_CARD_ROOT);
|
||||
return getPrefs(context).getString("working_folder2", defaultFolder(context));
|
||||
}
|
||||
|
||||
public static String[] getSavedPaths(Context context) {
|
||||
return getPrefs(context).getString("savedPaths", "").split(",");
|
||||
return getPrefs(context).getString("savedPaths2", "").split(",");
|
||||
}
|
||||
|
||||
public static boolean getPageSystemButtonsPopupShown(Context context) {
|
||||
@ -109,6 +147,10 @@ public final class PreferenceHelper {
|
||||
return getPrefs(context).getBoolean("page_system_active", true);
|
||||
}
|
||||
|
||||
public static boolean getSplitByLine(Context context){
|
||||
return getPrefs(context).getBoolean("split_by_line", true);
|
||||
}
|
||||
|
||||
public static boolean hasDonated(Context context) {
|
||||
return getPrefs(context).getBoolean("has_donated", false);
|
||||
}
|
||||
@ -118,6 +160,14 @@ public final class PreferenceHelper {
|
||||
getEditor(context).putBoolean("use_monospace", value).commit();
|
||||
}
|
||||
|
||||
public static void setUseAccessoryView(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("accessory_view", value).commit();
|
||||
}
|
||||
|
||||
public static void setUseStorageAccessFramework(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("storage_access_framework", value).commit();
|
||||
}
|
||||
|
||||
public static void setLineNumbers(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("editor_line_numbers", value).commit();
|
||||
}
|
||||
@ -139,11 +189,11 @@ public final class PreferenceHelper {
|
||||
}
|
||||
|
||||
public static void setWorkingFolder(Context context, String value) {
|
||||
getEditor(context).putString("working_folder", value).commit();
|
||||
getEditor(context).putString("working_folder2", value).commit();
|
||||
}
|
||||
|
||||
public static void setSavedPaths(Context context, StringBuilder stringBuilder) {
|
||||
getEditor(context).putString("savedPaths", stringBuilder.toString()).commit();
|
||||
getEditor(context).putString("savedPaths2", stringBuilder.toString()).commit();
|
||||
}
|
||||
|
||||
public static void setPageSystemButtonsPopupShown(Context context, boolean value) {
|
||||
@ -158,8 +208,8 @@ public final class PreferenceHelper {
|
||||
getEditor(context).putBoolean("has_donated", value).commit();
|
||||
}
|
||||
|
||||
public static void setLightTheme(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("light_theme", value).commit();
|
||||
public static void setTheme(Context context, int value) {
|
||||
getEditor(context).putInt("theme", value).commit();
|
||||
}
|
||||
|
||||
public static void setSuggestionsActive(Context context, boolean value) {
|
||||
@ -178,8 +228,12 @@ public final class PreferenceHelper {
|
||||
getEditor(context).putBoolean("page_system_active", value).commit();
|
||||
}
|
||||
|
||||
public static void setSplitByLine(Context context, boolean value){
|
||||
getEditor(context).putBoolean("split_by_line",value).commit();
|
||||
}
|
||||
|
||||
public static void setSendErrorReport(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("ignore_back_button", value).commit();
|
||||
getEditor(context).putBoolean("send_error_reports", value).commit();
|
||||
}
|
||||
|
||||
public static void setEncoding(Context context, String value) {
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,9 +17,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.preferences;
|
||||
package com.maskyn.fileeditorpro.preferences;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.view.LayoutInflater;
|
||||
@ -28,26 +31,15 @@ import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.activity.MainActivity;
|
||||
import sharedcode.turboeditor.dialogfragment.EncodingDialog;
|
||||
import sharedcode.turboeditor.dialogfragment.NumberPickerDialog;
|
||||
import sharedcode.turboeditor.util.ProCheckUtils;
|
||||
import sharedcode.turboeditor.util.ViewUtils;
|
||||
import sharedcode.turboeditor.views.DialogHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.activity.MainActivity;
|
||||
import com.maskyn.fileeditorpro.dialogfragment.EncodingDialog;
|
||||
import com.maskyn.fileeditorpro.dialogfragment.NumberPickerDialog;
|
||||
import com.maskyn.fileeditorpro.dialogfragment.ThemeDialog;
|
||||
import com.maskyn.fileeditorpro.util.Device;
|
||||
import com.maskyn.fileeditorpro.util.ViewUtils;
|
||||
|
||||
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged;
|
||||
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.LINE_NUMERS;
|
||||
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.SYNTAX;
|
||||
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.WRAP_CONTENT;
|
||||
|
||||
public class SettingsFragment extends Fragment implements NumberPickerDialog.INumberPickerDialog, EncodingDialog.DialogListener {
|
||||
public class SettingsFragment extends Fragment implements NumberPickerDialog.INumberPickerDialog, EncodingDialog.DialogListener, ThemeDialog.DialogListener {
|
||||
|
||||
// Editor Variables
|
||||
private boolean sLineNumbers;
|
||||
@ -55,29 +47,32 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
private boolean sWrapContent;
|
||||
private boolean sUseMonospace;
|
||||
private boolean sReadOnly;
|
||||
|
||||
private boolean sLightTheme;
|
||||
private boolean sAccessoryView;
|
||||
private boolean sStorageAccessFramework;
|
||||
private boolean sSuggestions;
|
||||
private boolean sAutoSave;
|
||||
private boolean sIgnoreBackButton;
|
||||
private boolean sSplitText;
|
||||
private boolean sSplitByLine;
|
||||
private boolean sErrorReports;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
sUseMonospace = PreferenceHelper.getUseMonospace(getActivity());
|
||||
sColorSyntax = PreferenceHelper.getSyntaxHighlight(getActivity());
|
||||
sWrapContent = PreferenceHelper.getWrapContent(getActivity());
|
||||
sLineNumbers = PreferenceHelper.getLineNumbers(getActivity());
|
||||
sReadOnly = PreferenceHelper.getReadOnly(getActivity());
|
||||
|
||||
sLightTheme = PreferenceHelper.getLightTheme(getActivity());
|
||||
sSuggestions = PreferenceHelper.getSuggestionActive(getActivity());
|
||||
sAutoSave = PreferenceHelper.getAutoSave(getActivity());
|
||||
sIgnoreBackButton = PreferenceHelper.getIgnoreBackButton(getActivity());
|
||||
sSplitText = PreferenceHelper.getSplitText(getActivity());
|
||||
sErrorReports = PreferenceHelper.getSendErrorReports(getActivity());
|
||||
Context context = getActivity();
|
||||
sUseMonospace = PreferenceHelper.getUseMonospace(context);
|
||||
sColorSyntax = PreferenceHelper.getSyntaxHighlight(context);
|
||||
sWrapContent = PreferenceHelper.getWrapContent(context);
|
||||
sLineNumbers = PreferenceHelper.getLineNumbers(context);
|
||||
sReadOnly = PreferenceHelper.getReadOnly(context);
|
||||
sAccessoryView = PreferenceHelper.getUseAccessoryView(context);
|
||||
sStorageAccessFramework = PreferenceHelper.getUseStorageAccessFramework(context);
|
||||
sSuggestions = PreferenceHelper.getSuggestionActive(context);
|
||||
sAutoSave = PreferenceHelper.getAutoSave(context);
|
||||
sIgnoreBackButton = PreferenceHelper.getIgnoreBackButton(context);
|
||||
sSplitText = PreferenceHelper.getSplitText(context);
|
||||
sSplitByLine = PreferenceHelper.getSplitByLine(context);
|
||||
sErrorReports = PreferenceHelper.getSendErrorReports(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -86,7 +81,7 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
// Our custom layout
|
||||
final View rootView = inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
final SwitchCompat swLineNumbers, swSyntax, swWrapContent, swMonospace, swReadOnly;
|
||||
final SwitchCompat swLightTheme, swSuggestions, swAutoSave, swIgnoreBackButton, swSplitText, swErrorReports;
|
||||
final SwitchCompat swSuggestions, swAccessoryView, swStorageAccessFramework, swAutoSave, swIgnoreBackButton, swSplitText, swSplitByLine, swErrorReports;
|
||||
|
||||
swLineNumbers = (SwitchCompat) rootView.findViewById(R.id.switch_line_numbers);
|
||||
swSyntax = (SwitchCompat) rootView.findViewById(R.id.switch_syntax);
|
||||
@ -94,11 +89,14 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
swMonospace = (SwitchCompat) rootView.findViewById(R.id.switch_monospace);
|
||||
swReadOnly = (SwitchCompat) rootView.findViewById(R.id.switch_read_only);
|
||||
|
||||
swLightTheme = (SwitchCompat) rootView.findViewById(R.id.switch_light_theme);
|
||||
swSuggestions = (SwitchCompat) rootView.findViewById(R.id.switch_suggestions_active);
|
||||
swAccessoryView = (SwitchCompat) rootView.findViewById(R.id.switch_accessory_view);
|
||||
swStorageAccessFramework = (SwitchCompat) rootView.findViewById(R.id.switch_storage_access_framework);
|
||||
swAutoSave = (SwitchCompat) rootView.findViewById(R.id.switch_auto_save);
|
||||
swIgnoreBackButton = (SwitchCompat) rootView.findViewById(R.id.switch_ignore_backbutton);
|
||||
swSplitText = (SwitchCompat) rootView.findViewById(R.id.switch_page_system);
|
||||
swSplitByLine = (SwitchCompat) rootView.findViewById(R.id.split_by_line);
|
||||
|
||||
swErrorReports = (SwitchCompat) rootView.findViewById(R.id.switch_send_error_reports);
|
||||
|
||||
swLineNumbers.setChecked(sLineNumbers);
|
||||
@ -107,27 +105,28 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
swMonospace.setChecked(sUseMonospace);
|
||||
swReadOnly.setChecked(sReadOnly);
|
||||
|
||||
swLightTheme.setChecked(sLightTheme);
|
||||
swSuggestions.setChecked(sSuggestions);
|
||||
swAccessoryView.setChecked(sAccessoryView);
|
||||
swStorageAccessFramework.setChecked(sStorageAccessFramework);
|
||||
swAutoSave.setChecked(sAutoSave);
|
||||
swIgnoreBackButton.setChecked(sIgnoreBackButton);
|
||||
swSplitText.setChecked(sSplitText);
|
||||
swSplitByLine.setChecked(sSplitByLine);
|
||||
swErrorReports.setChecked(sErrorReports);
|
||||
|
||||
TextView fontSizeView, encodingView, donateView, extraOptionsView;
|
||||
TextView fontSizeView, encodingView, extraOptionsView, themeView;
|
||||
fontSizeView = (TextView) rootView.findViewById(R.id.drawer_button_font_size);
|
||||
encodingView = (TextView) rootView.findViewById(R.id.drawer_button_encoding);
|
||||
extraOptionsView = (TextView) rootView.findViewById(R.id.drawer_button_extra_options);
|
||||
donateView = (TextView) rootView.findViewById(R.id.drawer_button_go_pro);
|
||||
themeView = (TextView) rootView.findViewById(R.id.drawer_button_theme);
|
||||
|
||||
if(ProCheckUtils.isPro(getActivity(), false))
|
||||
ViewUtils.setVisible(donateView, false);
|
||||
ViewUtils.setVisible(swStorageAccessFramework, Device.hasKitKatApi());
|
||||
|
||||
swLineNumbers.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setLineNumbers(getActivity(), isChecked);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(LINE_NUMERS));
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.LINE_NUMERS);
|
||||
}
|
||||
});
|
||||
|
||||
@ -136,7 +135,7 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
sColorSyntax = isChecked;
|
||||
PreferenceHelper.setSyntaxHighlight(getActivity(), isChecked);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(SYNTAX));
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.SYNTAX);
|
||||
|
||||
}
|
||||
});
|
||||
@ -145,7 +144,7 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setWrapContent(getActivity(), isChecked);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(WRAP_CONTENT));
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.WRAP_CONTENT);
|
||||
}
|
||||
});
|
||||
|
||||
@ -154,7 +153,7 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
sUseMonospace = isChecked;
|
||||
PreferenceHelper.setUseMonospace(getActivity(), isChecked);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(MONOSPACE));
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.MONOSPACE);
|
||||
|
||||
}
|
||||
});
|
||||
@ -163,7 +162,7 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setReadOnly(getActivity(), isChecked);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(READ_ONLY));
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.READ_ONLY);
|
||||
}
|
||||
});
|
||||
|
||||
@ -200,18 +199,12 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
}
|
||||
});
|
||||
|
||||
donateView.setOnClickListener(new View.OnClickListener() {
|
||||
themeView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DialogHelper.showDonateDialog(getActivity());
|
||||
}
|
||||
});
|
||||
|
||||
swLightTheme.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setLightTheme(getActivity(), isChecked);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(THEME_CHANGE));
|
||||
ThemeDialog dialogFrag = ThemeDialog.newInstance();
|
||||
dialogFrag.setTargetFragment(SettingsFragment.this, 0);
|
||||
dialogFrag.show(getFragmentManager().beginTransaction(), "dialog");
|
||||
}
|
||||
});
|
||||
|
||||
@ -219,7 +212,22 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setSuggestionsActive(getActivity(), isChecked);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(TEXT_SUGGESTIONS));
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.TEXT_SUGGESTIONS);
|
||||
}
|
||||
});
|
||||
|
||||
swAccessoryView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setUseAccessoryView(getActivity(), isChecked);
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.ACCESSORY_VIEW);
|
||||
}
|
||||
});
|
||||
|
||||
swStorageAccessFramework.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setUseStorageAccessFramework(getActivity(), isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
@ -241,6 +249,14 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setSplitText(getActivity(), isChecked);
|
||||
swSplitByLine.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
swSplitByLine.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
PreferenceHelper.setSplitByLine(getActivity(), isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
@ -257,13 +273,19 @@ public class SettingsFragment extends Fragment implements NumberPickerDialog.INu
|
||||
@Override
|
||||
public void onNumberPickerDialogDismissed(NumberPickerDialog.Actions action, int value) {
|
||||
PreferenceHelper.setFontSize(getActivity(), value);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(FONT_SIZE));
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.FONT_SIZE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEncodingSelected(String result) {
|
||||
PreferenceHelper.setEncoding(getActivity(), result);
|
||||
((MainActivity) getActivity()).onEvent(new APreferenceValueWasChanged(ENCODING));
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.ENCODING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onThemeSelected(int result) {
|
||||
PreferenceHelper.setTheme(getActivity(), result);
|
||||
((MainActivity) getActivity()).aPreferenceValueWasChanged(PreferenceChangeType.THEME_CHANGE);
|
||||
}
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Text Editor 8000 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.
|
||||
*
|
||||
* Text Editor 8000 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 com.maskyn.fileeditorpro.task;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.spazedog.lib.rootfw4.RootFW;
|
||||
import com.spazedog.lib.rootfw4.Shell;
|
||||
import com.spazedog.lib.rootfw4.utils.File;
|
||||
import com.spazedog.lib.rootfw4.utils.Filesystem;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.activity.MainActivity;
|
||||
import com.maskyn.fileeditorpro.util.Device;
|
||||
import com.maskyn.fileeditorpro.util.GreatUri;
|
||||
|
||||
public class SaveFileTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private final MainActivity activity;
|
||||
private final GreatUri uri;
|
||||
private final String newContent;
|
||||
private final String encoding;
|
||||
private String message;
|
||||
private String positiveMessage, negativeMessage;
|
||||
private SaveFileInterface mCompletionHandler;
|
||||
|
||||
public SaveFileTask(MainActivity activity, GreatUri uri, String newContent, String encoding, SaveFileInterface mCompletionHandler) {
|
||||
this.activity = activity;
|
||||
this.uri = uri;
|
||||
this.newContent = newContent;
|
||||
this.encoding = encoding;
|
||||
this.mCompletionHandler = mCompletionHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
positiveMessage = String.format(activity.getString(R.string.file_saved_with_success), uri.getFileName());
|
||||
negativeMessage = activity.getString(R.string.err_occured);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Void doInBackground(final Void... voids) {
|
||||
|
||||
boolean isRootNeeded = false;
|
||||
Shell.Result resultRoot = null;
|
||||
|
||||
try {
|
||||
String filePath = uri.getFilePath();
|
||||
// if the uri has no path
|
||||
if (TextUtils.isEmpty(filePath)) {
|
||||
writeUri(uri.getUri(), newContent, encoding);
|
||||
} else {
|
||||
isRootNeeded = !uri.isWritable();
|
||||
if (isRootNeeded == false) {
|
||||
if (Device.hasKitKatApi())
|
||||
writeUri(uri.getUri(), newContent, encoding);
|
||||
else {
|
||||
FileUtils.write(new java.io.File(filePath),
|
||||
newContent,
|
||||
encoding);
|
||||
}
|
||||
}
|
||||
// if we can read the file associated with the uri
|
||||
else {
|
||||
|
||||
if (RootFW.connect()) {
|
||||
Filesystem.Disk systemPart = RootFW.getDisk(uri.getParentFolder());
|
||||
systemPart.mount(new String[]{"rw"});
|
||||
|
||||
File file = RootFW.getFile(uri.getFilePath());
|
||||
resultRoot = file.writeResult(newContent);
|
||||
|
||||
RootFW.disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (isRootNeeded) {
|
||||
if (resultRoot != null && resultRoot.wasSuccessful()) {
|
||||
message = positiveMessage;
|
||||
}
|
||||
else if (resultRoot != null) {
|
||||
message = negativeMessage + " command number: " + resultRoot.getCommandNumber() + " result code: " + resultRoot.getResultCode() + " error lines: " + resultRoot.getString();
|
||||
}
|
||||
else
|
||||
message = negativeMessage;
|
||||
}
|
||||
else
|
||||
message = positiveMessage;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = e.getMessage();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void writeUri(Uri uri, String newContent, String encoding) throws IOException {
|
||||
ParcelFileDescriptor pfd = activity.getContentResolver().openFileDescriptor(uri, "w");
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
|
||||
fileOutputStream.write(newContent.getBytes(Charset.forName(encoding)));
|
||||
fileOutputStream.close();
|
||||
pfd.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void onPostExecute(final Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
Toast.makeText(activity, message, Toast.LENGTH_LONG).show();
|
||||
|
||||
/*android.content.ClipboardManager clipboard = (android.content.ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
android.content.ClipData clip = android.content.ClipData.newPlainText("Clip",message);
|
||||
clipboard.setPrimaryClip(clip);*/
|
||||
|
||||
if (mCompletionHandler != null)
|
||||
mCompletionHandler.fileSaved(message.equals(positiveMessage));
|
||||
}
|
||||
|
||||
public interface SaveFileInterface {
|
||||
void fileSaved(Boolean success);
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,11 +17,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.texteditor;
|
||||
package com.maskyn.fileeditorpro.texteditor;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import sharedcode.turboeditor.util.PixelDipConverter;
|
||||
import com.maskyn.fileeditorpro.preferences.PreferenceHelper;
|
||||
import com.maskyn.fileeditorpro.util.PixelDipConverter;
|
||||
|
||||
public class EditTextPadding {
|
||||
|
||||
@ -29,6 +30,11 @@ public class EditTextPadding {
|
||||
return (int) PixelDipConverter.convertDpToPixel(5, context);
|
||||
}
|
||||
|
||||
public static int getPaddingBottom(Context context) {
|
||||
boolean useAccessoryView = PreferenceHelper.getUseAccessoryView(context);
|
||||
return (int) PixelDipConverter.convertDpToPixel(useAccessoryView ? 50 : 0, context);
|
||||
}
|
||||
|
||||
public static int getPaddingWithLineNumbers(Context context, float fontSize) {
|
||||
return (int) PixelDipConverter.convertDpToPixel(fontSize * 2f, context);
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,22 +17,21 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.texteditor;
|
||||
package com.maskyn.fileeditorpro.texteditor;
|
||||
|
||||
import org.mozilla.universalchardet.UniversalDetector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public class FileUtils {
|
||||
public static String getDetectedEncoding(File file) {
|
||||
InputStream is = null;
|
||||
public static String getDetectedEncoding(InputStream is) {
|
||||
String encoding = null;
|
||||
try {
|
||||
is = new FileInputStream(file);
|
||||
UniversalDetector detector = new UniversalDetector(null);
|
||||
byte[] buf = new byte[4096];
|
||||
int nread;
|
||||
@ -55,4 +54,8 @@ public class FileUtils {
|
||||
}
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public static String getDetectedEncoding(File file) throws FileNotFoundException {
|
||||
return getDetectedEncoding(new FileInputStream(file));
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.texteditor;
|
||||
package com.maskyn.fileeditorpro.texteditor;
|
||||
|
||||
import android.text.Layout;
|
||||
import android.text.TextUtils;
|
||||
@ -27,7 +27,7 @@ public class LineUtils {
|
||||
private boolean[] toCountLinesArray;
|
||||
private int[] realLines;
|
||||
|
||||
public boolean[] getToCountLinesArray() {
|
||||
public boolean[] getGoodLines() {
|
||||
return toCountLinesArray;
|
||||
}
|
||||
|
||||
@ -57,8 +57,11 @@ public class LineUtils {
|
||||
toCountLinesArray = new boolean[lineCount];
|
||||
realLines = new int[lineCount];
|
||||
|
||||
if(TextUtils.isEmpty(text))
|
||||
if(TextUtils.isEmpty(text)) {
|
||||
toCountLinesArray[0] = false;
|
||||
realLines[0] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
@ -78,6 +81,8 @@ public class LineUtils {
|
||||
}
|
||||
}
|
||||
|
||||
toCountLinesArray[lineCount-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++) {
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,18 +17,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.texteditor;
|
||||
package com.maskyn.fileeditorpro.texteditor;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import com.maskyn.fileeditorpro.preferences.PreferenceHelper;
|
||||
|
||||
public class PageSystem {
|
||||
|
||||
@ -37,43 +33,65 @@ public class PageSystem {
|
||||
private int currentPage = 0;
|
||||
private PageSystemInterface pageSystemInterface;
|
||||
|
||||
public PageSystem(Context context, PageSystemInterface pageSystemInterface, String text, @Nullable File file) {
|
||||
public PageSystem(Context context, PageSystemInterface pageSystemInterface, String text) {
|
||||
|
||||
final int charForPage = 20000;
|
||||
final int firstPageChars = 50000;
|
||||
final int lineForPage = 250;
|
||||
|
||||
final int charForPage = 15000;
|
||||
final int MAX_KBs_WITHOUT_PAGE_SYSTEM = 50;
|
||||
|
||||
this.pageSystemInterface = pageSystemInterface;
|
||||
pages = new LinkedList<>();
|
||||
|
||||
final boolean dimensionOverLimit;
|
||||
if(file != null && file.exists() && file.isFile())
|
||||
dimensionOverLimit = FileUtils.sizeOf(file) >= MAX_KBs_WITHOUT_PAGE_SYSTEM * FileUtils.ONE_KB;
|
||||
else
|
||||
dimensionOverLimit = false;
|
||||
|
||||
int i = 0;
|
||||
int to;
|
||||
int nextIndexOfReturn;
|
||||
final int textLength = text.length();
|
||||
boolean pageSystemEnabled = PreferenceHelper.getSplitText(context);
|
||||
boolean splitByLineEnablec = PreferenceHelper.getSplitByLine(context);
|
||||
|
||||
if (pageSystemEnabled && dimensionOverLimit) {
|
||||
if (pageSystemEnabled && !splitByLineEnablec) {
|
||||
while (i < textLength) {
|
||||
to = i + charForPage;
|
||||
// first page is longer
|
||||
to = i + (i == 0 ? firstPageChars : charForPage);
|
||||
nextIndexOfReturn = text.indexOf("\n", to);
|
||||
if (nextIndexOfReturn > to) to = nextIndexOfReturn;
|
||||
if (to > text.length()) to = text.length();
|
||||
pages.add(text.substring(i, to));
|
||||
i = to + 1;
|
||||
}
|
||||
if (i == 0)
|
||||
pages.add("");
|
||||
} else if(pageSystemEnabled && splitByLineEnablec){
|
||||
int linecount = 0;
|
||||
to = 0;
|
||||
while (i < textLength) {
|
||||
// first page is longer
|
||||
nextIndexOfReturn = text.indexOf("\n", to);
|
||||
if (nextIndexOfReturn > to) {
|
||||
to = nextIndexOfReturn;
|
||||
linecount++;
|
||||
}
|
||||
if (to > text.length()) {
|
||||
to = text.length();
|
||||
pages.add(text.substring(i, to));
|
||||
i = to;
|
||||
}
|
||||
if (linecount >= lineForPage) {
|
||||
pages.add(text.substring(i, to));
|
||||
i = to;
|
||||
linecount = 0;
|
||||
}
|
||||
|
||||
|
||||
to++;
|
||||
}
|
||||
if (i == 0)
|
||||
pages.add("");
|
||||
} else {
|
||||
pages.add(text);
|
||||
}
|
||||
|
||||
|
||||
startingLines = new int[pages.size()];
|
||||
setStartingLines();
|
||||
}
|
||||
@ -164,7 +182,9 @@ public class PageSystem {
|
||||
int i;
|
||||
StringBuilder allText = new StringBuilder();
|
||||
for (i = 0; i < pages.size(); i++) {
|
||||
allText.append(pages.get(i)).append("\n");
|
||||
allText.append(pages.get(i));
|
||||
if(i < pages.size() - 1)
|
||||
allText.append("\n");
|
||||
}
|
||||
return allText.toString();
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.texteditor;
|
||||
package com.maskyn.fileeditorpro.texteditor;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
@ -25,7 +25,7 @@ import android.view.View;
|
||||
|
||||
import com.faizmalkani.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
|
||||
public class PageSystemButtons {
|
||||
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.texteditor;
|
||||
package com.maskyn.fileeditorpro.texteditor;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -35,10 +35,8 @@ public class Patterns {
|
||||
// Strings
|
||||
public static final Pattern GENERAL_STRINGS = Pattern.compile("\"(.*?)\"|'(.*?)'");
|
||||
|
||||
public static final Pattern HTML_OPEN_TAGS = Pattern.compile(
|
||||
"<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>");
|
||||
public static final Pattern HTML_CLOSE_TAGS = Pattern.compile(
|
||||
"</([A-Za-z][A-Za-z0-9]*)\\b[^>]*>");
|
||||
public static final Pattern HTML_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(
|
||||
"(\\S+)=[\"']?((?:.(?![\"']?\\s+(?:\\S+)=|[>\"']))+.)[\"']?");
|
||||
|
||||
@ -54,20 +52,23 @@ public class Patterns {
|
||||
//public static final Pattern CSS_NUMBERS = Pattern.compile(
|
||||
// "/^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 NUMBERS_OR_SYMBOLS = Pattern.compile(NUMBERS.pattern()+"|"+SYMBOLS.pattern());
|
||||
public static final Pattern GENERAL_KEYWORDS = Pattern.compile(
|
||||
"\\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"
|
||||
+ "|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|"
|
||||
+ "not|not_eq|null|nullptr|operator|or|or_eq|private|protected|public|register|"
|
||||
+ "reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast"
|
||||
+ "|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);
|
||||
"(?<=\\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"
|
||||
+ ")|(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)|("
|
||||
+ "not)|(not_eq)|(null)|(nullptr)|(operator)|(or)|(or_eq)|(private)|(protected)|(public)|(register)|("
|
||||
+ "reinterpret_cast)|(return)|(short)|(signed)|(sizeof)|(static)|(static_assert)|(static_cast"
|
||||
+ ")|(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);
|
||||
|
||||
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(
|
||||
"@[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" +
|
||||
@ -84,7 +85,7 @@ public class Patterns {
|
||||
public static final Pattern GENERAL_COMMENTS_NO_SLASH = Pattern.compile(
|
||||
"/\\*(?:.|[\\n\\r])*?\\*/|#.*");
|
||||
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;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.texteditor;
|
||||
package com.maskyn.fileeditorpro.texteditor;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
@ -28,12 +28,17 @@ public class SearchResult {
|
||||
public boolean isReplace;
|
||||
public String textToReplace;
|
||||
public int index;
|
||||
public String whatToSearch;
|
||||
public boolean isRegex;
|
||||
|
||||
public SearchResult(LinkedList<Integer> foundIndex, int textLength, boolean isReplace, String textToReplace) {
|
||||
|
||||
public SearchResult(LinkedList<Integer> foundIndex, int textLength, boolean isReplace, String whatToSearch, String textToReplace, boolean isRegex) {
|
||||
this.foundIndex = foundIndex;
|
||||
this.textLength = textLength;
|
||||
this.isReplace = isReplace;
|
||||
this.whatToSearch = whatToSearch;
|
||||
this.textToReplace = textToReplace;
|
||||
this.isRegex = isRegex;
|
||||
}
|
||||
|
||||
public void doneReplace() {
|
@ -0,0 +1,266 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Text Editor 8000 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.
|
||||
*
|
||||
* Text Editor 8000 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 com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AccessStorageApi {
|
||||
|
||||
public static Bitmap loadPrescaledBitmap(String filename) throws IOException {
|
||||
// Facebook image size
|
||||
final int IMAGE_MAX_SIZE = 630;
|
||||
|
||||
File file = null;
|
||||
FileInputStream fis;
|
||||
|
||||
BitmapFactory.Options opts;
|
||||
int resizeScale;
|
||||
Bitmap bmp;
|
||||
|
||||
file = new File(filename);
|
||||
|
||||
// This bit determines only the width/height of the bitmap without loading the contents
|
||||
opts = new BitmapFactory.Options();
|
||||
opts.inJustDecodeBounds = true;
|
||||
fis = new FileInputStream(file);
|
||||
BitmapFactory.decodeStream(fis, null, opts);
|
||||
fis.close();
|
||||
|
||||
// Find the correct scale value. It should be a power of 2
|
||||
resizeScale = 1;
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
// Load pre-scaled bitmap
|
||||
opts = new BitmapFactory.Options();
|
||||
opts.inSampleSize = resizeScale;
|
||||
fis = new FileInputStream(file);
|
||||
bmp = BitmapFactory.decodeStream(fis, null, opts);
|
||||
|
||||
fis.close();
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* other file-based ContentProviders.
|
||||
*
|
||||
* @param context The context.
|
||||
* @param uri The Uri to query.
|
||||
* @author paulburke
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
public static String getPath(final Context context, final Uri uri) {
|
||||
|
||||
String path = "";
|
||||
|
||||
if (uri == null || uri.equals(Uri.EMPTY))
|
||||
return "";
|
||||
|
||||
try {
|
||||
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
|
||||
// DocumentProvider
|
||||
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
|
||||
if (isTurboDocument(uri)) {
|
||||
final String docId = DocumentsContract.getDocumentId(uri);
|
||||
final String[] split = docId.split(":");
|
||||
path = "/" + split[1];
|
||||
}
|
||||
// ExternalStorageProvider
|
||||
else if (isExternalStorageDocument(uri)) {
|
||||
|
||||
final String docId = DocumentsContract.getDocumentId(uri);
|
||||
final String[] split = docId.split(":");
|
||||
final String type = split[0];
|
||||
|
||||
if ("primary".equalsIgnoreCase(type)) {
|
||||
path = Environment.getExternalStorageDirectory() + "/" + split[1];
|
||||
}
|
||||
|
||||
// TODO handle non-primary volumes
|
||||
}
|
||||
// DownloadsProvider
|
||||
else if (isDownloadsDocument(uri)) {
|
||||
|
||||
final String id = DocumentsContract.getDocumentId(uri);
|
||||
final Uri contentUri = ContentUris.withAppendedId(
|
||||
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
|
||||
|
||||
path = getDataColumn(context, contentUri, null, null);
|
||||
}
|
||||
// MediaProvider
|
||||
else if (isMediaDocument(uri)) {
|
||||
final String docId = DocumentsContract.getDocumentId(uri);
|
||||
final String[] split = docId.split(":");
|
||||
final String type = split[0];
|
||||
|
||||
Uri contentUri = null;
|
||||
if ("image".equals(type)) {
|
||||
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||
} else if ("video".equals(type)) {
|
||||
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
|
||||
} else if ("audio".equals(type)) {
|
||||
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
|
||||
final String selection = "_id=?";
|
||||
final String[] selectionArgs = new String[]{
|
||||
split[1]
|
||||
};
|
||||
|
||||
path = getDataColumn(context, contentUri, selection, selectionArgs);
|
||||
}
|
||||
}
|
||||
// MediaStore (and general)
|
||||
else if ("content".equalsIgnoreCase(uri.getScheme())) {
|
||||
path = getDataColumn(context, uri, null, null);
|
||||
}
|
||||
// File
|
||||
else if ("file".equalsIgnoreCase(uri.getScheme())) {
|
||||
path = uri.getPath();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
public static String getName(Context context, Uri uri)
|
||||
{
|
||||
|
||||
if (uri == null || uri.equals(Uri.EMPTY))
|
||||
return "";
|
||||
|
||||
String fileName = "";
|
||||
try {
|
||||
String scheme = uri.getScheme();
|
||||
if (scheme.equals("file")) {
|
||||
fileName = uri.getLastPathSegment();
|
||||
}
|
||||
else if (scheme.equals("content")) {
|
||||
String[] proj = { MediaStore.Images.Media.DISPLAY_NAME };
|
||||
Cursor cursor = context.getContentResolver().query(uri, proj, null, null, null);
|
||||
if (cursor != null && cursor.getCount() != 0) {
|
||||
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME);
|
||||
cursor.moveToFirst();
|
||||
fileName = cursor.getString(columnIndex);
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
return "";
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public static String getExtension(Context context, Uri uri) {
|
||||
return FilenameUtils.getExtension(getName(context, uri));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the data column for this Uri. This is useful for
|
||||
* MediaStore Uris, and other file-based ContentProviders.
|
||||
*
|
||||
* @param context The context.
|
||||
* @param uri The Uri to query.
|
||||
* @param selection (Optional) Filter used in the query.
|
||||
* @param selectionArgs (Optional) Selection arguments used in the query.
|
||||
* @return The value of the _data column, which is typically a file path.
|
||||
*/
|
||||
public static String getDataColumn(Context context, Uri uri, String selection,
|
||||
String[] selectionArgs) {
|
||||
|
||||
Cursor cursor = null;
|
||||
final String column = "_data";
|
||||
final String[] projection = {
|
||||
column
|
||||
};
|
||||
|
||||
try {
|
||||
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
|
||||
null);
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
final int column_index = cursor.getColumnIndexOrThrow(column);
|
||||
return cursor.getString(column_index);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is ExternalStorageProvider.
|
||||
*/
|
||||
public static boolean isExternalStorageDocument(Uri uri) {
|
||||
return "com.android.externalstorage.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is DownloadsProvider.
|
||||
*/
|
||||
public static boolean isDownloadsDocument(Uri uri) {
|
||||
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is MediaProvider.
|
||||
*/
|
||||
public static boolean isMediaDocument(Uri uri) {
|
||||
return "com.android.providers.media.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is Turbo Storage.
|
||||
*/
|
||||
public static boolean isTurboDocument(Uri uri) {
|
||||
return "com.maskyn.fileeditorpro.util.documents".equals(uri.getAuthority());
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Text Editor 8000 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.
|
||||
*
|
||||
* Text Editor 8000 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 com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.preferences.PreferenceHelper;
|
||||
|
||||
/**
|
||||
* Created by mac on 15/02/15.
|
||||
*/
|
||||
public class AccessoryView extends LinearLayout {
|
||||
|
||||
public IAccessoryView iAccessoryView;
|
||||
private TypedValue outValue;
|
||||
|
||||
public AccessoryView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public AccessoryView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public AccessoryView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setOrientation(HORIZONTAL);
|
||||
createView();
|
||||
}
|
||||
|
||||
public void setInterface(IAccessoryView iBreadcrumb) {
|
||||
this.iAccessoryView = iBreadcrumb;
|
||||
}
|
||||
|
||||
|
||||
public void createView() {
|
||||
removeAllViews();
|
||||
|
||||
// If we're running on Honeycomb or newer, then we can use the Theme's
|
||||
// selectableItemBackground to ensure that the View has a pressed state
|
||||
outValue = new TypedValue();
|
||||
getContext().getTheme().resolveAttribute(R.attr.selectableItemBackgroundBorderless, outValue, true);
|
||||
|
||||
String[] characters = {
|
||||
"<", ">", "!", "/", ".", ";", "=", "\"", "{", "}", "[", "]", "(", ")", "&", "|", "#", "*", "+", "-", ":", "%", ",", "_", "@", "?", "^", "'",
|
||||
};
|
||||
|
||||
for (int i = 0; i < characters.length; i++)
|
||||
addAButton(characters[i]);
|
||||
|
||||
updateTextColors();
|
||||
}
|
||||
|
||||
private void addAButton(final String text) {
|
||||
int dimension = (int) PixelDipConverter.convertDpToPixel(50, getContext());
|
||||
//int padding = (int) PixelDipConverter.convertDpToPixel(10, getContext());
|
||||
final Button name = new Button(getContext());
|
||||
|
||||
name.setLayoutParams(new LinearLayout.LayoutParams(dimension, dimension));
|
||||
|
||||
|
||||
name.setGravity(Gravity.CENTER);
|
||||
|
||||
name.setText(text);
|
||||
name.setTextSize(15);
|
||||
name.setAllCaps(true);
|
||||
|
||||
//name.setPadding(padding, padding, padding, padding);
|
||||
|
||||
name.setClickable(true);
|
||||
|
||||
name.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
iAccessoryView.onButtonAccessoryViewClicked(text);
|
||||
}
|
||||
});
|
||||
|
||||
name.setBackgroundResource(outValue.resourceId);
|
||||
addView(name);
|
||||
}
|
||||
|
||||
public void updateTextColors() {
|
||||
boolean isLightTheme = PreferenceHelper.getLightTheme(getContext());
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
((Button) getChildAt(i)).setTextColor(isLightTheme ? getResources().getColor(android.R.color.background_dark) : getResources().getColor(android.R.color.white));
|
||||
}
|
||||
}
|
||||
|
||||
public interface IAccessoryView {
|
||||
public void onButtonAccessoryViewClicked(String text);
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;/*
|
||||
package com.maskyn.fileeditorpro.util;/*
|
||||
* The Alphanum Algorithm is an improved sorting algorithm for strings
|
||||
* containing numbers. Instead of sorting numbers in ASCII order like
|
||||
* a standard sort, this algorithm sorts numbers in numeric order.
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,9 +17,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
import sharedcode.turboeditor.BuildConfig;
|
||||
import com.maskyn.fileeditorpro.BuildConfig;
|
||||
|
||||
/**
|
||||
* Created by Artem on 30.12.13.
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
@ -53,6 +53,14 @@ public class Device {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if device is running
|
||||
* {@link android.os.Build.VERSION_CODES#KITKAT KitKat} {@code false} otherwise.
|
||||
*/
|
||||
public static boolean isKitKatApi() {
|
||||
return Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if device is running
|
||||
* {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2 Jelly Bean 4.3} or higher, {@code false} otherwise.
|
100
app/src/main/java/com/maskyn/fileeditorpro/util/GreatUri.java
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Text Editor 8000 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.
|
||||
*
|
||||
* Text Editor 8000 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 com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by mac on 19/03/15.
|
||||
*/
|
||||
public class GreatUri {
|
||||
private Uri uri;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
|
||||
public GreatUri(Uri uri, String filePath, String fileName) {
|
||||
this.uri = uri;
|
||||
this.filePath = filePath;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
|
||||
// if deriving: appendSuper(super.hashCode()).
|
||||
append(uri).
|
||||
toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof GreatUri))
|
||||
return false;
|
||||
if (obj == this)
|
||||
return true;
|
||||
|
||||
GreatUri rhs = (GreatUri) obj;
|
||||
return new EqualsBuilder().
|
||||
// if deriving: appendSuper(super.equals(obj)).
|
||||
append(uri, rhs.uri).
|
||||
isEquals();
|
||||
}
|
||||
|
||||
public Uri getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(Uri uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public String getParentFolder() {
|
||||
return new File(filePath).getParent();
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public boolean isReadable() {
|
||||
return new File(getFilePath()).canRead();
|
||||
}
|
||||
|
||||
public boolean isWritable() {
|
||||
return new File(getFilePath()).canWrite();
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Text Editor 8000 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.
|
||||
*
|
||||
* Text Editor 8000 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 com.maskyn.fileeditorpro.util;
|
||||
|
||||
public interface IHomeActivity {
|
||||
public abstract boolean showInterstitial();
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
public class MimeTypes {
|
||||
public static final String[] MIME_TEXT = {
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,12 +17,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.preferences.PreferenceHelper;
|
||||
|
||||
public class ThemeUtils {
|
||||
|
||||
@ -35,21 +35,16 @@ public class ThemeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setPreferenceTheme(Activity activity){
|
||||
boolean light = PreferenceHelper.getLightTheme(activity);
|
||||
if (light) {
|
||||
activity.setTheme(R.style.PreferenceLight);
|
||||
} else {
|
||||
activity.setTheme(R.style.PreferenceDark);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setWindowsBackground(Activity activity) {
|
||||
boolean whiteTheme = PreferenceHelper.getLightTheme(activity);
|
||||
boolean darkTheme = PreferenceHelper.getDarkTheme(activity);
|
||||
boolean blackTheme = PreferenceHelper.getBlackTheme(activity);
|
||||
if (whiteTheme) {
|
||||
activity.getWindow().setBackgroundDrawableResource(R.color.window_background_light);
|
||||
} else {
|
||||
} else if (darkTheme) {
|
||||
activity.getWindow().setBackgroundDrawableResource(R.color.window_background);
|
||||
} else {
|
||||
activity.getWindow().setBackgroundDrawableResource(android.R.color.black);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
package com.maskyn.fileeditorpro.util;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import android.support.annotation.NonNull;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util.systemui;
|
||||
package com.maskyn.fileeditorpro.util.systemui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Build;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util.systemui;
|
||||
package com.maskyn.fileeditorpro.util.systemui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.support.v7.app.ActionBar;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util.systemui;
|
||||
package com.maskyn.fileeditorpro.util.systemui;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util.systemui;
|
||||
package com.maskyn.fileeditorpro.util.systemui;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActionBar;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.util.systemui;
|
||||
package com.maskyn.fileeditorpro.util.systemui;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.views;
|
||||
package com.maskyn.fileeditorpro.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.widget.DrawerLayout;
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.views;
|
||||
package com.maskyn.fileeditorpro.views;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@ -37,9 +37,8 @@ import android.widget.TextView;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.dialogfragment.AboutDialog;
|
||||
import sharedcode.turboeditor.iab.DonationFragment;
|
||||
import com.maskyn.fileeditorpro.R;
|
||||
import com.maskyn.fileeditorpro.dialogfragment.AboutDialog;
|
||||
|
||||
/**
|
||||
* Helper class for showing fragment dialogs.
|
||||
@ -48,13 +47,8 @@ public class DialogHelper {
|
||||
|
||||
public static final String TAG_FRAGMENT_ABOUT = "dialog_about";
|
||||
public static final String TAG_FRAGMENT_HELP = "dialog_help";
|
||||
public static final String TAG_FRAGMENT_DONATION = "dialog_donate";
|
||||
public static final String TAG_FRAGMENT_FEEDBACK = "dialog_feedback";
|
||||
|
||||
public static void showDonateDialog(Activity activity) {
|
||||
showDialog(activity, DonationFragment.class, TAG_FRAGMENT_DONATION);
|
||||
}
|
||||
|
||||
public static void showAboutDialog(Activity activity) {
|
||||
showDialog(activity, AboutDialog.class, TAG_FRAGMENT_ABOUT);
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
* This file is part of Text Editor 8000.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* Text Editor 8000 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,
|
||||
* Text Editor 8000 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.
|
||||
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.views;
|
||||
package com.maskyn.fileeditorpro.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 724 B |
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 621 B |
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 615 B After Width: | Height: | Size: 615 B |
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 495 B After Width: | Height: | Size: 495 B |
Before Width: | Height: | Size: 875 B After Width: | Height: | Size: 875 B |
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 713 B |
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 365 B |
BIN
app/src/main/res/drawable-hdpi/ic_fab_ok.png
Normal file
After Width: | Height: | Size: 401 B |
Before Width: | Height: | Size: 853 B After Width: | Height: | Size: 853 B |
Before Width: | Height: | Size: 898 B After Width: | Height: | Size: 898 B |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 475 B After Width: | Height: | Size: 475 B |
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 403 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 596 B |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 535 B |
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 434 B |