forked from organicmaps/organicmaps
[android] Review fixes.
This commit is contained in:
parent
7ed96e924d
commit
13959aa79d
3 changed files with 63 additions and 46 deletions
|
@ -1360,32 +1360,37 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
@Override
|
||||
public void updateMenu()
|
||||
{
|
||||
adjustMenuLineFrameVisibility();
|
||||
|
||||
if (RoutingController.get().isNavigating())
|
||||
adjustMenuLineFrameVisibility(new Runnable()
|
||||
{
|
||||
if (mNavigationController != null)
|
||||
mNavigationController.show(true);
|
||||
mSearchController.hide();
|
||||
mMainMenu.setState(MainMenu.State.NAVIGATION, false, mIsFullscreen);
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (RoutingController.get().isNavigating())
|
||||
{
|
||||
if (mNavigationController != null)
|
||||
mNavigationController.show(true);
|
||||
mSearchController.hide();
|
||||
mMainMenu.setState(MainMenu.State.NAVIGATION, false, mIsFullscreen);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mIsFragmentContainer)
|
||||
{
|
||||
mMainMenu.setEnabled(MainMenu.Item.P2P, !RoutingController.get().isPlanning());
|
||||
mMainMenu.setEnabled(MainMenu.Item.SEARCH, !RoutingController.get().isWaitingPoiPick());
|
||||
}
|
||||
else if (RoutingController.get().isPlanning())
|
||||
{
|
||||
mMainMenu.setState(MainMenu.State.ROUTE_PREPARE, false, mIsFullscreen);
|
||||
return;
|
||||
}
|
||||
if (mIsFragmentContainer)
|
||||
{
|
||||
mMainMenu.setEnabled(MainMenu.Item.P2P, !RoutingController.get().isPlanning());
|
||||
mMainMenu.setEnabled(MainMenu.Item.SEARCH, !RoutingController.get().isWaitingPoiPick());
|
||||
}
|
||||
else if (RoutingController.get().isPlanning())
|
||||
{
|
||||
mMainMenu.setState(MainMenu.State.ROUTE_PREPARE, false, mIsFullscreen);
|
||||
return;
|
||||
}
|
||||
|
||||
mMainMenu.setState(MainMenu.State.MENU, false, mIsFullscreen);
|
||||
mMainMenu.setState(MainMenu.State.MENU, false, mIsFullscreen);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void adjustMenuLineFrameVisibility()
|
||||
private void adjustMenuLineFrameVisibility(@Nullable final Runnable completion)
|
||||
{
|
||||
final RoutingController controller = RoutingController.get();
|
||||
|
||||
|
@ -1399,6 +1404,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
adjustRuler(0, 0);
|
||||
}
|
||||
});
|
||||
|
||||
if (completion != null)
|
||||
completion.run();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1411,6 +1419,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
{
|
||||
final int menuHeight = getCurrentMenu().getFrame().getHeight();
|
||||
adjustRuler(0, menuHeight);
|
||||
if (completion != null)
|
||||
completion.run();
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
@ -1425,6 +1435,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
}
|
||||
});
|
||||
|
||||
if (completion != null)
|
||||
completion.run();
|
||||
}
|
||||
|
||||
private void setNavButtonsTopLimit(int limit)
|
||||
|
|
|
@ -26,9 +26,9 @@ class NavigationButtonsAnimationController
|
|||
private float mContentHeight;
|
||||
private float mMyPositionBottom;
|
||||
|
||||
private boolean mZoomAnimate;
|
||||
private boolean mMyPosAnimate;
|
||||
private boolean mSlideDown;
|
||||
private boolean mZoomAnimating;
|
||||
private boolean mMyPosAnimating;
|
||||
private boolean mSlidingDown;
|
||||
|
||||
private float mTopLimit;
|
||||
private float mBottomLimit;
|
||||
|
@ -40,7 +40,7 @@ class NavigationButtonsAnimationController
|
|||
{
|
||||
mZoomIn = zoomIn;
|
||||
mZoomOut = zoomOut;
|
||||
UiUtils.showIf(showZoomButtons(), mZoomIn, mZoomOut);
|
||||
checkZoomButtonsVisibility();
|
||||
mMyPosition = myPosition;
|
||||
Resources res = mZoomIn.getResources();
|
||||
mMargin = res.getDimension(R.dimen.margin_base_plus);
|
||||
|
@ -58,6 +58,12 @@ class NavigationButtonsAnimationController
|
|||
});
|
||||
}
|
||||
|
||||
private void checkZoomButtonsVisibility()
|
||||
{
|
||||
UiUtils.showIf(showZoomButtons(), mZoomIn, mZoomOut);
|
||||
}
|
||||
|
||||
|
||||
private void calculateLimitTranslations()
|
||||
{
|
||||
mTopLimit = mMargin;
|
||||
|
@ -87,17 +93,17 @@ class NavigationButtonsAnimationController
|
|||
|
||||
private void fadeOutZoom()
|
||||
{
|
||||
if (mSlideDown)
|
||||
if (mSlidingDown)
|
||||
return;
|
||||
|
||||
mZoomAnimate = true;
|
||||
mZoomAnimating = true;
|
||||
Animations.fadeOutView(mZoomIn, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mZoomIn.setVisibility(View.INVISIBLE);
|
||||
mZoomAnimate = false;
|
||||
mZoomAnimating = false;
|
||||
}
|
||||
});
|
||||
Animations.fadeOutView(mZoomOut, new Runnable()
|
||||
|
@ -112,7 +118,7 @@ class NavigationButtonsAnimationController
|
|||
|
||||
private void fadeInZoom()
|
||||
{
|
||||
mZoomAnimate = true;
|
||||
mZoomAnimating = true;
|
||||
mZoomIn.setVisibility(View.VISIBLE);
|
||||
mZoomOut.setVisibility(View.VISIBLE);
|
||||
Animations.fadeInView(mZoomIn, new Runnable()
|
||||
|
@ -120,7 +126,7 @@ class NavigationButtonsAnimationController
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
mZoomAnimate = false;
|
||||
mZoomAnimating = false;
|
||||
}
|
||||
});
|
||||
Animations.fadeInView(mZoomOut, null);
|
||||
|
@ -128,31 +134,31 @@ class NavigationButtonsAnimationController
|
|||
|
||||
private void fadeOutMyPosition()
|
||||
{
|
||||
if (mSlideDown)
|
||||
if (mSlidingDown)
|
||||
return;
|
||||
|
||||
mMyPosAnimate = true;
|
||||
mMyPosAnimating = true;
|
||||
Animations.fadeOutView(mMyPosition, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
UiUtils.invisible(mMyPosition);
|
||||
mMyPosAnimate = false;
|
||||
mMyPosAnimating = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fadeInMyPosition()
|
||||
{
|
||||
mMyPosAnimate = true;
|
||||
mMyPosAnimating = true;
|
||||
mMyPosition.setVisibility(View.VISIBLE);
|
||||
Animations.fadeInView(mMyPosition, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mMyPosAnimate = false;
|
||||
mMyPosAnimating = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -177,23 +183,23 @@ class NavigationButtonsAnimationController
|
|||
mMyPosition.setTranslationY(translation);
|
||||
mZoomOut.setTranslationY(translation);
|
||||
mZoomIn.setTranslationY(translation);
|
||||
if (!mZoomAnimate && mZoomIn.getVisibility() == View.VISIBLE
|
||||
if (!mZoomAnimating && mZoomIn.getVisibility() == View.VISIBLE
|
||||
&& !isViewInsideLimits(mZoomIn))
|
||||
{
|
||||
fadeOutZoom();
|
||||
}
|
||||
else if (!mZoomAnimate && mZoomIn.getVisibility() == View.INVISIBLE
|
||||
else if (!mZoomAnimating && mZoomIn.getVisibility() == View.INVISIBLE
|
||||
&& isViewInsideLimits(mZoomIn))
|
||||
{
|
||||
fadeInZoom();
|
||||
}
|
||||
|
||||
if (!shouldBeHidden() && !mMyPosAnimate
|
||||
if (!shouldBeHidden() && !mMyPosAnimating
|
||||
&& mMyPosition.getVisibility() == View.VISIBLE && !isViewInsideLimits(mMyPosition))
|
||||
{
|
||||
fadeOutMyPosition();
|
||||
}
|
||||
else if (!shouldBeHidden() && !mMyPosAnimate
|
||||
else if (!shouldBeHidden() && !mMyPosAnimating
|
||||
&& mMyPosition.getVisibility() == View.INVISIBLE && isViewInsideLimits(mMyPosition))
|
||||
{
|
||||
fadeInMyPosition();
|
||||
|
@ -218,7 +224,7 @@ class NavigationButtonsAnimationController
|
|||
|| (!isDown && mZoomIn.getTranslationY() <= 0))
|
||||
return;
|
||||
|
||||
mSlideDown = isDown;
|
||||
mSlidingDown = isDown;
|
||||
mCurrentOffset = isDown ? distance : 0;
|
||||
|
||||
ValueAnimator animator = ValueAnimator.ofFloat(isDown ? 0 : distance, isDown ? distance : 0);
|
||||
|
@ -236,7 +242,7 @@ class NavigationButtonsAnimationController
|
|||
@Override
|
||||
public void onAnimationEnd(Animator animation)
|
||||
{
|
||||
mSlideDown = false;
|
||||
mSlidingDown = false;
|
||||
update();
|
||||
}
|
||||
});
|
||||
|
@ -269,6 +275,6 @@ class NavigationButtonsAnimationController
|
|||
|
||||
public void onResume()
|
||||
{
|
||||
update();
|
||||
checkZoomButtonsVisibility();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,14 +36,14 @@ public class SlotFrame extends LinearLayout
|
|||
private int mTextColor;
|
||||
private int mHintColor;
|
||||
|
||||
@Nullable
|
||||
private SlotClickListener mSlotClickListener;
|
||||
|
||||
interface SlotClickListener
|
||||
{
|
||||
void onSlotClicked(int order, @NonNull Rect rect);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SlotClickListener mSlotClickListener;
|
||||
|
||||
private class Slot
|
||||
{
|
||||
private final View mFrame;
|
||||
|
@ -87,7 +87,6 @@ public class SlotFrame extends LinearLayout
|
|||
mFrame.getGlobalVisibleRect(rect);
|
||||
if (mSlotClickListener != null)
|
||||
mSlotClickListener.onSlotClicked(mOrder, rect);
|
||||
//RoutingController.get().searchPoi(mOrder, rect);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue