Version 1.2: font size
font size
This commit is contained in:
parent
d7a5d513c7
commit
ba0fb4ebaa
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,7 +30,6 @@ proguard/
|
|||||||
|
|
||||||
# Android Studio
|
# Android Studio
|
||||||
.gradle
|
.gradle
|
||||||
*.gradle
|
|
||||||
*.jks
|
*.jks
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/workspace.xml
|
/.idea/workspace.xml
|
||||||
|
30
Turbo Editor/build.gradle
Normal file
30
Turbo Editor/build.gradle
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:0.5.+'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
apply plugin: 'android'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 18
|
||||||
|
buildToolsVersion "18.1.0"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 14
|
||||||
|
targetSdkVersion 18
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'com.github.gabrielemariotti.changeloglib:library:1.2.0'
|
||||||
|
compile 'com.android.support:support-v13:18.0.0'
|
||||||
|
compile "commons-io:commons-io:2.4"
|
||||||
|
compile fileTree(dir: 'libs', include: '*.jar')
|
||||||
|
}
|
BIN
Turbo Editor/libs/eventbus-2.0.2.jar
Normal file
BIN
Turbo Editor/libs/eventbus-2.0.2.jar
Normal file
Binary file not shown.
Binary file not shown.
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.vmihalachi.turboeditor"
|
package="com.vmihalachi.turboeditor"
|
||||||
android:versionCode="5"
|
android:versionCode="6"
|
||||||
android:versionName="1.1"
|
android:versionName="1.2"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
|
@ -232,8 +232,8 @@ public class SelectFileActivity extends Activity implements AdapterView.OnItemCl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(final LinkedList<AdapterDetailedList.FileDetail> names) {
|
protected void onPostExecute(final LinkedList<AdapterDetailedList.FileDetail> names) {
|
||||||
boolean isRoot = currentFolder.equals("/");
|
|
||||||
if (names != null) {
|
if (names != null) {
|
||||||
|
boolean isRoot = currentFolder.equals("/");
|
||||||
listView.setAdapter(new AdapterDetailedList(getBaseContext(), names, isRoot));
|
listView.setAdapter(new AdapterDetailedList(getBaseContext(), names, isRoot));
|
||||||
}
|
}
|
||||||
super.onPostExecute(names);
|
super.onPostExecute(names);
|
||||||
|
@ -45,13 +45,10 @@ public class EditDialogFragment extends DialogFragment implements TextView.OnEdi
|
|||||||
|
|
||||||
public static EditDialogFragment newInstance(final Actions action, final String hint) {
|
public static EditDialogFragment newInstance(final Actions action, final String hint) {
|
||||||
final EditDialogFragment f = new EditDialogFragment();
|
final EditDialogFragment f = new EditDialogFragment();
|
||||||
|
|
||||||
// Supply num input as an argument.
|
|
||||||
final Bundle args = new Bundle();
|
final Bundle args = new Bundle();
|
||||||
args.putSerializable("action", action);
|
args.putSerializable("action", action);
|
||||||
args.putString("hint", hint);
|
args.putString("hint", hint);
|
||||||
f.setArguments(args);
|
f.setArguments(args);
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
import de.greenrobot.event.EventBus;
|
import de.greenrobot.event.EventBus;
|
||||||
|
|
||||||
public class EditorFragment extends Fragment implements EditDialogFragment.EditDialogListener {
|
public class EditorFragment extends Fragment implements EditDialogFragment.EditDialogListener, SeekbarDialogFragment.onSeekbarDialogDismissed {
|
||||||
|
|
||||||
private static final String TAG = "A0A";
|
private static final String TAG = "A0A";
|
||||||
private Editor mEditor;
|
private Editor mEditor;
|
||||||
@ -77,6 +77,7 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
// Editor Variables
|
// Editor Variables
|
||||||
static boolean sWrapText;
|
static boolean sWrapText;
|
||||||
static boolean sColorSyntax;
|
static boolean sColorSyntax;
|
||||||
|
static int sFontSize;
|
||||||
//
|
//
|
||||||
private boolean mUseMonospace;
|
private boolean mUseMonospace;
|
||||||
private String mCurrentEncoding;
|
private String mCurrentEncoding;
|
||||||
@ -99,6 +100,12 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
this.sFilePath = getArguments().getString("filePath");
|
||||||
|
this.mCurrentEncoding = PreferenceHelper.getEncoding(getActivity());
|
||||||
|
this.mUseMonospace = PreferenceHelper.getUseMonospace(getActivity());
|
||||||
|
this.sColorSyntax = PreferenceHelper.getSyntaxHiglight(getActivity());
|
||||||
|
this.sWrapText = PreferenceHelper.getWrapText(getActivity());
|
||||||
|
this.sFontSize = PreferenceHelper.getFontSize(getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,10 +114,20 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
// Out custom layout
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_editor, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_editor, container, false);
|
||||||
//
|
|
||||||
mEditor = (Editor) rootView.findViewById(R.id.editor);
|
mEditor = (Editor) rootView.findViewById(R.id.editor);
|
||||||
|
mEditor.setHorizontallyScrolling(!this.sWrapText);
|
||||||
|
if (!this.sWrapText) {
|
||||||
|
int paddingLeft = (int) PixelDipConverter.convertDpToPixel(sFontSize * 1.5f, getActivity());
|
||||||
|
mEditor.setPadding(paddingLeft, 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
int paddingLeft = (int) PixelDipConverter.convertDpToPixel(5, getActivity());
|
||||||
|
mEditor.setPadding(paddingLeft, 0, 0, 0);
|
||||||
|
}
|
||||||
|
if(this.mUseMonospace){
|
||||||
|
mEditor.setTypeface(Typeface.MONOSPACE);
|
||||||
|
}
|
||||||
|
mEditor.setTextSize(sFontSize);
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,18 +138,8 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
//
|
|
||||||
this.sFilePath = getArguments().getString("filePath");
|
|
||||||
this.mCurrentEncoding = PreferenceHelper.getEncoding(getActivity());
|
|
||||||
this.mUseMonospace = PreferenceHelper.getUseMonospace(getActivity());
|
|
||||||
this.sColorSyntax = PreferenceHelper.getSyntaxHiglight(getActivity());
|
|
||||||
this.sWrapText = PreferenceHelper.getWrapText(getActivity());
|
|
||||||
String fileName = FilenameUtils.getName(getArguments().getString("filePath"));
|
String fileName = FilenameUtils.getName(getArguments().getString("filePath"));
|
||||||
//
|
|
||||||
getActivity().getActionBar().setTitle(fileName);
|
getActivity().getActionBar().setTitle(fileName);
|
||||||
//
|
|
||||||
configureEditText();
|
|
||||||
//
|
|
||||||
try {
|
try {
|
||||||
final FileInputStream inputStream =
|
final FileInputStream inputStream =
|
||||||
new FileInputStream(
|
new FileInputStream(
|
||||||
@ -174,7 +181,16 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
this.mEditor.onKeyShortcut(KeyEvent.KEYCODE_Y, new KeyEvent(KeyEvent.ACTION_DOWN,
|
this.mEditor.onKeyShortcut(KeyEvent.KEYCODE_Y, new KeyEvent(KeyEvent.ACTION_DOWN,
|
||||||
KeyEvent.KEYCODE_Y));
|
KeyEvent.KEYCODE_Y));
|
||||||
} else if (i == R.id.im_editor_encoding) {
|
} else if (i == R.id.im_editor_encoding) {
|
||||||
showEncodingDialog();
|
EditDialogFragment dialogFrag = EditDialogFragment.newInstance(EditDialogFragment.Actions.Encoding, this.mCurrentEncoding);
|
||||||
|
dialogFrag.setTargetFragment(this, 0);
|
||||||
|
dialogFrag.show(getFragmentManager().beginTransaction(), "dialog");
|
||||||
|
} else if (i == R.id.im_text_size) {
|
||||||
|
int fontMax = 36;
|
||||||
|
float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
|
||||||
|
int fontCurrent = (int) (mEditor.getTextSize() / scaledDensity);
|
||||||
|
SeekbarDialogFragment dialogFrag = SeekbarDialogFragment.newInstance(SeekbarDialogFragment.Actions.FileSize, fontCurrent, fontMax);
|
||||||
|
dialogFrag.setTargetFragment(this, 0);
|
||||||
|
dialogFrag.show(getFragmentManager().beginTransaction(), "dialog");
|
||||||
} else if (i == R.id.im_syntax_highlight) {
|
} else if (i == R.id.im_syntax_highlight) {
|
||||||
item.setChecked(!item.isChecked());
|
item.setChecked(!item.isChecked());
|
||||||
PreferenceHelper.setSyntaxHiglight(getActivity(), item.isChecked());
|
PreferenceHelper.setSyntaxHiglight(getActivity(), item.isChecked());
|
||||||
@ -191,13 +207,6 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showEncodingDialog() {
|
|
||||||
EditDialogFragment dialogFrag = EditDialogFragment.newInstance(EditDialogFragment.Actions.Encoding, this.mCurrentEncoding);
|
|
||||||
dialogFrag.setTargetFragment(this, 0);
|
|
||||||
dialogFrag.show(getFragmentManager().beginTransaction(), "encodingDialog");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@ -209,33 +218,50 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onSeekbarDialogDismissed(SeekbarDialogFragment.Actions action, int value) {
|
||||||
|
PreferenceHelper.setFontSize(getActivity(), value);
|
||||||
|
updateTextEditor();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateTextEditor() {
|
private void updateTextEditor() {
|
||||||
final boolean countLines = PreferenceHelper.getWrapText(getActivity());
|
final boolean wrapText = PreferenceHelper.getWrapText(getActivity());
|
||||||
final boolean syntaxHighlight = PreferenceHelper.getSyntaxHiglight(getActivity());
|
final boolean syntaxHighlight = PreferenceHelper.getSyntaxHiglight(getActivity());
|
||||||
final boolean useMonospace = PreferenceHelper.getUseMonospace(getActivity());
|
final boolean useMonospace = PreferenceHelper.getUseMonospace(getActivity());
|
||||||
final String encoding = PreferenceHelper.getEncoding(getActivity());
|
final String encoding = PreferenceHelper.getEncoding(getActivity());
|
||||||
|
final int fontSize = PreferenceHelper.getFontSize(getActivity());
|
||||||
|
|
||||||
if (this.sWrapText != countLines) {
|
if (this.sWrapText != wrapText) {
|
||||||
this.sWrapText = countLines;
|
this.sWrapText = wrapText;
|
||||||
final String s = this.mEditor.getText().toString();
|
this.mEditor.setText(this.mEditor.getText().toString());
|
||||||
//inflateOfWrapText();
|
this.mEditor.setHorizontallyScrolling(!this.sWrapText);
|
||||||
this.mEditor.setText(s);
|
if (!this.sWrapText) {
|
||||||
configureEditText();
|
int paddingLeft = (int) PixelDipConverter.convertDpToPixel(sFontSize * 1.5f, getActivity());
|
||||||
|
mEditor.setPadding(paddingLeft, 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
int paddingLeft = (int) PixelDipConverter.convertDpToPixel(5, getActivity());
|
||||||
|
mEditor.setPadding(paddingLeft, 0, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.sColorSyntax != syntaxHighlight) {
|
if (this.sColorSyntax != syntaxHighlight) {
|
||||||
this.sColorSyntax = syntaxHighlight;
|
this.sColorSyntax = syntaxHighlight;
|
||||||
final String s = this.mEditor.getText().toString();
|
this.mEditor.setText(this.mEditor.getText().toString());
|
||||||
//inflateOfWrapText();
|
|
||||||
this.mEditor.setText(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mUseMonospace != useMonospace) {
|
if (this.mUseMonospace != useMonospace) {
|
||||||
this.mUseMonospace = useMonospace;
|
this.mUseMonospace = useMonospace;
|
||||||
this.mEditor.setTypeface(Typeface.MONOSPACE);
|
this.mEditor.setTypeface(Typeface.MONOSPACE);
|
||||||
//final String s = this.mEditor.getText().toString();
|
}
|
||||||
//inflateOfWrapText();
|
|
||||||
//this.mEditor.setText(s);
|
if (this.sFontSize != fontSize) {
|
||||||
|
this.sFontSize = fontSize;
|
||||||
|
int paddingLeft = (int) PixelDipConverter.convertDpToPixel(fontSize * 1.5f, getActivity());
|
||||||
|
mEditor.setPadding(paddingLeft, 0, 0, 0);
|
||||||
|
this.mEditor.setTextSize(fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.mCurrentEncoding.equals(encoding)) {
|
if (!this.mCurrentEncoding.equals(encoding)) {
|
||||||
@ -248,20 +274,6 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureEditText() {
|
|
||||||
this.mEditor.setHorizontallyScrolling(!this.sWrapText);
|
|
||||||
if (!this.sWrapText) {
|
|
||||||
int paddingLeft = (int) PixelDipConverter.convertDpToPixel(25, getActivity());
|
|
||||||
mEditor.setPadding(paddingLeft, 0, 0, 0);
|
|
||||||
} else {
|
|
||||||
int paddingLeft = (int) PixelDipConverter.convertDpToPixel(5, getActivity());
|
|
||||||
mEditor.setPadding(paddingLeft, 0, 0, 0);
|
|
||||||
}
|
|
||||||
if(this.mUseMonospace){
|
|
||||||
this.mEditor.setTypeface(Typeface.MONOSPACE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SaveFile extends AsyncTask<Void, Void, Void> {
|
class SaveFile extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -301,7 +313,6 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
ID_REDO = R.id.im_redo;
|
ID_REDO = R.id.im_redo;
|
||||||
private static final int SYNTAX_DELAY_MILLIS =
|
private static final int SYNTAX_DELAY_MILLIS =
|
||||||
0;
|
0;
|
||||||
private static final float textSize = 16;
|
|
||||||
private final Handler updateHandler =
|
private final Handler updateHandler =
|
||||||
new Handler();
|
new Handler();
|
||||||
private final TextPaint mPaintNumbers =
|
private final TextPaint mPaintNumbers =
|
||||||
@ -346,11 +357,11 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
this.mScale = context.getResources()
|
this.mScale = context.getResources()
|
||||||
.getDisplayMetrics().density;
|
.getDisplayMetrics().density;
|
||||||
init(context);
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init the class
|
// Init the class
|
||||||
private void init(final Context context) {
|
private void init() {
|
||||||
mEditHistory = new EditHistory();
|
mEditHistory = new EditHistory();
|
||||||
mChangeListener =
|
mChangeListener =
|
||||||
new EditTextChangeListener();
|
new EditTextChangeListener();
|
||||||
@ -361,7 +372,7 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
getTextColors().getDefaultColor());
|
getTextColors().getDefaultColor());
|
||||||
this.mPaintNumbers
|
this.mPaintNumbers
|
||||||
.setTextSize(
|
.setTextSize(
|
||||||
textSize * this.mScale * 0.8f);
|
sFontSize);
|
||||||
this.mPaintNumbers.setAntiAlias(true);
|
this.mPaintNumbers.setAntiAlias(true);
|
||||||
|
|
||||||
// Syntax editor
|
// Syntax editor
|
||||||
@ -393,6 +404,12 @@ public class EditorFragment extends Fragment implements EditDialogFragment.EditD
|
|||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTextSize(float size) {
|
||||||
|
super.setTextSize(size);
|
||||||
|
this.mPaintNumbers.setTextSize(sFontSize);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013 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 Turbo Editor. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.vmihalachi.turboeditor.fragment;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.SeekBar;
|
||||||
|
|
||||||
|
import com.vmihalachi.turboeditor.R;
|
||||||
|
|
||||||
|
// ...
|
||||||
|
public class SeekbarDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
SeekBar mSeekBar;
|
||||||
|
|
||||||
|
public static SeekbarDialogFragment newInstance(final Actions action) {
|
||||||
|
return SeekbarDialogFragment.newInstance(action, 50, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SeekbarDialogFragment newInstance(final Actions action, final int current, final int max) {
|
||||||
|
final SeekbarDialogFragment f = new SeekbarDialogFragment();
|
||||||
|
final Bundle args = new Bundle();
|
||||||
|
args.putSerializable("action", action);
|
||||||
|
args.putInt("current", current);
|
||||||
|
args.putInt("max", max);
|
||||||
|
f.setArguments(args);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
|
||||||
|
final Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
final Dialog dialog = getDialog();
|
||||||
|
final Actions action = (Actions) getArguments().getSerializable("action");
|
||||||
|
final String title;
|
||||||
|
switch (action) {
|
||||||
|
case FileSize:
|
||||||
|
title = getString(R.string.text_size);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
title = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dialog.setTitle(title);
|
||||||
|
|
||||||
|
final View view = inflater.inflate(R.layout.dialog_fragment_seekbar, container);
|
||||||
|
this.mSeekBar = (SeekBar) view.findViewById(android.R.id.input);
|
||||||
|
this.mSeekBar.setProgress(getArguments().getInt("current"));
|
||||||
|
this.mSeekBar.setMax(getArguments().getInt("max"));
|
||||||
|
|
||||||
|
view.findViewById(android.R.id.button1)
|
||||||
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(final View v) {
|
||||||
|
returnData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
void returnData(){
|
||||||
|
try {
|
||||||
|
((onSeekbarDialogDismissed) getTargetFragment()).onSeekbarDialogDismissed(
|
||||||
|
(Actions) getArguments().getSerializable("action"),
|
||||||
|
mSeekBar.getProgress()
|
||||||
|
);
|
||||||
|
} catch (Exception e){
|
||||||
|
try {
|
||||||
|
((onSeekbarDialogDismissed) getActivity()).onSeekbarDialogDismissed(
|
||||||
|
(Actions) getArguments().getSerializable("action"),
|
||||||
|
mSeekBar.getProgress()
|
||||||
|
);
|
||||||
|
} catch (Exception e2){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Actions {
|
||||||
|
FileSize
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface onSeekbarDialogDismissed {
|
||||||
|
void onSeekbarDialogDismissed(Actions action, int value);
|
||||||
|
}
|
||||||
|
}
|
@ -57,6 +57,10 @@ public final class PreferenceHelper {
|
|||||||
return getPrefs(context).getString("editor_encoding", "UTF-8");
|
return getPrefs(context).getString("editor_encoding", "UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getFontSize(Context context) {
|
||||||
|
return getPrefs(context).getInt("font_size", 18);
|
||||||
|
}
|
||||||
|
|
||||||
public static String getLastNavigatedFolder(Context context) {
|
public static String getLastNavigatedFolder(Context context) {
|
||||||
return getPrefs(context).getString("last_navigated_folder", SD_CARD_ROOT);
|
return getPrefs(context).getString("last_navigated_folder", SD_CARD_ROOT);
|
||||||
}
|
}
|
||||||
@ -83,6 +87,10 @@ public final class PreferenceHelper {
|
|||||||
getEditor(context).putString("editor_encoding", value).commit();
|
getEditor(context).putString("editor_encoding", value).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setFontSize(Context context, int value) {
|
||||||
|
getEditor(context).putInt("font_size", value).commit();
|
||||||
|
}
|
||||||
|
|
||||||
public static void setLastNavigatedFolder(Context context, String value) {
|
public static void setLastNavigatedFolder(Context context, String value) {
|
||||||
getEditor(context).putString("last_navigated_folder", value).commit();
|
getEditor(context).putString("last_navigated_folder", value).commit();
|
||||||
}
|
}
|
||||||
|
48
Turbo Editor/src/main/res/layout/dialog_fragment_seekbar.xml
Normal file
48
Turbo Editor/src/main/res/layout/dialog_fragment_seekbar.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (C) 2013 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 Turbo Editor. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@android:id/input"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/dialog_edittext_margin"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:background="?android:attr/listDivider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/line_dimension"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:background="@drawable/holo_selector"
|
||||||
|
android:gravity="center_vertical|center_horizontal"
|
||||||
|
android:id="@android:id/button1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/dialog_button_padding"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@android:string/ok"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||||
|
</LinearLayout>
|
@ -36,7 +36,6 @@
|
|||||||
android:inputType="textMultiLine|textImeMultiLine|textNoSuggestions"
|
android:inputType="textMultiLine|textImeMultiLine|textNoSuggestions"
|
||||||
android:maxLength="@integer/editor_max_file_size"
|
android:maxLength="@integer/editor_max_file_size"
|
||||||
android:singleLine="false"
|
android:singleLine="false"
|
||||||
android:text="@null"
|
android:text="@null" />
|
||||||
android:textSize="@dimen/text_size_editor" />
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
@ -39,7 +39,8 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="@dimen/text_size_title"
|
android:textSize="@dimen/text_size_title"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:padding="@dimen/minimum_padding" />
|
android:padding="@dimen/minimum_padding"
|
||||||
|
android:textColor="@android:color/primary_text_dark_nodisable"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -40,10 +40,6 @@
|
|||||||
android:title="@string/preferenze"
|
android:title="@string/preferenze"
|
||||||
android:showAsAction="ifRoom|withText">
|
android:showAsAction="ifRoom|withText">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
|
||||||
android:id="@id/im_editor_encoding"
|
|
||||||
android:showAsAction="ifRoom"
|
|
||||||
android:title="@string/codifica"/>
|
|
||||||
<item
|
<item
|
||||||
android:id="@id/im_wrap_text"
|
android:id="@id/im_wrap_text"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
@ -59,6 +55,14 @@
|
|||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:title="@string/use_monospace"
|
android:title="@string/use_monospace"
|
||||||
android:checkable="true"/>
|
android:checkable="true"/>
|
||||||
|
<item
|
||||||
|
android:id="@id/im_editor_encoding"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/codifica"/>
|
||||||
|
<item
|
||||||
|
android:id="@id/im_text_size"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/text_size"/>
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<changelog bulletedList="true">
|
<changelog bulletedList="true">
|
||||||
|
|
||||||
|
<changelogversion versionName="1.2" changeDate="Oct 10, 2013">
|
||||||
|
<changelogtext>Now you can change the font size</changelogtext>
|
||||||
|
</changelogversion>
|
||||||
|
|
||||||
<changelogversion versionName="1.1" changeDate="Oct 6, 2013">
|
<changelogversion versionName="1.1" changeDate="Oct 6, 2013">
|
||||||
<changelogtext>Now you can create new files (open -> create new file)</changelogtext>
|
<changelogtext>Now you can create new files (open -> create new file)</changelogtext>
|
||||||
<changelogtext>Added the monospace font (choose it in the preferences)</changelogtext>
|
<changelogtext>Added the monospace font (choose it in the preferences)</changelogtext>
|
||||||
|
@ -21,9 +21,7 @@
|
|||||||
<!-- action bar background color -->
|
<!-- action bar background color -->
|
||||||
<color name="actionbar_background">#111111</color>
|
<color name="actionbar_background">#111111</color>
|
||||||
<!-- activity background color -->
|
<!-- activity background color -->
|
||||||
<color name="activity_background">#202020</color>
|
<color name="activity_background">#ff191919</color>
|
||||||
<!-- activity text color -->
|
|
||||||
<color name="activity_text_color">#fff7f7f9</color>
|
|
||||||
<!-- navigation drawer background color -->
|
<!-- navigation drawer background color -->
|
||||||
<color name="navigation_drawer_background">#1d1d1d</color>
|
<color name="navigation_drawer_background">#1d1d1d</color>
|
||||||
<!-- colors used as file icons -->
|
<!-- colors used as file icons -->
|
||||||
|
@ -34,5 +34,4 @@
|
|||||||
<dimen name="text_size_mega_title">25sp</dimen>
|
<dimen name="text_size_mega_title">25sp</dimen>
|
||||||
<dimen name="text_size_title">16sp</dimen>
|
<dimen name="text_size_title">16sp</dimen>
|
||||||
<dimen name="text_size_subtitle">14sp</dimen>
|
<dimen name="text_size_subtitle">14sp</dimen>
|
||||||
<dimen name="text_size_editor">16sp</dimen>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
<item type="id" name="im_syntax_highlight"/>
|
<item type="id" name="im_syntax_highlight"/>
|
||||||
<item type="id" name="im_use_monospace"/>
|
<item type="id" name="im_use_monospace"/>
|
||||||
<item type="id" name="im_new_file"/>
|
<item type="id" name="im_new_file"/>
|
||||||
|
<item type="id" name="im_text_size"/>
|
||||||
<!-- layout item ids -->
|
<!-- layout item ids -->
|
||||||
<item type="id" name="drawer_layout"/>
|
<item type="id" name="drawer_layout"/>
|
||||||
<item type="id" name="fragment_editor"/>
|
<item type="id" name="fragment_editor"/>
|
||||||
|
@ -116,7 +116,8 @@
|
|||||||
<string name="open_this_time_only">Open this time only</string>
|
<string name="open_this_time_only">Open this time only</string>
|
||||||
<string name="advise_editor_title">Are you missing Turbo Editor?</string>
|
<string name="advise_editor_title">Are you missing Turbo Editor?</string>
|
||||||
<string name="advise_editor_subtitle">The best free and open source file editor!</string>
|
<string name="advise_editor_subtitle">The best free and open source file editor!</string>
|
||||||
<string name="change_list_type">Change the list type</string>
|
<string name="change_list_type">Change The List Type</string>
|
||||||
<string name="use_monospace">Use monospace</string>
|
<string name="use_monospace">Use Monospace</string>
|
||||||
<string name="recent_files">Recent files</string>
|
<string name="recent_files">Recent Files</string>
|
||||||
|
<string name="text_size">Text Size</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
parent="android:Theme.Holo">
|
parent="android:Theme.Holo">
|
||||||
<item name="android:windowBackground">@color/activity_background</item>
|
<item name="android:windowBackground">@color/activity_background</item>
|
||||||
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
|
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
|
||||||
<item name="android:textColor">@color/activity_text_color</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ActionBarStyle"
|
<style name="ActionBarStyle"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user