From 9792ff3414bd7c0ebe536d1046c6ddbc0c15f7a9 Mon Sep 17 00:00:00 2001 From: Nazar-Kutz Date: Thu, 20 Aug 2020 17:12:12 +0300 Subject: [PATCH] Fix Material Theme --- ...ttom_sheet_item_edit_with_recyclerview.xml | 1 + .../bottom_sheet_item_with_descr_56dp.xml | 1 + ...heet_item_with_descr_and_checkbox_56dp.xml | 1 + ..._sheet_item_with_descr_and_switch_56dp.xml | 1 + ...escr_switch_and_additional_button_56dp.xml | 1 + OsmAnd/res/layout/fragment_edit_poi.xml | 41 ++++++----- .../layout/fragment_map_markers_groups.xml | 1 + OsmAnd/res/layout/gpx_description_card.xml | 1 + OsmAnd/res/layout/gpx_item_list_header.xml | 24 ++++--- OsmAnd/res/layout/gpx_track_item.xml | 6 +- .../res/layout/markers_group_view_holder.xml | 1 + OsmAnd/res/layout/plan_route_gpx.xml | 3 +- .../res/layout/point_editor_fragment_new.xml | 1 + .../res/layout/preference_dropdown_list.xml | 6 +- .../res/layout/profile_preference_toolbar.xml | 1 + ...profile_preference_toolbar_with_switch.xml | 1 + OsmAnd/res/layout/quick_action_list.xml | 1 + OsmAnd/res/layout/wikivoyage_article_card.xml | 2 + .../layout/wikivoyage_search_list_item.xml | 2 + .../download/ui/LocalIndexesFragment.java | 7 +- .../plus/osmedit/EditPoiDialogFragment.java | 70 +++++++------------ 21 files changed, 92 insertions(+), 81 deletions(-) diff --git a/OsmAnd/res/layout/bottom_sheet_item_edit_with_recyclerview.xml b/OsmAnd/res/layout/bottom_sheet_item_edit_with_recyclerview.xml index df28c0a05e..570839e671 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_edit_with_recyclerview.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_edit_with_recyclerview.xml @@ -104,6 +104,7 @@ android:paddingRight="@dimen/content_padding_small" android:paddingEnd="@dimen/content_padding_small" android:paddingLeft="@dimen/content_padding_small" + android:textColor="?android:textColorSecondary" android:text="@string/shared_string_meters" /> diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_descr_56dp.xml b/OsmAnd/res/layout/bottom_sheet_item_with_descr_56dp.xml index adb62373fa..88dfc6f66a 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_with_descr_56dp.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_with_descr_56dp.xml @@ -43,6 +43,7 @@ android:ellipsize="end" android:maxLines="2" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="Some description"/> diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_checkbox_56dp.xml b/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_checkbox_56dp.xml index ae1255e374..34e329d8a3 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_checkbox_56dp.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_checkbox_56dp.xml @@ -44,6 +44,7 @@ android:ellipsize="end" android:maxLines="2" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="Some description"/> diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_switch_56dp.xml b/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_switch_56dp.xml index 7f54956e23..82d4698be8 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_switch_56dp.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_switch_56dp.xml @@ -44,6 +44,7 @@ android:ellipsize="end" android:maxLines="2" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="Some description"/> diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_descr_switch_and_additional_button_56dp.xml b/OsmAnd/res/layout/bottom_sheet_item_with_descr_switch_and_additional_button_56dp.xml index 006824b159..ceb6326c35 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_with_descr_switch_and_additional_button_56dp.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_with_descr_switch_and_additional_button_56dp.xml @@ -49,6 +49,7 @@ android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="2" + android:textColor="@null" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" tools:text="Some description" /> diff --git a/OsmAnd/res/layout/fragment_edit_poi.xml b/OsmAnd/res/layout/fragment_edit_poi.xml index f2854b4a77..9e142ae938 100644 --- a/OsmAnd/res/layout/fragment_edit_poi.xml +++ b/OsmAnd/res/layout/fragment_edit_poi.xml @@ -43,26 +43,32 @@ android:layout_height="wrap_content" app:layout_scrollFlags="scroll"> - - - + - + android:layout_marginStart="24dp" + android:layout_marginLeft="24dp" + android:importantForAutofill="noExcludeDescendants" + app:endIcon="@drawable/ic_action_arrow_drop_down" + app:labelText="@string/poi_dialog_poi_type" + app:panelBackgroundColor="@color/color_transparent" + app:primaryColor="@color/color_white" + app:secondaryColor="@color/white_50_transparent"> - - + diff --git a/OsmAnd/res/layout/gpx_description_card.xml b/OsmAnd/res/layout/gpx_description_card.xml index 88d7c651fa..e60e525bb0 100644 --- a/OsmAnd/res/layout/gpx_description_card.xml +++ b/OsmAnd/res/layout/gpx_description_card.xml @@ -24,6 +24,7 @@ android:ellipsize="end" android:maxLines="5" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard." android:layout_marginStart="@dimen/content_padding" android:layout_marginEnd="@dimen/content_padding" /> diff --git a/OsmAnd/res/layout/gpx_item_list_header.xml b/OsmAnd/res/layout/gpx_item_list_header.xml index 251eda21b6..715dd7789e 100644 --- a/OsmAnd/res/layout/gpx_item_list_header.xml +++ b/OsmAnd/res/layout/gpx_item_list_header.xml @@ -64,19 +64,21 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1.8" - android:minHeight="48dp" + android:minHeight="@dimen/card_row_min_height" android:paddingLeft="@dimen/content_padding" - android:paddingTop="@dimen/content_padding_half" - android:paddingBottom="@dimen/content_padding_half" + android:paddingStart="@dimen/content_padding" + android:paddingRight="0dp" + android:paddingEnd="0dp" android:orientation="horizontal" - android:gravity="center_vertical" - android:paddingStart="@dimen/content_padding"> + android:gravity="center_vertical"> @@ -119,14 +121,16 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1.6" - android:minHeight="48dp" + android:minHeight="@dimen/card_row_min_height" android:paddingLeft="@dimen/content_padding" + android:paddingStart="@dimen/content_padding" + android:paddingRight="0dp" + android:paddingEnd="0dp" android:paddingTop="@dimen/content_padding_half" android:paddingBottom="@dimen/content_padding_half" android:background="?attr/selectableItemBackground" android:orientation="horizontal" - android:gravity="center_vertical" - android:paddingStart="@dimen/content_padding"> + android:gravity="center_vertical"> diff --git a/OsmAnd/res/layout/markers_group_view_holder.xml b/OsmAnd/res/layout/markers_group_view_holder.xml index 800dc74bc0..1c9179ba6d 100644 --- a/OsmAnd/res/layout/markers_group_view_holder.xml +++ b/OsmAnd/res/layout/markers_group_view_holder.xml @@ -44,6 +44,7 @@ android:ellipsize="end" android:maxLines="1" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" android:visibility="gone" tools:text="Some description" tools:visibility="visible"/> diff --git a/OsmAnd/res/layout/plan_route_gpx.xml b/OsmAnd/res/layout/plan_route_gpx.xml index 5e68cdfa44..2429273922 100644 --- a/OsmAnd/res/layout/plan_route_gpx.xml +++ b/OsmAnd/res/layout/plan_route_gpx.xml @@ -46,7 +46,8 @@ android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="2" - android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" /> + android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" /> diff --git a/OsmAnd/res/layout/point_editor_fragment_new.xml b/OsmAnd/res/layout/point_editor_fragment_new.xml index edb092f31e..77f9744c4c 100644 --- a/OsmAnd/res/layout/point_editor_fragment_new.xml +++ b/OsmAnd/res/layout/point_editor_fragment_new.xml @@ -461,6 +461,7 @@ android:lines="1" android:text="@string/replace_point_descr" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="@string/replace_point_descr" /> diff --git a/OsmAnd/res/layout/preference_dropdown_list.xml b/OsmAnd/res/layout/preference_dropdown_list.xml index ec62e1232d..6f247664fa 100644 --- a/OsmAnd/res/layout/preference_dropdown_list.xml +++ b/OsmAnd/res/layout/preference_dropdown_list.xml @@ -22,9 +22,11 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical|end" android:paddingRight="@dimen/content_padding" + android:paddingEnd="@dimen/content_padding" + android:paddingLeft="0dp" + android:paddingStart="0dp" app:srcCompat="@drawable/ic_action_arrow_drop_down" - android:tint="@color/settings_divider" - android:paddingEnd="@dimen/content_padding" /> + android:tint="@color/settings_divider" /> diff --git a/OsmAnd/res/layout/profile_preference_toolbar_with_switch.xml b/OsmAnd/res/layout/profile_preference_toolbar_with_switch.xml index 73db37f093..33a93fc70e 100644 --- a/OsmAnd/res/layout/profile_preference_toolbar_with_switch.xml +++ b/OsmAnd/res/layout/profile_preference_toolbar_with_switch.xml @@ -66,6 +66,7 @@ android:ellipsize="end" android:maxLines="2" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="Some description" /> diff --git a/OsmAnd/res/layout/quick_action_list.xml b/OsmAnd/res/layout/quick_action_list.xml index 7b042aa261..9d8b797ae1 100644 --- a/OsmAnd/res/layout/quick_action_list.xml +++ b/OsmAnd/res/layout/quick_action_list.xml @@ -31,6 +31,7 @@ android:layout_alignParentBottom="true" android:layout_margin="@dimen/content_padding" android:contentDescription="@string/quick_action_new_action" + app:tint="?attr/app_bar_primary_item_color" app:backgroundTint="?attr/color_dialog_buttons" app:srcCompat="@drawable/ic_action_plus" /> diff --git a/OsmAnd/res/layout/wikivoyage_article_card.xml b/OsmAnd/res/layout/wikivoyage_article_card.xml index b7b266f138..cd44a13933 100644 --- a/OsmAnd/res/layout/wikivoyage_article_card.xml +++ b/OsmAnd/res/layout/wikivoyage_article_card.xml @@ -54,6 +54,7 @@ android:ellipsize="end" android:maxLines="3" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard."/> @@ -84,6 +85,7 @@ android:ellipsize="end" android:maxLines="1" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="England • United Kingdom" android:layout_marginStart="@dimen/content_padding" android:layout_marginEnd="@dimen/content_padding" /> diff --git a/OsmAnd/res/layout/wikivoyage_search_list_item.xml b/OsmAnd/res/layout/wikivoyage_search_list_item.xml index 1f78ca6221..14c6c79729 100644 --- a/OsmAnd/res/layout/wikivoyage_search_list_item.xml +++ b/OsmAnd/res/layout/wikivoyage_search_list_item.xml @@ -61,6 +61,7 @@ android:ellipsize="end" android:maxLines="1" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" + android:textColor="@null" tools:text="Amstellend North Holland"/> diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java index 99f5e9b642..2fb12e2ea4 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java @@ -561,7 +561,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement ActionBar actionBar = getDownloadActivity().getSupportActionBar(); //hide action bar from downloadindexfragment actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); - int iconColorResId = getMyApplication().getSettings().isLightContent() ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark; + boolean nightMode = !getMyApplication().getSettings().isLightContent(); + UiUtilities iconsCache = getMyApplication().getUIUtilities(); + int iconColorResId = nightMode ? + R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light; optionsMenuAdapter = new ContextMenuAdapter(requireMyApplication()); ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() { @Override @@ -600,7 +603,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(j); if (j + 1 >= max && optionsMenuAdapter.length() > max) { if (split == null) { - Drawable icOverflowMenu = getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white); + Drawable icOverflowMenu = iconsCache.getIcon(R.drawable.ic_overflow_menu_white, iconColorResId); split = menu.addSubMenu(0, 1, j + 1, R.string.shared_string_more_actions); split.setIcon(icOverflowMenu); split.getItem(); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index ace09d8c3d..a145bbd1c8 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -19,7 +19,6 @@ import android.util.TypedValue; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; @@ -27,7 +26,6 @@ import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.AdapterView; import android.widget.ArrayAdapter; -import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; @@ -40,6 +38,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatImageButton; import androidx.appcompat.widget.Toolbar; import androidx.core.view.ViewCompat; import androidx.fragment.app.DialogFragment; @@ -50,7 +49,6 @@ import androidx.fragment.app.FragmentTransaction; import androidx.viewpager.widget.ViewPager; import com.google.android.material.tabs.TabLayout; -import com.google.android.material.textfield.TextInputLayout; import net.osmand.AndroidUtils; import net.osmand.CallbackWithObject; @@ -75,6 +73,7 @@ import net.osmand.plus.osmedit.OsmPoint.Action; import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment; import net.osmand.plus.osmedit.dialogs.PoiTypeDialogFragment; import net.osmand.plus.settings.backend.OsmandSettings; +import net.osmand.plus.widgets.OsmandTextFieldBoxes; import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; @@ -89,6 +88,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import studio.carbonylgroup.textfieldboxes.ExtendedEditText; + public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { public static final String TAG = EditPoiDialogFragment.class.getSimpleName(); private static final Log LOG = PlatformUtil.getLog(EditPoiDialogFragment.class); @@ -111,11 +112,11 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { private EditPoiData editPoiData; private EditPoiViewPager viewPager; - private AutoCompleteTextView poiTypeEditText; + private ExtendedEditText poiTypeEditText; private OnSaveButtonClickListener onSaveButtonClickListener; private OpenstreetmapUtil mOpenstreetmapUtil; - private TextInputLayout poiTypeTextInputLayout; + private OsmandTextFieldBoxes poiTypeTextInputLayout; private View view; public static final int AMENITY_TEXT_LENGTH= 255; @@ -250,7 +251,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { } }); - EditText poiNameEditText = (EditText) view.findViewById(R.id.poiNameEditText); + ExtendedEditText poiNameEditText = (ExtendedEditText) view.findViewById(R.id.poiNameEditText); AndroidUtils.setTextHorizontalGravity(poiNameEditText, Gravity.START); poiNameEditText.addTextChangedListener(new TextWatcher() { @Override @@ -276,8 +277,8 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { poiNameEditText.setText(editPoiData.getTag(OSMSettings.OSMTagKey.NAME.getValue())); poiNameEditText.requestFocus(); AndroidUtils.showSoftKeyboard(getActivity(), poiNameEditText); - poiTypeTextInputLayout = (TextInputLayout) view.findViewById(R.id.poiTypeTextInputLayout); - poiTypeEditText = (AutoCompleteTextView) view.findViewById(R.id.poiTypeEditText); + poiTypeTextInputLayout = (OsmandTextFieldBoxes) view.findViewById(R.id.poiTypeTextInputLayout); + poiTypeEditText = (ExtendedEditText) view.findViewById(R.id.poiTypeEditText); AndroidUtils.setTextHorizontalGravity(poiTypeEditText, Gravity.START); poiTypeEditText.setText(editPoiData.getPoiTypeString()); poiTypeEditText.addTextChangedListener(new TextWatcher() { @@ -296,7 +297,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { if (!getMyApplication().isApplicationInitializing()) { PoiCategory category = editPoiData.getPoiCategory(); if (category != null) { - poiTypeTextInputLayout.setHint(category.getTranslation()); + poiTypeTextInputLayout.setLabelText(category.getTranslation()); } } } @@ -304,45 +305,24 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { }); poiNameEditText.setOnEditorActionListener(mOnEditorActionListener); poiTypeEditText.setOnEditorActionListener(mOnEditorActionListener); - poiTypeEditText.setOnTouchListener(new View.OnTouchListener() { + + AppCompatImageButton expandButton = poiTypeTextInputLayout.getEndIconImageButton(); + expandButton.setColorFilter(R.color.gpx_chart_red); + expandButton.setOnClickListener(new View.OnClickListener() { @Override - public boolean onTouch(final View v, MotionEvent event) { - Context ctx = getContext(); - if (ctx == null) { - return false; - } - boolean isLayoutRtl = AndroidUtils.isLayoutRtl(getContext()); - final EditText editText = (EditText) v; - if (event.getAction() == MotionEvent.ACTION_UP) { - final int DRAWABLE_END = 2; - int expandBtnWidth = AndroidUtils.getCompoundDrawables(editText)[DRAWABLE_END].getBounds().width(); - - boolean expandButtonPressed = false; - if (isLayoutRtl) { - expandButtonPressed = event.getX() <= (editText.getLeft() + expandBtnWidth - + editText.getPaddingLeft()); - } else { - expandButtonPressed = event.getX() >= (editText.getRight() - expandBtnWidth - - editText.getPaddingRight()); - } - - if (expandButtonPressed) { - PoiCategory category = editPoiData.getPoiCategory(); - if (category != null) { - PoiSubTypeDialogFragment dialogFragment = - PoiSubTypeDialogFragment.createInstance(category); - dialogFragment.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() { - @Override - public void select(String category) { - setSubCategory(category); - } - }); - dialogFragment.show(getChildFragmentManager(), "PoiSubTypeDialogFragment"); + public void onClick(View v) { + PoiCategory category = editPoiData.getPoiCategory(); + if (category != null) { + PoiSubTypeDialogFragment dialogFragment = + PoiSubTypeDialogFragment.createInstance(category); + dialogFragment.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() { + @Override + public void select(String category) { + setSubCategory(category); } - return true; - } + }); + dialogFragment.show(getChildFragmentManager(), "PoiSubTypeDialogFragment"); } - return false; } });