Skip to content

Commit 6f0d297

Browse files
committed
LegacyEditorFragment now lives in the editor subproject
1 parent 777635b commit 6f0d297

File tree

9 files changed

+1238
-2
lines changed

9 files changed

+1238
-2
lines changed

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

Lines changed: 1013 additions & 2 deletions
Large diffs are not rendered by default.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package org.wordpress.android.editor.legacy;
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.widget.Button;
8+
import android.widget.EditText;
9+
10+
import org.wordpress.android.editor.R;
11+
12+
public class EditLinkActivity extends ActionBarActivity {
13+
@Override
14+
protected void onCreate(Bundle savedInstanceState) {
15+
super.onCreate(savedInstanceState);
16+
17+
setContentView(R.layout.alert_create_link);
18+
19+
Bundle extras = getIntent().getExtras();
20+
if (extras != null) {
21+
String selectedText = extras.getString("selectedText");
22+
if (selectedText != null) {
23+
EditText linkTextET = (EditText) findViewById(R.id.linkText);
24+
linkTextET.setText(selectedText);
25+
}
26+
}
27+
28+
final Button cancelButton = (Button) findViewById(R.id.cancel);
29+
final Button okButton = (Button) findViewById(R.id.ok);
30+
31+
final EditText urlEditText = (EditText) findViewById(R.id.linkURL);
32+
urlEditText.setOnClickListener(new View.OnClickListener() {
33+
@Override
34+
public void onClick(View v) {
35+
if (urlEditText.getText().toString().equals("")) {
36+
urlEditText.setText("http://");
37+
urlEditText.setSelection(7);
38+
}
39+
}
40+
41+
});
42+
43+
okButton.setOnClickListener(new Button.OnClickListener() {
44+
public void onClick(View v) {
45+
EditText linkURLET = (EditText) findViewById(R.id.linkURL);
46+
String linkURL = linkURLET.getText().toString();
47+
48+
EditText linkTextET = (EditText) findViewById(R.id.linkText);
49+
String linkText = linkTextET.getText().toString();
50+
51+
Bundle bundle = new Bundle();
52+
bundle.putString("linkURL", linkURL);
53+
if (!linkText.equals("")) {
54+
bundle.putString("linkText", linkText);
55+
}
56+
57+
Intent mIntent = new Intent();
58+
mIntent.putExtras(bundle);
59+
setResult(RESULT_OK, mIntent);
60+
finish();
61+
62+
}
63+
});
64+
65+
cancelButton.setOnClickListener(new Button.OnClickListener() {
66+
public void onClick(View v) {
67+
Intent mIntent = new Intent();
68+
setResult(RESULT_CANCELED, mIntent);
69+
finish();
70+
}
71+
});
72+
73+
// select end of url
74+
urlEditText.performClick();
75+
}
76+
}
4.11 KB
Loading
4.19 KB
Loading
2.19 KB
Loading
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:layout_width="fill_parent"
5+
android:layout_height="wrap_content"
6+
android:padding="@dimen/margin_medium"
7+
android:layout_gravity="center_vertical">
8+
9+
<EditText
10+
android:id="@+id/linkURL"
11+
android:inputType="textUri"
12+
android:layout_width="fill_parent"
13+
android:layout_height="wrap_content"
14+
android:hint="@string/link_enter_url"
15+
android:imeOptions="actionNext" />
16+
17+
<EditText
18+
android:id="@+id/linkText"
19+
android:inputType="text"
20+
android:layout_width="fill_parent"
21+
android:layout_height="wrap_content"
22+
android:layout_below="@id/linkURL"
23+
android:hint="@string/link_enter_url_text" />
24+
25+
<Button
26+
android:id="@+id/ok"
27+
android:layout_width="wrap_content"
28+
android:layout_height="wrap_content"
29+
android:layout_below="@id/linkText"
30+
android:layout_alignParentRight="true"
31+
android:layout_marginLeft="@dimen/margin_medium"
32+
android:text="@android:string/ok" />
33+
34+
<Button
35+
android:id="@+id/cancel"
36+
android:layout_width="wrap_content"
37+
android:layout_height="wrap_content"
38+
android:layout_alignTop="@id/ok"
39+
android:layout_toLeftOf="@id/ok"
40+
android:text="@android:string/cancel" />
41+
42+
</RelativeLayout>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ScrollView
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent">
6+
7+
<LinearLayout
8+
android:orientation="vertical"
9+
android:layout_width="match_parent"
10+
android:layout_height="wrap_content"
11+
android:padding="10dp"
12+
android:layout_gravity="center_horizontal"
13+
android:gravity="center_horizontal">
14+
15+
<EditText
16+
android:id="@+id/title"
17+
android:layout_width="match_parent"
18+
android:layout_height="wrap_content"
19+
android:hint="@string/title"
20+
android:singleLine="true"/>
21+
22+
<EditText
23+
android:id="@+id/caption"
24+
android:layout_width="match_parent"
25+
android:layout_height="wrap_content"
26+
android:hint="@string/caption"
27+
android:singleLine="true"
28+
android:inputType="textCapSentences"/>
29+
30+
<TextView
31+
android:layout_width="fill_parent"
32+
android:layout_height="wrap_content"
33+
android:text="@string/horizontal_alignment"
34+
android:textStyle="bold"
35+
android:textColor="@color/image_options_label"/>
36+
37+
<Spinner
38+
android:id="@+id/alignment_spinner"
39+
android:layout_width="fill_parent"
40+
android:layout_height="wrap_content"
41+
android:prompt="@string/image_alignment"/>
42+
43+
<TextView
44+
android:layout_width="fill_parent"
45+
android:layout_height="wrap_content"
46+
android:text="@string/width"
47+
android:textStyle="bold"
48+
android:textColor="@color/image_options_label"/>
49+
50+
<SeekBar
51+
android:layout_height="wrap_content"
52+
android:id="@+id/imageWidth"
53+
android:layout_width="match_parent"/>
54+
55+
<EditText
56+
android:layout_width="fill_parent"
57+
android:layout_height="wrap_content"
58+
android:text=""
59+
android:imeOptions="actionDone"
60+
android:id="@+id/imageWidthText"
61+
android:layout_gravity="left|center_vertical"
62+
android:singleLine="true"
63+
android:inputType="number"/>
64+
65+
<CheckBox
66+
android:layout_gravity="left"
67+
android:text="@string/featured"
68+
android:id="@+id/featuredImage"
69+
android:layout_width="wrap_content"
70+
android:layout_height="wrap_content"
71+
android:visibility="gone"/>
72+
73+
<CheckBox
74+
android:layout_gravity="left"
75+
android:text="@string/featured_in_post"
76+
android:id="@+id/featuredInPost"
77+
android:layout_width="wrap_content"
78+
android:layout_height="wrap_content"
79+
android:visibility="gone"/>
80+
</LinearLayout>
81+
</ScrollView>

