forked from organicmaps/organicmaps
[android] Review fixes
This commit is contained in:
parent
1167dfeba8
commit
cc12287acf
9 changed files with 163 additions and 84 deletions
|
@ -6,4 +6,4 @@
|
|||
android:layout_height="match_parent">
|
||||
<include
|
||||
layout="@layout/recycler_default"/>
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
|
@ -106,6 +106,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
RoutingController.Container,
|
||||
LocationHelper.UiCallback,
|
||||
RoutingPlanController.OnToggleListener,
|
||||
RoutingPlanController.SearchPoiTransitionListener,
|
||||
FloatingSearchToolbarController.VisibilityListener
|
||||
{
|
||||
public static final String EXTRA_TASK = "map_task";
|
||||
|
@ -455,6 +456,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
{
|
||||
mRoutingPlanInplaceController = new RoutingPlanInplaceController(this);
|
||||
mRoutingPlanInplaceController.setOnToggleListener(this);
|
||||
mRoutingPlanInplaceController.setPoiTransitionListener(this);
|
||||
removeCurrentFragment(false);
|
||||
}
|
||||
|
||||
|
@ -549,7 +551,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
ImageButton traffic = (ImageButton) frame.findViewById(R.id.traffic);
|
||||
mTraffic = new TrafficButton(this, traffic);
|
||||
mTrafficButtonController = new TrafficButtonController(mTraffic, this);
|
||||
mNavAnimationController = new NavigationButtonsAnimationController(zoomIn, zoomOut, myPosition);
|
||||
mNavAnimationController = new NavigationButtonsAnimationController(
|
||||
zoomIn, zoomOut, myPosition, getWindow().getDecorView().getRootView());
|
||||
}
|
||||
|
||||
public boolean closePlacePage()
|
||||
|
@ -1385,7 +1388,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
private void adjustMenuLineFrameVisibility()
|
||||
{
|
||||
final RoutingController controller = RoutingController.get();
|
||||
final int menuHeight = getCurrentMenu().getFrame().getHeight();
|
||||
|
||||
if (controller.isBuilt() || controller.isUberRequestHandled())
|
||||
{
|
||||
|
@ -1394,7 +1396,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
adjustCompass(0);
|
||||
adjustRuler(0, 0);
|
||||
}
|
||||
});
|
||||
|
@ -1408,7 +1409,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
adjustCompass(menuHeight);
|
||||
final int menuHeight = getCurrentMenu().getFrame().getHeight();
|
||||
adjustRuler(0, menuHeight);
|
||||
}
|
||||
});
|
||||
|
@ -1420,7 +1421,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
adjustCompass(0);
|
||||
adjustRuler(0, 0);
|
||||
}
|
||||
});
|
||||
|
@ -1439,7 +1439,10 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
public void showRoutePlan(boolean show, @Nullable Runnable completionListener)
|
||||
{
|
||||
if (mNavAnimationController != null && !mIsFragmentContainer)
|
||||
mNavAnimationController.slide(show);
|
||||
{
|
||||
mNavAnimationController.setBottomLimit(show ? 0 : getCurrentMenu().getFrame().getHeight());
|
||||
mNavAnimationController.slide(show, getCurrentMenu().getFrame().getHeight());
|
||||
}
|
||||
if (show)
|
||||
{
|
||||
mSearchController.hide();
|
||||
|
|
|
@ -23,17 +23,20 @@ class NavigationButtonsAnimationController
|
|||
private final View mMyPosition;
|
||||
|
||||
private final float mMargin;
|
||||
private float mBottom;
|
||||
private float mTop;
|
||||
private float mContentHeight;
|
||||
private float mMyPositionBottom;
|
||||
|
||||
private boolean mIsZoomAnimate;
|
||||
private boolean mIsMyPosAnimate;
|
||||
private boolean mIsSlideDown;
|
||||
private boolean mZoomAnimate;
|
||||
private boolean mMyPosAnimate;
|
||||
private boolean mSlideDown;
|
||||
|
||||
private final float mMenuHeight;
|
||||
private float mTopLimit;
|
||||
private float mBottomLimit;
|
||||
|
||||
private float mCurrentOffset;
|
||||
|
||||
NavigationButtonsAnimationController(@NonNull View zoomIn, @NonNull View zoomOut,
|
||||
@NonNull View myPosition)
|
||||
@NonNull View myPosition, @NonNull final View contentView)
|
||||
{
|
||||
mZoomIn = zoomIn;
|
||||
mZoomOut = zoomOut;
|
||||
|
@ -41,20 +44,30 @@ class NavigationButtonsAnimationController
|
|||
mMyPosition = myPosition;
|
||||
Resources res = mZoomIn.getResources();
|
||||
mMargin = res.getDimension(R.dimen.margin_base_plus);
|
||||
mMenuHeight = res.getDimension(R.dimen.menu_line_height);
|
||||
mBottomLimit = res.getDimension(R.dimen.menu_line_height);
|
||||
calculateLimitTranslations();
|
||||
contentView.addOnLayoutChangeListener(new View.OnLayoutChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
|
||||
int oldTop, int oldRight, int oldBottom)
|
||||
{
|
||||
mContentHeight = bottom - top;
|
||||
contentView.removeOnLayoutChangeListener(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void calculateLimitTranslations()
|
||||
{
|
||||
mTop = mMargin;
|
||||
mTopLimit = mMargin;
|
||||
mMyPosition.addOnLayoutChangeListener(new View.OnLayoutChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom)
|
||||
{
|
||||
mBottom = bottom + mMargin;
|
||||
mMyPositionBottom = bottom;
|
||||
mMyPosition.removeOnLayoutChangeListener(this);
|
||||
}
|
||||
});
|
||||
|
@ -62,22 +75,29 @@ class NavigationButtonsAnimationController
|
|||
|
||||
void setTopLimit(float limit)
|
||||
{
|
||||
mTop = limit + mMargin;
|
||||
mTopLimit = limit + mMargin;
|
||||
update();
|
||||
}
|
||||
|
||||
void setBottomLimit(float limit)
|
||||
{
|
||||
mBottomLimit = limit;
|
||||
update();
|
||||
}
|
||||
|
||||
private void fadeOutZoom()
|
||||
{
|
||||
if (mIsSlideDown)
|
||||
if (mSlideDown)
|
||||
return;
|
||||
mIsZoomAnimate = true;
|
||||
|
||||
mZoomAnimate = true;
|
||||
Animations.fadeOutView(mZoomIn, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mZoomIn.setVisibility(View.INVISIBLE);
|
||||
mIsZoomAnimate = false;
|
||||
mZoomAnimate = false;
|
||||
}
|
||||
});
|
||||
Animations.fadeOutView(mZoomOut, new Runnable()
|
||||
|
@ -92,7 +112,7 @@ class NavigationButtonsAnimationController
|
|||
|
||||
private void fadeInZoom()
|
||||
{
|
||||
mIsZoomAnimate = true;
|
||||
mZoomAnimate = true;
|
||||
mZoomIn.setVisibility(View.VISIBLE);
|
||||
mZoomOut.setVisibility(View.VISIBLE);
|
||||
Animations.fadeInView(mZoomIn, new Runnable()
|
||||
|
@ -100,7 +120,7 @@ class NavigationButtonsAnimationController
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
mIsZoomAnimate = false;
|
||||
mZoomAnimate = false;
|
||||
}
|
||||
});
|
||||
Animations.fadeInView(mZoomOut, null);
|
||||
|
@ -108,43 +128,43 @@ class NavigationButtonsAnimationController
|
|||
|
||||
private void fadeOutMyPosition()
|
||||
{
|
||||
if (mIsSlideDown)
|
||||
if (mSlideDown)
|
||||
return;
|
||||
|
||||
mIsMyPosAnimate = true;
|
||||
mMyPosAnimate = true;
|
||||
Animations.fadeOutView(mMyPosition, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
UiUtils.invisible(mMyPosition);
|
||||
mIsMyPosAnimate = false;
|
||||
mMyPosAnimate = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fadeInMyPosition()
|
||||
{
|
||||
mIsMyPosAnimate = true;
|
||||
mMyPosAnimate = true;
|
||||
mMyPosition.setVisibility(View.VISIBLE);
|
||||
Animations.fadeInView(mMyPosition, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mIsMyPosAnimate = false;
|
||||
mMyPosAnimate = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void onPlacePageMoved(float translationY)
|
||||
{
|
||||
if (UiUtils.isLandscape(mMyPosition.getContext()) || mBottom == 0)
|
||||
if (UiUtils.isLandscape(mMyPosition.getContext()) || mMyPositionBottom == 0 || mContentHeight == 0)
|
||||
return;
|
||||
|
||||
final float amount = mZoomIn.getTranslationY() > 0 ? mMenuHeight : 0;
|
||||
final float translation = translationY - mBottom;
|
||||
update(translation <= amount ? translation : amount);
|
||||
final float amount = mCurrentOffset > 0 ? mMargin : -mMargin;
|
||||
final float translation = translationY - (mMyPositionBottom - mCurrentOffset + amount);
|
||||
update(translation <= mCurrentOffset ? translation : mCurrentOffset);
|
||||
}
|
||||
|
||||
private void update()
|
||||
|
@ -157,35 +177,33 @@ class NavigationButtonsAnimationController
|
|||
mMyPosition.setTranslationY(translation);
|
||||
mZoomOut.setTranslationY(translation);
|
||||
mZoomIn.setTranslationY(translation);
|
||||
if (!mIsZoomAnimate && isOverTopLimit(mZoomIn))
|
||||
if (!mZoomAnimate && mZoomIn.getVisibility() == View.VISIBLE
|
||||
&& !isViewInsideLimits(mZoomIn))
|
||||
{
|
||||
fadeOutZoom();
|
||||
}
|
||||
else if (!mIsZoomAnimate && satisfyTopLimit(mZoomIn))
|
||||
else if (!mZoomAnimate && mZoomIn.getVisibility() == View.INVISIBLE
|
||||
&& isViewInsideLimits(mZoomIn))
|
||||
{
|
||||
fadeInZoom();
|
||||
}
|
||||
|
||||
if (!shouldBeHidden() && !mIsMyPosAnimate
|
||||
&& isOverTopLimit(mMyPosition))
|
||||
if (!shouldBeHidden() && !mMyPosAnimate
|
||||
&& mMyPosition.getVisibility() == View.VISIBLE && !isViewInsideLimits(mMyPosition))
|
||||
{
|
||||
fadeOutMyPosition();
|
||||
}
|
||||
else if (!shouldBeHidden() && !mIsMyPosAnimate
|
||||
&& satisfyTopLimit(mMyPosition))
|
||||
else if (!shouldBeHidden() && !mMyPosAnimate
|
||||
&& mMyPosition.getVisibility() == View.INVISIBLE && isViewInsideLimits(mMyPosition))
|
||||
{
|
||||
fadeInMyPosition();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOverTopLimit(@NonNull View view)
|
||||
private boolean isViewInsideLimits(@NonNull View view)
|
||||
{
|
||||
return view.getVisibility() == View.VISIBLE && view.getY() <= mTop;
|
||||
}
|
||||
|
||||
private boolean satisfyTopLimit(@NonNull View view)
|
||||
{
|
||||
return view.getVisibility() == View.INVISIBLE && view.getY() >= mTop;
|
||||
return view.getY() >= mTopLimit &&
|
||||
view.getBottom() + view.getTranslationY() <= mContentHeight - mBottomLimit;
|
||||
}
|
||||
|
||||
private boolean shouldBeHidden()
|
||||
|
@ -194,15 +212,16 @@ class NavigationButtonsAnimationController
|
|||
&& (RoutingController.get().isPlanning() || RoutingController.get().isNavigating());
|
||||
}
|
||||
|
||||
void slide(boolean isDown)
|
||||
void slide(boolean isDown, float distance)
|
||||
{
|
||||
if (UiUtils.isLandscape(mMyPosition.getContext())
|
||||
|| (!isDown && mZoomIn.getTranslationY() <= 0))
|
||||
return;
|
||||
|
||||
mIsSlideDown = isDown;
|
||||
mSlideDown = isDown;
|
||||
mCurrentOffset = isDown ? distance : 0;
|
||||
|
||||
ValueAnimator animator = ValueAnimator.ofFloat(isDown ? 0 : mMenuHeight, isDown ? mMenuHeight : 0);
|
||||
ValueAnimator animator = ValueAnimator.ofFloat(isDown ? 0 : distance, isDown ? distance : 0);
|
||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
|
||||
{
|
||||
@Override
|
||||
|
@ -217,7 +236,7 @@ class NavigationButtonsAnimationController
|
|||
@Override
|
||||
public void onAnimationEnd(Animator animation)
|
||||
{
|
||||
mIsSlideDown = false;
|
||||
mSlideDown = false;
|
||||
update();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -75,8 +75,6 @@ public class RoutingController
|
|||
* @param progress progress to be displayed.
|
||||
* */
|
||||
void updateBuildProgress(@IntRange(from = 0, to = 100) int progress, @Framework.RouterType int router);
|
||||
|
||||
void animateSearchPoiTransition(@NonNull Rect startRect, @Nullable Runnable runnable);
|
||||
}
|
||||
|
||||
private static final RoutingController sInstance = new RoutingController();
|
||||
|
@ -754,7 +752,7 @@ public class RoutingController
|
|||
build();
|
||||
}
|
||||
|
||||
void searchPoi(int slotId, @NonNull Rect startRect)
|
||||
void searchPoi(int slotId)
|
||||
{
|
||||
mLogger.d("searchPoi: " + slotId);
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_SEARCH_POINT);
|
||||
|
@ -762,14 +760,8 @@ public class RoutingController
|
|||
mWaitingPoiPickSlot = slotId;
|
||||
if (mContainer != null)
|
||||
{
|
||||
mContainer.animateSearchPoiTransition(startRect, new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mContainer.showSearch();
|
||||
mContainer.updateMenu();
|
||||
}
|
||||
});
|
||||
mContainer.showSearch();
|
||||
mContainer.updateMenu();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.animation.Animator;
|
|||
import android.animation.ValueAnimator;
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.DrawableRes;
|
||||
|
@ -42,7 +43,7 @@ import com.mapswithme.util.Utils;
|
|||
import com.mapswithme.util.statistics.AlohaHelper;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
public class RoutingPlanController extends ToolbarController
|
||||
public class RoutingPlanController extends ToolbarController implements SlotFrame.SlotClickListener
|
||||
{
|
||||
static final int ANIM_TOGGLE = MwmApplication.get().getResources().getInteger(R.integer.anim_slots_toggle);
|
||||
private static final String STATE_ALTITUDE_CHART_SHOWN = "altitude_chart_shown";
|
||||
|
@ -62,7 +63,7 @@ public class RoutingPlanController extends ToolbarController
|
|||
private final View mUberFrame;
|
||||
|
||||
private final RotateDrawable mToggleImage = new RotateDrawable(R.drawable.ic_down);
|
||||
protected int mFrameHeight;
|
||||
int mFrameHeight;
|
||||
private int mToolbarHeight;
|
||||
private boolean mOpen;
|
||||
@Nullable
|
||||
|
@ -74,11 +75,20 @@ public class RoutingPlanController extends ToolbarController
|
|||
@Nullable
|
||||
private OnToggleListener mToggleListener;
|
||||
|
||||
@Nullable
|
||||
private SearchPoiTransitionListener mPoiTransitionListener;
|
||||
|
||||
public interface OnToggleListener
|
||||
{
|
||||
void onToggle(boolean state);
|
||||
}
|
||||
|
||||
public interface SearchPoiTransitionListener
|
||||
{
|
||||
void animateSearchPoiTransition(@NonNull final Rect startRect,
|
||||
@Nullable final Runnable runnable);
|
||||
}
|
||||
|
||||
private RadioButton setupRouterButton(@IdRes int buttonId, final @DrawableRes int iconRes, View.OnClickListener clickListener)
|
||||
{
|
||||
CompoundButton.OnCheckedChangeListener listener = new CompoundButton.OnCheckedChangeListener()
|
||||
|
@ -109,6 +119,7 @@ public class RoutingPlanController extends ToolbarController
|
|||
|
||||
mToggle = (ImageView) mToolbar.findViewById(R.id.toggle);
|
||||
mSlotFrame = (SlotFrame) root.findViewById(R.id.slots);
|
||||
mSlotFrame.setSlotClickListener(this);
|
||||
mRouterTypes = (RadioGroup) mToolbar.findViewById(R.id.route_type);
|
||||
|
||||
setupRouterButton(R.id.vehicle, R.drawable.ic_car, new View.OnClickListener()
|
||||
|
@ -186,7 +197,32 @@ public class RoutingPlanController extends ToolbarController
|
|||
RoutingController.get().cancelPlanning();
|
||||
}
|
||||
|
||||
protected boolean checkFrameHeight()
|
||||
@Override
|
||||
public void onSlotClicked(final int order, @NonNull Rect rect)
|
||||
{
|
||||
if (mPoiTransitionListener != null)
|
||||
{
|
||||
mPoiTransitionListener.animateSearchPoiTransition(rect, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
RoutingController.get().searchPoi(order);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
RoutingController.get().searchPoi(order);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPoiTransitionListener(@Nullable SearchPoiTransitionListener poiTransitionListener)
|
||||
{
|
||||
mPoiTransitionListener = poiTransitionListener;
|
||||
}
|
||||
|
||||
boolean checkFrameHeight()
|
||||
{
|
||||
if (mFrameHeight > 0)
|
||||
return true;
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.Rect;
|
|||
import android.os.Build;
|
||||
import android.support.annotation.IdRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -35,6 +36,14 @@ public class SlotFrame extends LinearLayout
|
|||
private int mTextColor;
|
||||
private int mHintColor;
|
||||
|
||||
interface SlotClickListener
|
||||
{
|
||||
void onSlotClicked(int order, @NonNull Rect rect);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SlotClickListener mSlotClickListener;
|
||||
|
||||
private class Slot
|
||||
{
|
||||
private final View mFrame;
|
||||
|
@ -76,7 +85,9 @@ public class SlotFrame extends LinearLayout
|
|||
{
|
||||
Rect rect = new Rect();
|
||||
mFrame.getGlobalVisibleRect(rect);
|
||||
RoutingController.get().searchPoi(mOrder, rect);
|
||||
if (mSlotClickListener != null)
|
||||
mSlotClickListener.onSlotClicked(mOrder, rect);
|
||||
//RoutingController.get().searchPoi(mOrder, rect);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -336,6 +347,11 @@ public class SlotFrame extends LinearLayout
|
|||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public void setSlotClickListener(@Nullable SlotClickListener slotClickListener)
|
||||
{
|
||||
mSlotClickListener = slotClickListener;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
mSlotFrom.setMapObject(RoutingController.get().getStartPoint());
|
||||
|
|
|
@ -18,13 +18,12 @@ public class SearchActivity extends BaseMwmFragmentActivity implements CustomNav
|
|||
{
|
||||
public static final String EXTRA_QUERY = "search_query";
|
||||
|
||||
public static void start(Context context, String query)
|
||||
public static void start(@NonNull Activity activity, String query)
|
||||
{
|
||||
final Intent i = new Intent(context, SearchActivity.class);
|
||||
final Intent i = new Intent(activity, SearchActivity.class);
|
||||
i.putExtra(EXTRA_QUERY, query);
|
||||
context.startActivity(i);
|
||||
if (context instanceof Activity)
|
||||
((Activity) context).overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||
activity.startActivity(i);
|
||||
activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,7 @@ public class SearchCategoriesFragment extends BaseMwmRecyclerFragment
|
|||
@Override
|
||||
protected int getLayoutRes()
|
||||
{
|
||||
return R.layout.fragment_recycler_no_elevation;
|
||||
return R.layout.fragment_search_categories;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -143,23 +143,12 @@ public final class Animations
|
|||
});
|
||||
}
|
||||
|
||||
public static void riseTransition(@NonNull ViewGroup rootView, @NonNull final Rect startRect,
|
||||
public static void riseTransition(@NonNull final ViewGroup rootView, @NonNull final Rect startRect,
|
||||
@Nullable final Runnable runnable)
|
||||
{
|
||||
Context context = rootView.getContext();
|
||||
final Context context = rootView.getContext();
|
||||
final View view = new View(context);
|
||||
TypedArray a = null;
|
||||
try
|
||||
{
|
||||
a = context.obtainStyledAttributes(new int[] { R.attr.cardBackgroundColor });
|
||||
int color = a.getColor(0, ContextCompat.getColor(context, R.color.bg_cards));
|
||||
view.setBackgroundColor(color);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (a != null)
|
||||
a.recycle();
|
||||
}
|
||||
setCardBackgroundColor(view);
|
||||
|
||||
DisplayMetrics dm = context.getResources().getDisplayMetrics();
|
||||
final float screenWidth = dm.widthPixels;
|
||||
|
@ -202,9 +191,34 @@ public final class Animations
|
|||
{
|
||||
if (runnable != null)
|
||||
runnable.run();
|
||||
rootView.postDelayed(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
rootView.removeView(view);
|
||||
}
|
||||
}, context.getResources().getInteger(android.R.integer.config_longAnimTime));
|
||||
}
|
||||
});
|
||||
animator.setDuration(DURATION_MENU);
|
||||
animator.start();
|
||||
}
|
||||
|
||||
private static void setCardBackgroundColor(@NonNull View view)
|
||||
{
|
||||
Context context = view.getContext();
|
||||
TypedArray a = null;
|
||||
try
|
||||
{
|
||||
a = context.obtainStyledAttributes(new int[] { R.attr.cardBackgroundColor });
|
||||
int color = a.getColor(0, ContextCompat.getColor(context, R.color.bg_cards));
|
||||
view.setBackgroundColor(color);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (a != null)
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue