Merge pull request #8914 from osmandapp/configure_menu_items_fix
Configure menu items fix
This commit is contained in:
commit
2b051b8da8
6 changed files with 37 additions and 25 deletions
|
@ -10,21 +10,21 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/activity_background_basic"
|
||||
tools:paddingEnd="56dp"
|
||||
tools:paddingStart="56dp"
|
||||
tools:paddingTop="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/device_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:adjustViewBounds="true"
|
||||
tools:src="@drawable/img_settings_device_top_dark" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:adjustViewBounds="true"
|
||||
tools:src="@drawable/img_settings_customize_configure_map_night" />
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginEnd="@dimen/list_content_padding_large"
|
||||
|
|
|
@ -85,19 +85,23 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/move_icon"
|
||||
android:layout_width="wrap_content"
|
||||
<FrameLayout
|
||||
android:id="@+id/move_button"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/bottom_sheet_icon_margin"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/bottom_sheet_icon_margin"
|
||||
android:src="@drawable/ic_action_item_move"
|
||||
android:tint="?attr/secondary_icon_color"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding" />
|
||||
android:layout_marginEnd="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:padding="@dimen/content_padding_small">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/move_icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:src="@drawable/ic_action_item_move"
|
||||
android:tint="?attr/secondary_icon_color" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
@ -384,11 +385,11 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
profileViewHolder.moveIcon.setVisibility(mode.isDeleted() ? View.GONE : View.VISIBLE);
|
||||
profileViewHolder.moveButton.setVisibility(mode.isDeleted() ? View.GONE : View.VISIBLE);
|
||||
if (!mode.isDeleted()) {
|
||||
int removeIconColor = mode.isCustomProfile() ? R.color.color_osm_edit_delete : R.color.icon_color_default_light;
|
||||
profileViewHolder.actionIcon.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_remove, removeIconColor));
|
||||
profileViewHolder.moveIcon.setOnTouchListener(new View.OnTouchListener() {
|
||||
profileViewHolder.moveButton.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
|
||||
|
@ -479,6 +480,7 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
|
|||
ImageButton actionIcon;
|
||||
ImageView moveIcon;
|
||||
View itemsContainer;
|
||||
FrameLayout moveButton;
|
||||
|
||||
ProfileViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
@ -487,6 +489,7 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
|
|||
actionIcon = itemView.findViewById(R.id.action_icon);
|
||||
icon = itemView.findViewById(R.id.icon);
|
||||
moveIcon = itemView.findViewById(R.id.move_icon);
|
||||
moveButton = itemView.findViewById(R.id.move_button);
|
||||
itemsContainer = itemView.findViewById(R.id.selectable_list_item);
|
||||
}
|
||||
|
||||
|
|
|
@ -341,6 +341,9 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
|
|||
}
|
||||
} else {
|
||||
hiddenMenuItems.remove(id);
|
||||
if (screenType == ScreenType.CONTEXT_MENU_ACTIONS && mainActionItems.size() < MAIN_BUTTONS_QUANTITY) {
|
||||
mainActionItems.add(id);
|
||||
}
|
||||
}
|
||||
wasReset = false;
|
||||
isChanged = true;
|
||||
|
|
|
@ -155,7 +155,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
h.description.setText(R.string.divider_descr);
|
||||
h.icon.setVisibility(View.GONE);
|
||||
h.actionIcon.setVisibility(View.GONE);
|
||||
h.moveIcon.setVisibility(View.VISIBLE);
|
||||
h.moveButton.setVisibility(View.VISIBLE);
|
||||
h.divider.setVisibility(View.VISIBLE);
|
||||
} else if (SHOW_CATEGORY_ID.equals(id)
|
||||
|| MAP_RENDERING_CATEGORY_ID.equals(id)) {
|
||||
|
@ -165,7 +165,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
h.description.setText(R.string.move_inside_category);
|
||||
h.icon.setVisibility(View.GONE);
|
||||
h.actionIcon.setVisibility(View.GONE);
|
||||
h.moveIcon.setVisibility(View.GONE);
|
||||
h.moveButton.setVisibility(View.GONE);
|
||||
h.divider.setVisibility(View.VISIBLE);
|
||||
h.movable = false;
|
||||
} else {
|
||||
|
@ -179,7 +179,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
h.title.setTextColor(app.getResources().getColor(textColorRes));
|
||||
h.description.setText(getDescription(menuItem.getId()));
|
||||
h.divider.setVisibility(View.GONE);
|
||||
h.moveIcon.setVisibility(View.VISIBLE);
|
||||
h.moveButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
h.actionIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -190,7 +190,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
}
|
||||
}
|
||||
});
|
||||
h.moveIcon.setOnTouchListener(new View.OnTouchListener() {
|
||||
h.moveButton.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
|
||||
|
@ -202,11 +202,11 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
if (!menuItem.isHidden()
|
||||
&& !id.equals(SHOW_CATEGORY_ID)
|
||||
&& !id.equals(MAP_RENDERING_CATEGORY_ID)) {
|
||||
h.moveIcon.setVisibility(View.VISIBLE);
|
||||
h.moveButton.setVisibility(View.VISIBLE);
|
||||
h.moveIcon.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_item_move, nightMode));
|
||||
h.actionIcon.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_remove, R.color.color_osm_edit_delete));
|
||||
} else {
|
||||
h.moveIcon.setVisibility(View.GONE);
|
||||
h.moveButton.setVisibility(View.GONE);
|
||||
h.actionIcon.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_undo, R.color.color_osm_edit_create));
|
||||
}
|
||||
if (id.equals(MAP_CONTEXT_MENU_MORE_ID)) {
|
||||
|
@ -344,6 +344,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
private ImageView icon;
|
||||
private ImageView actionIcon;
|
||||
private ImageView moveIcon;
|
||||
private FrameLayout moveButton;
|
||||
private View divider;
|
||||
private boolean movable = true;
|
||||
|
||||
|
@ -354,6 +355,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
actionIcon = itemView.findViewById(R.id.action_icon);
|
||||
icon = itemView.findViewById(R.id.icon);
|
||||
moveIcon = itemView.findViewById(R.id.move_icon);
|
||||
moveButton = itemView.findViewById(R.id.move_button);
|
||||
divider = itemView.findViewById(R.id.divider);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue