[go: nahoru, domu]

Skip to content

Commit

Permalink
fix local draft style saving by introducing an awful "getSpannedConte…
Browse files Browse the repository at this point in the history
…nt()" method :(
  • Loading branch information
maxme committed Feb 17, 2015
1 parent 8f9d5e4 commit f6ef4ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import android.annotation.SuppressLint;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.text.Editable;
import android.text.Spanned;
import android.text.style.CharacterStyle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -151,4 +154,9 @@ public CharSequence getContent() {
public void appendMediaFile(MediaFile mediaFile, String imageUrl, ImageLoader imageLoader) {
// TODO
}

@Override
public Spanned getSpannedContent() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import android.app.Activity;
import android.app.Fragment;
import android.text.Editable;
import android.text.Spanned;
import android.text.style.CharacterStyle;

import com.android.volley.toolbox.ImageLoader;

Expand All @@ -13,6 +16,8 @@ public abstract class EditorFragmentAbstract extends Fragment {
public abstract CharSequence getTitle();
public abstract CharSequence getContent();
public abstract void appendMediaFile(MediaFile mediaFile, String imageUrl, ImageLoader imageLoader);
// TODO: remove this as soon as we can (we'll need to drop the legacy editor or fix html2spanned translation)
public abstract Spanned getSpannedContent();

protected EditorFragmentListener mEditorFragmentListener;
protected boolean mFeaturedImageSupported;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
import android.text.Layout;
import android.text.Selection;
import android.text.Spannable;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.ArrowKeyMovementMethod;
import android.text.style.AlignmentSpan;
import android.text.style.CharacterStyle;
import android.text.style.QuoteSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
Expand Down Expand Up @@ -141,6 +143,11 @@ public void setContent(CharSequence text) {
}
}

@Override
public Spanned getSpannedContent() {
return mContentEditText.getText();
}

public void setLocalDraft(boolean isLocalDraft) {
mIsLocalDraft = isLocalDraft;
}
Expand Down

0 comments on commit f6ef4ce

Please sign in to comment.