diff --git a/OsmAnd/res/layout/list_group_empty_title_with_switch.xml b/OsmAnd/res/layout/list_group_empty_title_with_switch.xml index bb4418505d..649ae4687c 100644 --- a/OsmAnd/res/layout/list_group_empty_title_with_switch.xml +++ b/OsmAnd/res/layout/list_group_empty_title_with_switch.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="16dp" + android:layout_height="wrap_content" android:clickable="false" android:orientation="vertical"> @@ -11,8 +11,7 @@ + android:layout_height="12dp"/> @@ -46,7 +45,8 @@ \ No newline at end of file diff --git a/OsmAnd/res/layout/quick_action_favorite.xml b/OsmAnd/res/layout/quick_action_favorite.xml index ae3bc66646..c1d1072288 100644 --- a/OsmAnd/res/layout/quick_action_favorite.xml +++ b/OsmAnd/res/layout/quick_action_favorite.xml @@ -26,7 +26,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:textAppearance="@style/TextAppearance.ListItemTitle" - tools:text="Some title text"/> + android:text="@string/quick_favorites_show_favorites_dialog"/> + android:src="@drawable/ic_action_fav_dark"/> @@ -89,11 +89,11 @@ android:layout_marginRight="12dp" android:text="@string/favourites_edit_dialog_name" android:textColor="?android:textColorSecondary" - android:textSize="@dimen/default_list_text_size"/> + android:textSize="@dimen/default_sub_text_size"/> + + diff --git a/OsmAnd/res/layout/quick_action_list_item.xml b/OsmAnd/res/layout/quick_action_list_item.xml index ddd2431ae6..e0fb489dc5 100644 --- a/OsmAnd/res/layout/quick_action_list_item.xml +++ b/OsmAnd/res/layout/quick_action_list_item.xml @@ -2,21 +2,23 @@ + android:scaleType="centerInside" + android:src="@drawable/ic_action_flag_dark"/> + android:layout_weight="1" + android:orientation="vertical" + android:paddingBottom="8dp" + android:paddingTop="8dp"> - + - + + android:background="?android:selectableItemBackground" + android:scaleType="centerInside" + android:src="@drawable/ic_action_remove_dark"/> diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index e4cd9d4e2d..aa7a749f3c 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2472,4 +2472,7 @@ If you need help with OsmAnd application, please contact our support team: suppo Add Action Create item Dismiss + Show favorites dialog + Name preset + Leave field blank and OsmAnd will use the address or name of a place for the favorite point diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java index a9bb55d875..e31a2608eb 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java @@ -13,6 +13,7 @@ import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.support.v7.widget.helper.ItemTouchHelper; +import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -59,7 +60,6 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - AddQuickActionDialog dialog = new AddQuickActionDialog(); dialog.show(getFragmentManager(), AddQuickActionDialog.TAG); dialog.selectionListener = QuickActionListFragment.this; @@ -86,6 +86,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick quickActionRV.setAdapter(adapter); quickActionRV.setLayoutManager(new LinearLayoutManager(getContext())); + ItemTouchHelper.Callback touchHelperCallback = new QuickActionItemTouchHelperCallback(adapter); touchHelper = new ItemTouchHelper(touchHelperCallback); touchHelper.attachToRecyclerView(quickActionRV); @@ -207,7 +208,6 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick } }); -// LinearLayout.LayoutParams dividerParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams dividerParams = (LinearLayout.LayoutParams) itemVH.divider.getLayoutParams(); //noinspection ResourceType dividerParams.setMargins(!isLongDivider(position) ? dpToPx(56f) : 0, 0, 0, 0); @@ -254,6 +254,11 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick } } notifyItemRangeChanged(position, itemsList.size() - position); + + if (itemsList.size() == 1){ + itemsList.remove(0); + notifyItemRemoved(0); + } } private void showFABIfNotScrollable() { @@ -309,10 +314,6 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick return getActionPosition(globalPosition) == ITEMS_IN_GROUP || globalPosition == getItemCount() - 1; } - public boolean isRecyclerScrollable(RecyclerView recyclerView) { - return recyclerView.computeHorizontalScrollRange() > recyclerView.getWidth() || recyclerView.computeVerticalScrollRange() > recyclerView.getHeight(); - } - private int dpToPx(float dp) { Resources r = getActivity().getResources(); return (int) TypedValue.applyDimension( @@ -329,6 +330,10 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick else { int selectedPosition = viewHolder.getAdapterPosition(); int targetPosition = target.getAdapterPosition(); + Log.v(TAG, "selected: " + selectedPosition + ", target: " + targetPosition); + + if (selectedPosition < 0 || targetPosition < 0) + return false; Collections.swap(itemsList, selectedPosition, targetPosition); if (selectedPosition - targetPosition < -1) { @@ -361,6 +366,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick public QuickActionItemVH(View itemView) { super(itemView); +// AndroidUtils.setListItemBackground(itemView.getContext(), itemView, getMyApplication().getDaynightHelper().isNightMode()); title = (TextView) itemView.findViewById(R.id.title); subTitle = (TextView) itemView.findViewById(R.id.subtitle); icon = (ImageView) itemView.findViewById(R.id.imageView);