[go: nahoru, domu]

Skip to content

Commit

Permalink
Squashed 'libs/editor/' changes from a59304d..e0a8651
Browse files Browse the repository at this point in the history
e0a8651 0.2 version bump
084cff2 Merge pull request #201 from wordpress-mobile/issue/199-format-bar-tweaks
7c19426 Changed tablet layout from sw600dp to w600dp
2709e4b Dropped an unnecessary LinearLayout wrapper from the w380dp layout
a980b78 Added centered format bar layout for w380dp
e08332c Change ToggleButton to RippleToggleButton in w360dp layout
82bd171 Merge branch 'develop' into issue/199-format-bar-tweaks
e7ca66a Merge pull request #200 from wordpress-mobile/issue/131-animate-format-bar
3a2a584 Added layout for screens with at least 360dp width with no HorizontalScrollView
9ec3056 Removed padding between format bar buttons in phone layout
e6485b9 Merge branch 'develop' into issue/131-animate-format-bar
e2d9fd0 Added custom ToggleButton with ripple animation on click
09447d7 Merge pull request #198 from wordpress-mobile/feature/145-format-bar-updates
dc7376e Dropped duplicate HTML drawables for sw600dp
845b7e5 Switched the HTML mode separator back to WP Gray Lighten 30
71a2aee Added the chevron divider to the format bar
5e917a2 Merge branch 'develop' of github.com:wordpress-mobile/WordPress-Editor-Android into feature/145-format-bar-updates
4d1ea7a Merge pull request #195 from wordpress-mobile/issue/173-inconsistent-actionbar
d9ce482 EditorFrafment, now with less `this`.
a5d075f Refactored the actionbar showy/hidey logic
045f958 Explicitly showing and hiding the actionbar in onConfigurationChanged
c1aa14c Added disabled state to format button selectors.
1ad7901 Updated all the formatbar assets, now with more disabled icons.
832b022 Merge branch 'develop' of github.com:wordpress-mobile/WordPress-Editor-Android into feature/145-format-bar-updates
5a22e38 Merge pull request #191 from wordpress-mobile/issue/165-content-field-size
8e2f102 Merge pull request #193 from wordpress-mobile/revert-192-feature/travis-containers
752ac78 Revert "Update to new containers"
02da62f Merge branch 'develop' into issue/165-content-field-size
3c73747 Merge pull request #192 from wordpress-mobile/feature/travis-containers
ee7efcb Merge pull request #190 from wordpress-mobile/issue/188-save-html-mode
b78ee06 Update to new containers
b04f318 Merge branch 'develop' into issue/165-content-field-size
077f100 Merge pull request #189 from wordpress-mobile/issue/171-placeholder-text
34b3abe Refresh the viewport size whenever the WebView's layout is changed
2c9e7e6 Updated getTitle() and getContent() to return HTML mode text if it's active
e8e7018 Added new dimens to accomidate extra large screens.
bd9005b Format bar dimension updates for tablets; removed unused resources.
cacd197 Re-assigned content field padding to body and separator in editor.css
e36c158 Adjusted format bar height and colors.
b7bfb3e Removed the blue underline from the formatbar icons.
161d6e8 Renamed the HTML mode placeholder text color resource for clarity
4e3ad9f Fixed a bug where the placeholder text would not re-appear after deleting all the contents of a field in visual mode
3223321 Merge branch 'develop' of github.com:wordpress-mobile/WordPress-Editor-Android into feature/145-format-bar-updates
3adf410 Updated format bar icons.
f620ed1 Updated tablet layout xml with placeholder changes
42b0ecf Merge branch 'develop' into issue/171-placeholder-text
ee0b9b6 Fixed a broken test (missing abstract method implementations)
7778baf Updated editor CSS with placeholder color
fa83689 Added coloring for placeholder text in HTML mode
99df84f Added placeholder text loading to the example activity
b72468d Added support for setting the title and content placeholder text
19cbd24 Merge pull request #184 from wordpress-mobile/issue/177-html-mode-style
d1f8e0b Added javadocs for HTML styling methods
60d6252 Added some extra null checking/input validation to HTML styling
a395b9f Disabled spell check for the content field in HTML mode
22e63f2 HtmlStyleTextWatcher deletion/replacement improvements
4477963 Updated HTML styling tests
889fe1a Moved clearSpans() to HtmlStyleUtils
947c553 Added more HtmlStyleTextWatcher tests
a4b33d2 Cleaned up some HtmlStyleTextWatcher methods for readability and test support
99344b3 Expanded HtmlStyleTextWatcherTest
2b6128b Merge branch 'develop' into issue/177-html-mode-style
35f6740 Added a first round of unit tests for HtmlStyleTextWatcher
9e227e3 Refactored HtmlStyleTextWatcher to make testing easier
83e371b Merge pull request #182 from wordpress-mobile/feature/181-example-app-empty-button
25c40db Refactored offset usage in HtmlStyleTextWatcher for readability
7c9d00e Fixed some bugs in HtmlStyleTextWatcher's string parsing
9c0f957 Fixed bug that crashed the app when deleting a tag at the end of the content
c2d07ba Added a button to example app for launching the editor with no content
082ab40 Merge branch 'develop' into issue/177-html-mode-style
af99a4f Merge pull request #176 from wordpress-mobile/issue/11-html-mode
1786acf Fixed a bug where the soft keyboard would hide when switching from visual to HTML mode
a409730 Tweaked EditorFragmentTest.testHtmlModeToggleTextTransfer()
2317e0e Renamed CustomTextWatcher class to HtmlStyleTextWatcher
620bc96 Reduced size of comments and entities in HTML mode (reflecting iOS editor)
1c162ec Refactored CustomTextWatcher for better readability
ee2c25a Added a custom TextWatcher for HTML mode content which keeps the styling updated in realtime (first pass)
6078883 Added regex and styling rules for HTML comments to HtmlStyleUtils
c22f0c1 Refactoring of HtmlStyler (now HtmlStyleUtils)
26d1e47 Apply style to HTML tags/attributes when HTML mode is loaded
297f3a0 EditorFragment code cleanup
2bc922b Fixed some tablet-specific display issues
651b7e9 Added an integration test for HTML mode toggling
eeadafe Fixed an issue where an empty content field in HTML mode would not expand as text was added
9231926 Reset format bar buttons to unchecked state onDomLoaded
dcc1c08 Added support for showing/hiding the action bar in landscape mode in HTML mode
6e61c7c Updated tablet layout with changes to EditTexts
b4bfaf6 Switched to using SourceViewEditText instead of the legacy WPEditText in the editor
a48ceb2 Added a custom EditText, SourceViewEditText
c59cab9 Extracted the OnImeBackListener interface from EditorWebViewAbstract
36b222b Changed context text in HTML mode to use a monospace font (Roboto by Android default)
43051e4 Updated the separator color in HTML mode to reflect equivalent changes to visual editor styling
266eb8c Merge branch 'develop' into issue/11-html-mode
fa78242 Merge pull request #170 from wordpress-mobile/issue/169-merriweather-css
78d11a7 Add li tags when adding ol or ul elements in HTML mode
3717c38 Focus on content field when toggling between visual and HTML modes
90d08bb Disable format bar when title is in focus in HTML mode
b75459b Clear all format bar buttons (except for HTML) when toggling between visual and HTML modes
8f301be Renamed updateToolbarEnabledState to updatedFormatBarEnabledState for naming consistency
e9690ed Added HTML mode elements and button tags to tablet layout
dcf38e1 Changed tags used in HTML mode to be consistent with visual editor
edd99f6 Added support for inserting HTML tags from the format bar in HTML mode
a012f3c Extracted handling of HTML formatting buttons from onClick into a separate method
b2da291 Added string resource tags to format bar buttons
2401228 Added OpenSans fonts to editor assets
7b3c724 Removed unused Merriweather LightItalic font file
710c3a5 Updated hr color to use WP Gray Lighten 30 (#E9EFF3)
03bc027 Updated editor.css to use Merriweather for editor content
ddb4777 Set up toggling between visual and HTML mode using format bar button
7ec5e8f Added a ScrollView for HTML mode to editor layout xml
d2d2a26 Refactored setting WebView fields into a standalone method

git-subtree-dir: libs/editor
git-subtree-split: e0a865165de3deb2fb478d8a54304755029c5caa
  • Loading branch information
aforcier committed Jul 28, 2015
1 parent 5f30f53 commit f9336b1
Show file tree
Hide file tree
Showing 170 changed files with 2,280 additions and 285 deletions.
4 changes: 2 additions & 2 deletions WordPressEditor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
buildToolsVersion "22.0.1"

defaultConfig {
versionCode 1
versionName "0.1"
versionCode 2
versionName "0.2"
minSdkVersion 14
targetSdkVersion 22
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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 <b>content</b>");

// Check that getTitle() and getContent() return latest version even in HTML mode
assertEquals("new title", mFragment.getTitle());
assertEquals("new <b>content</b>", 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 <b>content</b>", 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"));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
Loading

0 comments on commit f9336b1

Please sign in to comment.