Merge pull request #9267 from osmandapp/Color_select_favs_group_out_of_screen
Color selection for favorites point group outside of screen
This commit is contained in:
commit
a6963620c4
5 changed files with 56 additions and 51 deletions
|
@ -19,28 +19,34 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/favorites_my_places_icon_left_padding"
|
||||
android:paddingStart="@dimen/favorites_my_places_icon_left_padding"
|
||||
android:paddingRight="0dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/expandable_list_item_background">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/toggle_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
tools:visiblity="visible"/>
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/favorites_my_places_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/category_icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/toggle_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/category_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/shared_string_groups" />
|
||||
</FrameLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/category_name"
|
||||
|
|
|
@ -45,9 +45,7 @@
|
|||
android:id="@+id/toggle_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_gravity="center"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
|
|
@ -1,29 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp" />
|
||||
<TextView
|
||||
android:id="@+id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_marginBottom="@dimen/content_padding_small"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/ctx_menu_info_divider"
|
||||
android:visibility="gone"/>
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/ctx_menu_info_divider"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
<dimen name="context_menu_transport_stop_item_height">24dp</dimen>
|
||||
<dimen name="context_menu_main_actions_padding_top">11dp</dimen>
|
||||
<dimen name="context_menu_main_actions_padding_bottom">9dp</dimen>
|
||||
<dimen name="context_menu_main_actions_icon_margin">5dp</dimen>
|
||||
|
||||
<!-- General -->
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import android.app.Activity;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -31,6 +31,7 @@ import net.osmand.plus.MapMarkersHelper;
|
|||
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
|
||||
|
@ -73,12 +74,13 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
|||
public void onClick(View v) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(activity);
|
||||
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(themedContext);
|
||||
b.setTitle(R.string.favorite_category_name);
|
||||
final EditText nameEditText = new EditText(activity);
|
||||
final EditText nameEditText = new EditText(themedContext);
|
||||
nameEditText.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||
nameEditText.setText(group.getName());
|
||||
LinearLayout container = new LinearLayout(activity);
|
||||
LinearLayout container = new LinearLayout(themedContext);
|
||||
int sidePadding = AndroidUtils.dpToPx(activity, 24f);
|
||||
int topPadding = AndroidUtils.dpToPx(activity, 4f);
|
||||
container.setPadding(sidePadding, topPadding, sidePadding, topPadding);
|
||||
|
@ -105,9 +107,8 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
|||
.create();
|
||||
items.add(editNameItem);
|
||||
|
||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
final View changeColorView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||
R.layout.change_fav_color, null);
|
||||
final View changeColorView = UiUtilities.getInflater(getContext(), nightMode)
|
||||
.inflate(R.layout.change_fav_color, null, false);
|
||||
((ImageView) changeColorView.findViewById(R.id.change_color_icon))
|
||||
.setImageDrawable(getContentIcon(R.drawable.ic_action_appearance));
|
||||
updateColorView((ImageView) changeColorView.findViewById(R.id.colorImage));
|
||||
|
@ -118,13 +119,15 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
|||
public void onClick(View v) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
final ListPopupWindow popup = new ListPopupWindow(activity);
|
||||
final ListPopupWindow popup = new ListPopupWindow(v.getContext());
|
||||
popup.setAnchorView(v);
|
||||
popup.setContentWidth(AndroidUtils.dpToPx(app, 200f));
|
||||
popup.setModal(true);
|
||||
popup.setDropDownGravity(Gravity.END | Gravity.TOP);
|
||||
if (AndroidUiHelper.isOrientationPortrait(activity)) {
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, 48f));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, 48f));
|
||||
}
|
||||
} else {
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue