Skip to content

Commit

Permalink
LegacyEditorFragment now lives in the editor subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Feb 12, 2015
1 parent 777635b commit 6f0d297
Show file tree
Hide file tree
Showing 9 changed files with 1,238 additions and 2 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package org.wordpress.android.editor.legacy;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import org.wordpress.android.editor.R;

public class EditLinkActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.alert_create_link);

Bundle extras = getIntent().getExtras();
if (extras != null) {
String selectedText = extras.getString("selectedText");
if (selectedText != null) {
EditText linkTextET = (EditText) findViewById(R.id.linkText);
linkTextET.setText(selectedText);
}
}

final Button cancelButton = (Button) findViewById(R.id.cancel);
final Button okButton = (Button) findViewById(R.id.ok);

final EditText urlEditText = (EditText) findViewById(R.id.linkURL);
urlEditText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (urlEditText.getText().toString().equals("")) {
urlEditText.setText("http://");
urlEditText.setSelection(7);
}
}

});

okButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
EditText linkURLET = (EditText) findViewById(R.id.linkURL);
String linkURL = linkURLET.getText().toString();

EditText linkTextET = (EditText) findViewById(R.id.linkText);
String linkText = linkTextET.getText().toString();

Bundle bundle = new Bundle();
bundle.putString("linkURL", linkURL);
if (!linkText.equals("")) {
bundle.putString("linkText", linkText);
}

Intent mIntent = new Intent();
mIntent.putExtras(bundle);
setResult(RESULT_OK, mIntent);
finish();

}
});

cancelButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent mIntent = new Intent();
setResult(RESULT_CANCELED, mIntent);
finish();
}
});

// select end of url
urlEditText.performClick();
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions WordPressEditor/src/main/res/layout/alert_create_link.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin_medium"
android:layout_gravity="center_vertical">

<EditText
android:id="@+id/linkURL"
android:inputType="textUri"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/link_enter_url"
android:imeOptions="actionNext" />

<EditText
android:id="@+id/linkText"
android:inputType="text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/linkURL"
android:hint="@string/link_enter_url_text" />

<Button
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/linkText"
android:layout_alignParentRight="true"
android:layout_marginLeft="@dimen/margin_medium"
android:text="@android:string/ok" />

<Button
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/ok"
android:layout_toLeftOf="@id/ok"
android:text="@android:string/cancel" />

</RelativeLayout>
81 changes: 81 additions & 0 deletions WordPressEditor/src/main/res/layout/alert_image_options.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal">

<EditText
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/title"
android:singleLine="true"/>

<EditText
android:id="@+id/caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/caption"
android:singleLine="true"
android:inputType="textCapSentences"/>

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/horizontal_alignment"
android:textStyle="bold"
android:textColor="@color/image_options_label"/>

<Spinner
android:id="@+id/alignment_spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:prompt="@string/image_alignment"/>

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/width"
android:textStyle="bold"
android:textColor="@color/image_options_label"/>

<SeekBar
android:layout_height="wrap_content"
android:id="@+id/imageWidth"
android:layout_width="match_parent"/>

<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:imeOptions="actionDone"
android:id="@+id/imageWidthText"
android:layout_gravity="left|center_vertical"
android:singleLine="true"
android:inputType="number"/>

<CheckBox
android:layout_gravity="left"
android:text="@string/featured"
android:id="@+id/featuredImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>

<CheckBox
android:layout_gravity="left"
android:text="@string/featured_in_post"
android:id="@+id/featuredInPost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</LinearLayout>
</ScrollView>
1 change: 1 addition & 0 deletions WordPressEditor/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<color name="blue_new_kid">#2EA2CC</color>
<color name="grey_extra_light">#eeeeee</color>
<color name="pressed_wordpress">#CC78C8E6</color>
<color name="image_options_label">#CCCCCC</color>
</resources>
25 changes: 25 additions & 0 deletions WordPressEditor/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,29 @@
<string name="post_settings">Settings</string>
<string name="post_content">Content</string>
<string name="post_title">Title</string>



<!-- link view -->
<string name="link_enter_url">URL</string>
<string name="link_enter_url_text">Link text (optional)</string>
<string name="create_a_link">Create a link</string>

<!-- image settings -->
<string name="image_settings">Image settings</string>
<string name="title">Title</string>
<string name="width">Width</string>
<string name="featured">Use as featured image</string>
<string name="featured_in_post">Include image in post content</string>
<string name="image_alignment">Alignment</string>
<string name="horizontal_alignment">Horizontal alignment</string>
<string name="caption">Caption (optional)</string>

<string-array name="alignment_array">
<item>None</item>
<item>Left</item>
<item>Center</item>
<item>Right</item>
</string-array>

</resources>

0 comments on commit 6f0d297

Please sign in to comment.