diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-03-19 23:16:02 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-03-19 23:21:28 +0100 |
commit | 382f9f744652d6ae1482910ec62513d6ea94863c (patch) | |
tree | 4c4b8ed48275498fafb5793de1d58a58b0b7c0d0 /android | |
parent | 088fb93a7b178b076d293d15c049132ba2975a26 (diff) |
tdf#106317 bottom tabbar, grow/shrink font, insert line,rect
- added some initial implementation of the bottom tab-bar, which
has 3 tabs - character, paragraph, insert
- insert has not (completely) working insert line and rect shapes
- add ability to shring/grow font as alternative to select its size
Change-Id: If039f985403a8155d1e011953043f2979b4bfa91
Diffstat (limited to 'android')
-rw-r--r-- | android/source/res/drawable/ic_grow.xml | 16 | ||||
-rw-r--r-- | android/source/res/drawable/ic_line.xml | 12 | ||||
-rw-r--r-- | android/source/res/drawable/ic_rect.xml | 13 | ||||
-rw-r--r-- | android/source/res/drawable/ic_shrink.xml | 16 | ||||
-rw-r--r-- | android/source/res/layout/toolbar_bottom.xml | 451 | ||||
-rw-r--r-- | android/source/res/values/dimens.xml | 1 | ||||
-rw-r--r-- | android/source/src/java/org/libreoffice/FormattingController.java | 19 | ||||
-rwxr-xr-x | android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java | 20 |
8 files changed, 386 insertions, 162 deletions
diff --git a/android/source/res/drawable/ic_grow.xml b/android/source/res/drawable/ic_grow.xml new file mode 100644 index 000000000000..fd169434d7ea --- /dev/null +++ b/android/source/res/drawable/ic_grow.xml @@ -0,0 +1,16 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="m17,9.219 l0,-4.313 2.281,2.313 0.719,-0.719 -3.281,-3.281 -0.219,-0.219 -0.219,0.219 -3.281,3.281 0.719,0.719 2.281,-2.313 0,4.313 1,0z" + android:fillAlpha="1" + android:strokeColor="#00000000" + android:fillColor="#1d99f3"/> + <path + android:pathData="m8.911,5 l-3.315,9.594 -0.123,0.406 -1.473,4 1.657,0 1.627,-4.438 5.432,0 1.627,4.438 1.657,0 -1.473,-4 -0.123,-0.406 -3.315,-9.594 -0.215,0 -1.749,0 -0.215,0zM10.015,6.938 L12.194,13.281 7.806,13.281 10.015,6.938z" + android:fillAlpha="1" + android:strokeColor="#00000000" + android:fillColor="#4d4d4d"/> +</vector> diff --git a/android/source/res/drawable/ic_line.xml b/android/source/res/drawable/ic_line.xml new file mode 100644 index 000000000000..639ba2dbf690 --- /dev/null +++ b/android/source/res/drawable/ic_line.xml @@ -0,0 +1,12 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="M4,11h16v2h-16z" + android:fillAlpha="1" + android:strokeColor="#00000000" + android:fillColor="#4d4d4d" + android:strokeWidth="2"/> +</vector> diff --git a/android/source/res/drawable/ic_rect.xml b/android/source/res/drawable/ic_rect.xml new file mode 100644 index 000000000000..241759ff00c3 --- /dev/null +++ b/android/source/res/drawable/ic_rect.xml @@ -0,0 +1,13 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="M4,6h16v12h-16z" + android:fillAlpha="0.99" + android:strokeColor="#00000000" + android:fillColor="#4d4d4d" + android:strokeWidth="4" + android:strokeAlpha="0.99"/> +</vector> diff --git a/android/source/res/drawable/ic_shrink.xml b/android/source/res/drawable/ic_shrink.xml new file mode 100644 index 000000000000..db0348437f16 --- /dev/null +++ b/android/source/res/drawable/ic_shrink.xml @@ -0,0 +1,16 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="m16,14.781 l0,4.313 -2.281,-2.313 -0.719,0.719 3.281,3.281 0.219,0.219 0.219,-0.219 3.281,-3.281 -0.719,-0.719 -2.281,2.313 0,-4.313 -1,0z" + android:fillAlpha="1" + android:strokeColor="#00000000" + android:fillColor="#1d99f3"/> + <path + android:pathData="m8.91,5 l-3.314,9.594 -0.123,0.406 -1.473,4 1.658,0 1.625,-4.438c-0.004,-0.001 7.111,0.004 7.111,0.004l-3.305,-9.566 -0.215,0 -1.75,0zM10.016,6.938 L12.195,13.281 7.805,13.281z" + android:fillAlpha="1" + android:strokeColor="#00000000" + android:fillColor="#4d4d4d"/> +</vector> diff --git a/android/source/res/layout/toolbar_bottom.xml b/android/source/res/layout/toolbar_bottom.xml index dc17a721ac2e..15ff06886efe 100644 --- a/android/source/res/layout/toolbar_bottom.xml +++ b/android/source/res/layout/toolbar_bottom.xml @@ -1,191 +1,320 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/toolbar_bottom" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" android:layout_alignParentBottom="true" - android:elevation="3dp" android:background="@color/toolbar_background" + android:elevation="3dp" + android:orientation="vertical" app:popupTheme="@style/LibreOfficeTheme.Toolbar" app:theme="@style/LibreOfficeTheme.Toolbar" tools:showIn="@layout/activity_main"> - <LinearLayout - android:id="@+id/formatting_toolbar" + <LinearLayout + android:id="@+id/formatting_toolbar" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <TabHost + android:id="@+id/toolbarTabHost" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> + android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <ImageButton - android:id="@+id/button_bold" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_bold"/> - - <ImageButton - android:id="@+id/button_italic" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_italic"/> - - <ImageButton - android:id="@+id/button_underlined" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_underlined"/> - - <ImageButton - android:id="@+id/button_strikethrough" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_strikethrough"/> - - <ImageButton - android:id="@+id/button_insertFormatListNumbering" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_numbering"/> - - <ImageButton - android:id="@+id/button_insertFormatListBullets" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_bullets"/> + android:layout_height="match_parent" + android:orientation="vertical"> - </LinearLayout> + <TabWidget + android:id="@android:id/tabs" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <ImageButton - android:id="@+id/button_align_left" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_align_left"/> - - <ImageButton - android:id="@+id/button_align_center" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_align_center"/> - - <ImageButton - android:id="@+id/button_align_right" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_align_right"/> - - <ImageButton - android:id="@+id/button_align_justify" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.25" - android:background="@drawable/image_button_background" - android:paddingBottom="12dp" - android:paddingTop="12dp" - android:src="@drawable/ic_format_align_justify"/> - </LinearLayout> + </TabWidget> - <Spinner - android:id="@+id/font_name_spinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - android:minHeight="50dip"/> + <FrameLayout + android:id="@android:id/tabcontent" + android:layout_width="match_parent" + android:layout_height="match_parent"> - <Spinner - android:id="@+id/font_size_spinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - android:minHeight="50dip"/> + <LinearLayout + android:id="@+id/tab_character" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + <ScrollView + android:layout_width="match_parent" + android:layout_height="@dimen/toolbar_height"> - </LinearLayout> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> - <LinearLayout - android:id="@+id/search_toolbar" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_weight="0.25" + android:orientation="horizontal"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal"> + <ImageButton + android:id="@+id/button_bold" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_bold" /> - <EditText - android:id="@+id/search_string" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_weight="0.2"/> + <ImageButton + android:id="@+id/button_italic" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_italic" /> - <ImageButton - android:id="@+id/button_search_up" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_weight="0.6" - android:background="@drawable/image_button_background" - android:padding="10dp" - android:src="@drawable/ic_search_direction_down"/> - - <ImageButton - android:id="@+id/button_search_down" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_weight="0.6" - android:background="@drawable/image_button_background" - android:padding="10dp" - android:src="@drawable/ic_search_direction_up"/> + <ImageButton + android:id="@+id/button_underlined" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_underlined" /> + + <ImageButton + android:id="@+id/button_strikethrough" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_strikethrough" /> + + </LinearLayout> + + <Spinner + android:id="@+id/font_name_spinner" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:minHeight="50dip" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal"> + + <Spinner + android:id="@+id/font_size_spinner" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="0.80" + android:minHeight="50dip" /> + + <ImageButton + android:id="@+id/button_font_shrink" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.10" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_shrink" /> + + <ImageButton + android:id="@+id/button_font_grow" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.10" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_grow" /> + + </LinearLayout> + </LinearLayout> + </ScrollView> + + </LinearLayout> + + <LinearLayout + android:id="@+id/tab_paragraph" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="@dimen/toolbar_height"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal"> + + <ImageButton + android:id="@+id/button_align_left" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_align_left" /> + + <ImageButton + android:id="@+id/button_align_center" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_align_center" /> + + <ImageButton + android:id="@+id/button_align_right" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_align_right" /> + + <ImageButton + android:id="@+id/button_align_justify" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_align_justify" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal"> + + <ImageButton + android:id="@+id/button_insertFormatListNumbering" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_numbering" /> + + <ImageButton + android:id="@+id/button_insertFormatListBullets" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_format_bullets" /> + </LinearLayout> + + </LinearLayout> + </ScrollView> + </LinearLayout> + + <LinearLayout + android:id="@+id/tab_insert" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="@dimen/toolbar_height"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_weight="0.25" + android:orientation="horizontal"> + + <ImageButton + android:id="@+id/button_insert_line" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_line" /> + + <ImageButton + android:id="@+id/button_insert_rect" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.25" + android:background="@drawable/image_button_background" + android:paddingBottom="12dp" + android:paddingTop="12dp" + android:src="@drawable/ic_rect" /> + </LinearLayout> + </ScrollView> + </LinearLayout> + </FrameLayout> </LinearLayout> - </LinearLayout> + </TabHost> + + </LinearLayout> + + <LinearLayout + android:id="@+id/search_toolbar" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal"> + + <EditText + android:id="@+id/search_string" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_weight="0.2" + android:inputType="" /> + + <ImageButton + android:id="@+id/button_search_up" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_weight="0.6" + android:background="@drawable/image_button_background" + android:padding="10dp" + android:src="@drawable/ic_search_direction_down" /> + + <ImageButton + android:id="@+id/button_search_down" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_weight="0.6" + android:background="@drawable/image_button_background" + android:padding="10dp" + android:src="@drawable/ic_search_direction_up" /> + </LinearLayout> </LinearLayout> diff --git a/android/source/res/values/dimens.xml b/android/source/res/values/dimens.xml index 7c48f2bc14f3..3de476c0cc42 100644 --- a/android/source/res/values/dimens.xml +++ b/android/source/res/values/dimens.xml @@ -8,4 +8,5 @@ <dimen name="file_icon_margin_end">8dp</dimen> <dimen name="list_item_margin">8dp</dimen> <dimen name="file_icon_width">32dp</dimen> + <dimen name="toolbar_height">256dp</dimen> </resources> diff --git a/android/source/src/java/org/libreoffice/FormattingController.java b/android/source/src/java/org/libreoffice/FormattingController.java index ea8b6fb54e85..cecb0dd469e4 100644 --- a/android/source/src/java/org/libreoffice/FormattingController.java +++ b/android/source/src/java/org/libreoffice/FormattingController.java @@ -15,7 +15,6 @@ import org.libreoffice.kit.Document; mContext = context; mContext.findViewById(R.id.button_insertFormatListBullets).setOnClickListener(this); - mContext.findViewById(R.id.button_insertFormatListNumbering).setOnClickListener(this); mContext.findViewById(R.id.button_bold).setOnClickListener(this); @@ -27,6 +26,12 @@ import org.libreoffice.kit.Document; mContext.findViewById(R.id.button_align_center).setOnClickListener(this); mContext.findViewById(R.id.button_align_right).setOnClickListener(this); mContext.findViewById(R.id.button_align_justify).setOnClickListener(this); + + mContext.findViewById(R.id.button_insert_line).setOnClickListener(this); + mContext.findViewById(R.id.button_insert_rect).setOnClickListener(this); + + mContext.findViewById(R.id.button_font_shrink).setOnClickListener(this); + mContext.findViewById(R.id.button_font_grow).setOnClickListener(this); } @Override @@ -73,6 +78,18 @@ import org.libreoffice.kit.Document; case R.id.button_align_justify: LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:JustifyPara")); break; + case R.id.button_insert_line: + LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Line")); + break; + case R.id.button_insert_rect: + LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Rect")); + break; + case R.id.button_font_shrink: + LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Shrink")); + break; + case R.id.button_font_grow: + LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Grow")); + break; } } diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java index d88e7eabe270..02129e50a7e8 100755 --- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -23,6 +23,7 @@ import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.ListView; +import android.widget.TabHost; import android.widget.Toast; import org.libreoffice.overlay.DocumentOverlay; @@ -95,6 +96,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity { private boolean isFormattingToolbarOpen = false; private boolean isSearchToolbarOpen = false; private boolean isDocumentChanged = false; + @Override public void onCreate(Bundle savedInstanceState) { Log.w(LOGTAG, "onCreate.."); @@ -185,6 +187,24 @@ public class LibreOfficeMainActivity extends AppCompatActivity { mDocumentOverlay = new DocumentOverlay(this, layerView); mToolbarController.setupToolbars(); + + TabHost host = (TabHost) findViewById(R.id.toolbarTabHost); + host.setup(); + + TabHost.TabSpec spec = host.newTabSpec("Character"); + spec.setContent(R.id.tab_character); + spec.setIndicator("Character"); + host.addTab(spec); + + spec = host.newTabSpec("Paragraph"); + spec.setContent(R.id.tab_paragraph); + spec.setIndicator("Paragraph"); + host.addTab(spec); + + spec = host.newTabSpec("Insert"); + spec.setContent(R.id.tab_insert); + spec.setIndicator("Insert"); + host.addTab(spec); } public RectF getCurrentCursorPosition() { |