Add buttons
This commit is contained in:
parent
b636e4e4ae
commit
9a0a518948
4 changed files with 162 additions and 118 deletions
|
@ -44,8 +44,8 @@ public class GPXUtilities {
|
||||||
public final static Log log = PlatformUtil.getLog(GPXUtilities.class);
|
public final static Log log = PlatformUtil.getLog(GPXUtilities.class);
|
||||||
private static final String ICON_NAME_EXTENSION = "icon";
|
private static final String ICON_NAME_EXTENSION = "icon";
|
||||||
private static final String DEFAULT_ICON_NAME = "special_star";
|
private static final String DEFAULT_ICON_NAME = "special_star";
|
||||||
public static final String BACK_TYPE_EXTENSION = "background";
|
private static final String BACKGROUND_TYPE_EXTENSION = "background";
|
||||||
private static final String DEFAULT_BACK_TYPE = "CIRCLE";
|
private static final String DEFAULT_BACKGROUND_TYPE = "CIRCLE";
|
||||||
|
|
||||||
private final static String GPX_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
|
private final static String GPX_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
|
||||||
private final static String GPX_TIME_FORMAT_MILLIS = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; //$NON-NLS-1$
|
private final static String GPX_TIME_FORMAT_MILLIS = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; //$NON-NLS-1$
|
||||||
|
@ -274,15 +274,15 @@ public class GPXUtilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBackType() {
|
public String getBackType() {
|
||||||
String backType = getExtensionsToRead().get(BACK_TYPE_EXTENSION);
|
String backType = getExtensionsToRead().get(BACKGROUND_TYPE_EXTENSION);
|
||||||
if (backType == null) {
|
if (backType == null) {
|
||||||
backType = DEFAULT_BACK_TYPE;
|
backType = DEFAULT_BACKGROUND_TYPE;
|
||||||
}
|
}
|
||||||
return backType;
|
return backType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBackType(String backType) {
|
public void setBackType(String backType) {
|
||||||
getExtensionsToWrite().put(BACK_TYPE_EXTENSION, backType);
|
getExtensionsToWrite().put(BACKGROUND_TYPE_EXTENSION, backType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="6dp"
|
android:paddingStart="0dp"
|
||||||
android:paddingRight="11dp"
|
|
||||||
android:paddingLeft="0dp"
|
android:paddingLeft="0dp"
|
||||||
android:paddingEnd="11dp"
|
android:paddingEnd="9dp"
|
||||||
android:paddingStart="0dp">
|
android:paddingRight="9dp"
|
||||||
|
android:paddingBottom="4dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/outline"
|
android:id="@+id/outline"
|
||||||
android:layout_width="46dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="46dp"
|
android:layout_height="48dp"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
app:srcCompat="@drawable/circle_contour_bg_light" />
|
app:srcCompat="@drawable/circle_contour_bg_light" />
|
||||||
|
|
||||||
|
@ -20,15 +20,15 @@
|
||||||
android:id="@+id/background"
|
android:id="@+id/background"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="3dp"
|
android:layout_margin="4dp"
|
||||||
android:background="@drawable/bg_point_circle" />
|
android:background="@drawable/bg_point_circle" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="11dp"
|
android:layout_margin="12dp"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:srcCompat="@drawable/mx_special_star_stroked"/>
|
app:srcCompat="@drawable/mx_special_star_stroked" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
|
@ -257,6 +257,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
tools:itemCount="1"
|
||||||
tools:listitem="@layout/point_group_select_item" />
|
tools:listitem="@layout/point_group_select_item" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -282,13 +283,22 @@
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular" />
|
osmand:typeface="@string/font_roboto_regular" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/group_name_recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:itemCount="1"
|
||||||
|
tools:listitem="@layout/point_group_select_item" />
|
||||||
|
|
||||||
<net.osmand.plus.widgets.FlowLayout
|
<net.osmand.plus.widgets.FlowLayout
|
||||||
android:id="@+id/select_icon"
|
android:id="@+id/select_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginLeft="13dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginStart="13dp" />
|
android:layout_marginTop="6dp" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -337,8 +347,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
android:layout_marginLeft="13dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginStart="13dp" />
|
android:layout_marginStart="12dp" />
|
||||||
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
@ -388,8 +398,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
android:layout_marginLeft="13dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginStart="13dp" />
|
android:layout_marginStart="12dp" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -409,12 +419,43 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/replace_action_icon"
|
android:id="@+id/replace_action_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:contentDescription="@string/replace_all"
|
android:contentDescription="@string/update_existing"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingRight="32dp"
|
||||||
android:paddingTop="21dp"
|
android:paddingTop="21dp"
|
||||||
android:paddingBottom="21dp"
|
android:paddingBottom="21dp"
|
||||||
android:src="@drawable/ic_action_replace" />
|
tools:src="@drawable/ic_action_replace"
|
||||||
|
android:paddingEnd="32dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/replace_action_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@string/update_existing"
|
||||||
|
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||||
|
tools:text="@string/update_existing" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/replace_action_description"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:lines="1"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
android:text="@string/shared_string_delete"
|
||||||
|
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||||
|
tools:text="@string/shared_string_delete" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -431,9 +472,21 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:contentDescription="@string/delete_point"
|
android:contentDescription="@string/delete_point"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingStart="16dp"
|
||||||
android:paddingBottom="8dp"
|
android:paddingRight="32dp"
|
||||||
android:src="@drawable/ic_action_delete_dark" />
|
android:paddingTop="12dp"
|
||||||
|
android:paddingBottom="12dp"
|
||||||
|
android:src="@drawable/ic_action_delete_dark"
|
||||||
|
android:paddingEnd="32dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/delete_action_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@string/shared_string_delete"
|
||||||
|
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||||
|
tools:text="@string/shared_string_delete" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -456,68 +509,10 @@
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?attr/divider_color" />
|
android:background="?attr/divider_color" />
|
||||||
|
|
||||||
<LinearLayout
|
<include
|
||||||
android:id="@+id/buttons_layout"
|
layout="@layout/bottom_buttons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/dialog_button_ex_height" />
|
||||||
android:background="?attr/activity_background_color"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/delete_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:paddingStart="10dp"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingEnd="10dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:text="@string/shared_string_delete"
|
|
||||||
android:textColor="?attr/contextMenuButtonColor" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/replace_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:paddingStart="10dp"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingEnd="10dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:text="@string/update_existing"
|
|
||||||
android:textColor="?attr/contextMenuButtonColor"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/cancel_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:paddingStart="10dp"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingEnd="10dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:text="@string/shared_string_cancel"
|
|
||||||
android:textColor="?attr/contextMenuButtonColor" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/save_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:paddingStart="10dp"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingEnd="10dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:text="@string/shared_string_save"
|
|
||||||
android:textColor="?attr/contextMenuButtonColor" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -64,11 +64,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
|
|
||||||
private View view;
|
private View view;
|
||||||
private EditText nameEdit;
|
private EditText nameEdit;
|
||||||
private ImageView nameIcon;
|
|
||||||
private Button addDelDescription;
|
private Button addDelDescription;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
private GroupAdapter groupListAdapter;
|
|
||||||
private String selectedIcon;
|
private String selectedIcon;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
@ -91,7 +89,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
toolbar.setTitle(getToolbarTitle());
|
toolbar.setTitle(getToolbarTitle());
|
||||||
|
|
||||||
final OsmandApplication app = requireMyApplication();
|
final OsmandApplication app = requireMyApplication();
|
||||||
Drawable icBack = app.getUIUtilities().getIcon(R.drawable.ic_arrow_back, nightMode ? R.color.active_buttons_and_links_text_dark : R.color.description_font_and_bottom_sheet_icons);
|
Drawable icBack = app.getUIUtilities().getIcon(R.drawable.ic_arrow_back,
|
||||||
|
nightMode ? R.color.active_buttons_and_links_text_dark : R.color.description_font_and_bottom_sheet_icons);
|
||||||
toolbar.setNavigationIcon(icBack);
|
toolbar.setNavigationIcon(icBack);
|
||||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -114,6 +113,10 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
ImageView deleteIcon = (ImageView) view.findViewById(R.id.delete_action_icon);
|
ImageView deleteIcon = (ImageView) view.findViewById(R.id.delete_action_icon);
|
||||||
deleteIcon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId));
|
deleteIcon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId));
|
||||||
|
|
||||||
|
// ((TextView)view.findViewById(R.id.replace_action_title)).setTextColor(ContextCompat.getColor(app,activeColorResId));
|
||||||
|
// ((TextView)view.findViewById(R.id.replace_action_description)).setTextColor(ContextCompat.getColor(app,activeColorResId));
|
||||||
|
// ((TextView)view.findViewById(R.id.delete_action_title)).setTextColor(ContextCompat.getColor(app,activeColorResId));
|
||||||
|
|
||||||
View groupList = view.findViewById(R.id.group_list_button);
|
View groupList = view.findViewById(R.id.group_list_button);
|
||||||
groupList.setOnClickListener(new View.OnClickListener() {
|
groupList.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,9 +127,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
view.findViewById(R.id.buttons_divider).setVisibility(View.VISIBLE);
|
||||||
Button saveButton = (Button) view.findViewById(R.id.save_button);
|
View saveButton = view.findViewById(R.id.right_bottom_button);
|
||||||
saveButton.setTextColor(getResources().getColor(activeColorResId));
|
saveButton.setVisibility(View.VISIBLE);
|
||||||
saveButton.setOnClickListener(new View.OnClickListener() {
|
saveButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -134,8 +137,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button cancelButton = (Button) view.findViewById(R.id.cancel_button);
|
View cancelButton = view.findViewById(R.id.dismiss_button);
|
||||||
cancelButton.setTextColor(getResources().getColor(activeColorResId));
|
|
||||||
cancelButton.setOnClickListener(new View.OnClickListener() {
|
cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -144,21 +146,24 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button deleteButton = (Button) view.findViewById(R.id.delete_button);
|
// Button deleteButton = (Button) view.findViewById(R.id.delete_button);
|
||||||
deleteButton.setTextColor(getResources().getColor(activeColorResId));
|
// deleteButton.setTextColor(getResources().getColor(activeColorResId));
|
||||||
deleteButton.setOnClickListener(new View.OnClickListener() {
|
// deleteButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
// @Override
|
||||||
public void onClick(View v) {
|
// public void onClick(View v) {
|
||||||
deletePressed();
|
// deletePressed();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
UiUtilities.setupDialogButton(nightMode, cancelButton, UiUtilities.DialogButtonType.SECONDARY, R.string.shared_string_cancel);
|
||||||
|
UiUtilities.setupDialogButton(nightMode, saveButton, UiUtilities.DialogButtonType.PRIMARY, R.string.shared_string_save);
|
||||||
|
|
||||||
TextInputLayout nameCaption = (TextInputLayout) view.findViewById(R.id.name_caption);
|
TextInputLayout nameCaption = (TextInputLayout) view.findViewById(R.id.name_caption);
|
||||||
nameCaption.setHint(getString(R.string.shared_string_name));
|
nameCaption.setHint(getString(R.string.shared_string_name));
|
||||||
|
|
||||||
nameEdit = (EditText) view.findViewById(R.id.name_edit);
|
nameEdit = (EditText) view.findViewById(R.id.name_edit);
|
||||||
nameEdit.setText(getNameInitValue());
|
nameEdit.setText(getNameInitValue());
|
||||||
nameIcon = (ImageView) view.findViewById(R.id.name_icon);
|
ImageView nameIcon = (ImageView) view.findViewById(R.id.name_icon);
|
||||||
TextView categoryEdit = view.findViewById(R.id.groupName);
|
TextView categoryEdit = view.findViewById(R.id.groupName);
|
||||||
if (categoryEdit != null) {
|
if (categoryEdit != null) {
|
||||||
AndroidUtils.setTextPrimaryColor(view.getContext(), categoryEdit, !editor.isLight());
|
AndroidUtils.setTextPrimaryColor(view.getContext(), categoryEdit, !editor.isLight());
|
||||||
|
@ -192,20 +197,18 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
|
|
||||||
if (app.accessibilityEnabled()) {
|
if (app.accessibilityEnabled()) {
|
||||||
nameCaption.setFocusable(true);
|
nameCaption.setFocusable(true);
|
||||||
// categoryCaption.setFocusable(true);
|
nameEdit.setHint(R.string.access_hint_enter_name);
|
||||||
// nameEdit.setHint(R.string.access_hint_enter_name);
|
descriptionEdit.setHint(R.string.access_hint_enter_description);
|
||||||
// categoryEdit.setHint(R.string.access_hint_enter_category);
|
|
||||||
// descriptionEdit.setHint(R.string.access_hint_enter_description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editor.isNew()) {
|
if (editor.isNew()) {
|
||||||
toolbarAction.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_replace, activeColorResId));
|
toolbarAction.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_replace, activeColorResId));
|
||||||
deleteButton.setVisibility(View.GONE);
|
// deleteButton.setVisibility(View.GONE);
|
||||||
descriptionCaption.setVisibility(View.GONE);
|
descriptionCaption.setVisibility(View.GONE);
|
||||||
deleteIcon.setVisibility(View.GONE);
|
deleteIcon.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
toolbarAction.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId));
|
toolbarAction.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId));
|
||||||
deleteButton.setVisibility(View.VISIBLE);
|
// deleteButton.setVisibility(View.VISIBLE);
|
||||||
deleteIcon.setVisibility(View.VISIBLE);
|
deleteIcon.setVisibility(View.VISIBLE);
|
||||||
if (!descriptionEdit.getText().toString().isEmpty() || descriptionCaption.getVisibility() != View.VISIBLE) {
|
if (!descriptionEdit.getText().toString().isEmpty() || descriptionCaption.getVisibility() != View.VISIBLE) {
|
||||||
descriptionCaption.setVisibility(View.VISIBLE);
|
descriptionCaption.setVisibility(View.VISIBLE);
|
||||||
|
@ -225,8 +228,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createGroupSelector(OsmandApplication app) {
|
private void createGroupSelector(OsmandApplication app) {
|
||||||
groupListAdapter = new GroupAdapter(app);
|
GroupAdapter groupListAdapter = new GroupAdapter(app);
|
||||||
|
|
||||||
groupListAdapter.setItemClickListener(new View.OnClickListener() {
|
groupListAdapter.setItemClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -238,11 +240,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
groupListAdapter.setSelectedItemName(getCategoryInitValue());
|
groupListAdapter.setSelectedItemName(getCategoryInitValue());
|
||||||
|
RecyclerView groupRecyclerView = view.findViewById(R.id.group_recycler_view);
|
||||||
LinearLayoutManager layoutManager = new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false);
|
groupRecyclerView.setAdapter(groupListAdapter);
|
||||||
RecyclerView recyclerView = view.findViewById(R.id.group_recycler_view);
|
groupRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
|
||||||
recyclerView.setAdapter(groupListAdapter);
|
|
||||||
recyclerView.setLayoutManager(layoutManager);
|
|
||||||
groupListAdapter.notifyDataSetChanged();
|
groupListAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,6 +319,14 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GroupNameAdapter groupNameListAdapter = new GroupNameAdapter();
|
||||||
|
groupNameListAdapter.setItems(new ArrayList<>(group.keySet()));
|
||||||
|
RecyclerView groupNameRecyclerView = view.findViewById(R.id.group_name_recycler_view);
|
||||||
|
groupNameRecyclerView.setAdapter(groupNameListAdapter);
|
||||||
|
groupNameRecyclerView.setLayoutManager(new LinearLayoutManager(requireMyApplication(), RecyclerView.HORIZONTAL, false));
|
||||||
|
groupNameListAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
for (String name : iconNameList) {
|
for (String name : iconNameList) {
|
||||||
selectIcon.addView(createIconItemView(name, selectIcon), new FlowLayout.LayoutParams(0, 0));
|
selectIcon.addView(createIconItemView(name, selectIcon), new FlowLayout.LayoutParams(0, 0));
|
||||||
}
|
}
|
||||||
|
@ -333,6 +341,12 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
AndroidUtils.setBackground(backgroundCircle,
|
AndroidUtils.setBackground(backgroundCircle,
|
||||||
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle),
|
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle),
|
||||||
ContextCompat.getColor(app, R.color.divider_color_light)));
|
ContextCompat.getColor(app, R.color.divider_color_light)));
|
||||||
|
GradientDrawable rectContourDrawable = (GradientDrawable) ContextCompat.getDrawable(app, R.drawable.circle_contour_bg_light);
|
||||||
|
if (rectContourDrawable != null) {
|
||||||
|
rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, 2), ContextCompat.getColor(app, R.color.divider_color_light));
|
||||||
|
ImageView outline = iconItemView.findViewById(R.id.outline);
|
||||||
|
outline.setImageDrawable(rectContourDrawable);
|
||||||
|
}
|
||||||
ImageView icon = iconItemView.findViewById(R.id.icon);
|
ImageView icon = iconItemView.findViewById(R.id.icon);
|
||||||
icon.setVisibility(View.VISIBLE);
|
icon.setVisibility(View.VISIBLE);
|
||||||
final int iconRes = app.getResources().getIdentifier("mx_" + iconName, "drawable", app.getPackageName());
|
final int iconRes = app.getResources().getIdentifier("mx_" + iconName, "drawable", app.getPackageName());
|
||||||
|
@ -702,4 +716,39 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
groupButton = itemView.findViewById(R.id.outlineRect);
|
groupButton = itemView.findViewById(R.id.outlineRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GroupNameAdapter extends RecyclerView.Adapter<NameViewHolder> {
|
||||||
|
|
||||||
|
List<String> items;
|
||||||
|
|
||||||
|
public void setItems(List<String> items) {
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public NameViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
Button view;
|
||||||
|
int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||||
|
view = new Button(requireMyApplication());
|
||||||
|
return new NameViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull NameViewHolder holder, int position) {
|
||||||
|
((Button) holder.itemView).setText(items.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return items.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static class NameViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
NameViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue