From e7dacc9c109dd4b3fce5c4457aa1c7dd80fd4bd1 Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Thu, 5 Feb 2015 12:09:39 -0500 Subject: [PATCH] Attempt to fix bug where DrawerArrowDrawable animation gets stuck half way. Also, add a background to indicate that the exit button on a tab is pressed. --- res/layout/tab_list_item.xml | 1 + .../browser/lightning/BrowserActivity.java | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/res/layout/tab_list_item.xml b/res/layout/tab_list_item.xml index 2c91f88..03af796 100644 --- a/res/layout/tab_list_item.xml +++ b/res/layout/tab_list_item.xml @@ -42,6 +42,7 @@ android:layout_centerVertical="true" android:layout_marginRight="13dp" android:alpha="0.5" + android:background="?attr/actionBarItemBackground" android:contentDescription="Delete Tab" android:gravity="center_vertical" android:padding="3dp" diff --git a/src/acr/browser/lightning/BrowserActivity.java b/src/acr/browser/lightning/BrowserActivity.java index 90a7e60..bfc7b13 100644 --- a/src/acr/browser/lightning/BrowserActivity.java +++ b/src/acr/browser/lightning/BrowserActivity.java @@ -32,6 +32,7 @@ import android.os.Handler; import android.os.Message; import android.provider.Browser; import android.support.v4.view.GravityCompat; +import android.support.v4.view.ViewCompat; import android.support.v4.widget.DrawerLayout; import android.text.TextUtils; import android.util.Log; @@ -346,6 +347,26 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl }; anim.setDuration(300); anim.setInterpolator(new DecelerateInterpolator()); + anim.setAnimationListener(new AnimationListener(){ + + @Override + public void onAnimationStart(Animation animation) { + } + + @Override + public void onAnimationEnd(Animation animation) { + if (!hasFocus) { + drawable.setProgress(0.0f); + } else { + drawable.setProgress(1.0f); + } + } + + @Override + public void onAnimationRepeat(Animation animation) { + } + + }); new Handler().postDelayed(new Runnable() { @Override @@ -1568,6 +1589,8 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl } }); + + ViewCompat.jumpDrawablesToCurrentState(holder.exit); LightningView web = data.get(position); holder.txtTitle.setText(web.getTitle());