Proper sizes for Tablet layout

This commit is contained in:
veliymolfar 2020-05-07 18:02:55 +03:00
parent 08829e7dca
commit dd95b32136
5 changed files with 35 additions and 26 deletions

View file

@ -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" />

View file

@ -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"

View file

@ -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>

View file

@ -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) {
@ -476,9 +477,10 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
TextView title;
TextView description;
ImageView icon;
ImageButton actionIcon;
ImageView 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);
}

View file

@ -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);
}