From 2961adbf90d5eb737bf6aceaa6bfd7ca9e1dbc97 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 27 Nov 2012 00:39:02 +0100 Subject: android: Use custom styles for widgets. --- android/res/drawable/busy.xml | 12 ++-- android/res/drawable/button.xml | 23 +++++++ android/res/drawable/page_num.xml | 11 ++- android/res/drawable/search.xml | 37 ++++++++++ android/res/drawable/seek_progress.xml | 6 ++ android/res/drawable/seek_thumb.xml | 7 ++ android/res/drawable/slider.xml | 9 --- android/res/layout/buttons.xml | 79 ++++++++++++---------- android/res/layout/outline_entry.xml | 4 +- android/res/layout/picker_entry.xml | 7 +- android/res/values/colors.xml | 15 +++- android/src/com/artifex/mupdf/MuPDFActivity.java | 10 +-- android/src/com/artifex/mupdf/OutlineActivity.java | 1 + android/src/com/artifex/mupdf/PageView.java | 4 +- 14 files changed, 156 insertions(+), 69 deletions(-) create mode 100644 android/res/drawable/button.xml create mode 100644 android/res/drawable/search.xml create mode 100644 android/res/drawable/seek_progress.xml create mode 100644 android/res/drawable/seek_thumb.xml delete mode 100644 android/res/drawable/slider.xml (limited to 'android') 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 @@ - - - + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 @@ - - - + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + 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 @@ + + + + + + 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 @@ - - - - - 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 @@ + @@ -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" > + + + android:layout_toLeftOf="@+id/outlineButton" + android:contentDescription="@string/link_control" + android:background="@drawable/button" + android:src="@drawable/ic_link" /> - - + android:layout_alignParentRight="true" + android:contentDescription="@string/search_document" + android:background="@drawable/button" + android:src="@drawable/ic_magnifying_glass" /> @@ -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" > @@ -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" /> @@ -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" + /> 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" /> 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 @@ + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingLeft="12dp" + android:paddingRight="12dp" + android:textAppearance="?android:attr/textAppearanceLarge" > 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 @@ - #FF404040 - #C0202020 + #404040 + #C0000000 + #C0202020 + #C0202020 + #00000000 + #FF2572AC + #FFFFFF + #FFFFFF + #000000 + #2572AC + #000000 + #2572AC + #FFFFFF 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; -- cgit v1.2.3