aboutsummaryrefslogtreecommitdiff
path: root/libs/editor/example/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'libs/editor/example/src/main')
-rw-r--r--libs/editor/example/src/main/AndroidManifest.xml24
-rw-r--r--libs/editor/example/src/main/assets/example/cowboy-cat.jpgbin0 -> 23142 bytes
-rw-r--r--libs/editor/example/src/main/assets/example/example-content.html58
-rw-r--r--libs/editor/example/src/main/java/org/wordpress/android/editor/example/EditorExampleActivity.java348
-rw-r--r--libs/editor/example/src/main/java/org/wordpress/android/editor/example/MainExampleActivity.java86
-rw-r--r--libs/editor/example/src/main/res/layout/activity_example.xml44
-rw-r--r--libs/editor/example/src/main/res/layout/activity_legacy_editor.xml13
-rw-r--r--libs/editor/example/src/main/res/layout/activity_new_editor.xml13
-rw-r--r--libs/editor/example/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 3418 bytes
-rw-r--r--libs/editor/example/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 2206 bytes
-rw-r--r--libs/editor/example/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 4842 bytes
-rw-r--r--libs/editor/example/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 7718 bytes
-rw-r--r--libs/editor/example/src/main/res/values/colors.xml4
-rw-r--r--libs/editor/example/src/main/res/values/strings.xml21
-rw-r--r--libs/editor/example/src/main/res/values/styles.xml9
15 files changed, 620 insertions, 0 deletions
diff --git a/libs/editor/example/src/main/AndroidManifest.xml b/libs/editor/example/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..d6b56a50a
--- /dev/null
+++ b/libs/editor/example/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.wordpress.android.editor.example" >
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MainExampleActivity"
+ android:label="@string/title_activity_example">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".EditorExampleActivity"
+ android:configChanges="orientation|keyboardHidden|screenSize">
+ </activity>
+ </application>
+
+</manifest>
diff --git a/libs/editor/example/src/main/assets/example/cowboy-cat.jpg b/libs/editor/example/src/main/assets/example/cowboy-cat.jpg
new file mode 100644
index 000000000..77f930b99
--- /dev/null
+++ b/libs/editor/example/src/main/assets/example/cowboy-cat.jpg
Binary files differ
diff --git a/libs/editor/example/src/main/assets/example/example-content.html b/libs/editor/example/src/main/assets/example/example-content.html
new file mode 100644
index 000000000..5f35f4826
--- /dev/null
+++ b/libs/editor/example/src/main/assets/example/example-content.html
@@ -0,0 +1,58 @@
+<p>
+I'm a test post.
+
+<strong>Bold text</strong>
+
+<em>Italic text</em>
+
+<a href="http://www.wordpress.com">I'm a link!</a>
+
+<!--more c'est mort -->
+
+<del datetime="2014-05-19T20:55:58+00:00">Strikethrough</del>
+
+Moar Text.
+</p>
+<p>
+Code:
+<code>
+ 10 PRINT "HOWDY WORLD"
+ 20 GOTO 10
+</code>
+</p>
+<p>
+Unordered List:
+<ul>
+ <li>One</li>
+ <li>Two</li>
+ <li>Three</li>
+</ul>
+</p>
+<p>
+Ordered List:
+<ol>
+ <li>One</li>
+ <li>Two</li>
+ <li>Three</li>
+</ol>
+</p>
+<p>
+Master cleanse Intelligentsia butcher Brooklyn Tumblr. Etsy lo-fi Marfa bicycle rights. Intelligentsia Helvetica fanny pack, normcore Odd Future fixie brunch mustache aesthetic kitsch artisan cardigan mlkshk. Pour-over hashtag selfies pug Tumblr mlkshk. Food truck small batch McSweeney's trust fund, Intelligentsia bitters Brooklyn twee meh authentic. Normcore distillery American Apparel single-origin coffee artisan try-hard, stumptown XOXO tote bag fanny pack Blue Bottle Shoreditch food truck Banksy. Church-key American Apparel Blue Bottle, swag try-hard Odd Future mustache chia iPhone.
+</p>
+<p>
+Block Quote:
+<blockquote>Kale chips Schlitz forage irony, kogi Tumblr Carles chillwave Etsy pug photo booth YOLO biodiesel tote bag actually. PBR Portland yr pickled, bespoke meggings selvage letterpress kitsch plaid before they sold out put a bird on it you probably haven't heard of them. Yr master cleanse slow-carb crucifix, sustainable keytar Helvetica Tumblr High Life mumblecore narwhal cornhole deep v craft beer. Portland forage hashtag locavore, before they sold out put a bird on it irony hella. Godard kale chips street art tote bag cardigan. Church-key next level seitan keytar meggings Portland. Keffiyeh flexitarian post-ironic drinking vinegar wayfarers.</blockquote>
+</p>
+<p>
+Image:<br/><br/>
+
+<img src="example/cowboy-cat.jpg" alt="Cowboy Cat" />
+</p>
+<p>
+Fanny pack Odd Future Intelligentsia lo-fi semiotics whatever. Selvage keffiyeh mustache sustainable ethnic, chambray mumblecore McSweeney's biodiesel Pitchfork four loko disrupt post-ironic art party American Apparel. Kitsch umami beard salvia, Vice before they sold out vegan tousled lomo jean shorts pickled PBR&amp;B. Tousled Wes Anderson Shoreditch flannel, 90's XOXO quinoa whatever mumblecore cliche Truffaut stumptown. Photo booth crucifix plaid Brooklyn. Authentic letterpress PBR&amp;B, sustainable VHS master cleanse ethnic High Life. Messenger bag umami pug flannel.
+</p>
+
+<!--nextpage-->
+
+Wow, such sample, much text.
+
diff --git a/libs/editor/example/src/main/java/org/wordpress/android/editor/example/EditorExampleActivity.java b/libs/editor/example/src/main/java/org/wordpress/android/editor/example/EditorExampleActivity.java
new file mode 100644
index 000000000..8723f708e
--- /dev/null
+++ b/libs/editor/example/src/main/java/org/wordpress/android/editor/example/EditorExampleActivity.java
@@ -0,0 +1,348 @@
+package org.wordpress.android.editor.example;
+
+import android.app.Fragment;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.ContextMenu;
+import android.view.DragEvent;
+import android.view.MenuItem;
+import android.view.View;
+
+import org.wordpress.android.editor.EditorFragmentAbstract;
+import org.wordpress.android.editor.EditorFragmentAbstract.EditorDragAndDropListener;
+import org.wordpress.android.editor.EditorFragmentAbstract.EditorFragmentListener;
+import org.wordpress.android.editor.EditorFragmentAbstract.TrackableEvent;
+import org.wordpress.android.editor.EditorMediaUploadListener;
+import org.wordpress.android.editor.ImageSettingsDialogFragment;
+import org.wordpress.android.util.AppLog;
+import org.wordpress.android.util.AppLog.T;
+import org.wordpress.android.util.ToastUtils;
+import org.wordpress.android.util.helpers.MediaFile;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public class EditorExampleActivity extends AppCompatActivity implements EditorFragmentListener,
+ EditorDragAndDropListener {
+ public static final String EDITOR_PARAM = "EDITOR_PARAM";
+ public static final String TITLE_PARAM = "TITLE_PARAM";
+ public static final String CONTENT_PARAM = "CONTENT_PARAM";
+ public static final String DRAFT_PARAM = "DRAFT_PARAM";
+ public static final String TITLE_PLACEHOLDER_PARAM = "TITLE_PLACEHOLDER_PARAM";
+ public static final String CONTENT_PLACEHOLDER_PARAM = "CONTENT_PLACEHOLDER_PARAM";
+ public static final int USE_NEW_EDITOR = 1;
+ public static final int USE_LEGACY_EDITOR = 2;
+
+ public static final int ADD_MEDIA_ACTIVITY_REQUEST_CODE = 1111;
+ public static final int ADD_MEDIA_FAIL_ACTIVITY_REQUEST_CODE = 1112;
+ public static final int ADD_MEDIA_SLOW_NETWORK_REQUEST_CODE = 1113;
+
+ public static final String MEDIA_REMOTE_ID_SAMPLE = "123";
+
+ private static final int SELECT_IMAGE_MENU_POSITION = 0;
+ private static final int SELECT_IMAGE_FAIL_MENU_POSITION = 1;
+ private static final int SELECT_VIDEO_MENU_POSITION = 2;
+ private static final int SELECT_VIDEO_FAIL_MENU_POSITION = 3;
+ private static final int SELECT_IMAGE_SLOW_MENU_POSITION = 4;
+
+ private EditorFragmentAbstract mEditorFragment;
+
+ private Map<String, String> mFailedUploads;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getIntent().getIntExtra(EDITOR_PARAM, USE_NEW_EDITOR) == USE_NEW_EDITOR) {
+ ToastUtils.showToast(this, R.string.starting_new_editor);
+ setContentView(R.layout.activity_new_editor);
+ } else {
+ ToastUtils.showToast(this, R.string.starting_legacy_editor);
+ setContentView(R.layout.activity_legacy_editor);
+ }
+
+ mFailedUploads = new HashMap<>();
+ }
+
+ @Override
+ public void onAttachFragment(Fragment fragment) {
+ super.onAttachFragment(fragment);
+ if (fragment instanceof EditorFragmentAbstract) {
+ mEditorFragment = (EditorFragmentAbstract) fragment;
+ }
+ }
+
+ @Override
+ public void onBackPressed() {
+ Fragment fragment = getFragmentManager()
+ .findFragmentByTag(ImageSettingsDialogFragment.IMAGE_SETTINGS_DIALOG_TAG);
+ if (fragment != null && fragment.isVisible()) {
+ ((ImageSettingsDialogFragment) fragment).dismissFragment();
+ } else {
+ super.onBackPressed();
+ }
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ menu.add(0, SELECT_IMAGE_MENU_POSITION, 0, getString(R.string.select_image));
+ menu.add(0, SELECT_IMAGE_FAIL_MENU_POSITION, 0, getString(R.string.select_image_fail));
+ menu.add(0, SELECT_VIDEO_MENU_POSITION, 0, getString(R.string.select_video));
+ menu.add(0, SELECT_VIDEO_FAIL_MENU_POSITION, 0, getString(R.string.select_video_fail));
+ menu.add(0, SELECT_IMAGE_SLOW_MENU_POSITION, 0, getString(R.string.select_image_slow_network));
+ }
+
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ Intent intent = new Intent(Intent.ACTION_PICK);
+
+ switch (item.getItemId()) {
+ case SELECT_IMAGE_MENU_POSITION:
+ intent.setType("image/*");
+ intent.setAction(Intent.ACTION_GET_CONTENT);
+ intent = Intent.createChooser(intent, getString(R.string.select_image));
+
+ startActivityForResult(intent, ADD_MEDIA_ACTIVITY_REQUEST_CODE);
+ return true;
+ case SELECT_IMAGE_FAIL_MENU_POSITION:
+ intent.setType("image/*");
+ intent.setAction(Intent.ACTION_GET_CONTENT);
+ intent = Intent.createChooser(intent, getString(R.string.select_image_fail));
+
+ startActivityForResult(intent, ADD_MEDIA_FAIL_ACTIVITY_REQUEST_CODE);
+ return true;
+ case SELECT_VIDEO_MENU_POSITION:
+ intent.setType("video/*");
+ intent.setAction(Intent.ACTION_GET_CONTENT);
+ intent = Intent.createChooser(intent, getString(R.string.select_video));
+
+ startActivityForResult(intent, ADD_MEDIA_ACTIVITY_REQUEST_CODE);
+ return true;
+ case SELECT_VIDEO_FAIL_MENU_POSITION:
+ intent.setType("video/*");
+ intent.setAction(Intent.ACTION_GET_CONTENT);
+ intent = Intent.createChooser(intent, getString(R.string.select_video_fail));
+
+ startActivityForResult(intent, ADD_MEDIA_FAIL_ACTIVITY_REQUEST_CODE);
+ return true;
+ case SELECT_IMAGE_SLOW_MENU_POSITION:
+ intent.setType("image/*");
+ intent.setAction(Intent.ACTION_GET_CONTENT);
+ intent = Intent.createChooser(intent, getString(R.string.select_image_slow_network));
+
+ startActivityForResult(intent, ADD_MEDIA_SLOW_NETWORK_REQUEST_CODE);
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+
+ if (data == null) {
+ return;
+ }
+
+ Uri mediaUri = data.getData();
+
+ MediaFile mediaFile = new MediaFile();
+ String mediaId = String.valueOf(System.currentTimeMillis());
+ mediaFile.setMediaId(mediaId);
+ mediaFile.setVideo(mediaUri.toString().contains("video"));
+
+ switch (requestCode) {
+ case ADD_MEDIA_ACTIVITY_REQUEST_CODE:
+ mEditorFragment.appendMediaFile(mediaFile, mediaUri.toString(), null);
+
+ if (mEditorFragment instanceof EditorMediaUploadListener) {
+ simulateFileUpload(mediaId, mediaUri.toString());
+ }
+ break;
+ case ADD_MEDIA_FAIL_ACTIVITY_REQUEST_CODE:
+ mEditorFragment.appendMediaFile(mediaFile, mediaUri.toString(), null);
+
+ if (mEditorFragment instanceof EditorMediaUploadListener) {
+ simulateFileUploadFail(mediaId, mediaUri.toString());
+ }
+ break;
+ case ADD_MEDIA_SLOW_NETWORK_REQUEST_CODE:
+ mEditorFragment.appendMediaFile(mediaFile, mediaUri.toString(), null);
+
+ if (mEditorFragment instanceof EditorMediaUploadListener) {
+ simulateSlowFileUpload(mediaId, mediaUri.toString());
+ }
+ break;
+ }
+ }
+
+ @Override
+ public void onSettingsClicked() {
+ // TODO
+ }
+
+ @Override
+ public void onAddMediaClicked() {
+ // TODO
+ }
+
+ @Override
+ public void onMediaRetryClicked(String mediaId) {
+ if (mFailedUploads.containsKey(mediaId)) {
+ simulateFileUpload(mediaId, mFailedUploads.get(mediaId));
+ }
+ }
+
+ @Override
+ public void onMediaUploadCancelClicked(String mediaId, boolean delete) {
+
+ }
+
+ @Override
+ public void onFeaturedImageChanged(long mediaId) {
+
+ }
+
+ @Override
+ public void onVideoPressInfoRequested(String videoId) {
+
+ }
+
+ @Override
+ public String onAuthHeaderRequested(String url) {
+ return "";
+ }
+
+ @Override
+ public void onEditorFragmentInitialized() {
+ // arbitrary setup
+ mEditorFragment.setFeaturedImageSupported(true);
+ mEditorFragment.setBlogSettingMaxImageWidth("600");
+ mEditorFragment.setDebugModeEnabled(true);
+
+ // get title and content and draft switch
+ String title = getIntent().getStringExtra(TITLE_PARAM);
+ String content = getIntent().getStringExtra(CONTENT_PARAM);
+ boolean isLocalDraft = getIntent().getBooleanExtra(DRAFT_PARAM, true);
+ mEditorFragment.setTitle(title);
+ mEditorFragment.setContent(content);
+ mEditorFragment.setTitlePlaceholder(getIntent().getStringExtra(TITLE_PLACEHOLDER_PARAM));
+ mEditorFragment.setContentPlaceholder(getIntent().getStringExtra(CONTENT_PLACEHOLDER_PARAM));
+ mEditorFragment.setLocalDraft(isLocalDraft);
+ }
+
+ @Override
+ public void saveMediaFile(MediaFile mediaFile) {
+ // TODO
+ }
+
+ @Override
+ public void onTrackableEvent(TrackableEvent event) {
+ AppLog.d(T.EDITOR, "Trackable event: " + event);
+ }
+
+ private void simulateFileUpload(final String mediaId, final String mediaUrl) {
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ float count = (float) 0.1;
+ while (count < 1.1) {
+ sleep(500);
+
+ ((EditorMediaUploadListener) mEditorFragment).onMediaUploadProgress(mediaId, count);
+
+ count += 0.1;
+ }
+
+ MediaFile mediaFile = new MediaFile();
+ mediaFile.setMediaId(MEDIA_REMOTE_ID_SAMPLE);
+ mediaFile.setFileURL(mediaUrl);
+
+ ((EditorMediaUploadListener) mEditorFragment).onMediaUploadSucceeded(mediaId, mediaFile);
+
+ if (mFailedUploads.containsKey(mediaId)) {
+ mFailedUploads.remove(mediaId);
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ thread.start();
+ }
+
+ private void simulateFileUploadFail(final String mediaId, final String mediaUrl) {
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ float count = (float) 0.1;
+ while (count < 0.6) {
+ sleep(500);
+
+ ((EditorMediaUploadListener) mEditorFragment).onMediaUploadProgress(mediaId, count);
+
+ count += 0.1;
+ }
+
+ ((EditorMediaUploadListener) mEditorFragment).onMediaUploadFailed(mediaId,
+ getString(R.string.tap_to_try_again));
+
+ mFailedUploads.put(mediaId, mediaUrl);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ thread.start();
+ }
+
+ private void simulateSlowFileUpload(final String mediaId, final String mediaUrl) {
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ sleep(5000);
+ float count = (float) 0.1;
+ while (count < 1.1) {
+ sleep(2000);
+
+ ((EditorMediaUploadListener) mEditorFragment).onMediaUploadProgress(mediaId, count);
+
+ count += 0.1;
+ }
+
+ MediaFile mediaFile = new MediaFile();
+ mediaFile.setMediaId(MEDIA_REMOTE_ID_SAMPLE);
+ mediaFile.setFileURL(mediaUrl);
+
+ ((EditorMediaUploadListener) mEditorFragment).onMediaUploadSucceeded(mediaId, mediaFile);
+
+ if (mFailedUploads.containsKey(mediaId)) {
+ mFailedUploads.remove(mediaId);
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ thread.start();
+ }
+
+ @Override
+ public void onMediaDropped(ArrayList<Uri> mediaUri) {
+ // TODO
+ }
+
+ @Override
+ public void onRequestDragAndDropPermissions(DragEvent dragEvent) {
+ // TODO
+ }
+}
diff --git a/libs/editor/example/src/main/java/org/wordpress/android/editor/example/MainExampleActivity.java b/libs/editor/example/src/main/java/org/wordpress/android/editor/example/MainExampleActivity.java
new file mode 100644
index 000000000..52b522d38
--- /dev/null
+++ b/libs/editor/example/src/main/java/org/wordpress/android/editor/example/MainExampleActivity.java
@@ -0,0 +1,86 @@
+package org.wordpress.android.editor.example;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+import org.wordpress.android.editor.Utils;
+import org.wordpress.android.editor.example.EditorExampleActivity;
+
+public class MainExampleActivity extends AppCompatActivity {
+ private Activity mActivity;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mActivity = this;
+ setContentView(R.layout.activity_example);
+
+ Button newEditorPost1 = (Button) findViewById(R.id.new_editor_post_1);
+ newEditorPost1.setOnClickListener(new OnClickListener() {
+ @Override public void onClick(View v) {
+ Intent intent = new Intent(MainExampleActivity.this, EditorExampleActivity.class);
+ Bundle bundle = new Bundle();
+ bundle.putString(EditorExampleActivity.TITLE_PARAM, getString(R.string.example_post_visual_title));
+ bundle.putString(EditorExampleActivity.CONTENT_PARAM, Utils.getHtmlFromFile(mActivity,
+ "example/example-content.html"));
+ bundle.putString(EditorExampleActivity.TITLE_PLACEHOLDER_PARAM,
+ getString(R.string.example_post_title_placeholder));
+ bundle.putString(EditorExampleActivity.CONTENT_PLACEHOLDER_PARAM,
+ getString(R.string.example_post_content_placeholder));
+ bundle.putInt(EditorExampleActivity.EDITOR_PARAM, EditorExampleActivity.USE_NEW_EDITOR);
+ intent.putExtras(bundle);
+ startActivity(intent);
+ }
+ });
+
+ Button newEditorPostEmpty = (Button) findViewById(R.id.new_editor_post_empty);
+ newEditorPostEmpty.setOnClickListener(new OnClickListener() {
+ @Override public void onClick(View v) {
+ Intent intent = new Intent(MainExampleActivity.this, EditorExampleActivity.class);
+ Bundle bundle = new Bundle();
+ bundle.putString(EditorExampleActivity.TITLE_PARAM, "");
+ bundle.putString(EditorExampleActivity.CONTENT_PARAM, "");
+ bundle.putString(EditorExampleActivity.TITLE_PLACEHOLDER_PARAM,
+ getString(R.string.example_post_title_placeholder));
+ bundle.putString(EditorExampleActivity.CONTENT_PLACEHOLDER_PARAM,
+ getString(R.string.example_post_content_placeholder));
+ bundle.putInt(EditorExampleActivity.EDITOR_PARAM, EditorExampleActivity.USE_NEW_EDITOR);
+ intent.putExtras(bundle);
+ startActivity(intent);
+ }
+ });
+
+ Button legacyEditorPost1Local = (Button) findViewById(R.id.legacy_editor_post_1_local);
+ legacyEditorPost1Local.setOnClickListener(new OnClickListener() {
+ @Override public void onClick(View v) {
+ Intent intent = new Intent(MainExampleActivity.this, EditorExampleActivity.class);
+ Bundle bundle = new Bundle();
+ bundle.putString(EditorExampleActivity.TITLE_PARAM, getString(R.string.example_post_1_title));
+ bundle.putString(EditorExampleActivity.CONTENT_PARAM, getString(R.string.example_post_1_content));
+ bundle.putInt(EditorExampleActivity.EDITOR_PARAM, EditorExampleActivity.USE_LEGACY_EDITOR);
+ bundle.putBoolean(EditorExampleActivity.DRAFT_PARAM, true);
+ intent.putExtras(bundle);
+ startActivity(intent);
+ }
+ });
+
+ Button legacyEditorPost1Remote = (Button) findViewById(R.id.legacy_editor_post_1_remote);
+ legacyEditorPost1Remote.setOnClickListener(new OnClickListener() {
+ @Override public void onClick(View v) {
+ Intent intent = new Intent(MainExampleActivity.this, EditorExampleActivity.class);
+ Bundle bundle = new Bundle();
+ bundle.putString(EditorExampleActivity.TITLE_PARAM, getString(R.string.example_post_1_title));
+ bundle.putString(EditorExampleActivity.CONTENT_PARAM, getString(R.string.example_post_1_content));
+ bundle.putInt(EditorExampleActivity.EDITOR_PARAM, EditorExampleActivity.USE_LEGACY_EDITOR);
+ bundle.putBoolean(EditorExampleActivity.DRAFT_PARAM, false);
+ intent.putExtras(bundle);
+ startActivity(intent);
+ }
+ });
+ }
+}
diff --git a/libs/editor/example/src/main/res/layout/activity_example.xml b/libs/editor/example/src/main/res/layout/activity_example.xml
new file mode 100644
index 000000000..b94cea8ab
--- /dev/null
+++ b/libs/editor/example/src/main/res/layout/activity_example.xml
@@ -0,0 +1,44 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="org.wordpress.android.editor.example.MainExampleActivity">
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="New Editor - Post 1"
+ android:id="@+id/new_editor_post_1"
+ android:layout_alignParentTop="true"
+ android:layout_marginTop="32dp"
+ android:layout_centerHorizontal="true"/>
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="New Editor - Empty Post"
+ android:id="@+id/new_editor_post_empty"
+ android:layout_marginTop="32dp"
+ android:layout_centerHorizontal="true"
+ android:layout_below="@id/new_editor_post_1"/>
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Legacy Editor - Post 1 - Local Draft"
+ android:id="@+id/legacy_editor_post_1_local"
+ android:layout_marginTop="32dp"
+ android:layout_centerHorizontal="true"
+ android:layout_below="@id/new_editor_post_empty"/>
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Legacy Editor - Post 1 - Remote"
+ android:id="@+id/legacy_editor_post_1_remote"
+ android:layout_marginTop="32dp"
+ android:layout_centerHorizontal="true"
+ android:layout_below="@id/legacy_editor_post_1_local"/>
+
+
+</RelativeLayout>
diff --git a/libs/editor/example/src/main/res/layout/activity_legacy_editor.xml b/libs/editor/example/src/main/res/layout/activity_legacy_editor.xml
new file mode 100644
index 000000000..24756188d
--- /dev/null
+++ b/libs/editor/example/src/main/res/layout/activity_legacy_editor.xml
@@ -0,0 +1,13 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".EditorActivity">
+
+ <fragment
+ android:id="@+id/postEditor"
+ android:name="org.wordpress.android.editor.LegacyEditorFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+
+</RelativeLayout>
diff --git a/libs/editor/example/src/main/res/layout/activity_new_editor.xml b/libs/editor/example/src/main/res/layout/activity_new_editor.xml
new file mode 100644
index 000000000..478e491e5
--- /dev/null
+++ b/libs/editor/example/src/main/res/layout/activity_new_editor.xml
@@ -0,0 +1,13 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".EditorActivity">
+
+ <fragment
+ android:id="@+id/postEditor"
+ android:name="org.wordpress.android.editor.EditorFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+
+</RelativeLayout>
diff --git a/libs/editor/example/src/main/res/mipmap-hdpi/ic_launcher.png b/libs/editor/example/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 000000000..cde69bccc
--- /dev/null
+++ b/libs/editor/example/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/libs/editor/example/src/main/res/mipmap-mdpi/ic_launcher.png b/libs/editor/example/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 000000000..c133a0cbd
--- /dev/null
+++ b/libs/editor/example/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/libs/editor/example/src/main/res/mipmap-xhdpi/ic_launcher.png b/libs/editor/example/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..bfa42f0e7
--- /dev/null
+++ b/libs/editor/example/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/libs/editor/example/src/main/res/mipmap-xxhdpi/ic_launcher.png b/libs/editor/example/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..324e72cdd
--- /dev/null
+++ b/libs/editor/example/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/libs/editor/example/src/main/res/values/colors.xml b/libs/editor/example/src/main/res/values/colors.xml
new file mode 100644
index 000000000..e8782a95d
--- /dev/null
+++ b/libs/editor/example/src/main/res/values/colors.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="color_control_activated">@color/wp_blue_light</color>
+</resources> \ No newline at end of file
diff --git a/libs/editor/example/src/main/res/values/strings.xml b/libs/editor/example/src/main/res/values/strings.xml
new file mode 100644
index 000000000..c8ac8b7dd
--- /dev/null
+++ b/libs/editor/example/src/main/res/values/strings.xml
@@ -0,0 +1,21 @@
+<resources>
+ <string name="app_name">Editor Example</string>
+ <string name="title_activity_example">Editor Example</string>
+ <string name="starting_legacy_editor">Starting legacy editor</string>
+ <string name="starting_new_editor">Starting new editor</string>
+ <string name="example_post_visual_title">I\'m editing a post!</string>
+ <string name="example_post_title_placeholder">Post title</string>
+ <string name="example_post_content_placeholder">Share your story hereā€¦</string>
+ <string name="example_post_1_title">Post 1</string>
+ <string name="example_post_1_content">Post 1 Content:\nBest post ever!</string>
+ <string name="example_post_2_title">Post 2</string>
+ <string name="example_post_2_content">
+ <![CDATA[<p>Post 2 Content</p><blockquote>Quoted text</blockquote><br/>]]>
+ </string>
+
+ <string name="select_image">Select an image</string>
+ <string name="select_image_fail">Select an image (failure demo)</string>
+ <string name="select_video">Select a video</string>
+ <string name="select_video_fail">Select a video (failure demo)</string>
+ <string name="select_image_slow_network">Select an image (slow network demo)</string>
+</resources>
diff --git a/libs/editor/example/src/main/res/values/styles.xml b/libs/editor/example/src/main/res/values/styles.xml
new file mode 100644
index 000000000..1ef1ba72e
--- /dev/null
+++ b/libs/editor/example/src/main/res/values/styles.xml
@@ -0,0 +1,9 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ <item name="colorControlActivated">@color/color_control_activated</item>
+ </style>
+
+</resources>