diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-11-27 00:39:02 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-11-27 15:44:22 +0000 |
commit | 2961adbf90d5eb737bf6aceaa6bfd7ca9e1dbc97 (patch) | |
tree | df2122990bb790a8779a4c66953e5469db67c3ce /android | |
parent | 554163f2fe0cde5990bf323a13e5c04de4b7b30b (diff) | |
download | mupdf-2961adbf90d5eb737bf6aceaa6bfd7ca9e1dbc97.tar.xz |
android: Use custom styles for widgets.
Diffstat (limited to 'android')
-rw-r--r-- | android/res/drawable/busy.xml | 12 | ||||
-rw-r--r-- | android/res/drawable/button.xml | 23 | ||||
-rw-r--r-- | android/res/drawable/page_num.xml | 11 | ||||
-rw-r--r-- | android/res/drawable/search.xml | 37 | ||||
-rw-r--r-- | android/res/drawable/seek_progress.xml | 6 | ||||
-rw-r--r-- | android/res/drawable/seek_thumb.xml | 7 | ||||
-rw-r--r-- | android/res/drawable/slider.xml | 9 | ||||
-rw-r--r-- | android/res/layout/buttons.xml | 79 | ||||
-rw-r--r-- | android/res/layout/outline_entry.xml | 4 | ||||
-rw-r--r-- | android/res/layout/picker_entry.xml | 7 | ||||
-rw-r--r-- | android/res/values/colors.xml | 15 | ||||
-rw-r--r-- | android/src/com/artifex/mupdf/MuPDFActivity.java | 10 | ||||
-rw-r--r-- | android/src/com/artifex/mupdf/OutlineActivity.java | 1 | ||||
-rw-r--r-- | android/src/com/artifex/mupdf/PageView.java | 4 |
14 files changed, 156 insertions, 69 deletions
diff --git a/android/res/drawable/busy.xml b/android/res/drawable/busy.xml index c20d320b..5ac0ce76 100644 --- a/android/res/drawable/busy.xml +++ b/android/res/drawable/busy.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <corners android:radius="10dp" /> - <padding android:left="20dp" - android:right="20dp" - android:top="20dp" - android:bottom="20dp" /> - <solid android:color="@color/bar" /> + <corners android:radius="12dp" /> + <padding android:left="16dp" + android:right="16dp" + android:top="16dp" + android:bottom="16dp" /> + <solid android:color="@color/busy_indicator" /> </shape> diff --git a/android/res/drawable/button.xml b/android/res/drawable/button.xml new file mode 100644 index 00000000..3b87ccb6 --- /dev/null +++ b/android/res/drawable/button.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true"> + <shape> + <solid android:color="@color/button_pressed" /> + <padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" /> + </shape> + </item> + <item android:state_focused="true"> + <shape> + <solid android:color="@color/button_normal" /> + <stroke android:width="4dp" android:color="@color/button_pressed" /> + <padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" /> + </shape> + </item> + <item> + <shape> + <solid android:color="@color/button_normal" /> + <padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" /> + </shape> + </item> +</selector> diff --git a/android/res/drawable/page_num.xml b/android/res/drawable/page_num.xml index 627f9b60..533579e1 100644 --- a/android/res/drawable/page_num.xml +++ b/android/res/drawable/page_num.xml @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <corners android:radius="2dp" /> - <padding android:left="5dp" - android:right="5dp" - android:top="5dp" - android:bottom="5dp" /> - <solid android:color="@color/bar" /> + <padding android:left="8dp" + android:right="8dp" + android:top="1dp" + android:bottom="2dp" /> + <solid android:color="@color/page_indicator" /> </shape> diff --git a/android/res/drawable/search.xml b/android/res/drawable/search.xml new file mode 100644 index 00000000..d689c465 --- /dev/null +++ b/android/res/drawable/search.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true"> + <shape android:shape="rectangle"> + <solid android:color="@color/text_pressed" /> + <stroke android:width="4dp" android:color="@color/text_border_pressed" /> + <padding + android:left="12dp" + android:right="12dp" + android:top="8dp" + android:bottom="8dp" /> + </shape> + </item> + <item android:state_focused="true"> + <shape> + <solid android:color="@color/text_normal" /> + <stroke android:width="4dp" android:color="@color/text_border_focused" /> + <padding + android:left="12dp" + android:right="12dp" + android:top="8dp" + android:bottom="8dp" /> + </shape> + </item> + <item> + <shape> + <solid android:color="@color/text_normal" /> + <stroke android:width="4dp" android:color="@color/text_border_normal" /> + <padding + android:left="12dp" + android:right="12dp" + android:top="8dp" + android:bottom="8dp" /> + </shape> + </item> +</selector> diff --git a/android/res/drawable/seek_progress.xml b/android/res/drawable/seek_progress.xml new file mode 100644 index 00000000..2722ed07 --- /dev/null +++ b/android/res/drawable/seek_progress.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> + +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="line" > + <stroke android:width="6dp" android:color="@color/seek_progress" /> +</shape> diff --git a/android/res/drawable/seek_thumb.xml b/android/res/drawable/seek_thumb.xml new file mode 100644 index 00000000..518aa588 --- /dev/null +++ b/android/res/drawable/seek_thumb.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> + +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="oval" > + <size android:width="28dp" android:height="28dp" /> + <solid android:color="@color/seek_thumb" /> +</shape> diff --git a/android/res/drawable/slider.xml b/android/res/drawable/slider.xml deleted file mode 100644 index bf4a75da..00000000 --- a/android/res/drawable/slider.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <padding android:left="15dp" - android:right="15dp" - android:top="5dp" - android:bottom="5dp" /> - <solid android:color="@color/bar" /> -</shape> diff --git a/android/res/layout/buttons.xml b/android/res/layout/buttons.xml index fe6b27f1..642e6e6a 100644 --- a/android/res/layout/buttons.xml +++ b/android/res/layout/buttons.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > @@ -14,20 +15,30 @@ android:id="@+id/topBar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingBottom="0dp" - android:paddingLeft="0dp" - android:paddingRight="0dp" - android:paddingTop="0dp" - android:background="@color/bar" > + android:background="@color/toolbar" > + + <TextView + android:id="@+id/docNameText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_toLeftOf="@+id/linkButton" + android:layout_alignParentLeft="true" + android:paddingLeft="16dp" + android:singleLine="true" + android:textColor="#FFFFFF" + android:textStyle="bold" + android:textAppearance="?android:attr/textAppearanceMedium" /> <ImageButton - android:id="@+id/searchButton" + android:id="@+id/linkButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentRight="true" android:layout_centerVertical="true" - android:contentDescription="@string/search_document" - android:src="@drawable/ic_magnifying_glass" /> + android:layout_toLeftOf="@+id/outlineButton" + android:contentDescription="@string/link_control" + android:background="@drawable/button" + android:src="@drawable/ic_link" /> <ImageButton android:id="@+id/outlineButton" @@ -36,27 +47,18 @@ android:layout_centerVertical="true" android:layout_toLeftOf="@+id/searchButton" android:contentDescription="@string/search_document" + android:background="@drawable/button" android:src="@drawable/ic_list" /> <ImageButton - android:id="@+id/linkButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/outlineButton" - android:contentDescription="@string/link_control" - android:src="@drawable/ic_link" /> - - <TextView - android:id="@+id/docNameText" + android:id="@+id/searchButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/linkButton" - android:paddingLeft="15dp" - android:singleLine="true" - android:textAppearance="?android:attr/textAppearanceMedium" /> + android:layout_alignParentRight="true" + android:contentDescription="@string/search_document" + android:background="@drawable/button" + android:src="@drawable/ic_magnifying_glass" /> </RelativeLayout> @@ -64,29 +66,26 @@ android:id="@+id/topBar2" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingBottom="0dp" - android:paddingLeft="0dp" - android:paddingRight="0dp" - android:paddingTop="0dp" - android:background="@color/bar" > + android:background="@color/toolbar" > <ImageButton android:id="@+id/cancel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" android:layout_centerVertical="true" + android:layout_alignParentLeft="true" android:contentDescription="@string/cancel" + android:background="@drawable/button" android:src="@drawable/ic_cancel" /> <EditText android:id="@+id/searchText" + android:background="@drawable/search" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerHorizontal="true" android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/searchBack" android:layout_toRightOf="@+id/cancel" + android:layout_toLeftOf="@+id/searchBack" android:inputType="text" android:hint="Search" android:singleLine="true" /> @@ -98,15 +97,17 @@ android:layout_centerVertical="true" android:layout_toLeftOf="@+id/searchForward" android:contentDescription="@string/search_backwards" + android:background="@drawable/button" android:src="@drawable/ic_arrow_left" /> <ImageButton android:id="@+id/searchForward" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentRight="true" android:layout_centerVertical="true" + android:layout_alignParentRight="true" android:contentDescription="@string/search_forwards" + android:background="@drawable/button" android:src="@drawable/ic_arrow_right" /> </RelativeLayout> @@ -127,7 +128,14 @@ android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_margin="0dp" - android:background="@drawable/slider" /> + android:thumb="@drawable/seek_thumb" + android:progressDrawable="@drawable/seek_progress" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingTop="12dp" + android:paddingBottom="8dp" + android:background="@color/toolbar" + /> <TextView android:id="@+id/pageNumber" @@ -135,8 +143,9 @@ android:layout_height="wrap_content" android:layout_above="@+id/pageSlider" android:layout_centerHorizontal="true" - android:layout_marginBottom="10dp" + android:layout_marginBottom="16dp" android:background="@drawable/page_num" + android:textColor="#FFFFFF" android:textAppearance="?android:attr/textAppearanceMedium" /> </RelativeLayout> diff --git a/android/res/layout/outline_entry.xml b/android/res/layout/outline_entry.xml index 3983d766..e0a23db5 100644 --- a/android/res/layout/outline_entry.xml +++ b/android/res/layout/outline_entry.xml @@ -11,7 +11,7 @@ android:layout_toLeftOf="@+id/page" android:singleLine="true" android:layout_centerVertical="true" - android:paddingLeft="10dp" + android:paddingLeft="8dp" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView @@ -21,7 +21,7 @@ android:layout_alignBaseline="@+id/title" android:layout_alignBottom="@+id/title" android:layout_alignParentRight="true" - android:paddingRight="10dp" + android:paddingRight="8dp" android:textAppearance="?android:attr/textAppearanceMedium" /> </RelativeLayout> diff --git a/android/res/layout/picker_entry.xml b/android/res/layout/picker_entry.xml index 2424630b..1b7038e6 100644 --- a/android/res/layout/picker_entry.xml +++ b/android/res/layout/picker_entry.xml @@ -2,6 +2,9 @@ <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="10dp" - android:textAppearance="?android:attr/textAppearanceMedium" > + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingLeft="12dp" + android:paddingRight="12dp" + android:textAppearance="?android:attr/textAppearanceLarge" > </TextView> diff --git a/android/res/values/colors.xml b/android/res/values/colors.xml index 30b2dbc3..1a02ca21 100644 --- a/android/res/values/colors.xml +++ b/android/res/values/colors.xml @@ -1,5 +1,16 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <color name="canvas">#FF404040</color> - <color name="bar">#C0202020</color> + <color name="canvas">#404040</color> + <color name="toolbar">#C0000000</color> + <color name="page_indicator">#C0202020</color> + <color name="busy_indicator">#C0202020</color> + <color name="button_normal">#00000000</color> + <color name="button_pressed">#FF2572AC</color> + <color name="text_normal">#FFFFFF</color> + <color name="text_pressed">#FFFFFF</color> + <color name="text_border_normal">#000000</color> + <color name="text_border_pressed">#2572AC</color> + <color name="text_border_focused">#000000</color> + <color name="seek_thumb">#2572AC</color> + <color name="seek_progress">#FFFFFF</color> </resources> diff --git a/android/src/com/artifex/mupdf/MuPDFActivity.java b/android/src/com/artifex/mupdf/MuPDFActivity.java index 81a23eee..283ed761 100644 --- a/android/src/com/artifex/mupdf/MuPDFActivity.java +++ b/android/src/com/artifex/mupdf/MuPDFActivity.java @@ -415,7 +415,7 @@ public class MuPDFActivity extends Activity protected void onMoveToChild(int i) { if (core == null) return; - mPageNumberView.setText(String.format("%d/%d", i+1, core.countPages())); + mPageNumberView.setText(String.format("%d / %d", i+1, core.countPages())); mPageSlider.setMax((core.countPages()-1) * mPageSliderRes); mPageSlider.setProgress(i * mPageSliderRes); if (SearchTaskResult.get() != null && SearchTaskResult.get().pageNumber != i) { @@ -546,11 +546,11 @@ public class MuPDFActivity extends Activity mLinkButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (mLinkHighlight) { - mLinkButton.setColorFilter(Color.argb(255, 255, 255, 255)); + mLinkButton.setColorFilter(Color.argb(0xFF, 255, 255, 255)); mLinkHighlight = false; } else { - // light blue tint - mLinkButton.setColorFilter(Color.argb(255, (37+255)/2, (114+255)/2, (172+255)/2)); + // LINK_COLOR tint + mLinkButton.setColorFilter(Color.argb(0xFF, 172, 114, 37)); mLinkHighlight = true; } // Inform pages of the change. @@ -753,7 +753,7 @@ public class MuPDFActivity extends Activity void updatePageNumView(int index) { if (core == null) return; - mPageNumberView.setText(String.format("%d/%d", index+1, core.countPages())); + mPageNumberView.setText(String.format("%d / %d", index+1, core.countPages())); } void makeButtonsView() { diff --git a/android/src/com/artifex/mupdf/OutlineActivity.java b/android/src/com/artifex/mupdf/OutlineActivity.java index dfb10639..262d4e22 100644 --- a/android/src/com/artifex/mupdf/OutlineActivity.java +++ b/android/src/com/artifex/mupdf/OutlineActivity.java @@ -16,6 +16,7 @@ public class OutlineActivity extends ListActivity { setListAdapter(new OutlineAdapter(getLayoutInflater(),mItems)); // Restore the position within the list from last viewing getListView().setSelection(OutlineActivityData.get().position); + getListView().setDividerHeight(0); setResult(-1); } diff --git a/android/src/com/artifex/mupdf/PageView.java b/android/src/com/artifex/mupdf/PageView.java index adacb3bd..f07ea8d8 100644 --- a/android/src/com/artifex/mupdf/PageView.java +++ b/android/src/com/artifex/mupdf/PageView.java @@ -41,8 +41,8 @@ class OpaqueImageView extends ImageView { } public abstract class PageView extends ViewGroup { - private static final int HIGHLIGHT_COLOR = 0x805555FF; - private static final int LINK_COLOR = 0x80FFCC88; + private static final int HIGHLIGHT_COLOR = 0x802572AC; + private static final int LINK_COLOR = 0x80AC7225; private static final int BACKGROUND_COLOR = 0xFFFFFFFF; private static final int PROGRESS_DIALOG_DELAY = 200; private final Context mContext; |