diff --git a/WordPressEditor/build.gradle b/WordPressEditor/build.gradle index 4ae2db70b456..5b9e57069298 100644 --- a/WordPressEditor/build.gradle +++ b/WordPressEditor/build.gradle @@ -25,8 +25,8 @@ android { buildToolsVersion "22.0.1" defaultConfig { - versionCode 1 - versionName "0.1" + versionCode 2 + versionName "0.2" minSdkVersion 14 targetSdkVersion 22 } diff --git a/WordPressEditor/src/androidTest/java/org.wordpress.android.editor/EditorFragmentTest.java b/WordPressEditor/src/androidTest/java/org.wordpress.android.editor/EditorFragmentTest.java index 14d1132aff0d..6ebb9d09fc47 100644 --- a/WordPressEditor/src/androidTest/java/org.wordpress.android.editor/EditorFragmentTest.java +++ b/WordPressEditor/src/androidTest/java/org.wordpress.android.editor/EditorFragmentTest.java @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.concurrent.CountDownLatch; import static org.wordpress.android.editor.TestingUtils.waitFor; @@ -29,13 +30,7 @@ public void testDomLoadedCallbackReceived() { // initJsEditor() should have been called on setup assertTrue(mFragment.mInitCalled); - long start = System.currentTimeMillis(); - while(!mFragment.mDomLoaded) { - waitFor(10); - if (System.currentTimeMillis() - start > 5000) { - throw(new RuntimeException("Callback wait timed out")); - } - } + waitForOnDomLoaded(); // The JS editor should have sent out a callback when the DOM loaded, triggering onDomLoaded() assertTrue(mFragment.mDomLoaded); @@ -103,4 +98,78 @@ public void testFormatBarToggledOnSelectedFieldChanged() { // The HTML button should always be enabled assertTrue(htmlButton.isEnabled()); } + + public void testHtmlModeToggleTextTransfer() throws InterruptedException { + waitForOnDomLoaded(); + + final View view = mFragment.getView(); + + if (view == null) { + throw (new IllegalStateException("Fragment view is empty")); + } + + final ToggleButton htmlButton = (ToggleButton) view.findViewById(R.id.format_bar_button_html); + + String content = mFragment.getContent().toString(); + + final SourceViewEditText titleText = (SourceViewEditText) view.findViewById(R.id.sourceview_title); + final SourceViewEditText contentText = (SourceViewEditText) view.findViewById(R.id.sourceview_content); + + // -- Check that title and content text is properly loaded into the EditTexts when switching to HTML mode + + final CountDownLatch uiThreadLatch1 = new CountDownLatch(1); + + mActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + htmlButton.performClick(); // Turn on HTML mode + + uiThreadLatch1.countDown(); + } + }); + + uiThreadLatch1.await(); + + // The HTML mode fields should be populated with the raw HTML loaded into the WebView on load + // (see MockEditorActivity) + assertEquals("A title", titleText.getText().toString()); + assertEquals(content, contentText.getText().toString()); + + // -- Check that the title and content text is updated in the WebView when switching back from HTML mode + + final CountDownLatch uiThreadLatch2 = new CountDownLatch(1); + + mActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + titleText.setText("new title"); + contentText.setText("new content"); + + // Check that getTitle() and getContent() return latest version even in HTML mode + assertEquals("new title", mFragment.getTitle()); + assertEquals("new content", mFragment.getContent()); + + htmlButton.performClick(); // Turn off HTML mode + + uiThreadLatch2.countDown(); + } + }); + + uiThreadLatch2.await(); + + waitFor(300); // Wait for JS to update the title/content + + assertEquals("new title", mFragment.getTitle()); + assertEquals("new content", mFragment.getContent()); + } + + private void waitForOnDomLoaded() { + long start = System.currentTimeMillis(); + while(!mFragment.mDomLoaded) { + waitFor(10); + if (System.currentTimeMillis() - start > 5000) { + throw(new RuntimeException("Callback wait timed out")); + } + } + } } \ No newline at end of file diff --git a/WordPressEditor/src/androidTest/java/org.wordpress.android.editor/MockEditorActivity.java b/WordPressEditor/src/androidTest/java/org.wordpress.android.editor/MockEditorActivity.java index f2df6c86eca7..ca10bea7fef0 100644 --- a/WordPressEditor/src/androidTest/java/org.wordpress.android.editor/MockEditorActivity.java +++ b/WordPressEditor/src/androidTest/java/org.wordpress.android.editor/MockEditorActivity.java @@ -11,6 +11,8 @@ public class MockEditorActivity extends AppCompatActivity implements EditorFragmentAbstract.EditorFragmentListener { public static final int LAYOUT_ID = 999; + EditorFragment mEditorFragment; + @SuppressWarnings("ResourceType") @Override protected void onCreate(Bundle savedInstanceState) { @@ -23,14 +25,15 @@ protected void onCreate(Bundle savedInstanceState) { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); - EditorFragment fragment = new EditorFragmentForTests(); - fragmentTransaction.add(linearLayout.getId(), fragment, "editorFragment"); + mEditorFragment = new EditorFragmentForTests(); + fragmentTransaction.add(linearLayout.getId(), mEditorFragment, "editorFragment"); fragmentTransaction.commit(); } @Override public void onEditorFragmentInitialized() { - + mEditorFragment.setTitle("A title"); + mEditorFragment.setContent(Utils.getHtmlFromFile(this, "example-content.html")); } @Override diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragment.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragment.java index 1431b4674bc3..ab51ff291f63 100755 --- a/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragment.java +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragment.java @@ -1,17 +1,21 @@ package org.wordpress.android.editor; import android.annotation.SuppressLint; +import android.content.Context; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.os.Looper; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; +import android.text.Editable; +import android.text.SpannableString; import android.text.Spanned; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; import android.webkit.WebView; import android.widget.ToggleButton; @@ -29,20 +33,14 @@ import java.util.concurrent.TimeUnit; public class EditorFragment extends EditorFragmentAbstract implements View.OnClickListener, View.OnTouchListener, - OnJsEditorStateChangedListener { + OnJsEditorStateChangedListener, OnImeBackListener { private static final String ARG_PARAM_TITLE = "param_title"; private static final String ARG_PARAM_CONTENT = "param_content"; private static final String JS_CALLBACK_HANDLER = "nativeCallbackHandler"; private static final String TAG_FORMAT_BAR_BUTTON_MEDIA = "media"; - private static final String TAG_FORMAT_BAR_BUTTON_BOLD = "bold"; - private static final String TAG_FORMAT_BAR_BUTTON_ITALIC = "italic"; - private static final String TAG_FORMAT_BAR_BUTTON_QUOTE = "blockquote"; - private static final String TAG_FORMAT_BAR_BUTTON_UL = "unorderedList"; - private static final String TAG_FORMAT_BAR_BUTTON_OL = "orderedList"; private static final String TAG_FORMAT_BAR_BUTTON_LINK = "link"; - private static final String TAG_FORMAT_BAR_BUTTON_STRIKETHROUGH = "strikeThrough"; private static final float TOOLBAR_ALPHA_ENABLED = 1; private static final float TOOLBAR_ALPHA_DISABLED = 0.5f; @@ -51,6 +49,12 @@ public class EditorFragment extends EditorFragmentAbstract implements View.OnCli private String mContentHtml = ""; private EditorWebViewAbstract mWebView; + private View mSourceView; + private SourceViewEditText mSourceViewTitle; + private SourceViewEditText mSourceViewContent; + + private String mTitlePlaceholder = ""; + private String mContentPlaceholder = ""; private boolean mHideActionBarOnSoftKeyboardUp; @@ -80,24 +84,30 @@ public void onCreate(Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_editor, container, false); - mWebView = (EditorWebViewAbstract) view.findViewById(R.id.webview); - - mWebView.setOnTouchListener(this); - // Setup hiding the action bar when the soft keyboard is displayed for narrow viewports if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && !getResources().getBoolean(R.bool.is_large_tablet_landscape)) { mHideActionBarOnSoftKeyboardUp = true; } - // Intercept back key presses while the keyboard is up, and reveal the action bar - mWebView.setOnImeBackListener(new EditorWebViewAbstract.OnImeBackListener() { + // -- WebView configuration + + mWebView = (EditorWebViewAbstract) view.findViewById(R.id.webview); + + mWebView.setOnTouchListener(this); + mWebView.setOnImeBackListener(this); + + // Ensure that the content field is always filling the remaining screen space + mWebView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override - public void onImeBack() { - ActionBar actionBar = getActionBar(); - if (mHideActionBarOnSoftKeyboardUp && actionBar != null && !actionBar.isShowing()) { - actionBar.show(); - } + public void onLayoutChange(View v, int left, int top, int right, int bottom, + int oldLeft, int oldTop, int oldRight, int oldBottom) { + mWebView.post(new Runnable() { + @Override + public void run() { + mWebView.execJavaScriptFromString("ZSSEditor.refreshVisibleViewportSize();"); + } + }); } }); @@ -105,33 +115,59 @@ public void onImeBack() { initJsEditor(); - ToggleButton mediaButton = (ToggleButton) view.findViewById(R.id.format_bar_button_media); - mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_MEDIA, mediaButton); + // -- HTML mode configuration + + mSourceView = view.findViewById(R.id.sourceview); + mSourceViewTitle = (SourceViewEditText) view.findViewById(R.id.sourceview_title); + mSourceViewContent = (SourceViewEditText) view.findViewById(R.id.sourceview_content); + + // Toggle format bar on/off as user changes focus between title and content in HTML mode + mSourceViewTitle.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + updateFormatBarEnabledState(!hasFocus); + } + }); + + mSourceViewTitle.setOnTouchListener(this); + mSourceViewContent.setOnTouchListener(this); + + mSourceViewTitle.setOnImeBackListener(this); + mSourceViewContent.setOnImeBackListener(this); + + mSourceViewContent.addTextChangedListener(new HtmlStyleTextWatcher()); + + mSourceViewTitle.setHint(mTitlePlaceholder); + + // -- Format bar configuration ToggleButton boldButton = (ToggleButton) view.findViewById(R.id.format_bar_button_bold); - mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_BOLD, boldButton); + mTagToggleButtonMap.put(getString(R.string.format_bar_tag_bold), boldButton); ToggleButton italicButton = (ToggleButton) view.findViewById(R.id.format_bar_button_italic); - mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_ITALIC, italicButton); + mTagToggleButtonMap.put(getString(R.string.format_bar_tag_italic), italicButton); ToggleButton quoteButton = (ToggleButton) view.findViewById(R.id.format_bar_button_quote); - mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_QUOTE, quoteButton); + mTagToggleButtonMap.put(getString(R.string.format_bar_tag_blockquote), quoteButton); ToggleButton ulButton = (ToggleButton) view.findViewById(R.id.format_bar_button_ul); - mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_UL, ulButton); + mTagToggleButtonMap.put(getString(R.string.format_bar_tag_unorderedList), ulButton); ToggleButton olButton = (ToggleButton) view.findViewById(R.id.format_bar_button_ol); - mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_OL, olButton); - - ToggleButton linkButton = (ToggleButton) view.findViewById(R.id.format_bar_button_link); - mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_LINK, linkButton); + mTagToggleButtonMap.put(getString(R.string.format_bar_tag_orderedList), olButton); // Tablet-only ToggleButton strikethroughButton = (ToggleButton) view.findViewById(R.id.format_bar_button_strikethrough); if (strikethroughButton != null) { - mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_STRIKETHROUGH, strikethroughButton); + mTagToggleButtonMap.put(getString(R.string.format_bar_tag_strikethrough), strikethroughButton); } + ToggleButton mediaButton = (ToggleButton) view.findViewById(R.id.format_bar_button_media); + mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_MEDIA, mediaButton); + + ToggleButton linkButton = (ToggleButton) view.findViewById(R.id.format_bar_button_link); + mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_LINK, linkButton); + ToggleButton htmlButton = (ToggleButton) view.findViewById(R.id.format_bar_button_html); htmlButton.setOnClickListener(this); @@ -167,8 +203,10 @@ public void onConfigurationChanged(Configuration newConfig) { if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE && !getResources().getBoolean(R.bool.is_large_tablet_landscape)) { mHideActionBarOnSoftKeyboardUp = true; + hideActionBarIfNeeded(); } else { mHideActionBarOnSoftKeyboardUp = false; + showActionBarIfNeeded(); } } @@ -189,43 +227,67 @@ protected void initJsEditor() { @Override public void onClick(View v) { int id = v.getId(); - if (id == R.id.format_bar_button_bold) { - mWebView.execJavaScriptFromString("ZSSEditor.setBold();"); - } else if (id == R.id.format_bar_button_italic) { - mWebView.execJavaScriptFromString("ZSSEditor.setItalic();"); - } else if (id == R.id.format_bar_button_strikethrough) { - mWebView.execJavaScriptFromString("ZSSEditor.setStrikeThrough();"); - } else if (id == R.id.format_bar_button_quote) { - mWebView.execJavaScriptFromString("ZSSEditor.setBlockquote();"); - } else if (id == R.id.format_bar_button_ul) { - mWebView.execJavaScriptFromString("ZSSEditor.setUnorderedList();"); - } else if (id == R.id.format_bar_button_ol) { - mWebView.execJavaScriptFromString("ZSSEditor.setOrderedList();"); + if (id == R.id.format_bar_button_html) { + clearFormatBarButtons(); + updateFormatBarEnabledState(true); + + if (((ToggleButton) v).isChecked()) { + mSourceViewTitle.setText(getTitle()); + + SpannableString spannableContent = new SpannableString(getContent()); + HtmlStyleUtils.styleHtmlForDisplay(spannableContent); + mSourceViewContent.setText(spannableContent); + + mWebView.setVisibility(View.GONE); + mSourceView.setVisibility(View.VISIBLE); + + mSourceViewContent.requestFocus(); + mSourceViewContent.setSelection(0); + + InputMethodManager imm = ((InputMethodManager) getActivity() + .getSystemService(Context.INPUT_METHOD_SERVICE)); + imm.showSoftInput(mSourceViewContent, InputMethodManager.SHOW_IMPLICIT); + } else { + mWebView.setVisibility(View.VISIBLE); + mSourceView.setVisibility(View.GONE); + + mTitle = mSourceViewTitle.getText().toString(); + mContentHtml = mSourceViewContent.getText().toString(); + updateVisualEditorFields(); + + mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_content').focus();"); + } } else if (id == R.id.format_bar_button_media) { // TODO: Handle inserting media ((ToggleButton) v).setChecked(false); } else if (id == R.id.format_bar_button_link) { // TODO: Handle inserting a link ((ToggleButton) v).setChecked(false); - } else if (id == R.id.format_bar_button_html) { - // TODO: Handle HTML mode toggling - ((ToggleButton) v).setChecked(false); + } else { + if (v instanceof ToggleButton) { + onFormattingButtonClicked((ToggleButton) v); + } } } @Override public boolean onTouch(View view, MotionEvent event) { - if (mHideActionBarOnSoftKeyboardUp && event.getAction() == MotionEvent.ACTION_UP) { - // If the WebView has received a touch event, the keyboard will be displayed and the action bar should hide - ActionBar actionBar = getActionBar(); - if (actionBar != null && actionBar.isShowing()) { - actionBar.hide(); - return false; - } + if (event.getAction() == MotionEvent.ACTION_UP) { + // If the WebView or EditText has received a touch event, the keyboard will be displayed and the action bar + // should hide + hideActionBarIfNeeded(); } return false; } + /** + * Intercept back button press while soft keyboard is visible. + */ + @Override + public void onImeBack() { + showActionBarIfNeeded(); + } + @SuppressLint("NewApi") private void enableWebDebugging(boolean enable) { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { @@ -254,6 +316,11 @@ public CharSequence getTitle() { return ""; } + if (mSourceView.getVisibility() == View.VISIBLE) { + mTitle = mSourceViewTitle.getText().toString(); + return StringUtils.notNullStr(mTitle); + } + if (Looper.myLooper() == Looper.getMainLooper()) { AppLog.d(T.EDITOR, "getTitle() called from UI thread"); } @@ -288,6 +355,11 @@ public CharSequence getContent() { return ""; } + if (mSourceView.getVisibility() == View.VISIBLE) { + mContentHtml = mSourceViewContent.getText().toString(); + return StringUtils.notNullStr(mContentHtml); + } + if (Looper.myLooper() == Looper.getMainLooper()) { AppLog.d(T.EDITOR, "getContent() called from UI thread"); } @@ -327,19 +399,36 @@ public Spanned getSpannedContent() { return null; } + @Override + public void setTitlePlaceholder(CharSequence placeholderText) { + mTitlePlaceholder = placeholderText.toString(); + } + + @Override + public void setContentPlaceholder(CharSequence placeholderText) { + mContentPlaceholder = placeholderText.toString(); + } + public void onDomLoaded() { mWebView.post(new Runnable() { public void run() { mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_content').setMultiline('true');"); - // Load title and content into ZSSEditor - mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_title').setHTML('" + - Utils.escapeHtml(mTitle) + "');"); - mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_content').setHTML('" + - Utils.escapeHtml(mContentHtml) + "');"); + // Set title and content placeholder text + mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_title').setPlaceholderText('" + + mTitlePlaceholder + "');"); + mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_content').setPlaceholderText('" + + mContentPlaceholder + "');"); - if (mHideActionBarOnSoftKeyboardUp && getActionBar() != null) { - getActionBar().hide(); + // Load title and content into ZSSEditor + updateVisualEditorFields(); + hideActionBarIfNeeded(); + + // Reset all format bar buttons (in case they remained active through activity re-creation) + ToggleButton htmlButton = (ToggleButton) getActivity().findViewById(R.id.format_bar_button_html); + htmlButton.setChecked(false); + for (ToggleButton button : mTagToggleButtonMap.values()) { + button.setChecked(false); } } }); @@ -367,10 +456,10 @@ public void run() { if (!focusedFieldId.isEmpty()) { switch(focusedFieldId) { case "zss_field_title": - updateToolbarEnabledState(false); + updateFormatBarEnabledState(false); break; case "zss_field_content": - updateToolbarEnabledState(true); + updateFormatBarEnabledState(true); break; } } @@ -395,11 +484,137 @@ public void onGetHtmlResponse(Map inputArgs) { } } - void updateToolbarEnabledState(boolean enabled) { + private void updateVisualEditorFields() { + mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_title').setPlainText('" + + Utils.escapeHtml(mTitle) + "');"); + mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_content').setHTML('" + + Utils.escapeHtml(mContentHtml) + "');"); + } + + /** + * Hide the action bar if needed. + */ + private void hideActionBarIfNeeded() { + + ActionBar actionBar = getActionBar(); + if (getActionBar() != null + && !isHardwareKeyboardPresent() + && mHideActionBarOnSoftKeyboardUp + && actionBar.isShowing()) { + getActionBar().hide(); + } + } + + /** + * Show the action bar if needed. + */ + private void showActionBarIfNeeded() { + + ActionBar actionBar = getActionBar(); + if (getActionBar() != null && !actionBar.isShowing()) { + getActionBar().show(); + } + } + + /** + * Returns true if a hardware keyboard is detected, otherwise false. + */ + private boolean isHardwareKeyboardPresent() { + Configuration config = getResources().getConfiguration(); + boolean returnValue = false; + if (config.keyboard != Configuration.KEYBOARD_NOKEYS) { + returnValue = true; + } + return returnValue; + } + + void updateFormatBarEnabledState(boolean enabled) { float alpha = (enabled ? TOOLBAR_ALPHA_ENABLED : TOOLBAR_ALPHA_DISABLED); for(ToggleButton button : mTagToggleButtonMap.values()) { button.setEnabled(enabled); button.setAlpha(alpha); } } + + private void clearFormatBarButtons() { + for (ToggleButton button : mTagToggleButtonMap.values()) { + if (button != null) { + button.setChecked(false); + } + } + } + + private void onFormattingButtonClicked(ToggleButton toggleButton) { + String tag = toggleButton.getTag().toString(); + + if (mWebView.getVisibility() == View.VISIBLE) { + mWebView.execJavaScriptFromString("ZSSEditor.set" + StringUtils.capitalize(tag) + "();"); + } else { + applyFormattingHtmlMode(toggleButton, tag); + } + } + + /** + * In HTML mode, applies formatting to selected text, or inserts formatting tag at current cursor position + * @param toggleButton format bar button which was clicked + * @param tag identifier tag + */ + private void applyFormattingHtmlMode(ToggleButton toggleButton, String tag) { + if (mSourceViewContent == null) { + return; + } + + // Replace style tags with their proper HTML tags + String htmlTag; + if (tag.equals(getString(R.string.format_bar_tag_bold))) { + htmlTag = "b"; + } else if (tag.equals(getString(R.string.format_bar_tag_italic))) { + htmlTag = "i"; + } else if (tag.equals(getString(R.string.format_bar_tag_strikethrough))) { + htmlTag = "del"; + } else if (tag.equals(getString(R.string.format_bar_tag_unorderedList))) { + htmlTag = "ul"; + } else if (tag.equals(getString(R.string.format_bar_tag_orderedList))) { + htmlTag = "ol"; + } else { + htmlTag = tag; + } + + int selectionStart = mSourceViewContent.getSelectionStart(); + int selectionEnd = mSourceViewContent.getSelectionEnd(); + + if (selectionStart > selectionEnd) { + int temp = selectionEnd; + selectionEnd = selectionStart; + selectionStart = temp; + } + + boolean textIsSelected = selectionEnd > selectionStart; + + String startTag = "<" + htmlTag + ">"; + String endTag = ""; + + // Add li tags together with ul and ol tags + if (htmlTag.equals("ul") || htmlTag.equals("ol")) { + startTag = startTag + "\n\t
  • "; + endTag = "
  • \n" + endTag; + } + + Editable content = mSourceViewContent.getText(); + if (textIsSelected) { + // Surround selected text with opening and closing tags + content.insert(selectionStart, startTag); + content.insert(selectionEnd + startTag.length(), endTag); + toggleButton.setChecked(false); + mSourceViewContent.setSelection(selectionEnd + startTag.length() + endTag.length()); + } else if (toggleButton.isChecked()) { + // Insert opening tag + content.insert(selectionStart, startTag); + mSourceViewContent.setSelection(selectionEnd + startTag.length()); + } else { + // Insert closing tag + content.insert(selectionEnd, endTag); + mSourceViewContent.setSelection(selectionEnd + endTag.length()); + } + } } diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java index 75dd0e5bdc89..52569c740ea5 100644 --- a/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java @@ -18,6 +18,8 @@ public abstract class EditorFragmentAbstract extends Fragment { public abstract CharSequence getContent(); public abstract void appendMediaFile(MediaFile mediaFile, String imageUrl, ImageLoader imageLoader); public abstract void appendGallery(MediaGallery mediaGallery); + public abstract void setTitlePlaceholder(CharSequence text); + public abstract void setContentPlaceholder(CharSequence text); // TODO: remove this as soon as we can (we'll need to drop the legacy editor or fix html2spanned translation) public abstract Spanned getSpannedContent(); diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorWebViewAbstract.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorWebViewAbstract.java index 902e51854fd0..23e30834d742 100644 --- a/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorWebViewAbstract.java +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorWebViewAbstract.java @@ -72,8 +72,4 @@ public boolean onKeyPreIme(int keyCode, KeyEvent event) { } return super.onKeyPreIme(keyCode, event); } - - public interface OnImeBackListener { - void onImeBack(); - } } diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/HtmlStyleTextWatcher.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/HtmlStyleTextWatcher.java new file mode 100644 index 000000000000..7d6205760a4e --- /dev/null +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/HtmlStyleTextWatcher.java @@ -0,0 +1,239 @@ +package org.wordpress.android.editor; + +import android.text.Editable; +import android.text.Spannable; +import android.text.TextWatcher; + +import org.wordpress.android.util.AppLog; +import org.wordpress.android.util.AppLog.T; + +public class HtmlStyleTextWatcher implements TextWatcher { + private enum Operation { + INSERT, DELETE, REPLACE, NONE + } + + private int mOffset; + private CharSequence mModifiedText; + private Operation mLastOperation; + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + if (s == null) { + return; + } + + int lastCharacterLocation = start + count - 1; + if (s.length() > lastCharacterLocation && lastCharacterLocation >= 0) { + if (after < count) { + if (after > 0) { + // Text was deleted and replaced by some other text + mLastOperation = Operation.REPLACE; + } else { + // Text was deleted only + mLastOperation = Operation.DELETE; + } + + mOffset = start; + mModifiedText = s.subSequence(start + after, start + count); + } + } + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + if (s == null) { + return; + } + + int lastCharacterLocation = start + count - 1; + if (s.length() > lastCharacterLocation) { + if (count > 0) { + if (before > 0) { + // Text was added, replacing some existing text + mLastOperation = Operation.REPLACE; + mModifiedText = s.subSequence(start, start + count); + } else { + // Text was added only + mLastOperation = Operation.INSERT; + mOffset = start; + mModifiedText = s.subSequence(start + before, start + count); + } + } + } + } + + @Override + public void afterTextChanged(Editable s) { + if (mModifiedText == null || s == null) { + return; + } + + SpanRange spanRange; + + // If the modified text included a tag or entity symbol ("<", ">", "&" or ";"), find its match and restyle + if (mModifiedText.toString().contains("<")) { + spanRange = getRespanRangeForChangedOpeningSymbol(s, "<"); + } else if (mModifiedText.toString().contains(">")) { + spanRange = getRespanRangeForChangedClosingSymbol(s, ">"); + } else if (mModifiedText.toString().contains("&")) { + spanRange = getRespanRangeForChangedOpeningSymbol(s, "&"); + } else if (mModifiedText.toString().contains(";")) { + spanRange = getRespanRangeForChangedClosingSymbol(s, ";"); + } else { + // If the modified text didn't include any tag or entity symbols, restyle if the modified text is inside + // a tag or entity + spanRange = getRespanRangeForNormalText(s, "<"); + if (spanRange == null) { + spanRange = getRespanRangeForNormalText(s, "&"); + } + } + + if (spanRange != null) { + updateSpans(s, spanRange); + } + + mModifiedText = null; + mLastOperation = Operation.NONE; + } + + /** + * For changes made which contain at least one opening symbol (e.g. '<' or '&'), whether added or deleted, returns + * the range of text which should have its style reapplied. + * @param content the content after modification + * @param openingSymbol the opening symbol recognized (e.g. '<' or '&') + * @return the range of characters to re-apply spans to + */ + protected SpanRange getRespanRangeForChangedOpeningSymbol(Editable content, String openingSymbol) { + // For simplicity, re-parse the document if text was replaced + if (mLastOperation == Operation.REPLACE) { + return new SpanRange(0, content.length()); + } + + String closingSymbol = getMatchingSymbol(openingSymbol); + + int firstOpeningTagLoc = mOffset + mModifiedText.toString().indexOf(openingSymbol); + int closingTagLoc; + if (mLastOperation == Operation.INSERT) { + // Apply span from the first added opening symbol until the closing symbol in the content matching the + // last added opening symbol + // e.g. pasting "<" before "/b>" - we want the span to be applied to all of "" + int lastOpeningTagLoc = mOffset + mModifiedText.toString().lastIndexOf(openingSymbol); + closingTagLoc = content.toString().indexOf(closingSymbol, lastOpeningTagLoc); + } else { + // Apply span until the first closing tag that appears after the deleted text + closingTagLoc = content.toString().indexOf(closingSymbol, mOffset); + } + + if (closingTagLoc > 0) { + return new SpanRange(firstOpeningTagLoc, closingTagLoc + 1); + } + return null; + } + + /** + * For changes made which contain at least one closing symbol (e.g. '>' or ';') and no opening symbols, whether + * added or deleted, returns the range of text which should have its style reapplied. + * @param content the content after modification + * @param closingSymbol the closing symbol recognized (e.g. '>' or ';') + * @return the range of characters to re-apply spans to + */ + protected SpanRange getRespanRangeForChangedClosingSymbol(Editable content, String closingSymbol) { + // For simplicity, re-parse the document if text was replaced + if (mLastOperation == Operation.REPLACE) { + return new SpanRange(0, content.length()); + } + + String openingSymbol = getMatchingSymbol(closingSymbol); + + int firstClosingTagInModLoc = mOffset + mModifiedText.toString().indexOf(closingSymbol); + int firstClosingTagAfterModLoc = content.toString().indexOf(closingSymbol, mOffset + mModifiedText.length()); + + int openingTagLoc = content.toString().lastIndexOf(openingSymbol, firstClosingTagInModLoc - 1); + if (openingTagLoc >= 0) { + if (firstClosingTagAfterModLoc >= 0) { + return new SpanRange(openingTagLoc, firstClosingTagAfterModLoc + 1); + } else { + return new SpanRange(openingTagLoc, content.length()); + } + } + return null; + } + + /** + * For changes made which contain no opening or closing symbols, checks whether the changed text is inside a tag, + * and if so returns the range of text which should have its style reapplied. + * @param content the content after modification + * @param openingSymbol the opening symbol of the tag to check for (e.g. '<' or '&') + * @return the range of characters to re-apply spans to + */ + protected SpanRange getRespanRangeForNormalText(Editable content, String openingSymbol) { + String closingSymbol = getMatchingSymbol(openingSymbol); + + int openingTagLoc = content.toString().lastIndexOf(openingSymbol, mOffset); + if (openingTagLoc >= 0) { + int closingTagLoc = content.toString().indexOf(closingSymbol, openingTagLoc); + if (closingTagLoc >= mOffset) { + return new SpanRange(openingTagLoc, closingTagLoc + 1); + } + } + return null; + } + + /** + * Clears and re-applies spans to {@code content} within range {@code spanRange} according to rules in + * {@link HtmlStyleUtils}. + * @param content the content to re-style + * @param spanRange the range within {@code content} to be re-styled + */ + protected void updateSpans(Spannable content, SpanRange spanRange) { + int spanStart = spanRange.getOpeningTagLoc(); + int spanEnd = spanRange.getClosingTagLoc(); + + if (spanStart > content.length() || spanEnd > content.length()) { + AppLog.d(T.EDITOR, "The specified span range was beyond the Spannable's length"); + return; + } + + HtmlStyleUtils.clearSpans(content, spanStart, spanEnd); + HtmlStyleUtils.styleHtmlForDisplay(content, spanStart, spanEnd); + } + + /** + * Returns the closing/opening symbol corresponding to the given opening/closing symbol. + */ + private String getMatchingSymbol(String symbol) { + switch(symbol) { + case "<": + return ">"; + case ">": + return "<"; + case "&": + return ";"; + case ";": + return "&"; + default: + return ""; + } + } + + /** + * Stores a pair of integers describing a range of values. + */ + protected static class SpanRange { + private final int mOpeningTagLoc; + private final int mClosingTagLoc; + + public SpanRange(int openingTagLoc, int closingTagLoc) { + mOpeningTagLoc = openingTagLoc; + mClosingTagLoc = closingTagLoc; + } + + public int getOpeningTagLoc() { + return mOpeningTagLoc; + } + + public int getClosingTagLoc() { + return mClosingTagLoc; + } + } +} \ No newline at end of file diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/HtmlStyleUtils.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/HtmlStyleUtils.java new file mode 100644 index 000000000000..cf2b8206d404 --- /dev/null +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/HtmlStyleUtils.java @@ -0,0 +1,142 @@ +package org.wordpress.android.editor; + +import android.graphics.Color; +import android.graphics.Typeface; +import android.support.annotation.NonNull; +import android.text.Spannable; +import android.text.style.CharacterStyle; +import android.text.style.ForegroundColorSpan; +import android.text.style.RelativeSizeSpan; +import android.text.style.StyleSpan; + +import org.wordpress.android.util.AppLog; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class HtmlStyleUtils { + public static final int TAG_COLOR = Color.rgb(0, 80, 130); + public static final int ATTRIBUTE_COLOR = Color.rgb(158, 158, 158); + + public static final String REGEX_HTML_TAGS = "(<\\/?[a-z][^<>]*>)"; + public static final String REGEX_HTML_ATTRIBUTES = "(?<==)('|\")(.*?\\1)(?=.*?>)"; + public static final String REGEX_HTML_COMMENTS = "()"; + public static final String REGEX_HTML_ENTITIES = "("|&|'|<|>| |¡|¢|£" + + "|¤|¥|¦|§|¨|©|ª|«|¬|­|®|¯|°|±" + + "|²|³|´|µ|¶|·|¸|¹|º|»|¼|½|¾|¿" + + "|À|Á|Â|Ã|Ä|Å|Æ|Ç|È|É|Ê|Ë|Ì|Í" + + "|Î|Ï|Ð|Ñ|Ò|Ó|Ô|Õ|Ö|×|Ø|Ù|Ú|Û" + + "|Ü|Ý|Þ|ß|à|á|â|ã|ä|å|æ|ç|è|é" + + "|ê|ë|ì|í|î|ï|ð|ñ|ò|ó|ô|õ|ö|÷" + + "|ø|ù|ú|û|ü|ý|þ|ÿ|Œ|œ|Š|š|Ÿ|ƒ" + + "|ˆ|˜|Α|Β|Γ|Δ|Ε|Ζ|Η|Θ|Ι|Κ|Λ|Μ" + + "|Ν|Ξ|Ο|Π|Ρ|Σ|Τ|Υ|Φ|Χ|Ψ|Ω|α|β" + + "|γ|δ|ε|ζ|η|θ|ι|κ|λ|μ|ν|ξ|ο|π" + + "|ρ|ς|σ|τ|υ|φ|χ|ψ|ω|ϑ|ϒ|ϖ| | " + + "| |‌|‍|‎|‏|–|—|‘|’|‚|“|”|„" + + "|†|‡|•|…|‰|′|″|‹|›|‾|⁄|€|ℑ" + + "|℘|ℜ|™|ℵ|←|↑|→|↓|↔|↵|⇐|⇑|⇒" + + "|⇓|⇔|∀|∂|∃|∅|∇|∈|∉|∋|∏|∑|−" + + "|∗|√|∝|∞|∠|∧|∨|∩|∪|∫|∴|∼|≅" + + "|≈|≠|≡|≤|≥|⊂|⊃|⊄|⊆|⊇|⊕|⊗|⊥" + + "|⋅|⌈|⌉|⌊|⌋|〈|〉|◊|♠|♣|♥|♦|"" + + "|&|'|<|>| |¡|¢|£|¤|¥|¦|§|¨|©|ª" + + "|«|¬|­|®|¯|°|±|²|³|´|µ|¶|·|¸" + + "|¹|º|»|¼|½|¾|¿|À|Á|Â|Ã|Ä" + + "|Å|Æ|Ç|È|É|Ê|Ë|Ì|Í|Î|Ï|Ð" + + "|Ñ|Ò|Ó|Ô|Õ|Ö|×|Ø|Ù|Ú|Û|Ü" + + "|Ý|Þ|ß|à|á|â|ã|ä|å|æ|ç|è" + + "|é|ê|ë|ì|í|î|ï|ð|ñ|ò|ó|ô" + + "|õ|ö|÷|ø|Ù|Ú|Û|Ü|ý|þ|ÿ|Œ" + + "|œ|Š|š|Ÿ|ƒ|ˆ|˜|Α|Β|Γ|Δ|Ε|Ζ" + + "|Η|Θ|Ι|Κ|Λ|Μ|Ν|Ξ|Ο|Π|Ρ|Σ|Τ|Υ|Φ" + + "|Χ|Ψ|Ω|α|β|γ|δ|ε|ζ|η|θ|ι|κ" + + "|λ|μ|ν|ξ|ο|π|ρ|ς|σ|τ|υ|φ|χ|ψ|ω" + + "|ϑ|&Upsih;|ϖ| | | |‌|‍|‎|‏|–|—|‘" + + "|’|‚|“|”|„|†|‡|•|…|‰|′|″" + + "|‹|›|‾|⁄|€|ℑ|℘|ℜ|™|ℵ|←|↑|→" + + "|↓|↔|↵|⇐|&UArr;|⇒|⇓|⇔|∀|∂|∃|∅|∇|∈" + + "|∉|∋|∏|∑|−|∗|√|∝|∞|∠|∧|∨|∩|∪|∫" + + "|∴|∼|≅|≈|≠|≡|≤|≥|⊂|⊃|⊄|⊆|⊇|⊕|⊗" + + "|⊥|⋅|⌈|⌉|⌊|⌋|⟨|⟩|◊|♠|♣|♥|♦)"; + + public static final int SPANNABLE_FLAGS = Spannable.SPAN_EXCLUSIVE_EXCLUSIVE; + + /** + * Apply styling rules to {@code content}. + */ + public static void styleHtmlForDisplay(@NonNull Spannable content) { + styleHtmlForDisplay(content, 0, content.length()); + } + + /** + * Apply styling rules to {@code content} inside the range from {@code start} to {@code end}. + * + * @param content the Spannable to apply style rules to + * @param start the index in {@code content} to start styling from + * @param end the index in {@code content} to style until + */ + public static void styleHtmlForDisplay(@NonNull Spannable content, int start, int end) { + applySpansByRegex(content, start, end, REGEX_HTML_TAGS); + applySpansByRegex(content, start, end, REGEX_HTML_ATTRIBUTES); + applySpansByRegex(content, start, end, REGEX_HTML_COMMENTS); + applySpansByRegex(content, start, end, REGEX_HTML_ENTITIES); + } + + /** + * Applies styles to {@code content} from {@code start} to {@code end}, based on rule {@code regex}. + * @param content the Spannable to apply style rules to + * @param start the index in {@code content} to start styling from + * @param end the index in {@code content} to style until + * @param regex the pattern to match for styling + */ + private static void applySpansByRegex(Spannable content, int start, int end, String regex) { + if (content == null || start < 0 || end < 0 || start > content.length() || end > content.length()) { + AppLog.d(AppLog.T.EDITOR, "applySpansByRegex() received invalid input"); + return; + } + + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(content.subSequence(start, end)); + + while (matcher.find()) { + int matchStart = matcher.start() + start; + int matchEnd = matcher.end() + start; + switch(regex) { + case REGEX_HTML_TAGS: + content.setSpan(new ForegroundColorSpan(TAG_COLOR), matchStart, matchEnd, SPANNABLE_FLAGS); + break; + case REGEX_HTML_ATTRIBUTES: + content.setSpan(new ForegroundColorSpan(ATTRIBUTE_COLOR), matchStart, matchEnd, SPANNABLE_FLAGS); + break; + case REGEX_HTML_COMMENTS: + content.setSpan(new ForegroundColorSpan(ATTRIBUTE_COLOR), matchStart, matchEnd, SPANNABLE_FLAGS); + content.setSpan(new StyleSpan(Typeface.ITALIC), matchStart, matchEnd, SPANNABLE_FLAGS); + content.setSpan(new RelativeSizeSpan(0.75f), matchStart, matchEnd, SPANNABLE_FLAGS); + break; + case REGEX_HTML_ENTITIES: + content.setSpan(new ForegroundColorSpan(TAG_COLOR), matchStart, matchEnd, SPANNABLE_FLAGS); + content.setSpan(new StyleSpan(Typeface.BOLD), matchStart, matchEnd, SPANNABLE_FLAGS); + content.setSpan(new RelativeSizeSpan(0.75f), matchStart, matchEnd, SPANNABLE_FLAGS); + break; + } + } + } + + /** + * Clears all relevant spans in {@code content} from {@code start} to {@code end}. Relevant spans are the subclasses + * of {@link CharacterStyle} applied by {@link HtmlStyleUtils#applySpansByRegex(Spannable, int, int, String)}. + * @param content the Spannable to clear styles from + * @param spanStart the index in {@code content} to start clearing styles from + * @param spanEnd the index in {@code content} to clear styles until + */ + public static void clearSpans(Spannable content, int spanStart, int spanEnd) { + CharacterStyle[] spans = content.getSpans(spanStart, spanEnd, CharacterStyle.class); + + for (CharacterStyle span : spans) { + if (span instanceof ForegroundColorSpan || span instanceof StyleSpan || span instanceof RelativeSizeSpan) { + content.removeSpan(span); + } + } + } +} diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/LegacyEditorFragment.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/LegacyEditorFragment.java index 9473611caa6d..f97b5488f14b 100644 --- a/WordPressEditor/src/main/java/org/wordpress/android/editor/LegacyEditorFragment.java +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/LegacyEditorFragment.java @@ -1129,4 +1129,14 @@ public void appendGallery(MediaGallery mediaGallery) { editableText.setSpan(as, selectionStart, selectionEnd + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); editableText.insert(selectionEnd + 1, "\n\n"); } + + @Override + public void setTitlePlaceholder(CharSequence text) { + + } + + @Override + public void setContentPlaceholder(CharSequence text) { + + } } diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/OnImeBackListener.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/OnImeBackListener.java new file mode 100644 index 000000000000..ed7ee09952bd --- /dev/null +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/OnImeBackListener.java @@ -0,0 +1,5 @@ +package org.wordpress.android.editor; + +public interface OnImeBackListener { + void onImeBack(); +} diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/RippleToggleButton.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/RippleToggleButton.java new file mode 100644 index 000000000000..4d932b322e0b --- /dev/null +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/RippleToggleButton.java @@ -0,0 +1,96 @@ +package org.wordpress.android.editor; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.support.annotation.NonNull; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.widget.ToggleButton; + +public class RippleToggleButton extends ToggleButton { + private static final int FRAME_RATE = 10; + private static final int DURATION = 250; + private static final int FILL_INITIAL_OPACITY = 200; + private static final int STROKE_INITIAL_OPACITY = 255; + + private float mHalfWidth; + private boolean mAnimationIsRunning = false; + private int mTimer = 0; + private Paint mFillPaint; + private Paint mStrokePaint; + + public RippleToggleButton(Context context) { + super(context); + } + + public RippleToggleButton(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + public RippleToggleButton(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(); + } + + private void init() { + if (isInEditMode()) { + return; + } + + int rippleColor = getResources().getColor(R.color.format_bar_ripple_animation); + + mFillPaint = new Paint(); + mFillPaint.setAntiAlias(true); + mFillPaint.setColor(rippleColor); + mFillPaint.setStyle(Paint.Style.FILL); + mFillPaint.setAlpha(FILL_INITIAL_OPACITY); + + mStrokePaint = new Paint(); + mStrokePaint.setAntiAlias(true); + mStrokePaint.setColor(rippleColor); + mStrokePaint.setStyle(Paint.Style.STROKE); + mStrokePaint.setStrokeWidth(2); + mStrokePaint.setAlpha(STROKE_INITIAL_OPACITY); + + setWillNotDraw(false); + } + + @Override + public void draw(@NonNull Canvas canvas) { + super.draw(canvas); + if (mAnimationIsRunning) { + if (DURATION <= mTimer * FRAME_RATE) { + mAnimationIsRunning = false; + mTimer = 0; + } else { + float progressFraction = ((float) mTimer * FRAME_RATE) / DURATION; + + mFillPaint.setAlpha((int) (FILL_INITIAL_OPACITY * (1 - progressFraction))); + mStrokePaint.setAlpha((int) (STROKE_INITIAL_OPACITY * (1 - progressFraction))); + + canvas.drawCircle(mHalfWidth, mHalfWidth, mHalfWidth * progressFraction, mFillPaint); + canvas.drawCircle(mHalfWidth, mHalfWidth, mHalfWidth * progressFraction, mStrokePaint); + + mTimer++; + } + + invalidate(); + } + } + + @Override + public boolean onTouchEvent(@NonNull MotionEvent event) { + startRippleAnimation(); + return super.onTouchEvent(event); + } + + private void startRippleAnimation() { + if (this.isEnabled() && !mAnimationIsRunning) { + mHalfWidth = getMeasuredWidth() / 2; + mAnimationIsRunning = true; + invalidate(); + } + } +} diff --git a/WordPressEditor/src/main/java/org/wordpress/android/editor/SourceViewEditText.java b/WordPressEditor/src/main/java/org/wordpress/android/editor/SourceViewEditText.java new file mode 100644 index 000000000000..12caa31d092b --- /dev/null +++ b/WordPressEditor/src/main/java/org/wordpress/android/editor/SourceViewEditText.java @@ -0,0 +1,60 @@ +package org.wordpress.android.editor; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Typeface; +import android.util.AttributeSet; +import android.view.KeyEvent; +import android.widget.EditText; + +import org.wordpress.android.util.AppLog; + +/** + * An EditText with support for {@link org.wordpress.android.editor.OnImeBackListener} and typeface setting + * using a custom XML attribute. + */ +public class SourceViewEditText extends EditText { + + private OnImeBackListener mOnImeBackListener; + + public SourceViewEditText(Context context) { + super(context); + } + + public SourceViewEditText(Context context, AttributeSet attrs) { + super(context, attrs); + setCustomTypeface(attrs); + } + + public SourceViewEditText(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + setCustomTypeface(attrs); + } + + public boolean onKeyPreIme(int keyCode, KeyEvent event) { + if(event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { + if (this.mOnImeBackListener != null) { + this.mOnImeBackListener.onImeBack(); + } + } + return super.onKeyPreIme(keyCode, event); + } + + public void setOnImeBackListener(OnImeBackListener listener) { + this.mOnImeBackListener = listener; + } + + private void setCustomTypeface(AttributeSet attrs) { + TypedArray values = getContext().obtainStyledAttributes(attrs, R.styleable.SourceViewEditText); + String typefaceName = values.getString(R.styleable.SourceViewEditText_fontFile); + if (typefaceName != null) { + try { + Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/" + typefaceName); + this.setTypeface(typeface); + } catch (RuntimeException e) { + AppLog.e(AppLog.T.EDITOR, "Could not load typeface " + typefaceName); + } + } + values.recycle(); + } +} \ No newline at end of file diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold.png index 89c3fdaaf1a9..5cadbdbb48d6 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold_disabled.png new file mode 100644 index 000000000000..07c51b6d6136 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold_highlighted.png old mode 100755 new mode 100644 index 3ccf0a48b808..f324e7f37b3e Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_bold_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html.png index 4d7e90d5b8c8..cf6598c46e80 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html_disabled.png new file mode 100644 index 000000000000..8e5e094d6a81 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html_highlighted.png old mode 100755 new mode 100644 index 508f9f312cab..ada19d880ee9 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_html_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic.png index 3d1e92ad76f8..57afe4b6d3d4 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic_disabled.png new file mode 100644 index 000000000000..0bc7247fe67d Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic_highlighted.png old mode 100755 new mode 100644 index ac2b45ade4da..826c9755fa47 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_italic_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link.png index 78f957d3f091..bb61856d5997 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link_disabled.png new file mode 100644 index 000000000000..58558dba2fde Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link_highlighted.png old mode 100755 new mode 100644 index 570389bc5614..c7bb8a76dde2 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_link_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media.png index 48ae074cea8a..b7ad17ad9a51 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media_disabled.png new file mode 100644 index 000000000000..78417e4e6a6c Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media_highlighted.png old mode 100755 new mode 100644 index 8a3730116c21..8325930d0047 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_media_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more.png index f96fd5d76d47..b3c93eec7b21 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more_disabled.png new file mode 100644 index 000000000000..390d61d7d93c Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more_highlighted.png old mode 100755 new mode 100644 index 9ab4487bf14c..5a2c8c54ddd2 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_more_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol.png index 8d0476031774..c5af4133edc8 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol_disabled.png new file mode 100644 index 000000000000..bd2a922714db Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol_highlighted.png old mode 100755 new mode 100644 index 201c5bd1aac6..81e998fbddac Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ol_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote.png index 8f7adfbf05bd..c264814751c3 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote_disabled.png new file mode 100644 index 000000000000..b61a08c79d48 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote_highlighted.png old mode 100755 new mode 100644 index d2ece2f507db..28bf6feee7f0 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_quote_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough.png index 19e4f6bb5458..431c7d878c48 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough_disabled.png new file mode 100644 index 000000000000..242e00a05669 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough_highlighted.png old mode 100755 new mode 100644 index 50b45a58caaf..bd0727aea154 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_strikethrough_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul.png index b4ce71ee686d..d241e520d27f 100644 Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul_disabled.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul_disabled.png new file mode 100644 index 000000000000..b61be7a2f75c Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul_highlighted.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul_highlighted.png old mode 100755 new mode 100644 index b9bca3f7365d..9781a9505d0d Binary files a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul_highlighted.png and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_button_ul_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-hdpi/format_bar_chevron.png b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_chevron.png new file mode 100644 index 000000000000..d47a4f1cee02 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-hdpi/format_bar_chevron.png differ diff --git a/WordPressEditor/src/main/res/drawable-sw600dp-hdpi/format_bar_button_html.png b/WordPressEditor/src/main/res/drawable-sw600dp-hdpi/format_bar_button_html.png deleted file mode 100644 index 884fafdc23d4..000000000000 Binary files a/WordPressEditor/src/main/res/drawable-sw600dp-hdpi/format_bar_button_html.png and /dev/null differ diff --git a/WordPressEditor/src/main/res/drawable-sw600dp-hdpi/format_bar_button_html_highlighted.png b/WordPressEditor/src/main/res/drawable-sw600dp-hdpi/format_bar_button_html_highlighted.png deleted file mode 100644 index 253fd109fffe..000000000000 Binary files a/WordPressEditor/src/main/res/drawable-sw600dp-hdpi/format_bar_button_html_highlighted.png and /dev/null differ diff --git a/WordPressEditor/src/main/res/drawable-sw600dp-xhdpi/format_bar_button_html.png b/WordPressEditor/src/main/res/drawable-sw600dp-xhdpi/format_bar_button_html.png deleted file mode 100644 index ce40ac2d0537..000000000000 Binary files a/WordPressEditor/src/main/res/drawable-sw600dp-xhdpi/format_bar_button_html.png and /dev/null differ diff --git a/WordPressEditor/src/main/res/drawable-sw600dp-xhdpi/format_bar_button_html_highlighted.png b/WordPressEditor/src/main/res/drawable-sw600dp-xhdpi/format_bar_button_html_highlighted.png deleted file mode 100644 index bfad2c98dc00..000000000000 Binary files a/WordPressEditor/src/main/res/drawable-sw600dp-xhdpi/format_bar_button_html_highlighted.png and /dev/null differ diff --git a/WordPressEditor/src/main/res/drawable-sw600dp-xxhdpi/format_bar_button_html.png b/WordPressEditor/src/main/res/drawable-sw600dp-xxhdpi/format_bar_button_html.png deleted file mode 100644 index 4572062f4b5e..000000000000 Binary files a/WordPressEditor/src/main/res/drawable-sw600dp-xxhdpi/format_bar_button_html.png and /dev/null differ diff --git a/WordPressEditor/src/main/res/drawable-sw600dp-xxhdpi/format_bar_button_html_highlighted.png b/WordPressEditor/src/main/res/drawable-sw600dp-xxhdpi/format_bar_button_html_highlighted.png deleted file mode 100644 index 6770c73a2337..000000000000 Binary files a/WordPressEditor/src/main/res/drawable-sw600dp-xxhdpi/format_bar_button_html_highlighted.png and /dev/null differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold.png index 255d97743526..32cd925b59a0 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold_disabled.png new file mode 100644 index 000000000000..886b58bde49a Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold_highlighted.png old mode 100755 new mode 100644 index 4c494c5dd1b5..b07ccec4096d Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_bold_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html.png index 73f29b97d78f..28ab8c3d320e 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html_disabled.png new file mode 100644 index 000000000000..1b430342f7bc Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html_highlighted.png old mode 100755 new mode 100644 index 1dc4d75f2463..346d6552cda3 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_html_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic.png index cc784480f194..21b7b5c65f23 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic_disabled.png new file mode 100644 index 000000000000..a88d483c5d89 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic_highlighted.png old mode 100755 new mode 100644 index 557316f6f18e..0d9b82bc5bda Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_italic_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link.png index 8f5f4cab8095..42da38879528 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link_disabled.png new file mode 100644 index 000000000000..62ad3bf734f7 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link_highlighted.png old mode 100755 new mode 100644 index 59c200cc359c..fb63462aa079 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_link_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media.png index c0fa0b66a5e6..e546778f7355 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media_disabled.png new file mode 100644 index 000000000000..5728b301d43a Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media_highlighted.png old mode 100755 new mode 100644 index e0cde28d7cdf..bb034b79ad89 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_media_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more.png index 4ecf7052aa90..20f3fd138217 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more_disabled.png new file mode 100644 index 000000000000..109cfcc799d2 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more_highlighted.png old mode 100755 new mode 100644 index 575698bb7ca3..b0889f02a1e1 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_more_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol.png index 766a81b1d33b..eefdd59da5a6 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol_disabled.png new file mode 100644 index 000000000000..97e1a3ae011d Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol_highlighted.png old mode 100755 new mode 100644 index 731bc7f81133..0de14b6502d6 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ol_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote.png index 10a864bc8590..0582726fedee 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote_disabled.png new file mode 100644 index 000000000000..973d7b4f18dc Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote_highlighted.png old mode 100755 new mode 100644 index 09d16fbb37bd..c374e951e636 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_quote_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough.png index 85097dbcf5d6..6b8cbe3d5539 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough_disabled.png new file mode 100644 index 000000000000..0683895e9dfd Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough_highlighted.png old mode 100755 new mode 100644 index 241292d3e3bd..b6dfe9d7ba52 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_strikethrough_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul.png index 1993c45fef01..192486349d8f 100644 Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul_disabled.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul_disabled.png new file mode 100644 index 000000000000..b881d8bf968f Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul_highlighted.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul_highlighted.png old mode 100755 new mode 100644 index f303ce361c3a..a017124ea0ed Binary files a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul_highlighted.png and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_button_ul_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_chevron.png b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_chevron.png new file mode 100644 index 000000000000..03b57a17ca1c Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xhdpi/format_bar_chevron.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold.png index 435049aee0ee..83378cd62cd8 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold_disabled.png new file mode 100644 index 000000000000..3466be62bba3 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold_highlighted.png old mode 100755 new mode 100644 index db0116bcfcc3..894b57518481 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_bold_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html.png index 4ae28495c8eb..ca57ef98ab9a 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html_disabled.png new file mode 100644 index 000000000000..707aca2b1af2 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html_highlighted.png old mode 100755 new mode 100644 index db0c60415725..f26b36df2802 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_html_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic.png index 184b1dfa6e63..2e766d7b8405 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic_disabled.png new file mode 100644 index 000000000000..104f0b73f169 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic_highlighted.png old mode 100755 new mode 100644 index 2b4a9376ae37..1126ba107abe Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_italic_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link.png index f08f26ddd165..e4518d2f50c5 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link_disabled.png new file mode 100644 index 000000000000..ae686a96eb4b Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link_highlighted.png old mode 100755 new mode 100644 index 2accfc4d4067..532bba2aa5dc Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_link_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media.png index 3be85757cf71..e764b0a12d11 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media_disabled.png new file mode 100644 index 000000000000..dbb45e4d05ea Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media_highlighted.png old mode 100755 new mode 100644 index cffc6f72e219..b88cec4cd6ff Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_media_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more.png index 34e74b09deb1..500f2dc71ec4 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more_disabled.png new file mode 100644 index 000000000000..bb7b665ed8cc Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more_highlighted.png old mode 100755 new mode 100644 index 4674a187bda0..17adaef8cea2 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_more_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol.png index 074aa098be6b..2e17b34b3361 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol_disabled.png new file mode 100644 index 000000000000..5bcc85934136 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol_highlighted.png old mode 100755 new mode 100644 index 93fc1eacf342..0ad3d5bdbcee Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ol_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote.png index 3f34d51000c6..d954ef1ed6c1 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote_disabled.png new file mode 100644 index 000000000000..00a61a47497f Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote_highlighted.png old mode 100755 new mode 100644 index 3607441c1331..82f4f902aab3 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_quote_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough.png index 263f3028796d..643f6ffef11c 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough_disabled.png new file mode 100644 index 000000000000..75076aa87c6a Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough_highlighted.png old mode 100755 new mode 100644 index fb86d4c54313..a0d194d45705 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_strikethrough_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul.png index ed54395d8295..ffba75e96b7e 100644 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul_disabled.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul_disabled.png new file mode 100644 index 000000000000..36fa8946d7aa Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul_disabled.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul_highlighted.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul_highlighted.png old mode 100755 new mode 100644 index 11ba3cf4c240..c0f6c41b4fd0 Binary files a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul_highlighted.png and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_button_ul_highlighted.png differ diff --git a/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_chevron.png b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_chevron.png new file mode 100644 index 000000000000..110b8ba5aaf6 Binary files /dev/null and b/WordPressEditor/src/main/res/drawable-xxhdpi/format_bar_chevron.png differ diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_bold_disabled_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_bold_disabled_state.xml new file mode 100755 index 000000000000..d0ee5f7df590 --- /dev/null +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_bold_disabled_state.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_bold_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_bold_selected_state.xml index 4ab6a2e2615e..9835de551bbf 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_bold_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_bold_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_bold_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_bold_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_bold_selector.xml index fdc1772d9ef1..2287d44987a5 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_bold_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_bold_selector.xml @@ -2,6 +2,7 @@ + - - - \ No newline at end of file diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_html_disabled_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_html_disabled_state.xml new file mode 100755 index 000000000000..e5c0e5feae40 --- /dev/null +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_html_disabled_state.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_html_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_html_selected_state.xml index 696a6ce9c0be..4ab895011c24 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_html_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_html_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_html_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_html_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_html_selector.xml index 86229c0f76e2..cc51e2f08dd8 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_html_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_html_selector.xml @@ -2,6 +2,7 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_italic_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_italic_selected_state.xml index 29eb69e4a705..3559953de6f0 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_italic_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_italic_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_italic_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_italic_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_italic_selector.xml index c627cb34c42f..21ba91650fad 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_italic_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_italic_selector.xml @@ -2,6 +2,7 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_link_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_link_selected_state.xml index 55102f1b1366..7aaad74f1008 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_link_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_link_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_link_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_link_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_link_selector.xml index 053cea8d32db..a71854054f07 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_link_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_link_selector.xml @@ -2,6 +2,7 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_media_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_media_selected_state.xml index 4b1563f0f273..1c9c0f4fa8c0 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_media_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_media_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_media_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_media_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_media_selector.xml index 003de550cc40..883a797a7c2d 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_media_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_media_selector.xml @@ -2,6 +2,7 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_ol_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_ol_selected_state.xml index 9d07fc4dc490..5209bdb8167b 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_ol_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_ol_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_ol_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_ol_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_ol_selector.xml index c0f849cd0264..7116a51df2d2 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_ol_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_ol_selector.xml @@ -2,6 +2,7 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_quote_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_quote_selected_state.xml index bcea43181cde..ea4f0b14dfcc 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_quote_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_quote_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_quote_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_quote_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_quote_selector.xml index bad08df8d9d1..9d2d91a25257 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_quote_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_quote_selector.xml @@ -2,6 +2,7 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_strikethrough_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_strikethrough_selected_state.xml index 1c89e03e9722..17f870fce508 100644 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_strikethrough_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_strikethrough_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_strikethrough_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_strikethrough_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_strikethrough_selector.xml index 07fe02a892c5..5208dcfcea22 100644 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_strikethrough_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_strikethrough_selector.xml @@ -2,6 +2,7 @@ + + + + + + diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_ul_selected_state.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_ul_selected_state.xml index d9e9929d6d5d..77f0b0021a34 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_ul_selected_state.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_ul_selected_state.xml @@ -6,11 +6,4 @@ android:src="@drawable/format_bar_button_ul_highlighted" android:gravity="center"/> - - - - - diff --git a/WordPressEditor/src/main/res/drawable/format_bar_button_ul_selector.xml b/WordPressEditor/src/main/res/drawable/format_bar_button_ul_selector.xml index d66242298f5b..ea9f0217f043 100755 --- a/WordPressEditor/src/main/res/drawable/format_bar_button_ul_selector.xml +++ b/WordPressEditor/src/main/res/drawable/format_bar_button_ul_selector.xml @@ -2,6 +2,8 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WordPressEditor/src/main/res/layout-w380dp/fragment_editor.xml b/WordPressEditor/src/main/res/layout-w380dp/fragment_editor.xml new file mode 100755 index 000000000000..a303fcff438a --- /dev/null +++ b/WordPressEditor/src/main/res/layout-w380dp/fragment_editor.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WordPressEditor/src/main/res/layout-sw600dp/fragment_editor.xml b/WordPressEditor/src/main/res/layout-w600dp/fragment_editor.xml similarity index 55% rename from WordPressEditor/src/main/res/layout-sw600dp/fragment_editor.xml rename to WordPressEditor/src/main/res/layout-w600dp/fragment_editor.xml index 26281530c6ab..b514d5523aa6 100644 --- a/WordPressEditor/src/main/res/layout-sw600dp/fragment_editor.xml +++ b/WordPressEditor/src/main/res/layout-w600dp/fragment_editor.xml @@ -1,5 +1,6 @@ + + + + + + + + + + + + - - + android:background="@drawable/format_bar_button_bold_selector" + android:tag="@string/format_bar_tag_bold"/> - + android:background="@drawable/format_bar_button_italic_selector" + android:tag="@string/format_bar_tag_italic"/> - + android:background="@drawable/format_bar_button_strikethrough_selector" + android:tag="@string/format_bar_tag_strikethrough"/> - - + android:background="@drawable/format_bar_button_ul_selector" + android:tag="@string/format_bar_tag_unorderedList"/> - + android:background="@drawable/format_bar_button_ol_selector" + android:tag="@string/format_bar_tag_orderedList"/> - + android:background="@drawable/format_bar_button_quote_selector" + android:tag="@string/format_bar_tag_blockquote"/> - + + + + + + + + + + + + + android:layout_weight="1" + android:layout_marginRight="@dimen/format_bar_scroll_right_margin"> - - + android:background="@drawable/format_bar_button_bold_selector" + android:tag="@string/format_bar_tag_bold"/> - + android:background="@drawable/format_bar_button_italic_selector" + android:tag="@string/format_bar_tag_italic"/> - + android:background="@drawable/format_bar_button_quote_selector" + android:tag="@string/format_bar_tag_blockquote"/> - + android:background="@drawable/format_bar_button_ul_selector" + android:tag="@string/format_bar_tag_unorderedList"/> - + android:background="@drawable/format_bar_button_ol_selector" + android:tag="@string/format_bar_tag_orderedList"/> - - + - + + @dimen/sourceview_side_margin_extra_large + @dimen/format_bar_button_margin_tablet_extra_large + @dimen/format_bar_button_group_tablet_extra_large + \ No newline at end of file diff --git a/WordPressEditor/src/main/res/values-w720dp/dimens.xml b/WordPressEditor/src/main/res/values-w720dp/dimens.xml new file mode 100644 index 000000000000..c56cac52f15a --- /dev/null +++ b/WordPressEditor/src/main/res/values-w720dp/dimens.xml @@ -0,0 +1,4 @@ + + + @dimen/sourceview_side_margin_large + \ No newline at end of file diff --git a/WordPressEditor/src/main/res/values/attrs.xml b/WordPressEditor/src/main/res/values/attrs.xml new file mode 100644 index 000000000000..bfe9ab434a87 --- /dev/null +++ b/WordPressEditor/src/main/res/values/attrs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WordPressEditor/src/main/res/values/colors.xml b/WordPressEditor/src/main/res/values/colors.xml index 79f935353f9d..7ed6b60e0baf 100755 --- a/WordPressEditor/src/main/res/values/colors.xml +++ b/WordPressEditor/src/main/res/values/colors.xml @@ -7,6 +7,12 @@ #cccccc - @color/wp_gray + @color/wp_gray_lighten_10 @color/wp_blue + #f9fbfc + @color/wp_gray_lighten_10 + + @color/wp_gray_lighten_10 + @color/wp_gray_lighten_30 + @color/wp_gray diff --git a/WordPressEditor/src/main/res/values/dimens.xml b/WordPressEditor/src/main/res/values/dimens.xml index e3f7d467b552..615b21e35a6a 100644 --- a/WordPressEditor/src/main/res/values/dimens.xml +++ b/WordPressEditor/src/main/res/values/dimens.xml @@ -1,25 +1,31 @@ - 40dp + 44dp + 49dp 5dp 2dp - 4dp 3dp + -7dp @dimen/format_bar_button_margin_tablet_small 2dp 7dp + 12dp @dimen/format_bar_button_group_tablet_small - 20dp - 30dp + 15dp + 25dp + 35dp 1dp 0.6dp 28dp - 37dp - 2dp + 15dp + 90dp + 170dp + 15dp + 15dp 20dp diff --git a/WordPressEditor/src/main/res/values/strings.xml b/WordPressEditor/src/main/res/values/strings.xml index cf23160a4174..c6dc090124f5 100644 --- a/WordPressEditor/src/main/res/values/strings.xml +++ b/WordPressEditor/src/main/res/values/strings.xml @@ -4,7 +4,12 @@ Content Title - + bold + italic + blockquote + unorderedList + orderedList + strikeThrough URL diff --git a/WordPressEditor/src/main/res/values/styles.xml b/WordPressEditor/src/main/res/values/styles.xml index 1bdc104c84d6..2f755e8ab6fc 100755 --- a/WordPressEditor/src/main/res/values/styles.xml +++ b/WordPressEditor/src/main/res/values/styles.xml @@ -19,17 +19,16 @@ @dimen/format_bar_button_margin_tablet - - + +