Some minor but major changes
New advance settings screen, new setting to ignore the back button, new behaviour of the left and right panels, now the app highlightes all the visible text
This commit is contained in:
@ -86,7 +86,7 @@
|
||||
android:theme="@style/AppTheme.Dark">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.maskyn.fileeditor.activity.HomeActivity" />
|
||||
android:value=".HomeActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="sharedcode.turboeditor.activity.LicensesActivity"
|
||||
@ -96,7 +96,7 @@
|
||||
android:theme="@style/AppTheme.Light">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.maskyn.fileeditor.activity.PreferenceAbout" />
|
||||
android:value=".PreferenceAbout" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="sharedcode.turboeditor.activity.SelectFileActivity"
|
||||
@ -106,7 +106,16 @@
|
||||
android:theme="@style/AppTheme.Light">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.maskyn.fileeditor.activity.HomeActivity" />
|
||||
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
|
||||
|
@ -91,7 +91,7 @@
|
||||
android:theme="@style/AppTheme.Dark">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.maskyn.fileeditor.activity.HomeActivity" />
|
||||
android:value=".HomeActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="sharedcode.turboeditor.activity.LicensesActivity"
|
||||
@ -101,7 +101,7 @@
|
||||
android:theme="@style/AppTheme.Light">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.maskyn.fileeditor.activity.PreferenceAbout" />
|
||||
android:value=".PreferenceAbout" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="sharedcode.turboeditor.activity.SelectFileActivity"
|
||||
@ -111,7 +111,16 @@
|
||||
android:theme="@style/AppTheme.Light">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.maskyn.fileeditor.activity.HomeActivity" />
|
||||
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
|
||||
|
@ -25,12 +25,24 @@
|
||||
jumboMode="false"
|
||||
revision="20.0.0"
|
||||
sha1="f449c5674e0427708d4fb17c4a2ec74c267e74d6"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\support-annotations-20.0.0-be727b9c9ce08c6ee055559b9506b675c13db989.jar"
|
||||
jar="C:\Users\Vlad\AppData\Local\Android\android-sdk\extras\android\m2repository\com\android\support\support-annotations\20.0.0\support-annotations-20.0.0.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="9d9013e9ff35fc3756411e62873c363c70c638fa"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\crashlytics-1.1.13-7bbec76a44aa9cc3279ec6bff22b2c929a8abf67.jar"
|
||||
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\com.crashlytics.android\crashlytics\1.1.13\e821eafa1bf489a26bdb71f95078c26785b37a1\crashlytics-1.1.13.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="0e821eafa1bf489a26bdb71f95078c26785b37a1"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-bcfe21eb1248db73c27c811996e28274cf39b024.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\classes.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="8c7c075b0ccffca898d29086dfb74055143b987f"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\TurboMaterialEditor\app\build\intermediates\pre-dexed\debug\commons-io-2.4-63b64e68cd19031cd252ac65a3ef94421c1bf0f4.jar"
|
||||
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\2.4\b1b6ea3b7e4aa4f492509a4952029cd8e48019ad\commons-io-2.4.jar"
|
||||
@ -43,6 +55,12 @@
|
||||
jumboMode="false"
|
||||
revision="20.0.0"
|
||||
sha1="2f3117da0016b1126fafe7fb332a45d2f910d76c"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\juniversalchardet-1.0.3-sources-58cfedaebe3b94ec0eaa2ede4e66aae8dbe309b0.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3-sources.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="77979eaa98f90806f984155f44f63cc1fb60ac25"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-7a329e7f23515542bf02d96773d08da1d2333a7b.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\turbo-editor.libraries\FloatingActionButton\unspecified\classes.jar"
|
||||
@ -91,12 +109,6 @@
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="f449c5674e0427708d4fb17c4a2ec74c267e74d6"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\support-v4-19.1.0-cf7033c44b86e758f85990185111614bac3ecfa8.jar"
|
||||
jar="C:\Users\Vlad\AppData\Local\Android\android-sdk\extras\android\m2repository\com\android\support\support-v4\19.1.0\support-v4-19.1.0.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="85f201b380937e61a9dce6ca90ccf6872abbfb67"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\juniversalchardet-1.0.3-9db20cdcb8ae72104757d81297c98978c65bd91b.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\libs\juniversalchardet-1.0.3.jar"
|
||||
@ -109,12 +121,24 @@
|
||||
jumboMode="false"
|
||||
revision="20.0.0"
|
||||
sha1="591d72211acc0b909b79c840e0b3ed9a0982d807"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\internal_impl-20.0.0-edeafbea8ee49aead89729b1fc0541af3708b834.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.android.support\support-v4\20.0.0\libs\internal_impl-20.0.0.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="e40b3078e3fbd353c9f44da8df25a8fc0078209d"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-91de6979bb6be1b46cde32b462c23831eadd01d4.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.github.gabrielemariotti.changeloglib\library\1.5.1\classes.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="74a89f0f8b56d9f11d70b8d8134cf4109f4797dc"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\pre-dexed\debug\classes-0dd78bfcbe1a497e15390bba3a50f41cf42d9162.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app-pro\build\intermediates\exploded-aar\com.android.support\support-v4\20.0.0\classes.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="8694693636ab36910c8100ce527c258ff3ebece0"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\TurboMaterialEditor\app-pro\build\intermediates\pre-dexed\debug\support-v4-19.0.1-f87b13e7ed00736c2050eda75093bf42b0503c64.jar"
|
||||
jar="C:\Users\Vlad\AppData\Local\Android\android-sdk\extras\android\m2repository\com\android\support\support-v4\19.0.1\support-v4-19.0.1.jar"
|
||||
@ -139,18 +163,30 @@
|
||||
jumboMode="false"
|
||||
revision="20.0.0"
|
||||
sha1="591d72211acc0b909b79c840e0b3ed9a0982d807"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-e7e86cab56b519ef20b4d01792717ffcddcc577b.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.android.support\support-v4\20.0.0\classes.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="8694693636ab36910c8100ce527c258ff3ebece0"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\classes-4dd6beddde59ff8bd6c22bd0d65ac974f7e489d2.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\turbo-editor.libraries\sharedCode\unspecified\classes.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="e7a26359f635a1353de0aa8492f56f1f47c42c1a"/>
|
||||
sha1="a3cd442213d832a910c1ec51cd2f2c507f7fea64"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\TurboMaterialEditor\app-pro\build\intermediates\pre-dexed\debug\classes-bfc447e4dbe83598b94dbdc8e38492cbbda6ebb2.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\TurboMaterialEditor\app-pro\build\intermediates\exploded-aar\TurboMaterialEditor.libraries\RootCommands\unspecified\classes.jar"
|
||||
jumboMode="false"
|
||||
revision="20.0.0"
|
||||
sha1="cdecd8167dfb75d5785decb911fc4516445dd6a6"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\internal_impl-20.0.0-2cc5dec0eb9c4e1671dc84ade9411d50c227e9ae.jar"
|
||||
jar="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\exploded-aar\com.android.support\support-v4\20.0.0\libs\internal_impl-20.0.0.jar"
|
||||
jumboMode="false"
|
||||
revision="19.1.0"
|
||||
sha1="e40b3078e3fbd353c9f44da8df25a8fc0078209d"/>
|
||||
<item
|
||||
dex="C:\Users\Vlad\Documents\AndroidStudioProjects\turbo-editor\app\build\intermediates\pre-dexed\release\eventbus-2.2.1-32e81c5612ed132ff771b5425053d87f4f6c68c5.jar"
|
||||
jar="C:\Users\Vlad\.gradle\caches\modules-2\files-2.1\de.greenrobot\eventbus\2.2.1\a18ff12a9ab5ae52fd30d42f134517997568231e\eventbus-2.2.1.jar"
|
||||
|
Binary file not shown.
Binary file not shown.
@ -51,12 +51,12 @@ dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile project(':libraries:RootCommands')
|
||||
compile project(':libraries:FloatingActionButton')
|
||||
compile 'com.android.support:support-v4:19.+'
|
||||
compile('de.greenrobot:eventbus:2.2.1') {
|
||||
exclude module: 'support-v4'
|
||||
}
|
||||
// compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
|
||||
compile files('libs/juniversalchardet-1.0.3.jar')
|
||||
compile 'com.android.support:support-v4:20.0.0'
|
||||
compile 'com.github.gabrielemariotti.changeloglib:library:1.5.1'
|
||||
compile 'commons-io:commons-io:2.4'
|
||||
compile files('libs/juniversalchardet-1.0.3.jar')
|
||||
}
|
||||
|
BIN
libraries/sharedCode/libs/juniversalchardet-1.0.3-sources.jar
Normal file
BIN
libraries/sharedCode/libs/juniversalchardet-1.0.3-sources.jar
Normal file
Binary file not shown.
@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2014 Vlad Mihalachi
|
||||
~
|
||||
@ -15,10 +16,8 @@
|
||||
~
|
||||
~ 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="sharedcode.turboeditor">
|
||||
|
||||
package="sharedcode.turboeditor" >
|
||||
|
||||
</manifest>
|
||||
|
@ -33,8 +33,6 @@ import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.app.ActivityOptionsCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MenuItem;
|
||||
@ -43,19 +41,6 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.fragment.ChangelogDialogFragment;
|
||||
import sharedcode.turboeditor.fragment.EditorFragment;
|
||||
import sharedcode.turboeditor.fragment.NoFileOpenedFragment;
|
||||
import sharedcode.turboeditor.preferences.SettingsFragment;
|
||||
import sharedcode.turboeditor.util.AppInfoHelper;
|
||||
import sharedcode.turboeditor.util.Constants;
|
||||
import sharedcode.turboeditor.util.ProCheckUtils;
|
||||
import sharedcode.turboeditor.views.CustomDrawerLayout;
|
||||
import sharedcode.turboeditor.util.EventBusEvents;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.util.ThemeHelper;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.sufficientlysecure.rootcommands.Shell;
|
||||
import org.sufficientlysecure.rootcommands.Toolbox;
|
||||
@ -63,6 +48,16 @@ import org.sufficientlysecure.rootcommands.Toolbox;
|
||||
import java.io.File;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.fragment.ChangelogDialogFragment;
|
||||
import sharedcode.turboeditor.fragment.EditorFragment;
|
||||
import sharedcode.turboeditor.fragment.NoFileOpenedFragment;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.util.AppInfoHelper;
|
||||
import sharedcode.turboeditor.util.EventBusEvents;
|
||||
import sharedcode.turboeditor.util.ProCheckUtils;
|
||||
import sharedcode.turboeditor.util.ThemeHelper;
|
||||
import sharedcode.turboeditor.views.CustomDrawerLayout;
|
||||
|
||||
public abstract class BaseHomeActivity extends Activity {
|
||||
|
||||
@ -145,7 +140,18 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (getFragmentManager().findFragmentById(R.id.fragment_editor) instanceof EditorFragment) {
|
||||
|
||||
// if we should ignore the back button
|
||||
if(PreferenceHelper.getIgnoreBackButton(this))
|
||||
return;
|
||||
|
||||
|
||||
boolean fileOpened = getFragmentManager().findFragmentById(R.id.fragment_editor) instanceof EditorFragment;
|
||||
if (mDrawerLayout.isDrawerOpen(Gravity.START) && fileOpened) {
|
||||
mDrawerLayout.closeDrawer(Gravity.START);
|
||||
} else if (mDrawerLayout.isDrawerOpen(Gravity.END) && fileOpened) {
|
||||
mDrawerLayout.closeDrawer(Gravity.END);
|
||||
} else if (fileOpened) {
|
||||
|
||||
// remove editor fragment
|
||||
getFragmentManager()
|
||||
@ -178,12 +184,12 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
// this will happen on first key pressed on hard-keyboard only. Once myInputField
|
||||
// gets the focus again, it will automatically receive further key presses.
|
||||
|
||||
try{
|
||||
try {
|
||||
if (editor != null && !editor.hasFocus()) {
|
||||
editor.requestFocus();
|
||||
editor.onKeyDown(keyCode, event);
|
||||
}
|
||||
} catch (NullPointerException ex){
|
||||
} catch (NullPointerException ex) {
|
||||
|
||||
}
|
||||
|
||||
@ -204,7 +210,7 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
File file = new File(path);
|
||||
if (file.isFile() && file.exists()) {
|
||||
EventBus.getDefault().postSticky(new EventBusEvents.NewFileToOpen(new File(path)));
|
||||
} else if(file.isDirectory()) {
|
||||
} else if (file.isDirectory()) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -234,7 +240,7 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
subActivity.putExtra("action", SelectFileActivity.Actions.SelectFile);
|
||||
Bundle scaleBundle = ActivityOptionsCompat.makeScaleUpAnimation(
|
||||
view, 0, 0, view.getWidth(), view.getHeight()).toBundle();
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
|
||||
startActivityForResult(subActivity, SELECT_FILE_CODE, scaleBundle);
|
||||
else
|
||||
startActivityForResult(subActivity, SELECT_FILE_CODE);
|
||||
@ -249,7 +255,7 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
Intent subActivity = new Intent(BaseHomeActivity.this, PreferenceAbout.class);
|
||||
Bundle scaleBundle = ActivityOptionsCompat.makeScaleUpAnimation(
|
||||
view, 0, 0, view.getWidth(), view.getHeight()).toBundle();
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
|
||||
startActivity(subActivity, scaleBundle);
|
||||
else
|
||||
startActivity(subActivity);
|
||||
@ -269,6 +275,7 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
File file;
|
||||
String message;
|
||||
String fileText;
|
||||
String encoding;
|
||||
ProgressDialog progressDialog;
|
||||
|
||||
@Override
|
||||
@ -312,20 +319,17 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
}
|
||||
|
||||
boolean autoencoding = PreferenceHelper.getAutoEncoding(BaseHomeActivity.this);
|
||||
|
||||
if (autoencoding) {
|
||||
|
||||
String encoding = sharedcode.turboeditor.util.FileUtils.getDetectedEncoding(file);
|
||||
if (!TextUtils.isEmpty(encoding)) {
|
||||
encoding = SettingsFragment.sCurrentEncoding;
|
||||
encoding = sharedcode.turboeditor.util.FileUtils.getDetectedEncoding(file);
|
||||
if (encoding.isEmpty()) {
|
||||
encoding = PreferenceHelper.getEncoding(BaseHomeActivity.this);
|
||||
}
|
||||
} else {
|
||||
SettingsFragment.sCurrentEncoding = encoding;
|
||||
encoding = PreferenceHelper.getEncoding(BaseHomeActivity.this);
|
||||
}
|
||||
|
||||
fileText = org.apache.commons.io.FileUtils.readFileToString(file, encoding);
|
||||
} else {
|
||||
fileText = org.apache.commons.io.FileUtils.readFileToString(file, SettingsFragment.sCurrentEncoding);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
message = e.getMessage();
|
||||
fileText = "";
|
||||
@ -351,7 +355,7 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
} else {
|
||||
getFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragment_editor, EditorFragment.newInstance(event.getFile().getAbsolutePath(), fileText))
|
||||
.replace(R.id.fragment_editor, EditorFragment.newInstance(event.getFile().getAbsolutePath(), fileText, encoding))
|
||||
.commit();
|
||||
|
||||
}
|
||||
@ -386,9 +390,9 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
displayInterstitial();
|
||||
}
|
||||
|
||||
public void onEvent(EventBusEvents.AFileIsSelected event){
|
||||
public void onEvent(EventBusEvents.AFileIsSelected event) {
|
||||
String name = FilenameUtils.getName(event.getPath());
|
||||
if(name.isEmpty())
|
||||
if (name.isEmpty())
|
||||
getActionBar().setTitle(R.string.nome_app_turbo_editor);
|
||||
else
|
||||
getActionBar().setTitle(name);
|
||||
@ -414,7 +418,7 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
|
||||
public void onEvent(EventBusEvents.APreferenceValueWasChanged event) {
|
||||
|
||||
if (event.getType() == EventBusEvents.APreferenceValueWasChanged.Type.THEME_CHANGE) {
|
||||
if (event.hasType(EventBusEvents.APreferenceValueWasChanged.Type.THEME_CHANGE)) {
|
||||
ThemeHelper.setWindowsBackground(this);
|
||||
}
|
||||
}
|
||||
@ -506,8 +510,7 @@ public abstract class BaseHomeActivity extends Activity {
|
||||
&& type != null) {
|
||||
// Post event
|
||||
EventBus.getDefault().postSticky(new EventBusEvents.NewFileToOpen(new File(intent.getData().getPath())));
|
||||
}
|
||||
else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||
if ("text/plain".equals(type)) {
|
||||
onEvent(new EventBusEvents.NewFileToOpen(intent.getStringExtra(Intent.EXTRA_TEXT)));
|
||||
onEvent(new EventBusEvents.AFileIsSelected("")); // simulate click on the list
|
||||
|
@ -37,13 +37,14 @@ public class LicensesActivity extends Activity implements AdapterView.OnItemClic
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
boolean light = PreferenceHelper.getLightTheme(this);
|
||||
if (light) {
|
||||
setTheme(R.style.AppTheme_Light);
|
||||
} else {
|
||||
setTheme(R.style.AppTheme_Dark);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_licenses);
|
||||
ListView listView = (ListView) findViewById(android.R.id.list);
|
||||
listView.setOnItemClickListener(this);
|
||||
|
@ -20,14 +20,10 @@
|
||||
package sharedcode.turboeditor.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -35,13 +35,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.faizmalkani.floatingactionbutton.FloatingActionButton;
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.adapter.AdapterDetailedList;
|
||||
import sharedcode.turboeditor.fragment.EditDialogFragment;
|
||||
import sharedcode.turboeditor.util.AlphanumComparator;
|
||||
import sharedcode.turboeditor.util.Constants;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.util.RootUtils;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
@ -57,6 +50,14 @@ 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.fragment.EditDialogFragment;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.util.AlphanumComparator;
|
||||
import sharedcode.turboeditor.util.Constants;
|
||||
import sharedcode.turboeditor.util.RootUtils;
|
||||
|
||||
public class SelectFileActivity extends Activity implements SearchView.OnQueryTextListener, AdapterView.OnItemClickListener, EditDialogFragment.EditDialogListener {
|
||||
private String currentFolder;
|
||||
private ListView listView;
|
||||
@ -87,7 +88,7 @@ public class SelectFileActivity extends Activity implements SearchView.OnQueryTe
|
||||
listView.setOnItemClickListener(this);
|
||||
listView.setTextFilterEnabled(true);
|
||||
|
||||
FloatingActionButton mFab = (FloatingActionButton)findViewById(R.id.fabbutton);
|
||||
FloatingActionButton mFab = (FloatingActionButton) findViewById(R.id.fabbutton);
|
||||
mFab.setColor(getResources().getColor(R.color.fab_light));
|
||||
mFab.setDrawable(getResources().getDrawable(R.drawable.ic_fab_add));
|
||||
|
||||
@ -218,15 +219,15 @@ public class SelectFileActivity extends Activity implements SearchView.OnQueryTe
|
||||
MenuItem imSetAsWorkingFolder = menu.findItem(R.id.im_set_as_working_folder);
|
||||
MenuItem imIsWorkingFolder = menu.findItem(R.id.im_is_working_folder);
|
||||
MenuItem imSelectFolder = menu.findItem(R.id.im_select_folder);
|
||||
if(imSetAsWorkingFolder != null){
|
||||
if (imSetAsWorkingFolder != null) {
|
||||
// set the imSetAsWorkingFolder visible only if the two folder dont concide
|
||||
imSetAsWorkingFolder.setVisible(!currentFolder.equals(PreferenceHelper.getWorkingFolder(SelectFileActivity.this)));
|
||||
}
|
||||
if(imIsWorkingFolder != null) {
|
||||
if (imIsWorkingFolder != null) {
|
||||
// set visible is the other is invisible
|
||||
imIsWorkingFolder.setVisible(!imSetAsWorkingFolder.isVisible());
|
||||
}
|
||||
if(imSelectFolder != null) {
|
||||
if (imSelectFolder != null) {
|
||||
imSelectFolder.setVisible(!wantAFile);
|
||||
}
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
|
@ -29,14 +29,14 @@ import android.widget.Filter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.util.MimeTypes;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.util.MimeTypes;
|
||||
|
||||
public class AdapterDetailedList extends
|
||||
ArrayAdapter<AdapterDetailedList.FileDetail> {
|
||||
|
||||
|
@ -29,11 +29,11 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
|
||||
public class AdapterDrawer extends
|
||||
ArrayAdapter<File> {
|
||||
|
||||
@ -111,6 +111,7 @@ public class AdapterDrawer extends
|
||||
|
||||
public interface Callbacks {
|
||||
void CancelItem(int position, boolean andCloseOpenedFile);
|
||||
|
||||
void ItemSelected(String path);
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,8 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
|
||||
import it.gmariotti.changelibs.library.view.ChangeLogListView;
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.util.Constants;
|
||||
|
||||
public class ChangelogDialogFragment extends DialogFragment {
|
||||
|
@ -63,8 +63,8 @@ import sharedcode.turboeditor.preferences.SettingsFragment;
|
||||
import sharedcode.turboeditor.util.EditorInterface;
|
||||
import sharedcode.turboeditor.util.EdittextPadding;
|
||||
import sharedcode.turboeditor.util.EventBusEvents;
|
||||
import sharedcode.turboeditor.views.GoodScrollView;
|
||||
import sharedcode.turboeditor.util.LineUtils;
|
||||
import sharedcode.turboeditor.views.GoodScrollView;
|
||||
import sharedcode.turboeditor.util.MimeTypes;
|
||||
import sharedcode.turboeditor.util.PageSystem;
|
||||
import sharedcode.turboeditor.util.PageSystemButtons;
|
||||
@ -105,6 +105,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
private SearchResult searchResult;
|
||||
private PageSystem pageSystem;
|
||||
private PageSystemButtons pageSystemButtons;
|
||||
private String currentEncoding;
|
||||
|
||||
private static final int SYNTAX_DELAY_MILLIS_SHORT = 250;
|
||||
private static final int SYNTAX_DELAY_MILLIS_LONG = 1500;
|
||||
@ -115,7 +116,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
static final int ID_PASTE = android.R.id.paste;
|
||||
private static final int ID_UNDO = R.id.im_undo;
|
||||
private static final int ID_REDO = R.id.im_redo;
|
||||
private static final int CHARS_TO_COLOR = 2000;
|
||||
private static final int CHARS_TO_COLOR = 2500;
|
||||
|
||||
private final Handler updateHandler = new Handler();
|
||||
private final Runnable colorRunnable_duringEditing =
|
||||
@ -134,11 +135,12 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
};
|
||||
//endregion
|
||||
|
||||
public static EditorFragment newInstance(String filePath, String fileText) {
|
||||
public static EditorFragment newInstance(String filePath, String fileText, String encoding) {
|
||||
EditorFragment frag = new EditorFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("filePath", filePath);
|
||||
args.putString("fileText", fileText);
|
||||
args.putString("encoding", encoding);
|
||||
frag.setArguments(args);
|
||||
return frag;
|
||||
}
|
||||
@ -151,6 +153,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
setHasOptionsMenu(true);
|
||||
sFilePath = getArguments().getString("filePath");
|
||||
pageSystem = new PageSystem(this, getArguments().getString("fileText"));
|
||||
currentEncoding = getArguments().getString("encoding");
|
||||
getArguments().remove("fileText");
|
||||
}
|
||||
|
||||
@ -164,49 +167,49 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
|
||||
mEditor.setEditorInterface(this);
|
||||
|
||||
if (SettingsFragment.sWrapContent) {
|
||||
if (PreferenceHelper.getWrapContent(getActivity())) {
|
||||
horizontalScroll.removeView(mEditor);
|
||||
verticalScroll.removeView(horizontalScroll);
|
||||
verticalScroll.addView(mEditor);
|
||||
} else {
|
||||
// else show what is in the xml file fragment_editor.xml-
|
||||
}
|
||||
if (SettingsFragment.sLightTheme) {
|
||||
if (PreferenceHelper.getLightTheme(getActivity())) {
|
||||
mEditor.setTextColor(getResources().getColor(R.color.textColorInverted));
|
||||
} else {
|
||||
mEditor.setTextColor(getResources().getColor(R.color.textColor));
|
||||
}
|
||||
if (SettingsFragment.sLineNumbers) {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithLineNumbers(getActivity(), SettingsFragment.sFontSize), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
if (PreferenceHelper.getLineNumbers(getActivity())) {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithLineNumbers(getActivity(), PreferenceHelper.getFontSize(getActivity())), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
} else {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithoutLineNumbers(getActivity()), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
}
|
||||
|
||||
if(SettingsFragment.sReadOnly) {
|
||||
if(PreferenceHelper.getReadOnly(getActivity())) {
|
||||
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
mEditor.setReadOnly(true);
|
||||
} else {
|
||||
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
|
||||
mEditor.setReadOnly(false);
|
||||
if (SettingsFragment.sSuggestionsActive) {
|
||||
if (PreferenceHelper.getSuggestionActive(getActivity())) {
|
||||
mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
|
||||
} else {
|
||||
mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
if (SettingsFragment.sUseMonospace) {
|
||||
if (PreferenceHelper.getUseMonospace(getActivity())) {
|
||||
mEditor.setTypeface(Typeface.MONOSPACE);
|
||||
} else {
|
||||
mEditor.setTypeface(Typeface.DEFAULT);
|
||||
}
|
||||
mEditor.setTextSize(SettingsFragment.sFontSize);
|
||||
mEditor.setTextSize(PreferenceHelper.getFontSize(getActivity()));
|
||||
|
||||
mEditor.setFocusable(true);
|
||||
mEditor.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(!SettingsFragment.sReadOnly) {
|
||||
if(!PreferenceHelper.getReadOnly(getActivity())) {
|
||||
((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE))
|
||||
.showSoftInput(mEditor, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
@ -216,7 +219,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
mEditor.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if(hasFocus && !SettingsFragment.sReadOnly) {
|
||||
if(hasFocus && !PreferenceHelper.getReadOnly(getActivity())) {
|
||||
((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE))
|
||||
.showSoftInput(mEditor, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
@ -249,7 +252,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
// Unregister the Event Bus
|
||||
EventBus.getDefault().unregister(this);
|
||||
|
||||
if(SettingsFragment.sAutoSave && mEditor.canSaveFile()) {
|
||||
if(PreferenceHelper.getAutoSave(getActivity()) && mEditor.canSaveFile()) {
|
||||
onEvent(new EventBusEvents.SaveAFile());
|
||||
mEditor.fileSaved(); // so it doesn't ask to save in onDetach
|
||||
}
|
||||
@ -260,7 +263,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
super.onDetach();
|
||||
|
||||
if (!getActivity().isFinishing() && mEditor.canSaveFile())
|
||||
SaveFileDialogFragment.newInstance(sFilePath, pageSystem.getAllText(mEditor.getText().toString())).show(getFragmentManager(), "dialog");
|
||||
SaveFileDialogFragment.newInstance(sFilePath, pageSystem.getAllText(mEditor.getText().toString()), currentEncoding).show(getFragmentManager(), "dialog");
|
||||
}
|
||||
|
||||
//endregion
|
||||
@ -387,7 +390,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
|
||||
@Override
|
||||
public void updateTextSyntax() {
|
||||
if (!SettingsFragment.sColorSyntax || mEditor.hasSelection() || updateHandler == null || colorRunnable_duringEditing == null)
|
||||
if (!PreferenceHelper.getSyntaxHiglight(getActivity()) || mEditor.hasSelection() || updateHandler == null || colorRunnable_duringEditing == null)
|
||||
return;
|
||||
|
||||
updateHandler.removeCallbacks(colorRunnable_duringEditing);
|
||||
@ -492,7 +495,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
public void onScrollChanged(int l, int t, int oldl, int oldt) {
|
||||
pageSystemButtons.updateVisibility(Math.abs(t) > 10);
|
||||
|
||||
if (!SettingsFragment.sColorSyntax || (mEditor.hasSelection() && !searchingText) || updateHandler == null || colorRunnable_duringScroll == null)
|
||||
if (!PreferenceHelper.getSyntaxHiglight(getActivity()) || (mEditor.hasSelection() && !searchingText) || updateHandler == null || colorRunnable_duringScroll == null)
|
||||
return;
|
||||
|
||||
updateHandler.removeCallbacks(colorRunnable_duringEditing);
|
||||
@ -592,8 +595,8 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
//region Eventbus
|
||||
public void onEvent(EventBusEvents.APreferenceValueWasChanged event) {
|
||||
|
||||
if (event.getType() == WRAP_CONTENT) {
|
||||
if (SettingsFragment.sWrapContent) {
|
||||
if (event.hasType(WRAP_CONTENT)) {
|
||||
if (PreferenceHelper.getWrapContent(getActivity())) {
|
||||
horizontalScroll.removeView(mEditor);
|
||||
verticalScroll.removeView(horizontalScroll);
|
||||
verticalScroll.addView(mEditor);
|
||||
@ -602,65 +605,65 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
verticalScroll.addView(horizontalScroll);
|
||||
horizontalScroll.addView(mEditor);
|
||||
}
|
||||
} else if (event.getType() == LINE_NUMERS) {
|
||||
} else if (event.hasType(LINE_NUMERS)) {
|
||||
mEditor.disableTextChangedListener();
|
||||
mEditor.replaceTextKeepCursor(null, true);
|
||||
mEditor.enableTextChangedListener();
|
||||
if (SettingsFragment.sLineNumbers) {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithLineNumbers(getActivity(), SettingsFragment.sFontSize), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
if (PreferenceHelper.getLineNumbers(getActivity())) {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithLineNumbers(getActivity(), PreferenceHelper.getFontSize(getActivity())), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
} else {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithoutLineNumbers(getActivity()), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
}
|
||||
} else if (event.getType() == SYNTAX) {
|
||||
} else if (event.hasType(SYNTAX)) {
|
||||
mEditor.disableTextChangedListener();
|
||||
mEditor.replaceTextKeepCursor(null, true);
|
||||
mEditor.enableTextChangedListener();
|
||||
} else if (event.getType() == MONOSPACE) {
|
||||
if (SettingsFragment.sUseMonospace)
|
||||
} else if (event.hasType(MONOSPACE)) {
|
||||
if (PreferenceHelper.getUseMonospace(getActivity()))
|
||||
this.mEditor.setTypeface(Typeface.MONOSPACE);
|
||||
else
|
||||
this.mEditor.setTypeface(Typeface.DEFAULT);
|
||||
} else if (event.getType() == THEME_CHANGE) {
|
||||
if (SettingsFragment.sLightTheme) {
|
||||
} else if (event.hasType(THEME_CHANGE)) {
|
||||
if (PreferenceHelper.getLightTheme(getActivity())) {
|
||||
mEditor.setTextColor(getResources().getColor(R.color.textColorInverted));
|
||||
} else {
|
||||
mEditor.setTextColor(getResources().getColor(R.color.textColor));
|
||||
}
|
||||
} else if (event.getType() == TEXT_SUGGESTIONS || event.getType() == READ_ONLY) {
|
||||
if(SettingsFragment.sReadOnly) {
|
||||
} else if (event.hasType(TEXT_SUGGESTIONS) || event.hasType(READ_ONLY)) {
|
||||
if(PreferenceHelper.getReadOnly(getActivity())) {
|
||||
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
mEditor.setReadOnly(true);
|
||||
} else {
|
||||
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
|
||||
mEditor.setReadOnly(false);
|
||||
if (SettingsFragment.sSuggestionsActive) {
|
||||
if (PreferenceHelper.getSuggestionActive(getActivity())) {
|
||||
mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
|
||||
} else {
|
||||
mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
|
||||
}
|
||||
}
|
||||
// sometimes it becomes monospace after setting the input type
|
||||
if (SettingsFragment.sUseMonospace)
|
||||
if (PreferenceHelper.getUseMonospace(getActivity()))
|
||||
this.mEditor.setTypeface(Typeface.MONOSPACE);
|
||||
else
|
||||
this.mEditor.setTypeface(Typeface.DEFAULT);
|
||||
} else if (event.getType() == FONT_SIZE) {
|
||||
if (SettingsFragment.sLineNumbers) {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithLineNumbers(getActivity(), SettingsFragment.sFontSize), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
} else if (event.hasType(FONT_SIZE)) {
|
||||
if (PreferenceHelper.getLineNumbers(getActivity())) {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithLineNumbers(getActivity(), PreferenceHelper.getFontSize(getActivity())), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
} else {
|
||||
mEditor.setPadding(EdittextPadding.getPaddingWithoutLineNumbers(getActivity()), EdittextPadding.getPaddingTop(getActivity()), 0, 0);
|
||||
}
|
||||
this.mEditor.setTextSize(SettingsFragment.sFontSize);
|
||||
} else if (event.getType() == ENCODING) {
|
||||
this.mEditor.setTextSize(PreferenceHelper.getFontSize(getActivity()));
|
||||
} else if (event.hasType(ENCODING)) {
|
||||
String oldEncoding, newEncoding;
|
||||
oldEncoding = SettingsFragment.sCurrentEncoding;
|
||||
oldEncoding = currentEncoding;
|
||||
newEncoding = PreferenceHelper.getEncoding(getActivity());
|
||||
try {
|
||||
final byte[] oldText = this.mEditor.getText().toString().getBytes(oldEncoding);
|
||||
mEditor.disableTextChangedListener();
|
||||
mEditor.replaceTextKeepCursor(new String(oldText, newEncoding), true);
|
||||
mEditor.enableTextChangedListener();
|
||||
SettingsFragment.sCurrentEncoding = newEncoding;
|
||||
currentEncoding = newEncoding;
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
try {
|
||||
final byte[] oldText = this.mEditor.getText().toString().getBytes(oldEncoding);
|
||||
@ -676,9 +679,9 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
public void onEvent(EventBusEvents.SaveAFile event) {
|
||||
File file = new File(sFilePath);
|
||||
if(!file.getName().isEmpty())
|
||||
new SaveFileTask(getActivity(), sFilePath, pageSystem.getAllText(mEditor.getText().toString()), SettingsFragment.sCurrentEncoding).execute();
|
||||
new SaveFileTask(getActivity(), sFilePath, pageSystem.getAllText(mEditor.getText().toString()), currentEncoding).execute();
|
||||
else {
|
||||
NewFileDetailsDialogFragment dialogFrag = NewFileDetailsDialogFragment.newInstance(pageSystem.getAllText(mEditor.getText().toString()), SettingsFragment.sCurrentEncoding);
|
||||
NewFileDetailsDialogFragment dialogFrag = NewFileDetailsDialogFragment.newInstance(pageSystem.getAllText(mEditor.getText().toString()), currentEncoding);
|
||||
dialogFrag.show(getFragmentManager().beginTransaction(), "dialog");
|
||||
}
|
||||
}
|
||||
@ -724,6 +727,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
private boolean canSaveFile = false;
|
||||
private KeyListener keyListener;
|
||||
private int firstVisibleIndex = 0, firstColoredIndex = 0;
|
||||
private int deviceHeight;
|
||||
//endregion
|
||||
|
||||
//region CONSTRUCTOR
|
||||
@ -732,6 +736,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
mEditHistory = new EditHistory();
|
||||
mChangeListener = new EditTextChangeListener();
|
||||
lineUtils = new LineUtils();
|
||||
deviceHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
|
||||
this.mPaintNumbers.setAntiAlias(true);
|
||||
this.mPaintNumbers.setDither(false);
|
||||
@ -846,21 +851,23 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
@Override
|
||||
public void onDraw(final Canvas canvas) {
|
||||
|
||||
if (SettingsFragment.sLineNumbers) {
|
||||
if (PreferenceHelper.getLineNumbers(getContext())) {
|
||||
if (lineCount != getLineCount()) {
|
||||
lineCount = getLineCount();
|
||||
|
||||
lineUtils.updateHasNewLineArray(editorInterface.getPageSystem().getStartingLine(), lineCount, getLayout(), getText().toString());
|
||||
}
|
||||
|
||||
int i = lineUtils.getFirstVisibleLine(editorInterface.getVerticalScrollView(), lineCount);
|
||||
int lastLine = lineUtils.getLastVisibleLine(i, lineCount);
|
||||
int editorHeight = getHeight();
|
||||
int i = lineUtils.getFirstVisibleLine(editorInterface.getVerticalScrollView(), editorHeight, lineCount);
|
||||
int lastLine = lineUtils.getLastVisibleLine(editorInterface.getVerticalScrollView(), editorHeight, lineCount, deviceHeight);
|
||||
boolean[] hasNewLineArray = lineUtils.getToCountLinesArray();
|
||||
int[] realLines = lineUtils.getRealLines();
|
||||
boolean wrapContent = PreferenceHelper.getWrapContent(getContext());
|
||||
|
||||
while (i < lastLine) {
|
||||
// if last line we count it anyway
|
||||
if (!SettingsFragment.sWrapContent
|
||||
if (!wrapContent
|
||||
|| hasNewLineArray[i]
|
||||
|| i == lastLine - 1) {
|
||||
if (i == lastLine - 1)
|
||||
@ -994,7 +1001,7 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
|
||||
|
||||
|
||||
if(SettingsFragment.sColorSyntax)
|
||||
if(PreferenceHelper.getSyntaxHiglight(getContext()))
|
||||
setText(highlight(textToUpdate == null ? getEditableText() : Editable.Factory.getInstance().newEditable(textToUpdate)));
|
||||
else
|
||||
setText(textToUpdate == null ? getText().toString() : textToUpdate);
|
||||
@ -1022,12 +1029,18 @@ public class EditorFragment extends Fragment implements FindTextDialogFragment.S
|
||||
}
|
||||
|
||||
firstVisibleIndex = 0;
|
||||
if(getHeight() > 0)
|
||||
firstVisibleIndex = getLayout().getLineStart(getLineUtils().getFirstVisibleLine(editorInterface.getVerticalScrollView(), getHeight(), getLineCount()));
|
||||
int end = CHARS_TO_COLOR;
|
||||
int height = getHeight();
|
||||
|
||||
if(height > 0) {
|
||||
firstVisibleIndex = getLayout().getLineStart(getLineUtils().getFirstVisibleLine(editorInterface.getVerticalScrollView(), height, getLineCount()));
|
||||
end = getLayout().getLineStart(getLineUtils().getLastVisibleLine(editorInterface.getVerticalScrollView(), height, lineCount, deviceHeight));
|
||||
//int end = firstColoredIndex + CHARS_TO_COLOR;
|
||||
}
|
||||
|
||||
firstColoredIndex = firstVisibleIndex - (CHARS_TO_COLOR / 5);
|
||||
if (firstColoredIndex < 0)
|
||||
firstColoredIndex = 0;
|
||||
int end = firstColoredIndex + CHARS_TO_COLOR;
|
||||
if (end > editable.length())
|
||||
end = editable.length();
|
||||
|
||||
|
@ -22,23 +22,18 @@ package sharedcode.turboeditor.fragment;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Switch;
|
||||
|
||||
import org.mozilla.universalchardet.Constants;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.preferences.SettingsFragment;
|
||||
import sharedcode.turboeditor.util.SaveFileTask;
|
||||
|
||||
import org.mozilla.universalchardet.Constants;
|
||||
|
||||
public class EncodingDialogFragment extends DialogFragment implements AdapterView.OnItemClickListener {
|
||||
|
||||
|
@ -32,14 +32,13 @@ import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
|
||||
import sharedcode.turboeditor.util.SearchResult;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.util.SearchResult;
|
||||
|
||||
// ...
|
||||
public class FindTextDialogFragment extends DialogFragment {
|
||||
|
||||
@ -91,30 +90,24 @@ public class FindTextDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
public void onStart() {
|
||||
super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point
|
||||
AlertDialog d = (AlertDialog)getDialog();
|
||||
if(d != null)
|
||||
{
|
||||
AlertDialog d = (AlertDialog) getDialog();
|
||||
if (d != null) {
|
||||
Button positiveButton = (Button) d.getButton(Dialog.BUTTON_POSITIVE);
|
||||
positiveButton.setText(getString(R.string.find));
|
||||
positiveButton.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
positiveButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
public void onClick(View v) {
|
||||
returnData();
|
||||
}
|
||||
});
|
||||
|
||||
Button negativeButton = (Button) d.getButton(Dialog.BUTTON_NEGATIVE);
|
||||
negativeButton.setText(getString(android.R.string.cancel));
|
||||
negativeButton.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
negativeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
@ -122,7 +115,7 @@ public class FindTextDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
void returnData() {
|
||||
if(textToFind.getText().toString().isEmpty()) {
|
||||
if (textToFind.getText().toString().isEmpty()) {
|
||||
this.dismiss();
|
||||
} else {
|
||||
// we disable the okButton while we search
|
||||
@ -130,7 +123,11 @@ public class FindTextDialogFragment extends DialogFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private class SearchTask extends AsyncTask<Void, Void, Void>{
|
||||
public interface SearchDialogInterface {
|
||||
void onSearchDone(SearchResult searchResult);
|
||||
}
|
||||
|
||||
private class SearchTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
LinkedList<Integer> foundIndex;
|
||||
boolean foundSomething;
|
||||
@ -145,9 +142,9 @@ public class FindTextDialogFragment extends DialogFragment {
|
||||
Matcher matcher = null;
|
||||
foundSomething = false;
|
||||
|
||||
if(isRegex) {
|
||||
if (isRegex) {
|
||||
try {
|
||||
if(caseSensitive)
|
||||
if (caseSensitive)
|
||||
matcher = Pattern.compile(whatToSearch, Pattern.MULTILINE).matcher(allText);
|
||||
else
|
||||
matcher = Pattern.compile(whatToSearch, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE).matcher(allText);
|
||||
@ -156,14 +153,14 @@ public class FindTextDialogFragment extends DialogFragment {
|
||||
}
|
||||
}
|
||||
|
||||
if(isRegex) {
|
||||
if (isRegex) {
|
||||
while (matcher.find()) {
|
||||
foundSomething = true;
|
||||
|
||||
foundIndex.add(matcher.start());
|
||||
}
|
||||
} else {
|
||||
if(caseSensitive == false) { // by default is case sensitive
|
||||
if (caseSensitive == false) { // by default is case sensitive
|
||||
whatToSearch = whatToSearch.toLowerCase();
|
||||
allText = allText.toLowerCase();
|
||||
}
|
||||
@ -183,15 +180,15 @@ public class FindTextDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
if(foundSomething) {
|
||||
if (foundSomething) {
|
||||
// the class that called this Dialog should implement the SearchDialogIterface
|
||||
SearchDialogInterface searchDialogInterface;
|
||||
searchDialogInterface = ((SearchDialogInterface) getTargetFragment());
|
||||
if(searchDialogInterface == null)
|
||||
if (searchDialogInterface == null)
|
||||
searchDialogInterface = ((SearchDialogInterface) getActivity());
|
||||
|
||||
// if who called this has not implemented the interface we return nothing
|
||||
if(searchDialogInterface == null)
|
||||
if (searchDialogInterface == null)
|
||||
return;
|
||||
// else we return positions and other things
|
||||
else {
|
||||
@ -206,8 +203,4 @@ public class FindTextDialogFragment extends DialogFragment {
|
||||
FindTextDialogFragment.this.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public interface SearchDialogInterface {
|
||||
void onSearchDone(SearchResult searchResult);
|
||||
}
|
||||
}
|
@ -27,15 +27,14 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.adapter.AdapterDrawer;
|
||||
import sharedcode.turboeditor.util.EventBusEvents;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.adapter.AdapterDrawer;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.util.EventBusEvents;
|
||||
|
||||
|
||||
public class NavigationDrawerListFragment extends Fragment implements AdapterView.OnItemClickListener, AdapterDrawer.Callbacks {
|
||||
|
@ -24,17 +24,13 @@ import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.activity.PreferenceAbout;
|
||||
import sharedcode.turboeditor.preferences.PreferenceHelper;
|
||||
import sharedcode.turboeditor.util.SaveFileTask;
|
||||
|
||||
@ -72,7 +68,7 @@ public class NewFileDetailsDialogFragment extends DialogFragment {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if(!mName.getText().toString().isEmpty() && !mFolder.getText().toString().isEmpty()) {
|
||||
if (!mName.getText().toString().isEmpty() && !mFolder.getText().toString().isEmpty()) {
|
||||
File file = new File(mFolder.getText().toString(), mName.getText().toString());
|
||||
new SaveFileTask(getActivity(), file.getPath(), getArguments().getString("fileText"), getArguments().getString("fileEncoding")).execute();
|
||||
}
|
||||
|
@ -25,21 +25,21 @@ import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.preferences.SettingsFragment;
|
||||
import sharedcode.turboeditor.util.SaveFileTask;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.util.SaveFileTask;
|
||||
|
||||
public class SaveFileDialogFragment extends DialogFragment {
|
||||
|
||||
public static SaveFileDialogFragment newInstance(String filePath, String text) {
|
||||
public static SaveFileDialogFragment newInstance(String filePath, String text, String encoding) {
|
||||
SaveFileDialogFragment frag = new SaveFileDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("filePath", filePath);
|
||||
args.putString("text", text);
|
||||
args.putString("encoding", encoding);
|
||||
frag.setArguments(args);
|
||||
return frag;
|
||||
}
|
||||
@ -48,6 +48,7 @@ public class SaveFileDialogFragment extends DialogFragment {
|
||||
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);
|
||||
|
||||
@ -57,10 +58,10 @@ public class SaveFileDialogFragment extends DialogFragment {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if(!fileName.isEmpty())
|
||||
new SaveFileTask(getActivity(), filePath, text, SettingsFragment.sCurrentEncoding).execute();
|
||||
if (!fileName.isEmpty())
|
||||
new SaveFileTask(getActivity(), filePath, text, encoding).execute();
|
||||
else {
|
||||
NewFileDetailsDialogFragment dialogFrag = NewFileDetailsDialogFragment.newInstance(text, SettingsFragment.sCurrentEncoding);
|
||||
NewFileDetailsDialogFragment dialogFrag = NewFileDetailsDialogFragment.newInstance(text, encoding);
|
||||
dialogFrag.show(getFragmentManager().beginTransaction(), "dialog");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Turbo Editor is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package sharedcode.turboeditor.preferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.util.EventBusEvents;
|
||||
|
||||
/**
|
||||
* A {@link PreferenceActivity} that presents a set of application settings. On
|
||||
* handset devices, settings are presented as a single list. On tablets,
|
||||
* settings are split by category, with category headers shown to the left of
|
||||
* the list of settings.
|
||||
* <p/>
|
||||
* See <a href="http://developer.android.com/design/patterns/settings.html">
|
||||
* Android Design: Settings</a> for design guidelines and the <a
|
||||
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
|
||||
* API Guide</a> for more information on developing a Settings UI.
|
||||
*/
|
||||
public class ExtraSettingsActivity extends PreferenceActivity {
|
||||
/**
|
||||
* Determines whether to always show the simplified settings UI, where
|
||||
* settings are presented in a single list. When false, settings are shown
|
||||
* as a master/detail two-pane view on tablets. When true, a single pane is
|
||||
* shown on tablets.
|
||||
*/
|
||||
private static final boolean ALWAYS_SIMPLE_PREFS = true;
|
||||
boolean encodingChanged = false,
|
||||
themeChanged = false,
|
||||
keyboardSuggestionsChanged = false;
|
||||
/**
|
||||
* A preference value change listener that updates the preference's summary
|
||||
* to reflect its new value.
|
||||
*/
|
||||
private Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||
String stringValue = value.toString();
|
||||
|
||||
if (preference instanceof ListPreference) {
|
||||
// For list preferences, look up the correct display value in
|
||||
// the preference's 'entries' list.
|
||||
ListPreference listPreference = (ListPreference) preference;
|
||||
int index = listPreference.findIndexOfValue(stringValue);
|
||||
|
||||
// Set the summary to reflect the new value.
|
||||
preference.setSummary(
|
||||
index >= 0
|
||||
? listPreference.getEntries()[index]
|
||||
: null);
|
||||
|
||||
}
|
||||
switch (preference.getKey()) {
|
||||
case "light_theme":
|
||||
themeChanged = !themeChanged;
|
||||
break;
|
||||
case "suggestion_active":
|
||||
keyboardSuggestionsChanged = !keyboardSuggestionsChanged;
|
||||
break;
|
||||
case "editor_encoding":
|
||||
encodingChanged = true;
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper method to determine if the device has an extra-large screen. For
|
||||
* example, 10" tablets are extra-large.
|
||||
*/
|
||||
private static boolean isXLargeTablet(Context context) {
|
||||
return (context.getResources().getConfiguration().screenLayout
|
||||
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
boolean light = PreferenceHelper.getLightTheme(this);
|
||||
if (light) {
|
||||
setTheme(R.style.AppTheme_Light);
|
||||
} else {
|
||||
setTheme(R.style.AppTheme_Dark);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
||||
setupSimplePreferencesScreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the simplified settings UI if the device configuration if the
|
||||
* device configuration dictates that a simplified, single-pane UI should be
|
||||
* shown.
|
||||
*/
|
||||
private void setupSimplePreferencesScreen() {
|
||||
if (!isSimplePreferences(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In the simplified UI, fragments are not used at all and we instead
|
||||
// use the older PreferenceActivity APIs.
|
||||
|
||||
// Add 'general' preferences.
|
||||
addPreferencesFromResource(R.xml.extra_options);
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
|
||||
// their values. When their values change, their summaries are updated
|
||||
// to reflect the new value, per the Android Design guidelines.
|
||||
bindPreferenceSummaryToValue(findPreference("editor_encoding"));
|
||||
|
||||
String[] checkBoxPreferences = {"light_theme", "suggestion_active"};
|
||||
for (String key : checkBoxPreferences) {
|
||||
// Set the listener to watch for value changes.
|
||||
findPreference(key).setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onIsMultiPane() {
|
||||
return isXLargeTablet(this) && !isSimplePreferences(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the simplified settings UI should be shown. This is
|
||||
* true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
|
||||
* doesn't have newer APIs like {@link PreferenceFragment}, or the device
|
||||
* doesn't have an extra-large screen. In these cases, a single-pane
|
||||
* "simplified" settings UI should be shown.
|
||||
*/
|
||||
private boolean isSimplePreferences(Context context) {
|
||||
return ALWAYS_SIMPLE_PREFS
|
||||
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
|
||||
|| !isXLargeTablet(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
List<EventBusEvents.APreferenceValueWasChanged.Type> listOfChanges = new ArrayList<>();
|
||||
if (themeChanged) {
|
||||
listOfChanges.add(EventBusEvents.APreferenceValueWasChanged.Type.THEME_CHANGE);
|
||||
}
|
||||
if (keyboardSuggestionsChanged) {
|
||||
listOfChanges.add(EventBusEvents.APreferenceValueWasChanged.Type.TEXT_SUGGESTIONS);
|
||||
}
|
||||
if (encodingChanged) {
|
||||
listOfChanges.add(EventBusEvents.APreferenceValueWasChanged.Type.ENCODING);
|
||||
}
|
||||
|
||||
|
||||
if (listOfChanges.size() > 0) {
|
||||
EventBus.getDefault().postSticky(new EventBusEvents.APreferenceValueWasChanged(listOfChanges));
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds a preference's summary to its value. More specifically, when the
|
||||
* preference's value is changed, its summary (line of text below the
|
||||
* preference title) is updated to reflect the value. The summary is also
|
||||
* immediately updated upon calling this method. The exact display format is
|
||||
* dependent on the type of preference.
|
||||
*
|
||||
* @see #sBindPreferenceSummaryToValueListener
|
||||
*/
|
||||
private void bindPreferenceSummaryToValue(Preference preference) {
|
||||
// Set the listener to watch for value changes.
|
||||
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
|
||||
|
||||
// Trigger the listener immediately with the preference's
|
||||
// current value.
|
||||
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
|
||||
PreferenceManager
|
||||
.getDefaultSharedPreferences(preference.getContext())
|
||||
.getString(preference.getKey(), ""));
|
||||
}
|
||||
}
|
@ -105,6 +105,10 @@ public final class PreferenceHelper {
|
||||
return getPrefs(context).getBoolean("read_only", false);
|
||||
}
|
||||
|
||||
public static boolean getIgnoreBackButton(Context context) {
|
||||
return getPrefs(context).getBoolean("ignore_back_button", false);
|
||||
}
|
||||
|
||||
// Setter methods
|
||||
|
||||
public static void setUseMonospace(Context context, boolean value) {
|
||||
@ -123,30 +127,14 @@ public final class PreferenceHelper {
|
||||
getEditor(context).putBoolean("editor_wrap_content", value).commit();
|
||||
}
|
||||
|
||||
public static void setLightTheme(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("light_theme", value).commit();
|
||||
}
|
||||
|
||||
public static void setSuggestionActive(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("suggestion_active", value).commit();
|
||||
}
|
||||
|
||||
public static void setAutoencoding(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("autoencoding", value).commit();
|
||||
}
|
||||
|
||||
public static void setSendErrorReports(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("send_error_reports", value).commit();
|
||||
}
|
||||
|
||||
public static void setLastDayAdShowed(Context context, int value) {
|
||||
getEditor(context).putInt("last_day_ad_showed", value).commit();
|
||||
}
|
||||
|
||||
public static void setEncoding(Context context, String value) {
|
||||
getEditor(context).putString("editor_encoding", value).commit();
|
||||
}
|
||||
|
||||
public static void setFontSize(Context context, int value) {
|
||||
getEditor(context).putInt("font_size", value).commit();
|
||||
}
|
||||
@ -163,10 +151,6 @@ public final class PreferenceHelper {
|
||||
getEditor(context).putBoolean("page_system_button_popup_shown", value).commit();
|
||||
}
|
||||
|
||||
public static void setAutoSave(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("auto_save", value).commit();
|
||||
}
|
||||
|
||||
public static void setReadOnly(Context context, boolean value) {
|
||||
getEditor(context).putBoolean("read_only", value).commit();
|
||||
}
|
||||
|
@ -27,59 +27,39 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CheckedTextView;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.fragment.EncodingDialogFragment;
|
||||
import sharedcode.turboeditor.fragment.SeekbarDialogFragment;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import sharedcode.turboeditor.R;
|
||||
import sharedcode.turboeditor.fragment.SeekbarDialogFragment;
|
||||
import sharedcode.turboeditor.util.ProCheckUtils;
|
||||
|
||||
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged;
|
||||
import static sharedcode.turboeditor.util.EventBusEvents.APreferenceValueWasChanged.Type.AUTO_SAVE;
|
||||
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 EncodingDialogFragment.DialogListener, SeekbarDialogFragment.onSeekbarDialogDismissed {
|
||||
public class SettingsFragment extends Fragment implements SeekbarDialogFragment.onSeekbarDialogDismissed {
|
||||
|
||||
public static String sCurrentEncoding;
|
||||
// Editor Variables
|
||||
public static boolean sLineNumbers;
|
||||
public static boolean sColorSyntax;
|
||||
public static boolean sWrapContent;
|
||||
public static int sFontSize;
|
||||
public static boolean sUseMonospace;
|
||||
public static boolean sLightTheme;
|
||||
public static boolean sSuggestionsActive;
|
||||
public static boolean sAutoSave;
|
||||
public static boolean sReadOnly;
|
||||
public static boolean sSendErrorReports;
|
||||
private boolean sLineNumbers;
|
||||
private boolean sColorSyntax;
|
||||
private boolean sWrapContent;
|
||||
private boolean sUseMonospace;
|
||||
private boolean sReadOnly;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SettingsFragment.sCurrentEncoding = PreferenceHelper.getEncoding(getActivity());
|
||||
SettingsFragment.sUseMonospace = PreferenceHelper.getUseMonospace(getActivity());
|
||||
SettingsFragment.sColorSyntax = PreferenceHelper.getSyntaxHiglight(getActivity());
|
||||
SettingsFragment.sWrapContent = PreferenceHelper.getWrapContent(getActivity());
|
||||
SettingsFragment.sLineNumbers = PreferenceHelper.getLineNumbers(getActivity());
|
||||
SettingsFragment.sFontSize = PreferenceHelper.getFontSize(getActivity());
|
||||
SettingsFragment.sSuggestionsActive = PreferenceHelper.getSuggestionActive(getActivity());
|
||||
SettingsFragment.sLightTheme = PreferenceHelper.getLightTheme(getActivity());
|
||||
SettingsFragment.sAutoSave = PreferenceHelper.getAutoSave(getActivity());
|
||||
SettingsFragment.sReadOnly = PreferenceHelper.getReadOnly(getActivity());
|
||||
SettingsFragment.sSendErrorReports = PreferenceHelper.getSendErrorReports(getActivity());
|
||||
sUseMonospace = PreferenceHelper.getUseMonospace(getActivity());
|
||||
sColorSyntax = PreferenceHelper.getSyntaxHiglight(getActivity());
|
||||
sWrapContent = PreferenceHelper.getWrapContent(getActivity());
|
||||
sLineNumbers = PreferenceHelper.getLineNumbers(getActivity());
|
||||
sReadOnly = PreferenceHelper.getReadOnly(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,25 +72,17 @@ public class SettingsFragment extends Fragment implements EncodingDialogFragment
|
||||
switchSyntax = (CheckBox) rootView.findViewById(R.id.switch_syntax);
|
||||
switchWrapContent = (CheckBox) rootView.findViewById(R.id.switch_wrap_content);
|
||||
switchMonospace = (CheckBox) rootView.findViewById(R.id.switch_monospace);
|
||||
switchLightTheme = (CheckBox) rootView.findViewById(R.id.switch_light_theme);
|
||||
switchSuggestionsActive = (CheckBox) rootView.findViewById(R.id.switch_suggestions_active);
|
||||
switchAutoSave = (CheckBox) rootView.findViewById(R.id.switch_auto_save);
|
||||
switchReadOnly = (CheckBox) rootView.findViewById(R.id.switch_read_only);
|
||||
switchSendErrorReports = (CheckBox) rootView.findViewById(R.id.switch_send_error_reports);
|
||||
|
||||
switchLineNumbers.setChecked(sLineNumbers);
|
||||
switchSyntax.setChecked(sColorSyntax);
|
||||
switchWrapContent.setChecked(sWrapContent);
|
||||
switchMonospace.setChecked(sUseMonospace);
|
||||
switchLightTheme.setChecked(sLightTheme);
|
||||
switchSuggestionsActive.setChecked(sSuggestionsActive);
|
||||
switchAutoSave.setChecked(sAutoSave);
|
||||
switchReadOnly.setChecked(sReadOnly);
|
||||
switchSendErrorReports.setChecked(sSendErrorReports);
|
||||
|
||||
TextView encodingView, fontSizeView, goProView;
|
||||
encodingView = (TextView) rootView.findViewById(R.id.drawer_button_encoding);
|
||||
TextView fontSizeView, goProView, extraOptionsView;
|
||||
fontSizeView = (TextView) rootView.findViewById(R.id.drawer_button_font_size);
|
||||
extraOptionsView = (TextView) rootView.findViewById(R.id.drawer_button_extra_options);
|
||||
goProView = (TextView) rootView.findViewById(R.id.drawer_button_go_pro);
|
||||
|
||||
switchLineNumbers.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@ -151,33 +123,6 @@ public class SettingsFragment extends Fragment implements EncodingDialogFragment
|
||||
}
|
||||
});
|
||||
|
||||
switchLightTheme.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
sLightTheme = isChecked;
|
||||
PreferenceHelper.setLightTheme(getActivity(), isChecked);
|
||||
EventBus.getDefault().post(new APreferenceValueWasChanged(THEME_CHANGE));
|
||||
}
|
||||
});
|
||||
|
||||
switchSuggestionsActive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
sSuggestionsActive = isChecked;
|
||||
PreferenceHelper.setSuggestionActive(getActivity(), isChecked);
|
||||
EventBus.getDefault().post(new APreferenceValueWasChanged(TEXT_SUGGESTIONS));
|
||||
}
|
||||
});
|
||||
|
||||
switchAutoSave.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
sAutoSave = isChecked;
|
||||
PreferenceHelper.setAutoSave(getActivity(), isChecked);
|
||||
EventBus.getDefault().post(new APreferenceValueWasChanged(AUTO_SAVE));
|
||||
}
|
||||
});
|
||||
|
||||
switchReadOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
@ -187,23 +132,6 @@ public class SettingsFragment extends Fragment implements EncodingDialogFragment
|
||||
}
|
||||
});
|
||||
|
||||
switchSendErrorReports.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
sSendErrorReports = isChecked;
|
||||
PreferenceHelper.setSendErrorReports(getActivity(), isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
encodingView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
EncodingDialogFragment dialogFrag = EncodingDialogFragment.newInstance();
|
||||
dialogFrag.setTargetFragment(SettingsFragment.this, 0);
|
||||
dialogFrag.show(getFragmentManager().beginTransaction(), "dialog");
|
||||
}
|
||||
});
|
||||
|
||||
fontSizeView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -217,6 +145,13 @@ public class SettingsFragment extends Fragment implements EncodingDialogFragment
|
||||
}
|
||||
});
|
||||
|
||||
extraOptionsView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getActivity(), ExtraSettingsActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
goProView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -232,33 +167,10 @@ public class SettingsFragment extends Fragment implements EncodingDialogFragment
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEncodingSelected(String value) {
|
||||
PreferenceHelper.setEncoding(getActivity(), value);
|
||||
EventBus.getDefault().post(new APreferenceValueWasChanged(ENCODING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSeekbarDialogDismissed(SeekbarDialogFragment.Actions action, int value) {
|
||||
sFontSize = value;
|
||||
PreferenceHelper.setFontSize(getActivity(), value);
|
||||
EventBus.getDefault().post(new APreferenceValueWasChanged(FONT_SIZE));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface must be implemented by activities that contain this
|
||||
* fragment to allow an interaction in this fragment to be communicated
|
||||
* to the activity and potentially other fragments contained in that
|
||||
* activity.
|
||||
* <p/>
|
||||
* See the Android Training lesson <a href=
|
||||
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
||||
* >Communicating with Other Fragments</a> for more information.
|
||||
*/
|
||||
public interface OnFragmentInteractionListener {
|
||||
// TODO: Update argument type and name
|
||||
public void onFragmentInteraction(Uri uri);
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,14 @@
|
||||
|
||||
package sharedcode.turboeditor.util;
|
||||
|
||||
import android.widget.ScrollView;
|
||||
|
||||
import sharedcode.turboeditor.views.GoodScrollView;
|
||||
|
||||
public interface EditorInterface {
|
||||
public GoodScrollView getVerticalScrollView();
|
||||
|
||||
public String getFilePath();
|
||||
|
||||
public PageSystem getPageSystem();
|
||||
|
||||
public void updateTextSyntax();
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
package sharedcode.turboeditor.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class EventBusEvents {
|
||||
public static class CannotOpenAFile {
|
||||
@ -65,21 +66,28 @@ public class EventBusEvents {
|
||||
|
||||
public static class APreferenceValueWasChanged {
|
||||
private Type type;
|
||||
private List<Type> types;
|
||||
|
||||
public APreferenceValueWasChanged(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
public APreferenceValueWasChanged(List<Type> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
public boolean hasType(Type value) {
|
||||
|
||||
if (type != null) {
|
||||
return value == type;
|
||||
} else {
|
||||
return types.contains(value);
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
FONT_SIZE, ENCODING, SYNTAX, WRAP_CONTENT, MONOSPACE, LINE_NUMERS, THEME_CHANGE, TEXT_SUGGESTIONS, AUTO_SAVE, READ_ONLY
|
||||
FONT_SIZE, ENCODING, SYNTAX, WRAP_CONTENT, MONOSPACE, LINE_NUMERS, THEME_CHANGE, TEXT_SUGGESTIONS, READ_ONLY
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,8 @@ public class LineUtils {
|
||||
return line;
|
||||
}
|
||||
|
||||
public int getLastVisibleLine(int firstVisibleLine, int lineCount) {
|
||||
int line;
|
||||
line = firstVisibleLine + 150;
|
||||
public int getLastVisibleLine(ScrollView scrollView, int childHeight, int lineCount, int deviceHeight) {
|
||||
int line = ((scrollView.getScrollY() + deviceHeight) * lineCount) / childHeight;
|
||||
if (line > lineCount) line = lineCount;
|
||||
return line;
|
||||
}
|
||||
|
@ -24,16 +24,9 @@ import java.util.List;
|
||||
|
||||
public class PageSystem {
|
||||
|
||||
public interface PageSystemInterface {
|
||||
void onPageChanged(int page);
|
||||
}
|
||||
|
||||
private List<String> pages;
|
||||
|
||||
private int[] startingLines;
|
||||
|
||||
private int currentPage = 0;
|
||||
|
||||
private PageSystemInterface pageSystemInterface;
|
||||
|
||||
public PageSystem(PageSystemInterface pageSystemInterface, String text) {
|
||||
@ -46,7 +39,7 @@ public class PageSystem {
|
||||
int to;
|
||||
int indexOfReturn;
|
||||
int textLenght = text.length();
|
||||
if(textLenght > maxLenghtInOnePage) {
|
||||
if (textLenght > maxLenghtInOnePage) {
|
||||
while (i < textLenght) {
|
||||
to = i + charForPage;
|
||||
indexOfReturn = text.indexOf("\n", to);
|
||||
@ -78,8 +71,8 @@ public class PageSystem {
|
||||
public String getTextOfNextPages(boolean includeCurrent, int nOfPages) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int i;
|
||||
for(i = includeCurrent ? 0 : 1; i < nOfPages; i++){
|
||||
if(pages.size() > (currentPage + i)) {
|
||||
for (i = includeCurrent ? 0 : 1; i < nOfPages; i++) {
|
||||
if (pages.size() > (currentPage + i)) {
|
||||
stringBuilder.append(pages.get(currentPage + 1));
|
||||
}
|
||||
}
|
||||
@ -92,25 +85,25 @@ public class PageSystem {
|
||||
}
|
||||
|
||||
public void nextPage() {
|
||||
if(!canReadNextPage()) return;
|
||||
if (!canReadNextPage()) return;
|
||||
goToPage(currentPage + 1);
|
||||
}
|
||||
|
||||
public void prevPage() {
|
||||
if(!canReadPrevPage()) return;
|
||||
if (!canReadPrevPage()) return;
|
||||
goToPage(currentPage - 1);
|
||||
}
|
||||
|
||||
public void goToPage(int page) {
|
||||
if(page >= pages.size()) page = pages.size() - 1;
|
||||
if(page < 0) page = 0;
|
||||
if (page >= pages.size()) page = pages.size() - 1;
|
||||
if (page < 0) page = 0;
|
||||
boolean shouldUpdateLines = page > currentPage && canReadNextPage();
|
||||
if(shouldUpdateLines) {
|
||||
if (shouldUpdateLines) {
|
||||
String text = getCurrentPageText();
|
||||
int nOfNewLineNow = (text.length() - text.replace("\n", "").length()) + 1; // normally the last line is not counted so we have to add 1
|
||||
int nOfNewLineBefore = startingLines[currentPage+1] - startingLines[currentPage];
|
||||
int nOfNewLineBefore = startingLines[currentPage + 1] - startingLines[currentPage];
|
||||
int difference = nOfNewLineNow - nOfNewLineBefore;
|
||||
updateStartingLines(currentPage+1, difference);
|
||||
updateStartingLines(currentPage + 1, difference);
|
||||
}
|
||||
currentPage = page;
|
||||
pageSystemInterface.onPageChanged(page);
|
||||
@ -122,8 +115,8 @@ public class PageSystem {
|
||||
int nOfNewLines;
|
||||
String text;
|
||||
startingLines[0] = 0;
|
||||
for(i = 1; i < pages.size(); i++) {
|
||||
text = pages.get(i-1);
|
||||
for (i = 1; i < pages.size(); i++) {
|
||||
text = pages.get(i - 1);
|
||||
nOfNewLines = text.length() - text.replace("\n", "").length() + 1;
|
||||
startingLine = startingLines[i - 1] + nOfNewLines;
|
||||
startingLines[i] = startingLine;
|
||||
@ -131,11 +124,11 @@ public class PageSystem {
|
||||
}
|
||||
|
||||
public void updateStartingLines(int fromPage, int difference) {
|
||||
if(difference == 0)
|
||||
if (difference == 0)
|
||||
return;
|
||||
int i;
|
||||
if(fromPage < 1) fromPage = 1;
|
||||
for(i = fromPage; i < pages.size(); i++) {
|
||||
if (fromPage < 1) fromPage = 1;
|
||||
for (i = fromPage; i < pages.size(); i++) {
|
||||
startingLines[i] += difference;
|
||||
}
|
||||
}
|
||||
@ -144,13 +137,15 @@ public class PageSystem {
|
||||
return pages.size() - 1;
|
||||
}
|
||||
|
||||
public int getCurrentPage() { return currentPage; }
|
||||
public int getCurrentPage() {
|
||||
return currentPage;
|
||||
}
|
||||
|
||||
public String getAllText(String currentPageText) {
|
||||
pages.set(currentPage, currentPageText);
|
||||
int i;
|
||||
StringBuilder allText = new StringBuilder();
|
||||
for(i = 0; i < pages.size(); i++) {
|
||||
for (i = 0; i < pages.size(); i++) {
|
||||
allText.append(pages.get(i)).append("\n");
|
||||
}
|
||||
return allText.toString();
|
||||
@ -163,4 +158,8 @@ public class PageSystem {
|
||||
public boolean canReadPrevPage() {
|
||||
return currentPage >= 1;
|
||||
}
|
||||
|
||||
public interface PageSystemInterface {
|
||||
void onPageChanged(int page);
|
||||
}
|
||||
}
|
||||
|
@ -24,21 +24,20 @@ import android.os.Handler;
|
||||
import android.view.View;
|
||||
|
||||
import com.faizmalkani.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
|
||||
public class PageSystemButtons {
|
||||
|
||||
private static final int TIME_TO_SHOW_FABS = 2000;
|
||||
|
||||
public interface PageButtonsInterface {
|
||||
public void nextPageClicked();
|
||||
public void prevPageClicked();
|
||||
public void pageSystemButtonLongClicked();
|
||||
|
||||
public boolean canReadNextPage();
|
||||
public boolean canReadPrevPage();
|
||||
final Handler handler = new Handler();
|
||||
final Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PageSystemButtons.this.next.setVisibility(View.GONE);
|
||||
PageSystemButtons.this.prev.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
};
|
||||
FloatingActionButton prev, next;
|
||||
PageButtonsInterface pageButtonsInterface;
|
||||
|
||||
@ -53,10 +52,10 @@ public class PageSystemButtons {
|
||||
this.prev.setColor(context.getResources().getColor(R.color.fab_light));
|
||||
this.prev.setDrawable(context.getResources().getDrawable(R.drawable.ic_keyboard_arrow_left));
|
||||
|
||||
if(pageButtonsInterface.canReadNextPage())
|
||||
if (pageButtonsInterface.canReadNextPage())
|
||||
next.setVisibility(View.VISIBLE);
|
||||
|
||||
if(pageButtonsInterface.canReadPrevPage())
|
||||
if (pageButtonsInterface.canReadPrevPage())
|
||||
prev.setVisibility(View.VISIBLE);
|
||||
|
||||
this.next.setOnClickListener(new View.OnClickListener() {
|
||||
@ -90,23 +89,14 @@ public class PageSystemButtons {
|
||||
});
|
||||
}
|
||||
|
||||
final Handler handler = new Handler();
|
||||
final Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PageSystemButtons.this.next.setVisibility(View.GONE);
|
||||
PageSystemButtons.this.prev.setVisibility(View.GONE);
|
||||
}
|
||||
};
|
||||
|
||||
public void updateVisibility(boolean autoHide) {
|
||||
|
||||
if(pageButtonsInterface.canReadNextPage())
|
||||
if (pageButtonsInterface.canReadNextPage())
|
||||
PageSystemButtons.this.next.setVisibility(View.VISIBLE);
|
||||
else
|
||||
PageSystemButtons.this.next.setVisibility(View.GONE);
|
||||
|
||||
if(pageButtonsInterface.canReadPrevPage())
|
||||
if (pageButtonsInterface.canReadPrevPage())
|
||||
PageSystemButtons.this.prev.setVisibility(View.VISIBLE);
|
||||
else
|
||||
PageSystemButtons.this.prev.setVisibility(View.GONE);
|
||||
@ -121,7 +111,7 @@ public class PageSystemButtons {
|
||||
else
|
||||
prev.hideFab();*/
|
||||
|
||||
if(autoHide) {
|
||||
if (autoHide) {
|
||||
handler.removeCallbacks(runnable);
|
||||
handler.postDelayed(runnable, TIME_TO_SHOW_FABS);
|
||||
} else {
|
||||
@ -129,4 +119,16 @@ public class PageSystemButtons {
|
||||
}
|
||||
}
|
||||
|
||||
public interface PageButtonsInterface {
|
||||
public void nextPageClicked();
|
||||
|
||||
public void prevPageClicked();
|
||||
|
||||
public void pageSystemButtonLongClicked();
|
||||
|
||||
public boolean canReadNextPage();
|
||||
|
||||
public boolean canReadPrevPage();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class Patterns {
|
||||
"\\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" +
|
||||
"@[A-Za-z0-9_\\.]*|\\b(local|global|boolean|number|userdata)\\b|\\b(true|false|nil)\\b|\\b(return|then|while|and|break|do|else|elseif|end|for|function|if|in|not|or|repeat|until|thread|table)\\b" +
|
||||
"|(?i)\\b(editsetText|editText|inkey|touch|system.exit|system.expCall|system.getAppPath|system.getCardMnt|system.getSec|system.impCallActionSend|system.impCallActionView|system.setrun|system.setScreen|system.version|El_Psy_Congroo|canvas.drawCircle|canvas.drawCls|canvas.drawLine|canvas.drawRect|canvas.getBmpSize|canvas.getColor|canvas.getg|canvas.getviewSize|canvas.loadBmp|canvas.putCircle|canvas.putCls|canvas.putflush|canvas.putg|canvas.putLine|canvas.putRect|canvas.putrotg|canvas.putWork|canvas.saveBmp|canvas.setMainBmp|canvas.setWorkBmp|canvas.workCls|canvas.workflush|color|canvas.drawText|canvas.drawTextBox|canvas.drawTextCenter|canvas.drawTextRotate|canvas.putText|canvas.putTextBox|canvas.putTextRotate|http.addHeader|http.addParam|http.clrHeader|http.clrParam|http.get|http.post|http.setContentType|http.setPostFile|http.status|dialog|item.add|item.check|item.clear|item.list|item.radio|toast|sensor.getAccel|sensor.setdevAccel|sensor.setdevMagnet|sensor.setdevOrient|sensor.getGdirection|sensor.getMagnet|sensor.getOrient|sound.beep|sound.isPlay|sound.pause|sound.restart|sound.setSoundFile|sound.start|sound.stop|zip.addFile|zip.exec|zip.status|sock.close|sock.connectOpen|sock.getAddress|sock.listenOpen|sock.recv|sock.send|sprite.clear|sprite.define|sprite.init|sprite.move|sprite.put)\\b" +
|
||||
"|(?i)\\b(assert|collectgarbage|coroutine.create|coroutine.resume|coroutine.running|coroutine.status|coroutine.wrap|coroutine.yield|debug.debug|debug.getfenv|debug.gethook|debug.getinfo|debug.getlocal|debug.getmetatable|debug.getregistry|debug.getupvalue|debug.setfenv|debug.sethook|debug.setlocal|debug.setmetatable|debug.setupvalue|debug.traceback|dofile|error|file:close|file:flush|file:lines|file:read|file:seek|file:setvbuf|file:write|getfenv|getmetatable|io.close|io.flush|io.input|io.lines|io.open|io.output|io.popen|io.read|io.tmpfile|io.type|io.write|ipairs|load|loadfile|loadstring|math.abs|math.acos|math.asin|math.atan2|math.atan|math.ceil|math.cosh|math.cos|math.deg|math.exp|math.floor|math.fmod|math.frexp|math.ldexp|math.log10|math.log|math.max|math.min|math.modf|math.pow|math.rad|math.random|math.randomseed|math.sinh|math.sin|math.sqrt|math.tanh|math.tan|module|next|os.clock|os.date|os.difftime|os.execute|os.exit|os.getenv|os.remove|os.rename|os.setlocale|os.time|os.tmpname|package.cpath|package.loaded|package.loadlib|package.path|package.preload|package.seeal|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|string.byte|string.char|string.dump|string.find|string.format|string.gmatch|string.gsub|string.len|string.lower|string.match|string.rep|string.reverse|string.sub|string.upper|table.concat|table.insert|table.maxn|table.remove|table.sort|tonumber|tostring|type|unpack|xpcall)\\b"
|
||||
);
|
||||
|
@ -26,9 +26,9 @@ public class ProCheckUtils {
|
||||
|
||||
String packageName = context.getPackageName();
|
||||
|
||||
if(Constants.FOR_AMAZON)
|
||||
if (Constants.FOR_AMAZON)
|
||||
return true;
|
||||
else if(packageName.equals("com.maskyn.fileeditorpro"))
|
||||
else if (packageName.equals("com.maskyn.fileeditorpro"))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -23,8 +23,6 @@ import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.Toast;
|
||||
|
||||
import sharedcode.turboeditor.R;
|
||||
|
||||
import org.sufficientlysecure.rootcommands.Shell;
|
||||
import org.sufficientlysecure.rootcommands.Toolbox;
|
||||
|
||||
@ -33,6 +31,7 @@ import java.io.IOException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import sharedcode.turboeditor.R;
|
||||
|
||||
public class SaveFileTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
@ -100,7 +99,7 @@ public class SaveFileTask extends AsyncTask<Void, Void, Void> {
|
||||
protected void onPostExecute(final Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
|
||||
if(message.equals(positiveMessage))
|
||||
if (message.equals(positiveMessage))
|
||||
EventBus.getDefault().post(new EventBusEvents.SavedAFile(filePath));
|
||||
}
|
||||
}
|
@ -38,7 +38,7 @@ public class SearchResult {
|
||||
public void doneReplace() {
|
||||
foundIndex.remove(index);
|
||||
int i;
|
||||
for(i = index; i < foundIndex.size(); i++) {
|
||||
for (i = index; i < foundIndex.size(); i++) {
|
||||
foundIndex.set(i, foundIndex.get(i) + textToReplace.length() - textLength);
|
||||
}
|
||||
index--; // an element was removed so we decrease the index
|
||||
|
@ -21,11 +21,13 @@ package sharedcode.turboeditor.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
public class GoodScrollView extends ScrollView {
|
||||
|
||||
public ScrollInterface scrollInterface;
|
||||
int lastY;
|
||||
|
||||
public GoodScrollView(Context context) {
|
||||
super(context);
|
||||
@ -39,24 +41,33 @@ public class GoodScrollView extends ScrollView {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
public interface ScrollInterface {
|
||||
public void onScrollChanged(int l, int t, int oldl, int oldt);
|
||||
}
|
||||
|
||||
public void setScrollInterface(ScrollInterface scrollInterface) {
|
||||
this.scrollInterface = scrollInterface;
|
||||
}
|
||||
|
||||
int lastY;
|
||||
|
||||
@Override
|
||||
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
|
||||
super.onScrollChanged(l, t, oldl, oldt);
|
||||
if(scrollInterface == null) return;
|
||||
if(Math.abs(lastY - t) > 50){
|
||||
if (scrollInterface == null) return;
|
||||
|
||||
|
||||
|
||||
if (Math.abs(lastY - t) > 100) {
|
||||
lastY = t;
|
||||
scrollInterface.onScrollChanged(l, t, oldl, oldt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean hasReachedBottom(){
|
||||
View firstChild = getChildAt(getChildCount()-1);
|
||||
|
||||
int diff = (firstChild.getBottom()-(getHeight()+getScrollY()+firstChild.getTop()));// Calculate the scrolldiff
|
||||
return diff <= 0;
|
||||
}
|
||||
|
||||
|
||||
public interface ScrollInterface {
|
||||
public void onScrollChanged(int l, int t, int oldl, int oldt);
|
||||
}
|
||||
}
|
||||
|
@ -143,71 +143,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/line_dimension"/>
|
||||
|
||||
<CheckBox
|
||||
android:button="@null"
|
||||
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:gravity="center_vertical"
|
||||
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:text="@string/light_theme"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="12sp"
|
||||
android:id="@id/switch_light_theme"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@color/navigation_drawer_button_text_color_inverted"/>
|
||||
|
||||
<View
|
||||
android:background="@color/divider_inverted"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/line_dimension"/>
|
||||
|
||||
<CheckBox android:button="@null" android:drawableRight="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:gravity="center_vertical"
|
||||
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:text="@string/keyboard_suggestions_and_swipe"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="12sp"
|
||||
android:id="@id/switch_suggestions_active"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@color/navigation_drawer_button_text_color_inverted"/>
|
||||
|
||||
<View
|
||||
android:background="@color/divider_inverted"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/line_dimension"/>
|
||||
|
||||
<CheckBox android:button="@null" android:drawableRight="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:gravity="center_vertical"
|
||||
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:text="@string/auto_save"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="12sp"
|
||||
android:id="@id/switch_auto_save"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@color/navigation_drawer_button_text_color_inverted"/>
|
||||
|
||||
<View
|
||||
android:background="@color/divider_inverted"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/line_dimension"/>
|
||||
|
||||
<CheckBox android:button="@null" android:drawableRight="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:gravity="center_vertical"
|
||||
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
|
||||
@ -224,48 +159,8 @@
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@color/navigation_drawer_button_text_color_inverted"/>
|
||||
|
||||
<View
|
||||
android:background="@color/divider_inverted"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/line_dimension"/>
|
||||
|
||||
<CheckBox
|
||||
android:button="@null"
|
||||
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:gravity="center_vertical"
|
||||
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:text="@string/send_error_reports"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="12sp"
|
||||
android:id="@id/switch_send_error_reports"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@color/navigation_drawer_button_text_color_inverted" />
|
||||
|
||||
<View
|
||||
android:background="@color/divider_inverted"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/line_dimension"/>
|
||||
|
||||
<TextView
|
||||
android:id="@id/drawer_button_encoding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:text="@string/codifica"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="12sp"
|
||||
android:textAllCaps="true"
|
||||
android:clickable="true"
|
||||
android:background="@drawable/item_background_holo_dark"
|
||||
android:textColor="@color/navigation_drawer_button_text_color_inverted"/>
|
||||
|
||||
<View
|
||||
android:background="@color/divider_inverted"
|
||||
@ -293,5 +188,26 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/line_dimension"/>
|
||||
|
||||
<TextView
|
||||
android:id="@id/drawer_button_extra_options"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:text="@string/extra_options"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="12sp"
|
||||
android:textAllCaps="true"
|
||||
android:clickable="true"
|
||||
android:background="@drawable/item_background_holo_dark"
|
||||
android:textColor="@color/navigation_drawer_button_text_color_inverted"/>
|
||||
|
||||
<View
|
||||
android:background="@color/divider_inverted"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/line_dimension"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -26,4 +26,36 @@
|
||||
<item>RootCommands</item>
|
||||
<item>Floating Action Button</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="encodings">
|
||||
<item>ISO-2022-JP</item>
|
||||
<item>ISO-2022-CN</item>
|
||||
<item>ISO-2022-KR</item>
|
||||
<item>ISO-8859-5</item>
|
||||
<item>ISO-8859-7</item>
|
||||
<item>ISO-8859-8</item>
|
||||
<item>BIG5</item>
|
||||
<item>GB18030</item>
|
||||
<item>EUC-JP</item>
|
||||
<item>EUC-KR</item>
|
||||
<item>EUC-TW</item>
|
||||
<item>SHIFT_JIS</item>
|
||||
<item>IBM855</item>
|
||||
<item>IBM866</item>
|
||||
<item>KOI8-R</item>
|
||||
<item>MACCYRILLIC</item>
|
||||
<item>WINDOWS-1251</item>
|
||||
<item>WINDOWS-1252</item>
|
||||
<item>WINDOWS-1253</item>
|
||||
<item>WINDOWS-1255</item>
|
||||
<item>UTF-8</item>
|
||||
<item>UTF-16BE</item>
|
||||
<item>UTF-16LE</item>
|
||||
<item>UTF-32BE</item>
|
||||
<item>UTF-32LE</item>
|
||||
<item>GB2312</item>
|
||||
<item>HZ-GB-2312</item>
|
||||
<item>X-ISO-10646-UCS-4-3412</item>
|
||||
<item>X-ISO-10646-UCS-4-2143</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -73,7 +73,7 @@
|
||||
<item type="id" name="switch_suggestions_active"/>
|
||||
<item type="id" name="switch_auto_save"/>
|
||||
<item type="id" name="switch_read_only"/>
|
||||
<item type="id" name="switch_send_error_reports"/>
|
||||
<item type="id" name="drawer_button_extra_options"/>
|
||||
|
||||
<item type="id" name="drawer_button_go_pro"/>
|
||||
<item type="id" name="drawer_button_encoding"/>
|
||||
|
@ -167,5 +167,7 @@
|
||||
<string name="auto_save">Auto save</string>
|
||||
<string name="read_only">Read only</string>
|
||||
<string name="send_error_reports">Send error reports</string>
|
||||
|
||||
<string name="extra_options">Extra options</string>
|
||||
<string name="split_text_if_too_long">Split the text if too long</string>
|
||||
<string name="ignore_back_button">Ignore back button</string>
|
||||
</resources>
|
||||
|
71
libraries/sharedCode/src/main/res/xml/extra_options.xml
Normal file
71
libraries/sharedCode/src/main/res/xml/extra_options.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="light_theme"
|
||||
android:title="@string/light_theme"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="suggestion_active"
|
||||
android:title="@string/keyboard_suggestions_and_swipe"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="auto_save"
|
||||
android:title="@string/auto_save"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="autoencoding"
|
||||
android:title="@string/enable_autoencoding"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
|
||||
dismiss it. -->
|
||||
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
|
||||
<ListPreference
|
||||
android:key="editor_encoding"
|
||||
android:title="@string/codifica"
|
||||
android:defaultValue="UTF-8"
|
||||
android:entries="@array/encodings"
|
||||
android:entryValues="@array/encodings"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="ignore_back_button"
|
||||
android:title="@string/ignore_back_button"
|
||||
android:defaultValue="false"
|
||||
android:enabled="true"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="page_system_active"
|
||||
android:title="@string/split_text_if_too_long"
|
||||
android:defaultValue="true"
|
||||
android:enabled="false"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="send_error_reports"
|
||||
android:title="@string/send_error_reports"
|
||||
android:defaultValue="true" />
|
||||
|
||||
</PreferenceScreen>
|
Reference in New Issue
Block a user