summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-02-21 18:17:05 +0100
committerTor Andersson <tor.andersson@artifex.com>2012-02-21 18:17:05 +0100
commit8881c1cf76182a780516d61539944dac8aca65ac (patch)
tree17a6735a6e5079df4095979593ebd3702468ef7f /android
parent827985639bd9f6302e3efcd96de0a541a2222f19 (diff)
downloadmupdf-8881c1cf76182a780516d61539944dac8aca65ac.tar.xz
android app: slide buttons on instead of fading
Diffstat (limited to 'android')
-rw-r--r--android/res/anim/fade_in.xml5
-rw-r--r--android/res/anim/fade_out.xml5
-rw-r--r--android/res/layout/buttons.xml27
-rw-r--r--android/src/com/artifex/mupdf/MuPDFActivity.java43
4 files changed, 51 insertions, 29 deletions
diff --git a/android/res/anim/fade_in.xml b/android/res/anim/fade_in.xml
deleted file mode 100644
index b2af62ca..00000000
--- a/android/res/anim/fade_in.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<alpha xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromAlpha="0.0"
- android:toAlpha="1.0"
- android:duration="200" />
diff --git a/android/res/anim/fade_out.xml b/android/res/anim/fade_out.xml
deleted file mode 100644
index 7d742df3..00000000
--- a/android/res/anim/fade_out.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<alpha xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromAlpha="1.0"
- android:toAlpha="0.0"
- android:duration="200" />
diff --git a/android/res/layout/buttons.xml b/android/res/layout/buttons.xml
index b4d44284..b35f7daa 100644
--- a/android/res/layout/buttons.xml
+++ b/android/res/layout/buttons.xml
@@ -3,21 +3,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <SeekBar
- android:id="@+id/pageSlider"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_centerHorizontal="true"
- android:layout_margin="0dp"
- android:background="@drawable/slider" />
-
<ViewSwitcher
android:id="@+id/switcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
- android:layout_below="@+id/topBar"
android:layout_centerHorizontal="true" >
<RelativeLayout
@@ -111,6 +101,22 @@
</RelativeLayout>
</ViewSwitcher>
+ <RelativeLayout
+ android:id="@+id/lowerButtons"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true" >
+
+ <SeekBar
+ android:id="@+id/pageSlider"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ android:layout_margin="0dp"
+ android:background="@drawable/slider" />
+
<TextView
android:id="@+id/pageNumber"
android:layout_width="wrap_content"
@@ -120,5 +126,6 @@
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 364f94ed..f7de9a4f 100644
--- a/android/src/com/artifex/mupdf/MuPDFActivity.java
+++ b/android/src/com/artifex/mupdf/MuPDFActivity.java
@@ -17,10 +17,10 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.TranslateAnimation;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
@@ -55,6 +55,7 @@ public class MuPDFActivity extends Activity
private ImageButton mCancelButton;
private ImageButton mOutlineButton;
private ViewSwitcher mTopBarSwitcher;
+ private View mLowerButtons;
private boolean mTopBarIsSearch;
private ImageButton mSearchBack;
private ImageButton mSearchFwd;
@@ -415,15 +416,26 @@ public class MuPDFActivity extends Activity
mSearchText.requestFocus();
showKeyboard();
}
- Animation anim = AnimationUtils.loadAnimation(this, R.anim.fade_in);
+ Animation anim = new TranslateAnimation(0, 0, -mTopBarSwitcher.getHeight(), 0);
+ anim.setDuration(500);
+ anim.setAnimationListener(new Animation.AnimationListener() {
+ public void onAnimationStart(Animation animation) {
+ mTopBarSwitcher.setVisibility(View.VISIBLE);
+ }
+ public void onAnimationRepeat(Animation animation) {}
+ public void onAnimationEnd(Animation animation) {}
+ });
+ mTopBarSwitcher.startAnimation(anim);
+ anim = new TranslateAnimation(0, 0, mLowerButtons.getHeight(), 0);
+ anim.setDuration(500);
anim.setAnimationListener(new Animation.AnimationListener() {
public void onAnimationStart(Animation animation) {
- mButtonsView.setVisibility(View.VISIBLE);
+ mLowerButtons.setVisibility(View.VISIBLE);
}
public void onAnimationRepeat(Animation animation) {}
public void onAnimationEnd(Animation animation) {}
});
- mButtonsView.startAnimation(anim);
+ mLowerButtons.startAnimation(anim);
}
}
@@ -431,15 +443,26 @@ public class MuPDFActivity extends Activity
if (mButtonsVisible) {
mButtonsVisible = false;
hideKeyboard();
- Animation anim = AnimationUtils.loadAnimation(this, R.anim.fade_out);
+ Animation anim = new TranslateAnimation(0, 0, 0, -mTopBarSwitcher.getHeight());
+ anim.setDuration(500);
+ anim.setAnimationListener(new Animation.AnimationListener() {
+ public void onAnimationStart(Animation animation) {}
+ public void onAnimationRepeat(Animation animation) {}
+ public void onAnimationEnd(Animation animation) {
+ mTopBarSwitcher.setVisibility(View.INVISIBLE);
+ }
+ });
+ mTopBarSwitcher.startAnimation(anim);
+ anim = new TranslateAnimation(0, 0, 0, mLowerButtons.getHeight());
+ anim.setDuration(500);
anim.setAnimationListener(new Animation.AnimationListener() {
public void onAnimationStart(Animation animation) {}
public void onAnimationRepeat(Animation animation) {}
public void onAnimationEnd(Animation animation) {
- mButtonsView.setVisibility(View.INVISIBLE);
+ mLowerButtons.setVisibility(View.INVISIBLE);
}
});
- mButtonsView.startAnimation(anim);
+ mLowerButtons.startAnimation(anim);
}
}
@@ -467,7 +490,6 @@ public class MuPDFActivity extends Activity
void makeButtonsView() {
mButtonsView = getLayoutInflater().inflate(R.layout.buttons,null);
- mButtonsView.setVisibility(View.INVISIBLE);
mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
@@ -478,6 +500,9 @@ 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);
+ mLowerButtons = mButtonsView.findViewById(R.id.lowerButtons);
+ mTopBarSwitcher.setVisibility(View.INVISIBLE);
+ mLowerButtons.setVisibility(View.INVISIBLE);
}
void showKeyboard() {