diff options
author | Chris Warrington <cmw@google.com> | 2016-10-18 12:29:21 +0100 |
---|---|---|
committer | Chris Warrington <cmw@google.com> | 2016-10-18 12:34:18 +0100 |
commit | e3780081075c01aa1dff6d1f373cb43192b33e68 (patch) | |
tree | fb734615933a39f3d009210dc0d1457160479b35 /libs/editor/example/src/main/java/org/wordpress/android/editor/example/MainExampleActivity.java | |
parent | 7e05eb7e57827eddc885570bc00aed8a50320dbf (diff) | |
parent | 025b8b226c8d8edba2b309ca878572f40512eca7 (diff) | |
download | gradle-perf-android-medium-e3780081075c01aa1dff6d1f373cb43192b33e68.tar.gz |
Merge remote-tracking branch 'origin/upstream-master' into masterHEADstudio-3.4.0studio-3.2.1studio-3.1.2studio-3.0studio-2.3gradle_3.4.0gradle_3.1.2gradle_3.0.0gradle_2.3.0studio-master-devmirror-goog-studio-master-devmastermain
Change-Id: I63f5e16d09297c48432192761b840310935eb903
Diffstat (limited to 'libs/editor/example/src/main/java/org/wordpress/android/editor/example/MainExampleActivity.java')
-rw-r--r-- | libs/editor/example/src/main/java/org/wordpress/android/editor/example/MainExampleActivity.java | 86 |
1 files changed, 86 insertions, 0 deletions
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); + } + }); + } +} |