From b6e9b2f8fe172d7175cea3d14d89f986688639af Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 22 Feb 2012 12:31:02 +0100 Subject: Tweak animations and colors. --- .gitignore | 1 + android/res/drawable/busy.xml | 4 +-- android/res/drawable/page_num.xml | 4 +-- android/res/drawable/slider.xml | 2 +- android/res/layout/buttons.xml | 40 ++++++++++++------------ android/res/values/colors.xml | 5 +++ android/src/com/artifex/mupdf/MuPDFActivity.java | 39 ++++++++++++++--------- 7 files changed, 56 insertions(+), 39 deletions(-) create mode 100644 android/res/values/colors.xml diff --git a/.gitignore b/.gitignore index 21ce486b..e86f8687 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ android/obj android/bin android/libs android/gen +android/local.properties diff --git a/android/res/drawable/busy.xml b/android/res/drawable/busy.xml index f0bc5612..c20d320b 100644 --- a/android/res/drawable/busy.xml +++ b/android/res/drawable/busy.xml @@ -6,5 +6,5 @@ android:right="20dp" android:top="20dp" android:bottom="20dp" /> - - \ No newline at end of file + + diff --git a/android/res/drawable/page_num.xml b/android/res/drawable/page_num.xml index 8090fb45..627f9b60 100644 --- a/android/res/drawable/page_num.xml +++ b/android/res/drawable/page_num.xml @@ -6,5 +6,5 @@ android:right="5dp" android:top="5dp" android:bottom="5dp" /> - - \ No newline at end of file + + diff --git a/android/res/drawable/slider.xml b/android/res/drawable/slider.xml index acac1d80..bf4a75da 100644 --- a/android/res/drawable/slider.xml +++ b/android/res/drawable/slider.xml @@ -5,5 +5,5 @@ android:right="15dp" android:top="5dp" android:bottom="5dp" /> - + diff --git a/android/res/layout/buttons.xml b/android/res/layout/buttons.xml index b35f7daa..e18ebbb2 100644 --- a/android/res/layout/buttons.xml +++ b/android/res/layout/buttons.xml @@ -18,7 +18,7 @@ android:paddingLeft="0dp" android:paddingRight="0dp" android:paddingTop="0dp" - android:background="#CC444444" > + android:background="@color/bar" > + android:background="@color/bar" > - - - + + + diff --git a/android/res/values/colors.xml b/android/res/values/colors.xml new file mode 100644 index 00000000..068c0a3f --- /dev/null +++ b/android/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #FF404040 + #C0303030 + diff --git a/android/src/com/artifex/mupdf/MuPDFActivity.java b/android/src/com/artifex/mupdf/MuPDFActivity.java index f7de9a4f..051c2740 100644 --- a/android/src/com/artifex/mupdf/MuPDFActivity.java +++ b/android/src/com/artifex/mupdf/MuPDFActivity.java @@ -7,6 +7,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.RectF; +import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; @@ -238,7 +239,6 @@ public class MuPDFActivity extends Activity } }; mDocView.setAdapter(new MuPDFPageAdapter(this, core)); - mDocView.setBackgroundResource(R.drawable.tiled_background); // Make the buttons overlay, and store all its // controls in variables @@ -344,6 +344,8 @@ public class MuPDFActivity extends Activity RelativeLayout layout = new RelativeLayout(this); layout.addView(mDocView); layout.addView(mButtonsView); + layout.setBackgroundResource(R.drawable.tiled_background); + //layout.setBackgroundResource(R.color.canvas); setContentView(layout); } @@ -416,8 +418,9 @@ public class MuPDFActivity extends Activity mSearchText.requestFocus(); showKeyboard(); } + Animation anim = new TranslateAnimation(0, 0, -mTopBarSwitcher.getHeight(), 0); - anim.setDuration(500); + anim.setDuration(200); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { mTopBarSwitcher.setVisibility(View.VISIBLE); @@ -426,16 +429,19 @@ public class MuPDFActivity extends Activity public void onAnimationEnd(Animation animation) {} }); mTopBarSwitcher.startAnimation(anim); - anim = new TranslateAnimation(0, 0, mLowerButtons.getHeight(), 0); - anim.setDuration(500); + + anim = new TranslateAnimation(0, 0, mPageSlider.getHeight(), 0); + anim.setDuration(200); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { - mLowerButtons.setVisibility(View.VISIBLE); + mPageSlider.setVisibility(View.VISIBLE); } public void onAnimationRepeat(Animation animation) {} - public void onAnimationEnd(Animation animation) {} + public void onAnimationEnd(Animation animation) { + mPageNumberView.setVisibility(View.VISIBLE); + } }); - mLowerButtons.startAnimation(anim); + mPageSlider.startAnimation(anim); } } @@ -443,8 +449,9 @@ public class MuPDFActivity extends Activity if (mButtonsVisible) { mButtonsVisible = false; hideKeyboard(); + Animation anim = new TranslateAnimation(0, 0, 0, -mTopBarSwitcher.getHeight()); - anim.setDuration(500); + anim.setDuration(200); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) {} public void onAnimationRepeat(Animation animation) {} @@ -453,16 +460,19 @@ public class MuPDFActivity extends Activity } }); mTopBarSwitcher.startAnimation(anim); - anim = new TranslateAnimation(0, 0, 0, mLowerButtons.getHeight()); - anim.setDuration(500); + + anim = new TranslateAnimation(0, 0, 0, mPageSlider.getHeight()); + anim.setDuration(200); anim.setAnimationListener(new Animation.AnimationListener() { - public void onAnimationStart(Animation animation) {} + public void onAnimationStart(Animation animation) { + mPageNumberView.setVisibility(View.INVISIBLE); + } public void onAnimationRepeat(Animation animation) {} public void onAnimationEnd(Animation animation) { - mLowerButtons.setVisibility(View.INVISIBLE); + mPageSlider.setVisibility(View.INVISIBLE); } }); - mLowerButtons.startAnimation(anim); + mPageSlider.startAnimation(anim); } } @@ -502,7 +512,8 @@ public class MuPDFActivity extends Activity mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText); mLowerButtons = mButtonsView.findViewById(R.id.lowerButtons); mTopBarSwitcher.setVisibility(View.INVISIBLE); - mLowerButtons.setVisibility(View.INVISIBLE); + mPageNumberView.setVisibility(View.INVISIBLE); + mPageSlider.setVisibility(View.INVISIBLE); } void showKeyboard() { -- cgit v1.2.3