Skip to content

Commit

Permalink
use EditorFragmentInterface and call initContentEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Feb 9, 2015
1 parent 26fc5f7 commit 4b1beca
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 14 deletions.

This file was deleted.

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

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;

import org.wordpress.android.editor.EditorFragmentInterface.EditorFragmentListener;

public class EditorExampleActivity extends ActionBarActivity implements EditorFragmentListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_editor);
}

@Override
public void onSettingsClicked() {
// TODO
}

@Override
public void onAddMediaButtonClicked() {
// TODO
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
package org.wordpress.android.editor;

import android.app.Activity;
import android.app.Fragment;

public abstract class EditorFragmentInterface extends Fragment {
public abstract void setTitle(CharSequence text);
public abstract void setContent(CharSequence text);
protected EditorFragmentListener mEditorFragmentListener;

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mEditorFragmentListener = (EditorFragmentListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement EditorFragmentListener");
}
}

public interface EditorFragmentListener {
public void onSettingsClicked();
public void onAddMediaButtonClicked();
}
}
2 changes: 1 addition & 1 deletion example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android {

defaultConfig {
applicationId "org.wordpress.editorexample"
minSdkVersion 15
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
Expand Down
2 changes: 1 addition & 1 deletion example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:label="@string/title_activity_example" >
</activity>
<activity
android:name="org.wordpress.android.editor.EditorActivity" >
android:name="org.wordpress.android.editor.EditorExampleActivity" >
</activity>
</application>

Expand Down

0 comments on commit 4b1beca

Please sign in to comment.