Skip to content

Commit bb8c537

Browse files
committed
Added format bar buttons and dividers to editor layout
1 parent 6e340ac commit bb8c537

File tree

3 files changed

+113
-16
lines changed

3 files changed

+113
-16
lines changed

WordPressEditor/src/main/res/layout/fragment_editor.xml

100644100755
Lines changed: 88 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,99 @@
1414
android:layout_width="fill_parent"
1515
android:layout_height="@dimen/format_bar_height"
1616
android:layout_gravity="bottom"
17-
android:background="@color/format_bar_background"
18-
android:orientation="horizontal">
17+
android:background="@android:color/white"
18+
android:orientation="vertical">
1919

20-
<HorizontalScrollView
21-
android:layout_width="0dp"
22-
android:layout_height="wrap_content"
23-
android:layout_weight="1">
20+
<View
21+
android:id="@+id/format_bar_horizontal_divider"
22+
android:layout_width="fill_parent"
23+
android:layout_height="@dimen/format_bar_horizontal_divider_height"
24+
style="@style/Divider"/>
2425

25-
<LinearLayout
26-
android:layout_width="wrap_content"
26+
<LinearLayout
27+
android:id="@+id/format_bar_buttons"
28+
android:layout_width="fill_parent"
29+
android:layout_height="@dimen/format_bar_height"
30+
android:layout_gravity="bottom"
31+
android:layout_marginLeft="@dimen/format_bar_side_margin"
32+
android:layout_marginRight="@dimen/format_bar_side_margin"
33+
android:orientation="horizontal">
34+
35+
<HorizontalScrollView
36+
android:layout_width="0dp"
2737
android:layout_height="wrap_content"
28-
android:orientation="horizontal">
38+
android:layout_weight="1">
2939

30-
<ToggleButton
31-
android:id="@+id/bold"
32-
style="@style/ToggleButton"
40+
<LinearLayout
3341
android:layout_width="wrap_content"
34-
android:layout_height="fill_parent"
35-
android:background="@drawable/format_bar_button_bold_selector" />
36-
</LinearLayout>
37-
</HorizontalScrollView>
42+
android:layout_height="wrap_content"
43+
android:orientation="horizontal">
44+
45+
<ToggleButton
46+
android:id="@+id/format_bar_button_media"
47+
style="@style/FormatBarButton"
48+
android:layout_width="wrap_content"
49+
android:layout_height="fill_parent"
50+
android:background="@drawable/format_bar_button_media_selector"/>
51+
52+
<ToggleButton
53+
android:id="@+id/format_bar_button_bold"
54+
style="@style/FormatBarButton"
55+
android:layout_width="wrap_content"
56+
android:layout_height="fill_parent"
57+
android:background="@drawable/format_bar_button_bold_selector"/>
58+
59+
<ToggleButton
60+
android:id="@+id/format_bar_button_italic"
61+
style="@style/FormatBarButton"
62+
android:layout_width="wrap_content"
63+
android:layout_height="fill_parent"
64+
android:background="@drawable/format_bar_button_italic_selector"/>
65+
66+
<ToggleButton
67+
android:id="@+id/format_bar_button_quote"
68+
style="@style/FormatBarButton"
69+
android:layout_width="wrap_content"
70+
android:layout_height="fill_parent"
71+
android:background="@drawable/format_bar_button_quote_selector"/>
72+
73+
<ToggleButton
74+
android:id="@+id/format_bar_button_ul"
75+
style="@style/FormatBarButton"
76+
android:layout_width="wrap_content"
77+
android:layout_height="fill_parent"
78+
android:background="@drawable/format_bar_button_ul_selector"/>
79+
80+
<ToggleButton
81+
android:id="@+id/format_bar_button_ol"
82+
style="@style/FormatBarButton"
83+
android:layout_width="wrap_content"
84+
android:layout_height="fill_parent"
85+
android:background="@drawable/format_bar_button_ol_selector"/>
86+
87+
<ToggleButton
88+
android:id="@+id/format_bar_button_link"
89+
style="@style/FormatBarButton"
90+
android:layout_width="wrap_content"
91+
android:layout_height="fill_parent"
92+
android:background="@drawable/format_bar_button_link_selector"/>
93+
</LinearLayout>
94+
</HorizontalScrollView>
95+
96+
<View
97+
android:id="@+id/format_bar_vertical_divider"
98+
android:layout_width="@dimen/format_bar_vertical_divider_width"
99+
android:layout_height="@dimen/format_bar_vertical_divider_height"
100+
android:layout_gravity="center"
101+
style="@style/Divider"/>
102+
103+
<ToggleButton
104+
android:id="@+id/format_bar_button_html"
105+
style="@style/FormatBarHtmlButton"
106+
android:layout_width="wrap_content"
107+
android:layout_height="fill_parent"
108+
android:background="@drawable/format_bar_button_html_selector"/>
109+
</LinearLayout>
38110
</LinearLayout>
39111

40112
</FrameLayout>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<dimen name="format_bar_height">40dp</dimen>
4+
<dimen name="format_bar_side_margin">5dp</dimen>
5+
<dimen name="format_bar_button_right_margin">4dp</dimen>
6+
<dimen name="format_bar_html_button_left_margin">9dp</dimen>
7+
8+
<dimen name="format_bar_horizontal_divider_height">1dp</dimen>
9+
<dimen name="format_bar_vertical_divider_width">0.6dp</dimen>
10+
<dimen name="format_bar_vertical_divider_height">28dp</dimen>
411

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

815
<dimen name="post_editor_content_side_margin">20dp</dimen>
16+
917
<dimen name="margin_extra_small">2dp</dimen>
1018
<dimen name="margin_small">4dp</dimen>
1119
<dimen name="margin_medium">8dp</dimen>

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

100644100755
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,21 @@
66
<item name="android:textOn">""</item>
77
<item name="android:textOff">""</item>
88
</style>
9+
10+
<style name="FormatBarButton">
11+
<item name="android:minWidth">@dimen/format_bar_height</item>
12+
<item name="android:minHeight">@dimen/format_bar_height</item>
13+
<item name="android:layout_marginRight">@dimen/format_bar_button_right_margin</item>
14+
<item name="android:textOn">""</item>
15+
<item name="android:textOff">""</item>
16+
</style>
17+
18+
<style name="FormatBarHtmlButton" parent="FormatBarButton">
19+
<item name="android:layout_marginLeft">@dimen/format_bar_html_button_left_margin</item>
20+
</style>
21+
22+
<style name="Divider">
23+
<item name="android:background">@color/wp_gray</item>
24+
<item name="android:alpha">0.5</item>
25+
</style>
926
</resources>

0 commit comments

Comments
 (0)