Skip to content

Commit

Permalink
Added format bar buttons and dividers to editor layout
Browse files Browse the repository at this point in the history
  • Loading branch information
aforcier committed Apr 17, 2015
1 parent 6e340ac commit bb8c537
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 16 deletions.
104 changes: 88 additions & 16 deletions WordPressEditor/src/main/res/layout/fragment_editor.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,99 @@
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">
android:background="@android:color/white"
android:orientation="vertical">

<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<View
android:id="@+id/format_bar_horizontal_divider"
android:layout_width="fill_parent"
android:layout_height="@dimen/format_bar_horizontal_divider_height"
style="@style/Divider"/>

<LinearLayout
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/format_bar_buttons"
android:layout_width="fill_parent"
android:layout_height="@dimen/format_bar_height"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/format_bar_side_margin"
android:layout_marginRight="@dimen/format_bar_side_margin"
android:orientation="horizontal">

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

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

<ToggleButton
android:id="@+id/format_bar_button_media"
style="@style/FormatBarButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/format_bar_button_media_selector"/>

<ToggleButton
android:id="@+id/format_bar_button_bold"
style="@style/FormatBarButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/format_bar_button_bold_selector"/>

<ToggleButton
android:id="@+id/format_bar_button_italic"
style="@style/FormatBarButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/format_bar_button_italic_selector"/>

<ToggleButton
android:id="@+id/format_bar_button_quote"
style="@style/FormatBarButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/format_bar_button_quote_selector"/>

<ToggleButton
android:id="@+id/format_bar_button_ul"
style="@style/FormatBarButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/format_bar_button_ul_selector"/>

<ToggleButton
android:id="@+id/format_bar_button_ol"
style="@style/FormatBarButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/format_bar_button_ol_selector"/>

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

<View
android:id="@+id/format_bar_vertical_divider"
android:layout_width="@dimen/format_bar_vertical_divider_width"
android:layout_height="@dimen/format_bar_vertical_divider_height"
android:layout_gravity="center"
style="@style/Divider"/>

<ToggleButton
android:id="@+id/format_bar_button_html"
style="@style/FormatBarHtmlButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/format_bar_button_html_selector"/>
</LinearLayout>
</LinearLayout>

</FrameLayout>
8 changes: 8 additions & 0 deletions WordPressEditor/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="format_bar_height">40dp</dimen>
<dimen name="format_bar_side_margin">5dp</dimen>
<dimen name="format_bar_button_right_margin">4dp</dimen>
<dimen name="format_bar_html_button_left_margin">9dp</dimen>

<dimen name="format_bar_horizontal_divider_height">1dp</dimen>
<dimen name="format_bar_vertical_divider_width">0.6dp</dimen>
<dimen name="format_bar_vertical_divider_height">28dp</dimen>

<dimen name="format_bar_button_highlighted_underline_top">37dp</dimen>
<dimen name="format_bar_button_highlighted_underline_width">2dp</dimen>

<dimen name="post_editor_content_side_margin">20dp</dimen>

<dimen name="margin_extra_small">2dp</dimen>
<dimen name="margin_small">4dp</dimen>
<dimen name="margin_medium">8dp</dimen>
Expand Down
17 changes: 17 additions & 0 deletions WordPressEditor/src/main/res/values/styles.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,21 @@
<item name="android:textOn">""</item>
<item name="android:textOff">""</item>
</style>

<style name="FormatBarButton">
<item name="android:minWidth">@dimen/format_bar_height</item>
<item name="android:minHeight">@dimen/format_bar_height</item>
<item name="android:layout_marginRight">@dimen/format_bar_button_right_margin</item>
<item name="android:textOn">""</item>
<item name="android:textOff">""</item>
</style>

<style name="FormatBarHtmlButton" parent="FormatBarButton">
<item name="android:layout_marginLeft">@dimen/format_bar_html_button_left_margin</item>
</style>

<style name="Divider">
<item name="android:background">@color/wp_gray</item>
<item name="android:alpha">0.5</item>
</style>
</resources>

0 comments on commit bb8c537

Please sign in to comment.