forked from organicmaps/organicmaps
Hide bottom buttons when show body of info view.
This commit is contained in:
parent
761075b832
commit
2813b98408
3 changed files with 45 additions and 11 deletions
|
@ -27,7 +27,7 @@
|
|||
layout="@layout/map_navigation_buttons" />
|
||||
|
||||
<include
|
||||
android:id="@+id/map_butons_container_ref"
|
||||
android:id="@+id/map_buttons_bottom_ref"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/info_box"
|
||||
|
|
|
@ -57,6 +57,7 @@ import com.mapswithme.maps.settings.SettingsActivity;
|
|||
import com.mapswithme.maps.settings.UnitLocale;
|
||||
import com.mapswithme.maps.state.SuppotedState;
|
||||
import com.mapswithme.maps.widget.MapInfoView;
|
||||
import com.mapswithme.maps.widget.MapInfoView.OnVisibilityChangedListener;
|
||||
import com.mapswithme.util.ConnectionState;
|
||||
import com.mapswithme.util.ShareAction;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
|
@ -65,7 +66,11 @@ import com.mapswithme.util.Yota;
|
|||
import com.mapswithme.util.statistics.Statistics;
|
||||
import com.nvidia.devtech.NvEventQueueActivity;
|
||||
|
||||
public class MWMActivity extends NvEventQueueActivity implements LocationService.Listener, OnBalloonListener, DrawerListener
|
||||
public class MWMActivity extends NvEventQueueActivity
|
||||
implements LocationService.Listener,
|
||||
OnBalloonListener,
|
||||
DrawerListener,
|
||||
OnVisibilityChangedListener
|
||||
{
|
||||
private final static String TAG = "MWMActivity";
|
||||
public static final String EXTRA_TASK = "map_task";
|
||||
|
@ -603,6 +608,7 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
|
|||
private void setUpInfoBox()
|
||||
{
|
||||
mInfoView = (MapInfoView) findViewById(R.id.info_box);
|
||||
mInfoView.setOnVisibilityChangedListener(this);
|
||||
}
|
||||
|
||||
private void setUpDrawer()
|
||||
|
@ -1379,7 +1385,7 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
|
|||
|
||||
private void showInfoBox(boolean show)
|
||||
{
|
||||
final View mapButtonBottom = findViewById(R.id.map_butons_container_ref);
|
||||
final View mapButtonBottom = findViewById(R.id.map_buttons_bottom_ref);
|
||||
final RelativeLayout.LayoutParams lp = (LayoutParams) mapButtonBottom.getLayoutParams();
|
||||
lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, show ? 0 : RelativeLayout.TRUE);
|
||||
mapButtonBottom.setLayoutParams(lp);
|
||||
|
@ -1420,12 +1426,6 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
|
|||
}
|
||||
}
|
||||
|
||||
// private void showInfoBoxWithText(CharSequence title, CharSequence subtitle)
|
||||
// {
|
||||
// mInfoView.setTextAndShow(title, subtitle);
|
||||
// showInfoBox(true);
|
||||
// }
|
||||
|
||||
public static Intent createShowMapIntent(Context context, Index index)
|
||||
{
|
||||
return new Intent(context, DownloadResourcesActivity.class)
|
||||
|
@ -1469,4 +1469,16 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
|
|||
public void onDrawerStateChanged(int arg0)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadVisibilityChanged(boolean isVisible)
|
||||
{
|
||||
// TODO could do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBodyVisibilityChanged(boolean isVisible)
|
||||
{
|
||||
UiUtils.hideIf(isVisible, findViewById(R.id.map_buttons_bottom_ref));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,11 @@ public class MapInfoView extends LinearLayout
|
|||
public interface OnVisibilityChangedListener
|
||||
{
|
||||
public void onHeadVisibilityChanged(boolean isVisible);
|
||||
public void onbodyVisibilityChanged(boolean isVisible);
|
||||
public void onBodyVisibilityChanged(boolean isVisible);
|
||||
}
|
||||
|
||||
private OnVisibilityChangedListener mVisibilityChangedListener;
|
||||
|
||||
private boolean mIsHeaderVisible = true;
|
||||
private boolean mIsBodyVisible = true;
|
||||
private boolean mIsVisible = true;
|
||||
|
@ -125,7 +127,7 @@ public class MapInfoView extends LinearLayout
|
|||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public void showBody(boolean show)
|
||||
public void showBody(final boolean show)
|
||||
{
|
||||
if (mIsBodyVisible == show)
|
||||
return; // if state is already same as we need
|
||||
|
@ -142,6 +144,9 @@ public class MapInfoView extends LinearLayout
|
|||
slideUp.setDuration(duration);
|
||||
UiUtils.show(mBodyGroup);
|
||||
mView.startAnimation(slideUp);
|
||||
|
||||
if (mVisibilityChangedListener != null)
|
||||
mVisibilityChangedListener.onBodyVisibilityChanged(show);
|
||||
}
|
||||
else // slide down
|
||||
{
|
||||
|
@ -158,6 +163,9 @@ public class MapInfoView extends LinearLayout
|
|||
public void onAnimationEnd(Animation animation)
|
||||
{
|
||||
UiUtils.hide(mBodyGroup);
|
||||
|
||||
if (mVisibilityChangedListener != null)
|
||||
mVisibilityChangedListener.onBodyVisibilityChanged(show);
|
||||
}
|
||||
});
|
||||
mView.startAnimation(slideDown);
|
||||
|
@ -168,12 +176,21 @@ public class MapInfoView extends LinearLayout
|
|||
|
||||
public void showHeader(boolean show)
|
||||
{
|
||||
if (mIsHeaderVisible == show)
|
||||
return;
|
||||
|
||||
UiUtils.hideIf(!show, mHeaderGroup);
|
||||
mIsHeaderVisible = show;
|
||||
|
||||
if (mVisibilityChangedListener != null)
|
||||
mVisibilityChangedListener.onHeadVisibilityChanged(show);
|
||||
}
|
||||
|
||||
public void show(boolean show)
|
||||
{
|
||||
if (mIsVisible == show)
|
||||
return;
|
||||
|
||||
UiUtils.hideIf(!show, mView);
|
||||
mIsVisible = show;
|
||||
}
|
||||
|
@ -224,4 +241,9 @@ public class MapInfoView extends LinearLayout
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnVisibilityChangedListener(OnVisibilityChangedListener listener)
|
||||
{
|
||||
mVisibilityChangedListener = listener;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue