Skip to content

Commit

Permalink
Added example format bar with bold button
Browse files Browse the repository at this point in the history
  • Loading branch information
aforcier committed Apr 9, 2015
1 parent fc5f50d commit 5da8d79
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ToggleButton;

import com.android.volley.toolbox.ImageLoader;

Expand All @@ -28,7 +29,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;

public class EditorFragment extends EditorFragmentAbstract {
public class EditorFragment extends EditorFragmentAbstract implements View.OnClickListener {
private static final String ARG_PARAM_TITLE = "param_title";
private static final String ARG_PARAM_CONTENT = "param_content";

Expand All @@ -38,6 +39,7 @@ public class EditorFragment extends EditorFragmentAbstract {
private String mParamContent;
private WebView mWebView;

private ToggleButton mBoldButton;
public static EditorFragment newInstance(String title, String content) {
EditorFragment fragment = new EditorFragment();
Bundle args = new Bundle();
Expand All @@ -60,11 +62,14 @@ public void onCreate(Bundle savedInstanceState) {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_editor, container, false);
mWebView = (WebView) view.findViewById(R.id.webview);
initWebView();

mBoldButton = (ToggleButton) view.findViewById(R.id.bold);
mBoldButton.setOnClickListener(this);

return view;
}

Expand Down
28 changes: 28 additions & 0 deletions WordPressEditor/src/main/res/layout/fragment_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,32 @@
android:layout_height="match_parent"
android:id="@+id/webview"/>

<LinearLayout
android:id="@+id/format_bar"
android:layout_width="fill_parent"
android:layout_height="@dimen/format_bar_height"
android:layout_gravity="bottom"
android:background="@color/format_bar_background"
android:orientation="horizontal">

<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

<ToggleButton
android:id="@+id/bold"
style="@style/ToggleButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/format_bar_button_bold_selector" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>

</FrameLayout>

0 comments on commit 5da8d79

Please sign in to comment.