diff --git a/app/build.gradle b/app/build.gradle
index d723556..379e25e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,8 +8,8 @@ android {
applicationId "org.kore.kolabnotes.android"
minSdkVersion 16
targetSdkVersion 23
- versionCode 60
- versionName "1.8.2"
+ versionCode 61
+ versionName "1.9.0"
//Running test
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/java/org/kore/kolabnotes/android/Utils.java b/app/src/main/java/org/kore/kolabnotes/android/Utils.java
index 93c4672..3500000 100755
--- a/app/src/main/java/org/kore/kolabnotes/android/Utils.java
+++ b/app/src/main/java/org/kore/kolabnotes/android/Utils.java
@@ -233,6 +233,16 @@ public static boolean getShowMetainformation(Context context) {
}
+ public static boolean getUseRicheditor(Context context) {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ if(prefs == null){
+ Log.d("getUseRicheditor","PreferenceManager prefs are null");
+ return true;
+ }
+ return prefs.getBoolean("pref_richeditor", true);
+
+ }
+
public static boolean getShowSyncNotifications(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if(prefs == null){
diff --git a/app/src/main/java/org/kore/kolabnotes/android/fragment/DetailFragment.java b/app/src/main/java/org/kore/kolabnotes/android/fragment/DetailFragment.java
index 68cc9b7..fdf84cb 100644
--- a/app/src/main/java/org/kore/kolabnotes/android/fragment/DetailFragment.java
+++ b/app/src/main/java/org/kore/kolabnotes/android/fragment/DetailFragment.java
@@ -13,6 +13,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.Html;
+import android.text.Spanned;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
@@ -105,6 +106,8 @@ public class DetailFragment extends Fragment{
private String startNotebook;
private RichEditor editor;
+
+ private EditText editText;
private AppCompatActivity activity;
@@ -156,23 +159,31 @@ public void onActivityCreated(Bundle savedInstanceState) {
setHasOptionsMenu(true);
- editor = (RichEditor)activity.findViewById(R.id.detail_description);
- editor.setBackgroundColor(getResources().getColor(R.color.background_material_light));
- editor.setEditorHeight(300);
- editor.setOnFocusChangeListener(new View.OnFocusChangeListener() {
- @Override
- public void onFocusChange(View view, boolean b) {
- final View bar = activity.findViewById(R.id.editor_bar);
- final int visibility = bar.getVisibility();
- if(visibility == View.GONE){
- bar.setVisibility(View.VISIBLE);
- }else{
- bar.setVisibility(View.GONE
- );
+ boolean useRicheditor = Utils.getUseRicheditor(activity);
+
+ if(useRicheditor) {
+ editor = (RichEditor) activity.findViewById(R.id.detail_description);
+ editor.setVisibility(View.VISIBLE);
+ editor.setBackgroundColor(getResources().getColor(R.color.background_material_light));
+ editor.setEditorHeight(300);
+ editor.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View view, boolean b) {
+ final View bar = activity.findViewById(R.id.editor_bar);
+ final int visibility = bar.getVisibility();
+ if (visibility == View.GONE) {
+ bar.setVisibility(View.VISIBLE);
+ } else {
+ bar.setVisibility(View.GONE
+ );
+ }
}
- }
- });
- initEditor();
+ });
+ initEditor();
+ }else{
+ editText = (EditText) activity.findViewById(R.id.detail_description_plain);
+ editText.setVisibility(View.VISIBLE);
+ }
// Handle Back Navigation :D
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@@ -291,7 +302,12 @@ void setToolbarColor(){
void setHtml(String text){
final String stripped = stripBody(text);
- editor.setHtml(stripped);
+ if(editor != null){
+ editor.setHtml(stripped);
+ }else{
+ Spanned fromHtml = Html.fromHtml(stripped);
+ editText.setText(fromHtml, TextView.BufferType.SPANNABLE);
+ }
}
String stripBody(String html){
@@ -947,11 +963,18 @@ public void onClick(DialogInterface dialog, int id) {
}
String getDescriptionFromView(){
- final String html = editor.getHtml();
- if(TextUtils.isEmpty(html)){
- return null;
+ if(editor != null){
+ final String html = editor.getHtml();
+ if(TextUtils.isEmpty(html)){
+ return null;
+ }
+ return html;
}
- return html;
+
+ StringBuilder sb = new StringBuilder(HTMLSTART);
+ sb.append(Html.toHtml(editText.getText()));
+ sb.append(HTMLEND);
+ return sb.toString();
}
private AlertDialog createNotebookDialog(){
diff --git a/app/src/main/res/drawable-hdpi/ic_format_list_bulleted_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_format_list_bulleted_white_24dp.png
new file mode 100644
index 0000000..0c5a50d
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_format_list_bulleted_white_24dp.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_format_list_bulleted_white_48dp.png b/app/src/main/res/drawable-hdpi/ic_format_list_bulleted_white_48dp.png
new file mode 100644
index 0000000..881ef8b
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_format_list_bulleted_white_48dp.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_format_list_numbered_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_format_list_numbered_white_24dp.png
new file mode 100644
index 0000000..41f4c68
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_format_list_numbered_white_24dp.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_format_list_numbered_white_48dp.png b/app/src/main/res/drawable-hdpi/ic_format_list_numbered_white_48dp.png
new file mode 100644
index 0000000..acd1249
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_format_list_numbered_white_48dp.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_format_list_bulleted_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_format_list_bulleted_white_24dp.png
new file mode 100644
index 0000000..63b17da
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_format_list_bulleted_white_24dp.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_format_list_bulleted_white_48dp.png b/app/src/main/res/drawable-mdpi/ic_format_list_bulleted_white_48dp.png
new file mode 100644
index 0000000..52b9eeb
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_format_list_bulleted_white_48dp.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_format_list_numbered_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_format_list_numbered_white_24dp.png
new file mode 100644
index 0000000..6149551
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_format_list_numbered_white_24dp.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_format_list_numbered_white_48dp.png b/app/src/main/res/drawable-mdpi/ic_format_list_numbered_white_48dp.png
new file mode 100644
index 0000000..fcb7575
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_format_list_numbered_white_48dp.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted_white_24dp.png
new file mode 100644
index 0000000..52b9eeb
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted_white_48dp.png b/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted_white_48dp.png
new file mode 100644
index 0000000..19f5f83
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted_white_48dp.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_format_list_numbered_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_format_list_numbered_white_24dp.png
new file mode 100644
index 0000000..fcb7575
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_format_list_numbered_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_format_list_numbered_white_48dp.png b/app/src/main/res/drawable-xhdpi/ic_format_list_numbered_white_48dp.png
new file mode 100644
index 0000000..e4a79b2
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_format_list_numbered_white_48dp.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted_white_24dp.png
new file mode 100644
index 0000000..881ef8b
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted_white_48dp.png b/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted_white_48dp.png
new file mode 100644
index 0000000..ec838eb
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted_white_48dp.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_list_numbered_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_format_list_numbered_white_24dp.png
new file mode 100644
index 0000000..acd1249
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_format_list_numbered_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_list_numbered_white_48dp.png b/app/src/main/res/drawable-xxhdpi/ic_format_list_numbered_white_48dp.png
new file mode 100644
index 0000000..ddddeda
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_format_list_numbered_white_48dp.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted_white_24dp.png
new file mode 100644
index 0000000..19f5f83
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted_white_48dp.png b/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted_white_48dp.png
new file mode 100644
index 0000000..c3f7b01
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted_white_48dp.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_list_numbered_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_format_list_numbered_white_24dp.png
new file mode 100644
index 0000000..e4a79b2
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_format_list_numbered_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_list_numbered_white_48dp.png b/app/src/main/res/drawable-xxxhdpi/ic_format_list_numbered_white_48dp.png
new file mode 100644
index 0000000..5eb047e
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_format_list_numbered_white_48dp.png differ
diff --git a/app/src/main/res/layout/fragment_detail.xml b/app/src/main/res/layout/fragment_detail.xml
index 68474d1..e11baac 100644
--- a/app/src/main/res/layout/fragment_detail.xml
+++ b/app/src/main/res/layout/fragment_detail.xml
@@ -271,6 +271,7 @@
+
+
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 7b05710..d03d776 100755
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -183,4 +183,6 @@
Importiere
Import abgebrochen
Noitizbuch importiert
+ Richtexteditor aktivieren
+ Aktiviert den Richtexteditor zum Erstellen von formattierten Notizen
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index ef9a8c2..4651c98 100755
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -169,4 +169,6 @@
Importation
Importation annulée
Notebook importés
+ Activer RichTextEditor
+ Active le RichTextEditor pour les notes formatées
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 28cc802..975ab83 100755
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -186,4 +186,6 @@
Importazione
Import cancellato
Notebook importati
+ Abilita RichTextEditor
+ Attiva la RichTextEditor per le note formattati
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 1cd6188..8fbd380 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -176,5 +176,7 @@
Импорт
Импорт блокнота отменён
Блокнот импортирован
+ Включить RichTextEditor
+ Включает RichTextEditor для отформатированных нот
diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml
index 867b614..b09be1d 100644
--- a/app/src/main/res/values-vi/strings.xml
+++ b/app/src/main/res/values-vi/strings.xml
@@ -192,4 +192,6 @@
nhập khẩu
nhập hủy
Máy tính xách tay nhập khẩu
+ Kích hoạt tính năng RichTextEditor
+ Cho phép các RichTextEditor cho các ghi chú được định dạng
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a9b931c..57cf913 100755
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -192,5 +192,7 @@
Importing
Notebook import canceled
Notebook imported
+ Enable Richtexteditor
+ Enables the Richtexteditor for formatted notes
diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml
index 368a32c..63f2ef9 100644
--- a/app/src/main/res/xml/pref_general.xml
+++ b/app/src/main/res/xml/pref_general.xml
@@ -11,6 +11,12 @@
android:summary="@string/pref_desc_metainformation"
android:defaultValue="true" />
+
+