[android] Removed tablet layout for content menu, made burger button always visible

This commit is contained in:
Александр Зацепин 2020-04-16 14:58:53 +03:00 committed by yoksnod
parent 6ce42258fd
commit 870cdd7a63
5 changed files with 8 additions and 118 deletions

View file

@ -1,84 +0,0 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/menu_line_height"
android:orientation="horizontal">
<!-- Fake view to make layout symmetrical -->
<Space
android:id="@+id/symmetrical_gap"
android:layout_width="228dp"
android:layout_height="match_parent"/>
<!-- Anchor ID. Disables menu toggle button if present. -->
<Space
android:id="@+id/disable_toggle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<ImageView
android:id="@+id/search"
style="@style/MwmTheme.Menu.Line.Button"
android:src="@drawable/ic_menu_search"/>
<ImageView
android:id="@+id/p2p"
style="@style/MwmTheme.Menu.Line.Button"
android:src="@drawable/ic_menu_point_to_point"/>
<ImageView
android:id="@+id/discovery"
style="@style/MwmTheme.Menu.Line.Button"
android:src="@drawable/ic_menu_discovery"/>
<ImageView
android:id="@+id/bookmarks"
style="@style/MwmTheme.Menu.Line.Button"
android:src="@drawable/ic_menu_bookmarks"/>
<ImageView
android:id="@+id/share"
style="@style/MwmTheme.Menu.Line.Button"
android:src="@drawable/ic_menu_share"/>
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<ImageView
android:id="@+id/add_place"
style="@style/MwmTheme.Menu.Line.Button"
android:src="@drawable/ic_plus"/>
<ImageView
android:id="@+id/download_guides"
style="@style/MwmTheme.Menu.Line.Button"
android:tint="?attr/colorAccent"
android:src="@drawable/ic_menu_download_guides"/>
<ImageView
android:id="@+id/hotel_search"
style="@style/MwmTheme.Menu.Line.Button"
android:src="@drawable/ic_menu_hotel_search"/>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/download_maps"
style="@style/MwmTheme.Menu.Line.Button"
android:src="@drawable/ic_menu_download"/>
<include layout="@layout/menu_news_marker"/>
</FrameLayout>
<ImageView
android:id="@+id/settings"
style="@style/MwmTheme.Menu.Line.Button"
android:layout_width="@dimen/menu_line_button_width_edge"
android:layout_height="@dimen/menu_line_height"
android:background="@drawable/menu_button_right"
android:src="@drawable/ic_menu_settings"/>
</LinearLayout>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<merge>
<include layout="@layout/menu_content_grid"/>
</merge>

View file

@ -850,12 +850,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
});
}
private void toggleMenu()
{
getCurrentMenu().toggle(true);
refreshFade();
}
public void refreshFade()
{
if (getCurrentMenu().isOpen())
@ -2665,17 +2659,13 @@ public class MwmActivity extends BaseMwmFragmentActivity
@Override
public void onMenuItemClickInternal()
{
if (!getActivity().mMainMenu.isOpen())
{
Statistics.INSTANCE.trackToolbarClick(getItem());
// TODO:
if (/*getActivity().mPlacePage.isDocked() &&*/ getActivity().closePlacePage())
return;
Statistics.INSTANCE.trackToolbarClick(getItem());
if (getActivity().closePlacePage())
return;
if (getActivity().closeSidePanel())
return;
if (getActivity().closeSidePanel())
return;
}
getActivity().toggleMenu();
Toast.makeText(getActivity(), "Open bottom sheet menu!", Toast.LENGTH_SHORT).show();
}
}

View file

@ -15,7 +15,6 @@ import com.mapswithme.util.UiUtils;
import com.mapswithme.util.statistics.StatisticValueConverter;
import java.util.Locale;
import java.util.Optional;
public class MainMenu extends BaseMenu
{
@ -26,7 +25,7 @@ public class MainMenu extends BaseMenu
@Override
boolean showToggle()
{
return false;
return true;
}
},
NAVIGATION,

View file

@ -16,8 +16,6 @@ import com.mapswithme.util.UiUtils;
class MenuToggle
{
private final ImageView mButton;
private final boolean mAlwaysShow;
private final TransitionDrawable mOpenImage;
private final TransitionDrawable mCollapseImage;
@ -29,7 +27,6 @@ class MenuToggle
private MenuToggle(View frame, @DimenRes int heightRes, @DrawableRes int src, @DrawableRes int dst)
{
mButton = (ImageView) frame.findViewById(R.id.toggle);
mAlwaysShow = (frame.findViewById(R.id.disable_toggle) == null);
int sz = UiUtils.dimen(heightRes);
Rect bounds = new Rect(0, 0, sz, sz);
@ -67,10 +64,7 @@ class MenuToggle
void show(boolean show)
{
//TODO: refactor mAlwaysShow logic, because now we shouldn't display
// the toggle button when we are in prepare routing state (create JIRA item for that)
// A temporary solution is the hide() method.
UiUtils.showIf(mAlwaysShow || show, mButton);
UiUtils.showIf(show, mButton);
}
void hide()
@ -82,9 +76,4 @@ class MenuToggle
{
transitImage(mOpenImage, open, animate);
}
void setCollapsed(boolean collapse, boolean animate)
{
transitImage(mCollapseImage, collapse, animate);
}
}