WordPressEditor/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
<color name="blue_new_kid">#2EA2CC</color>
66
<color name="grey_extra_light">#eeeeee</color>
77
<color name="pressed_wordpress">#CC78C8E6</color>
8+
<color name="image_options_label">#CCCCCC</color>
89
</resources>

WordPressEditor/src/main/res/values/strings.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,29 @@
33
<string name="post_settings">Settings</string>
44
<string name="post_content">Content</string>
55
<string name="post_title">Title</string>
6+
7+
8+
9+
<!-- link view -->
10+
<string name="link_enter_url">URL</string>
11+
<string name="link_enter_url_text">Link text (optional)</string>
12+
<string name="create_a_link">Create a link</string>
13+
14+
<!-- image settings -->
15+
<string name="image_settings">Image settings</string>
16+
<string name="title">Title</string>
17+
<string name="width">Width</string>
18+
<string name="featured">Use as featured image</string>
19+
<string name="featured_in_post">Include image in post content</string>
20+
<string name="image_alignment">Alignment</string>
21+
<string name="horizontal_alignment">Horizontal alignment</string>
22+
<string name="caption">Caption (optional)</string>
23+
24+
<string-array name="alignment_array">
25+
<item>None</item>
26+
<item>Left</item>
27+
<item>Center</item>
28+
<item>Right</item>
29+
</string-array>
30+
631
</resources>

0 commit comments

Comments
 (0)