From 285ee3d266cd291d94e8246ceb80e672e767642d Mon Sep 17 00:00:00 2001 From: Rosty Date: Wed, 28 Dec 2016 12:26:59 +0200 Subject: [PATCH] quick action widget land/keyboard resize screen/edit action bug fixed --- .../res/layout-land/quick_action_widget.xml | 58 +++++++++++++++++++ .../layout-land/quick_action_widget_page.xml | 11 ++++ .../quick_action_create_edit_dialog.xml | 12 ++-- OsmAnd/res/values-land/dimens.xml | 3 + .../quickaction/CreateEditActionDialog.java | 4 +- .../plus/quickaction/QuickActionsWidget.java | 18 +++--- 6 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 OsmAnd/res/layout-land/quick_action_widget.xml create mode 100644 OsmAnd/res/layout-land/quick_action_widget_page.xml diff --git a/OsmAnd/res/layout-land/quick_action_widget.xml b/OsmAnd/res/layout-land/quick_action_widget.xml new file mode 100644 index 0000000000..1004feb436 --- /dev/null +++ b/OsmAnd/res/layout-land/quick_action_widget.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout-land/quick_action_widget_page.xml b/OsmAnd/res/layout-land/quick_action_widget_page.xml new file mode 100644 index 0000000000..167de7cdd6 --- /dev/null +++ b/OsmAnd/res/layout-land/quick_action_widget_page.xml @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/quick_action_create_edit_dialog.xml b/OsmAnd/res/layout/quick_action_create_edit_dialog.xml index 99a533034d..4a64b381dc 100644 --- a/OsmAnd/res/layout/quick_action_create_edit_dialog.xml +++ b/OsmAnd/res/layout/quick_action_create_edit_dialog.xml @@ -86,13 +86,17 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - + android:layout_marginBottom="56dp"> + + + 50dp 30sp + + 100dp + 100dp \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java index 6172aec71b..87c4c28b68 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java @@ -183,7 +183,9 @@ public class CreateEditActionDialog extends DialogFragment { action.fillParams(); - quickActionRegistry.addQuickAction(action); + if (isNew) quickActionRegistry.addQuickAction(action); + else quickActionRegistry.updateQuickAction(action); + quickActionRegistry.notifyUpdates(); dismiss(); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionsWidget.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionsWidget.java index 493b3c6c4d..5e6d313af5 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionsWidget.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionsWidget.java @@ -1,5 +1,6 @@ package net.osmand.plus.quickaction; +import android.app.Activity; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; @@ -18,6 +19,7 @@ import android.widget.TextView; import net.osmand.plus.IconsCache; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; +import net.osmand.plus.helpers.AndroidUiHelper; import java.util.List; @@ -165,12 +167,7 @@ public class QuickActionsWidget extends LinearLayout { View page = li.inflate(R.layout.quick_action_widget_page, container, false); GridLayout gridLayout = (GridLayout) page.findViewById(R.id.grid); -// final int maxItems = position > 0 -// ? ELEMENT_PER_PAGE -// : (actions.size() > (ELEMENT_PER_PAGE / 2) -// ? ELEMENT_PER_PAGE -// : (ELEMENT_PER_PAGE / 2)); - + final boolean land = !AndroidUiHelper.isOrientationPortrait((Activity) getContext()); final int maxItems = actions.size() == 1 ? 1 : ELEMENT_PER_PAGE; for (int i = 0; i < maxItems; i++){ @@ -197,8 +194,13 @@ public class QuickActionsWidget extends LinearLayout { }); } - view.findViewById(R.id.dividerBot).setVisibility(i < ELEMENT_PER_PAGE / 2 ? VISIBLE : GONE); - view.findViewById(R.id.dividerRight).setVisibility(((i + 1) % 3) == 0 ? GONE : VISIBLE); + if (land) { + view.findViewById(R.id.dividerBot).setVisibility(GONE); + view.findViewById(R.id.dividerRight).setVisibility(VISIBLE); + } else { + view.findViewById(R.id.dividerBot).setVisibility(i < ELEMENT_PER_PAGE / 2 ? VISIBLE : GONE); + view.findViewById(R.id.dividerRight).setVisibility(((i + 1) % 3) == 0 ? GONE : VISIBLE); + } gridLayout.addView(view); }