Skip to content

Commit 406a9d4

Browse files
committed
move activities from editor/libs to editor/example
1 parent 4b80ec9 commit 406a9d4

File tree

10 files changed

+95
-73
lines changed

10 files changed

+95
-73
lines changed

WordPressEditor/src/main/java/org/wordpress/android/editor/EditorExampleActivity.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

WordPressEditor/src/main/java/org/wordpress/android/editor/LegacyEditorActivity.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

example/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
android:label="@string/app_name"
99
android:theme="@style/AppTheme" >
1010
<activity
11-
android:name=".ExampleActivity"
11+
android:name=".MainExampleActivity"
1212
android:label="@string/title_activity_example" >
1313
</activity>
1414
<activity
15-
android:name="org.wordpress.android.editor.EditorExampleActivity" >
15+
android:name=".EditorExampleActivity" >
1616
</activity>
1717
</application>
1818

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package org.wordpress.android.editor.example;
2+
3+
import android.os.Bundle;
4+
import android.support.v7.app.ActionBarActivity;
5+
6+
import org.wordpress.android.editor.EditorFragmentAbstract.EditorFragmentListener;
7+
import org.wordpress.android.util.ToastUtils;
8+
9+
public class EditorExampleActivity extends ActionBarActivity implements EditorFragmentListener {
10+
public static final String EDITOR_CHOICE = "EDITOR_CHOICE";
11+
public static final int USE_NEW_EDITOR = 1;
12+
public static final int USE_LEGACY_EDITOR = 2;
13+
14+
@Override
15+
protected void onCreate(Bundle savedInstanceState) {
16+
super.onCreate(savedInstanceState);
17+
if (getIntent().getIntExtra(EDITOR_CHOICE, USE_NEW_EDITOR) == USE_NEW_EDITOR) {
18+
ToastUtils.showToast(this, R.string.starting_new_editor);
19+
setContentView(R.layout.activity_new_editor);
20+
} else {
21+
ToastUtils.showToast(this, R.string.starting_legacy_editor);
22+
setContentView(R.layout.activity_legacy_editor);
23+
}
24+
}
25+
26+
@Override
27+
public void onSettingsClicked() {
28+
// TODO
29+
}
30+
31+
@Override
32+
public void onAddMediaButtonClicked() {
33+
// TODO
34+
}
35+
}

example/src/main/java/org/wordpress/example/ExampleActivity.java

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package org.wordpress.android.editor.example;
2+
3+
import android.content.Intent;
4+
import android.os.Bundle;
5+
import android.support.v7.app.ActionBarActivity;
6+
import android.view.View;
7+
import android.view.View.OnClickListener;
8+
import android.widget.Button;
9+
10+
import org.wordpress.android.editor.example.EditorExampleActivity;
11+
12+
public class MainExampleActivity extends ActionBarActivity {
13+
@Override
14+
protected void onCreate(Bundle savedInstanceState) {
15+
super.onCreate(savedInstanceState);
16+
setContentView(R.layout.activity_example);
17+
18+
Button newEditorPost1 = (Button) findViewById(R.id.new_editor_post_1);
19+
newEditorPost1.setOnClickListener(new OnClickListener() {
20+
@Override public void onClick(View v) {
21+
Intent intent = new Intent(MainExampleActivity.this, EditorExampleActivity.class);
22+
Bundle bundle = new Bundle();
23+
bundle.putInt(EditorExampleActivity.EDITOR_CHOICE, EditorExampleActivity.USE_NEW_EDITOR);
24+
intent.putExtras(bundle);
25+
startActivity(intent);
26+
}
27+
});
28+
29+
Button legacyEditorPost1 = (Button) findViewById(R.id.legacy_editor_post_1);
30+
legacyEditorPost1.setOnClickListener(new OnClickListener() {
31+
@Override public void onClick(View v) {
32+
Intent intent = new Intent(MainExampleActivity.this, EditorExampleActivity.class);
33+
Bundle bundle = new Bundle();
34+
bundle.putInt(EditorExampleActivity.EDITOR_CHOICE, EditorExampleActivity.USE_LEGACY_EDITOR);
35+
intent.putExtras(bundle);
36+
startActivity(intent);
37+
}
38+
});
39+
}
40+
}

example/src/main/res/layout/activity_example.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
xmlns:tools="http://schemas.android.com/tools"
33
android:layout_width="match_parent"
44
android:layout_height="match_parent"
5-
tools:context="org.wordpress.android.editor.example.ExampleActivity">
5+
tools:context="org.wordpress.android.editor.example.MainExampleActivity">
66

77
<Button
88
android:layout_width="wrap_content"
@@ -16,8 +16,8 @@
1616
<Button
1717
android:layout_width="wrap_content"
1818
android:layout_height="wrap_content"
19-
android:text="Old Editor - Post 1"
20-
android:id="@+id/old_editor_post_1"
19+
android:text="Legacy Editor - Post 1"
20+
android:id="@+id/legacy_editor_post_1"
2121
android:layout_marginTop="32dp"
2222
android:layout_centerHorizontal="true"
2323
android:layout_below="@id/new_editor_post_1"/>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
tools:context=".EditorActivity">
6+
7+
<fragment
8+
android:id="@+id/postEditor"
9+
android:name="org.wordpress.android.editor.EditorFragment"
10+
android:layout_width="match_parent"
11+
android:layout_height="match_parent"/>
12+
13+
</RelativeLayout>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<resources>
22
<string name="app_name">EditorExample</string>
33
<string name="title_activity_example">ExampleActivity</string>
4+
<string name="starting_legacy_editor">Starting legacy editor</string>
5+
<string name="starting_new_editor">Starting new editor</string>
46
</resources>

0 commit comments

Comments
 (0)