diff options
author | Adrian Roos <roosa@google.com> | 2014-06-11 13:10:43 +0200 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2014-06-11 13:10:43 +0200 |
commit | cabd8647ac9a10465627818ebdef409b7ddd3583 (patch) | |
tree | 145703a8019bbc34164fd452d940014afa8ca6c1 /src | |
parent | 9e17b4165418dec3b4872ed43a8844c950beedec (diff) | |
parent | 469e9df00dab07ce3f810d3ffa9a3261f1b71b52 (diff) |
resolved conflict for merge of 469e9df0 to master
Change-Id: Ic96a35172c113e8b25084de3c8cf5e44f931903b
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 29 | ||||
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 25 | ||||
-rw-r--r-- | src/com/android/dialer/list/RemoveView.java | 6 | ||||
-rw-r--r-- | src/com/android/dialer/widget/ActionBarController.java | 4 |
4 files changed, 37 insertions, 27 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index baacc1567..ad01b865b 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -51,17 +51,12 @@ import android.view.View; import android.view.ViewTreeObserver; import android.view.View.OnDragListener; import android.view.View.OnTouchListener; -import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; -import android.view.animation.Animation.AnimationListener; import android.view.animation.AnimationUtils; -import android.view.animation.DecelerateInterpolator; -import android.view.animation.Interpolator; import android.view.inputmethod.InputMethodManager; import android.widget.AbsListView.OnScrollListener; import android.widget.EditText; import android.widget.ImageButton; -import android.widget.ImageView; import android.widget.PopupMenu; import android.widget.RelativeLayout; import android.widget.Toast; @@ -87,7 +82,6 @@ import com.android.dialer.list.OnListFragmentScrolledListener; import com.android.dialer.list.SpeedDialFragment; import com.android.dialer.list.PhoneFavoriteSquareTileView; import com.android.dialer.list.RegularSearchFragment; -import com.android.dialer.list.RemoveView; import com.android.dialer.list.SearchFragment; import com.android.dialer.list.SmartDialSearchFragment; import com.android.dialer.widget.ActionBarController; @@ -222,13 +216,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private EditText mSearchView; private View mVoiceSearchButton; - /** - * View that contains the "Remove" dialog that shows up when the user long presses a contact. - * If the user releases a contact when hovering on top of this, the contact is unfavorited and - * removed from the speed dial list. - */ - private View mRemoveViewContainer; - private String mSearchQuery; private DialerDatabaseHelper mDialerDatabaseHelper; @@ -270,8 +257,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public boolean onDrag(View v, DragEvent event) { if (event.getAction() == DragEvent.ACTION_DRAG_LOCATION) { - mDragDropController.handleDragHovered(v, (int) event.getX(), - (int) event.getY()); + mDragDropController.handleDragHovered(v, (int) event.getX(), (int) event.getY()); } return true; } @@ -454,8 +440,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O setupActivityOverlay(); - mRemoveViewContainer = findViewById(R.id.remove_view_container); - mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this); SmartDialPrefix.initializeNanpSettings(this); } @@ -1063,9 +1047,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onDragStarted(int x, int y, PhoneFavoriteSquareTileView view) { if (mListsFragment.isPaneOpen()) { - mActionBarController.slideActionBarUp(true); + mActionBarController.setAlpha(ListsFragment.REMOVE_VIEW_SHOWN_ALPHA); } - mRemoveViewContainer.setVisibility(View.VISIBLE); + mListsFragment.showRemoveView(true); } @Override @@ -1078,9 +1062,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onDragFinished(int x, int y) { if (mListsFragment.isPaneOpen()) { - mActionBarController.slideActionBarDown(true); + mActionBarController.setAlpha(ListsFragment.REMOVE_VIEW_HIDDEN_ALPHA); } - mRemoveViewContainer.setVisibility(View.GONE); + mListsFragment.showRemoveView(false); } @Override @@ -1093,8 +1077,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void setDragDropController(DragDropController dragController) { mDragDropController = dragController; - ((RemoveView) findViewById(R.id.remove_view)) - .setDragDropController(dragController); + mListsFragment.getRemoveView().setDragDropController(dragController); } @Override diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index ab790ed25..bdd2d6c44 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -68,6 +68,9 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste private static final String KEY_LAST_DISMISSED_CALL_SHORTCUT_DATE = "key_last_dismissed_call_shortcut_date"; + public static final float REMOVE_VIEW_SHOWN_ALPHA = 0.5f; + public static final float REMOVE_VIEW_HIDDEN_ALPHA = 1; + // Used with LoaderManager private static int MISSED_CALL_LOADER = 1; @@ -81,6 +84,8 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste private ViewPagerTabs mViewPagerTabs; private ViewPagerAdapter mViewPagerAdapter; private ListView mShortcutCardsListView; + private RemoveView mRemoveView; + private View mRemoveViewContent; private SpeedDialFragment mSpeedDialFragment; private CallLogFragment mRecentsFragment; private AllContactsFragment mAllContactsFragment; @@ -267,6 +272,9 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste mShortcutCardsListView = (ListView) parentView.findViewById(R.id.shortcut_card_list); mShortcutCardsListView.setAdapter(mMergedAdapter); + mRemoveView = (RemoveView) parentView.findViewById(R.id.remove_view); + mRemoveViewContent = parentView.findViewById(R.id.remove_view_content); + setupPaneLayout((OverlappingPaneLayout) parentView); return parentView; @@ -335,6 +343,19 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste } } + public void showRemoveView(boolean show) { + mRemoveViewContent.setVisibility(show ? View.VISIBLE : View.GONE); + mRemoveView.setAlpha(show ? 0 : 1); + mRemoveView.animate().alpha(show ? 1 : 0).start(); + + if (mShortcutCardsListView.getCount() > 0) { + View v = mShortcutCardsListView.getChildAt(0); + v.animate().withLayer() + .alpha(show ? REMOVE_VIEW_SHOWN_ALPHA : REMOVE_VIEW_HIDDEN_ALPHA) + .start(); + } + } + public boolean shouldShowActionBar() { return mIsPanelOpen && mActionBar != null; } @@ -361,4 +382,8 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste public SpeedDialFragment getSpeedDialFragment() { return mSpeedDialFragment; } + + public RemoveView getRemoveView() { + return mRemoveView; + } } diff --git a/src/com/android/dialer/list/RemoveView.java b/src/com/android/dialer/list/RemoveView.java index ae358fc9f..fdb08f6f5 100644 --- a/src/com/android/dialer/list/RemoveView.java +++ b/src/com/android/dialer/list/RemoveView.java @@ -21,7 +21,6 @@ public class RemoveView extends FrameLayout { int mUnhighlightedColor; int mHighlightedColor; Drawable mRemoveDrawable; - Drawable mRemoveHighlightedDrawable; public RemoveView(Context context) { super(context); @@ -43,7 +42,6 @@ public class RemoveView extends FrameLayout { mUnhighlightedColor = r.getColor(R.color.remove_text_color); mHighlightedColor = r.getColor(R.color.remove_highlighted_text_color); mRemoveDrawable = r.getDrawable(R.drawable.ic_remove); - mRemoveHighlightedDrawable = r.getDrawable(R.drawable.ic_remove_highlight); } public void setDragDropController(DragDropController controller) { @@ -79,13 +77,13 @@ public class RemoveView extends FrameLayout { private void setAppearanceNormal() { mRemoveText.setTextColor(mUnhighlightedColor); - mRemoveIcon.setImageDrawable(mRemoveDrawable); + mRemoveIcon.setColorFilter(mUnhighlightedColor); invalidate(); } private void setAppearanceHighlighted() { mRemoveText.setTextColor(mHighlightedColor); - mRemoveIcon.setImageDrawable(mRemoveHighlightedDrawable); + mRemoveIcon.setColorFilter(mHighlightedColor); invalidate(); } } diff --git a/src/com/android/dialer/widget/ActionBarController.java b/src/com/android/dialer/widget/ActionBarController.java index 67037a28b..0e94df498 100644 --- a/src/com/android/dialer/widget/ActionBarController.java +++ b/src/com/android/dialer/widget/ActionBarController.java @@ -187,6 +187,10 @@ public class ActionBarController { mIsActionBarSlidUp = false; } + public void setAlpha(float alphaValue) { + mSearchBox.animate().alpha(alphaValue).start(); + } + /** * Saves the current state of the action bar into a provided {@link Bundle} */ |