Rewrite UI in SelectionMarkersGroupBottomSheetDialogFragment
This commit is contained in:
parent
670cfcf62c
commit
1f3d98480e
2 changed files with 41 additions and 166 deletions
|
@ -1,129 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/bg_color"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:id="@+id/add_markers_group_scroll_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
|
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
|
||||||
android:id="@+id/add_group_title"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingEnd="@dimen/content_padding"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding"
|
|
||||||
android:paddingStart="@dimen/content_padding"
|
|
||||||
android:text="@string/add_group"
|
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
|
||||||
osmand:typeface="@string/font_roboto_medium"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_descr_height"
|
|
||||||
android:paddingEnd="@dimen/content_padding"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding"
|
|
||||||
android:paddingStart="@dimen/content_padding"
|
|
||||||
android:text="@string/add_group_descr"
|
|
||||||
android:textColor="?android:textColorSecondary"
|
|
||||||
android:textSize="@dimen/default_desc_text_size"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/favourites_row"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:paddingEnd="@dimen/content_padding"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding"
|
|
||||||
android:paddingStart="@dimen/content_padding"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/favourites_icon"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
tools:src="@drawable/ic_action_fav_dark"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/favourites_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/favourites_group"
|
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/waypoints_row"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:paddingEnd="@dimen/content_padding"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding"
|
|
||||||
android:paddingStart="@dimen/content_padding"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/waypoints_icon"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
tools:src="@drawable/ic_action_polygom_dark"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/waypoints_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/track_waypoints"
|
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="?attr/dashboard_divider"/>
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/close_row"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
|
|
||||||
android:background="?attr/selectableItemBackground">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="@string/shared_string_close"
|
|
||||||
android:textAllCaps="true"
|
|
||||||
android:textColor="?attr/color_dialog_buttons"
|
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -1,15 +1,16 @@
|
||||||
package net.osmand.plus.mapmarkers;
|
package net.osmand.plus.mapmarkers;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.ContextThemeWrapper;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
|
|
||||||
public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
@ -23,45 +24,48 @@ public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSh
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
items.add(new TitleItem(getString(R.string.add_group)));
|
||||||
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_add_markers_group_bottom_sheet_dialog, container);
|
|
||||||
|
|
||||||
if (nightMode) {
|
items.add(new DescriptionItem(getString(R.string.add_group_descr)));
|
||||||
((TextView) mainView.findViewById(R.id.add_group_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
|
|
||||||
}
|
|
||||||
|
|
||||||
((ImageView) mainView.findViewById(R.id.favourites_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_fav_dark));
|
BaseBottomSheetItem favoritesItem = new SimpleBottomSheetItem.Builder()
|
||||||
((ImageView) mainView.findViewById(R.id.waypoints_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_polygom_dark));
|
.setIcon(getContentIcon(R.drawable.ic_action_fav_dark))
|
||||||
|
.setTitle(getString(R.string.favourites_group))
|
||||||
mainView.findViewById(R.id.favourites_row).setOnClickListener(new View.OnClickListener() {
|
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
||||||
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View v) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.favouritesOnClick();
|
listener.favouritesOnClick();
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
mainView.findViewById(R.id.waypoints_row).setOnClickListener(new View.OnClickListener() {
|
.create();
|
||||||
|
items.add(favoritesItem);
|
||||||
|
|
||||||
|
BaseBottomSheetItem waypointsItem = new SimpleBottomSheetItem.Builder()
|
||||||
|
.setIcon(getContentIcon(R.drawable.ic_action_polygom_dark))
|
||||||
|
.setTitle(getString(R.string.track_waypoints))
|
||||||
|
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
||||||
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View v) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.waypointsOnClick();
|
listener.waypointsOnClick();
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.create();
|
||||||
|
items.add(waypointsItem);
|
||||||
|
|
||||||
mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() {
|
return null;
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
dismiss();
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
setupHeightAndBackground(mainView, R.id.add_markers_group_scroll_view);
|
@Override
|
||||||
|
protected int getCloseRowTextId() {
|
||||||
return mainView;
|
return R.string.shared_string_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AddMarkersGroupFragmentListener {
|
interface AddMarkersGroupFragmentListener {
|
||||||
|
|
Loading…
Reference in a new issue