Skip to content

Commit

Permalink
fixed issue 174
Browse files Browse the repository at this point in the history
  • Loading branch information
konradrenner committed May 21, 2018
1 parent 0d29546 commit f464352
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 10 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

You can also have a look on the GitHub release page: https://github.com/konradrenner/kolabnotes-android/releases

## [3.1.3] - 2018-05-21
### Fixed
- plus sign disappears after saving (issue 174)

## [3.1.2] - 2018-02-22
### Fixed
- TLS v1.1 and v1.2 support (issue 172)
Expand Down Expand Up @@ -87,7 +91,8 @@ You can also have a look on the GitHub release page: https://github.com/konradre
### Fixed
- First stable release, support for all major features of the Kolab notes format

[Unreleased]: https://github.com/konradrenner/kolabnotes-android/compare/3.1.2...HEAD
[Unreleased]: https://github.com/konradrenner/kolabnotes-android/compare/3.1.3...HEAD
[3.1.2]: https://github.com/konradrenner/kolabnotes-android/compare/3.1.2...3.1.3
[3.1.1]: https://github.com/konradrenner/kolabnotes-android/compare/3.1.1...3.1.2
[3.0.1]: https://github.com/konradrenner/kolabnotes-android/compare/3.0.1...3.1.1
[3.0.1]: https://github.com/konradrenner/kolabnotes-android/compare/3.0.0...3.0.1
Expand Down
20 changes: 20 additions & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,37 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-main-apk-res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processing-tools" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "org.kore.kolabnotes.android"
minSdkVersion 16
targetSdkVersion 26
versionCode 97
versionName "3.1.2"
versionCode 98
versionName "3.1.3"

//Running test
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
import java.util.Set;
import java.util.UUID;

import jp.wasabeef.richeditor.RichEditor;
import org.kore.kolabnotes.android.fragment.KolabNotesRichEditor;
import yuku.ambilwarna.AmbilWarnaDialog;

/**
Expand Down Expand Up @@ -121,7 +121,7 @@ public class DetailFragment extends Fragment implements OnAccountSwitchedListene
private String startUid;
private String startNotebook;

private RichEditor editor;
private KolabNotesRichEditor editor;

private EditText editText;

Expand Down Expand Up @@ -266,7 +266,7 @@ private void initTextEditor() {
boolean useRicheditor = Utils.getUseRicheditor(activity);

if(useRicheditor) {
editor = (RichEditor) activity.findViewById(R.id.detail_description);
editor = (KolabNotesRichEditor) activity.findViewById(R.id.detail_description);
editor.setVisibility(View.VISIBLE);
editor.setBackgroundColor(Color.TRANSPARENT);
editor.setEditorHeight(300);
Expand Down Expand Up @@ -450,7 +450,7 @@ void setNotebook(ActiveAccount activeAccount,String uid, boolean setGivenNoteboo
}

void initEditor(){
editor.setOnTextChangeListener(new RichEditor.OnTextChangeListener() {
editor.setOnTextChangeListener(new KolabNotesRichEditor.OnTextChangeListener() {
@Override
public void onTextChange(String s) {
DetailFragment.this.isDescriptionDirty = true;
Expand Down Expand Up @@ -1222,10 +1222,11 @@ void saveNote(boolean closeWhenSaved){

String notebookName = getNotebookSpinnerSelectionName();

String descriptionValue = repairImages(getDescriptionFromView());
String beforeRepair = getDescriptionFromView();
String descriptionValue = repairImages(beforeRepair);

if(descriptionValue != null && !descriptionValue.startsWith("<!DOCTYPE HTML")){
descriptionValue = HTMLSTART + repairImages(getDescriptionFromView()) + HTMLEND;
descriptionValue = HTMLSTART + repairImages(beforeRepair) + HTMLEND;
}

final ActiveAccount activeAccount = activeAccountRepository.getActiveAccount();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.kore.kolabnotes.android.fragment;

import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import jp.wasabeef.richeditor.RichEditor;

/**
* This class is just here to fix issue 22 and because it looks like wasabeef is not activly developing the richeditor any more.
* Have a look at these issues/pull requests: https://github.com/wasabeef/richeditor-android/pull/123/commits/c225299d443af660582877d232a27bcee14c2f70
* https://github.com/wasabeef/richeditor-android/issues/155
* https://github.com/wasabeef/richeditor-android/pull/145/commits/a71100298878f18bbe06cf1b2aac07bcadf838db
*
* @deprecated delete class and use a fixed version of wasabeef richeditor (if he will be active any day in the future again)
*/
public class KolabNotesRichEditor extends RichEditor{


public KolabNotesRichEditor(Context context) {
super(context);
}

public KolabNotesRichEditor(Context context, AttributeSet attrs) {
super(context, attrs);
}

public KolabNotesRichEditor(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

@Override
protected EditorWebViewClient createWebviewClient() {
return new KolabNotesEditorWebViewClient();
}

protected class KolabNotesEditorWebViewClient extends RichEditor.EditorWebViewClient{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
String decode = Uri.decode(url);

//really really dirty hack to fix issue 174
decode = decode.replaceAll("\\+","&plus;");

return super.shouldOverrideUrlLoading(view, decode);
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
android:textColorHint="@color/secondary_text_default_material_light" />
</FrameLayout>

<jp.wasabeef.richeditor.RichEditor
<org.kore.kolabnotes.android.fragment.KolabNotesRichEditor
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
Expand Down

0 comments on commit f464352

Please sign in to comment.