summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/res/drawable-ldpi/ic_hl_link.pngbin558 -> 0 bytes
-rw-r--r--android/res/drawable-ldpi/ic_nolink.pngbin518 -> 0 bytes
-rw-r--r--android/res/drawable-mdpi/ic_hl_link.pngbin601 -> 0 bytes
-rw-r--r--android/res/drawable-mdpi/ic_nolink.pngbin690 -> 0 bytes
-rw-r--r--android/res/layout/buttons.xml10
-rw-r--r--android/src/com/artifex/mupdf/MuPDFActivity.java56
6 files changed, 34 insertions, 32 deletions
diff --git a/android/res/drawable-ldpi/ic_hl_link.png b/android/res/drawable-ldpi/ic_hl_link.png
deleted file mode 100644
index 30a03ea8..00000000
--- a/android/res/drawable-ldpi/ic_hl_link.png
+++ /dev/null
Binary files differ
diff --git a/android/res/drawable-ldpi/ic_nolink.png b/android/res/drawable-ldpi/ic_nolink.png
deleted file mode 100644
index 5a8f0051..00000000
--- a/android/res/drawable-ldpi/ic_nolink.png
+++ /dev/null
Binary files differ
diff --git a/android/res/drawable-mdpi/ic_hl_link.png b/android/res/drawable-mdpi/ic_hl_link.png
deleted file mode 100644
index d38f945c..00000000
--- a/android/res/drawable-mdpi/ic_hl_link.png
+++ /dev/null
Binary files differ
diff --git a/android/res/drawable-mdpi/ic_nolink.png b/android/res/drawable-mdpi/ic_nolink.png
deleted file mode 100644
index f13053cf..00000000
--- a/android/res/drawable-mdpi/ic_nolink.png
+++ /dev/null
Binary files differ
diff --git a/android/res/layout/buttons.xml b/android/res/layout/buttons.xml
index a9f46d38..fe6b27f1 100644
--- a/android/res/layout/buttons.xml
+++ b/android/res/layout/buttons.xml
@@ -37,7 +37,7 @@
android:layout_toLeftOf="@+id/searchButton"
android:contentDescription="@string/search_document"
android:src="@drawable/ic_list" />
-<!--
+
<ImageButton
android:id="@+id/linkButton"
android:layout_width="wrap_content"
@@ -46,17 +46,18 @@
android:layout_toLeftOf="@+id/outlineButton"
android:contentDescription="@string/link_control"
android:src="@drawable/ic_link" />
--->
+
<TextView
android:id="@+id/docNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
- android:layout_toLeftOf="@+id/outlineButton"
+ android:layout_toLeftOf="@+id/linkButton"
android:paddingLeft="15dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
+
</RelativeLayout>
<RelativeLayout
@@ -107,7 +108,9 @@
android:layout_centerVertical="true"
android:contentDescription="@string/search_forwards"
android:src="@drawable/ic_arrow_right" />
+
</RelativeLayout>
+
</ViewSwitcher>
<RelativeLayout
@@ -135,6 +138,7 @@
android:layout_marginBottom="10dp"
android:background="@drawable/page_num"
android:textAppearance="?android:attr/textAppearanceMedium" />
+
</RelativeLayout>
</RelativeLayout>
diff --git a/android/src/com/artifex/mupdf/MuPDFActivity.java b/android/src/com/artifex/mupdf/MuPDFActivity.java
index a177d092..81a23eee 100644
--- a/android/src/com/artifex/mupdf/MuPDFActivity.java
+++ b/android/src/com/artifex/mupdf/MuPDFActivity.java
@@ -10,6 +10,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
+import android.graphics.Color;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Bundle;
@@ -38,6 +39,7 @@ class ThreadPerTaskExecutor implements Executor {
new Thread(r).start();
}
}
+
class SearchTaskResult {
public final String txt;
public final int pageNumber;
@@ -76,10 +78,10 @@ class ProgressDialogX extends ProgressDialog {
super.cancel();
}
}
+
public class MuPDFActivity extends Activity
{
/* The core rendering instance */
- private enum LinkState {DEFAULT, HIGHLIGHT, INHIBIT};
private final int TAP_PAGE_MARGIN = 5;
private static final int SEARCH_PROGRESS_DELAY = 200;
private MuPDFCore core;
@@ -96,7 +98,7 @@ public class MuPDFActivity extends Activity
private ImageButton mCancelButton;
private ImageButton mOutlineButton;
private ViewSwitcher mTopBarSwitcher;
-// XXX private ImageButton mLinkButton;
+ private ImageButton mLinkButton;
private boolean mTopBarIsSearch;
private ImageButton mSearchBack;
private ImageButton mSearchFwd;
@@ -104,7 +106,7 @@ public class MuPDFActivity extends Activity
private AsyncTask<Void,Integer,SearchTaskResult> mSearchTask;
//private SearchTaskResult mSearchTaskResult;
private AlertDialog.Builder mAlertBuilder;
- private LinkState mLinkState = LinkState.DEFAULT;
+ private boolean mLinkHighlight = false;
private final Handler mHandler = new Handler();
private boolean mAlertsActive= false;
private AsyncTask<Void,Void,MuPDFAlert> mAlertTask;
@@ -351,12 +353,9 @@ public class MuPDFActivity extends Activity
super.moveToNext();
} else {
int linkPage = -1;
- if (mLinkState != LinkState.INHIBIT) {
- if (pageView != null) {
-// XXX linkPage = pageView.hitLinkPage(e.getX(), e.getY());
- }
+ if (mLinkHighlight && pageView != null) {
+ linkPage = pageView.hitLinkPage(e.getX(), e.getY());
}
-
if (linkPage != -1) {
mDocView.setDisplayedViewIndex(linkPage);
} else {
@@ -399,7 +398,7 @@ public class MuPDFActivity extends Activity
else
((PageView)v).setSearchBoxes(null);
- ((PageView)v).setLinkHighlighting(mLinkState == LinkState.HIGHLIGHT);
+ ((PageView)v).setLinkHighlighting(mLinkHighlight);
((MuPDFPageView)v).setChangeReporter(new Runnable() {
public void run() {
@@ -485,6 +484,8 @@ public class MuPDFActivity extends Activity
// Search invoking buttons are disabled while there is no text specified
mSearchBack.setEnabled(false);
mSearchFwd.setEnabled(false);
+ mSearchBack.setColorFilter(Color.argb(255, 128, 128, 128));
+ mSearchFwd.setColorFilter(Color.argb(255, 128, 128, 128));
// React to interaction with the text widget
mSearchText.addTextChangedListener(new TextWatcher() {
@@ -493,6 +494,13 @@ public class MuPDFActivity extends Activity
boolean haveText = s.toString().length() > 0;
mSearchBack.setEnabled(haveText);
mSearchFwd.setEnabled(haveText);
+ if (haveText) {
+ mSearchBack.setColorFilter(Color.argb(255, 255, 255, 255));
+ mSearchFwd.setColorFilter(Color.argb(255, 255, 255, 255));
+ } else {
+ mSearchBack.setColorFilter(Color.argb(255, 128, 128, 128));
+ mSearchFwd.setColorFilter(Color.argb(255, 128, 128, 128));
+ }
// Remove any previous search results
if (SearchTaskResult.get() != null && !mSearchText.getText().toString().equals(SearchTaskResult.get().txt)) {
@@ -535,30 +543,20 @@ public class MuPDFActivity extends Activity
}
});
-/* XXX
mLinkButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
- switch(mLinkState) {
- case DEFAULT:
- mLinkState = LinkState.HIGHLIGHT;
- mLinkButton.setImageResource(R.drawable.ic_hl_link);
- //Inform pages of the change.
- mDocView.resetupChildren();
- break;
- case HIGHLIGHT:
- mLinkState = LinkState.INHIBIT;
- mLinkButton.setImageResource(R.drawable.ic_nolink);
- //Inform pages of the change.
- mDocView.resetupChildren();
- break;
- case INHIBIT:
- mLinkState = LinkState.DEFAULT;
- mLinkButton.setImageResource(R.drawable.ic_link);
- break;
+ if (mLinkHighlight) {
+ mLinkButton.setColorFilter(Color.argb(255, 255, 255, 255));
+ mLinkHighlight = false;
+ } else {
+ // light blue tint
+ mLinkButton.setColorFilter(Color.argb(255, (37+255)/2, (114+255)/2, (172+255)/2));
+ mLinkHighlight = true;
}
+ // Inform pages of the change.
+ mDocView.resetupChildren();
}
});
-*/
if (core.hasOutline()) {
mOutlineButton.setOnClickListener(new View.OnClickListener() {
@@ -770,7 +768,7 @@ public class MuPDFActivity extends Activity
mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
-// XXX mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
+ mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
mTopBarSwitcher.setVisibility(View.INVISIBLE);
mPageNumberView.setVisibility(View.INVISIBLE);
mPageSlider.setVisibility(View.INVISIBLE);