Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 18794 #20162

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
373 changes: 184 additions & 189 deletions OsmAnd/res/layout/fragment_edit_poi.xml
Original file line number Diff line number Diff line change
@@ -1,190 +1,185 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/spinnerListBackground"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
tools:context="net.osmand.plus.plugins.osmedit.dialogs.EditPoiDialogFragment">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="?attr/pstsTabBackground"
android:minHeight="@dimen/dashboard_map_toolbar"
android:theme="?attr/toolbar_theme"
app:contentInsetLeft="@dimen/divider_color_light_margin_start"
app:contentInsetStart="@dimen/divider_color_light_margin_start"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp"/>

<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical">

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/pstsTabBackground"
android:theme="?attr/appbar_layout_theme">
<!-- TODO change theme -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll">

<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:labelText="@string/shared_string_name"
app:panelBackgroundColor="@color/color_transparent"
app:colorControlHighlight="@color/color_transparent"
app:primaryColor="@color/card_and_list_background_light"
app:secondaryColor="@color/white_50_transparent"
app:useDenseSpacing="true"
android:importantForAutofill="noExcludeDescendants"
android:layout_marginLeft="@dimen/divider_color_light_margin_start"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginStart="@dimen/divider_color_light_margin_start"
android:layout_marginEnd="@dimen/content_padding">

<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/poiNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_transparent"
android:imeOptions="actionNext"
android:importantForAutofill="noExcludeDescendants"
android:inputType="textCapSentences"/>

</net.osmand.plus.widgets.OsmandTextFieldBoxes>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding_half"
app:layout_scrollFlags="scroll">
<!--android:layout_marginLeft="72dp"-->
<ImageButton
android:id="@+id/poiTypeButton"
android:contentDescription="@string/poi_dialog_poi_type"
android:layout_width="@dimen/context_menu_buttons_bottom_height"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_gravity="bottom"
android:background="@null"
app:srcCompat="@drawable/ic_action_label"/>

<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:id="@+id/poiTypeTextInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
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/card_and_list_background_light"
app:secondaryColor="@color/white_50_transparent">

<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/poiTypeEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:gravity="bottom|start"
android:imeOptions="actionSend"
android:importantForAutofill="noExcludeDescendants"
android:inputType="text"
android:paddingBottom="@dimen/text_margin_small" />

</net.osmand.plus.widgets.OsmandTextFieldBoxes>

<ImageButton
android:id="@+id/onlineDocumentationButton"
android:contentDescription="@string/shared_string_help"
android:layout_width="@dimen/context_menu_buttons_bottom_height"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_gravity="bottom"
android:background="@null"
tools:src="@drawable/ic_action_help"/>
</LinearLayout>

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
app:layout_scrollFlags="scroll"
app:tabIndicatorColor="@color/osmand_orange"
app:tabSelectedTextColor="@color/osmand_orange"
app:tabTextColor="@android:color/darker_gray"/>
</com.google.android.material.appbar.AppBarLayout>

<net.osmand.plus.plugins.osmedit.EditPoiViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>

<View
android:id="@+id/buttonDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/divider_color"/>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="end">

<net.osmand.plus.widgets.ButtonEx
android:id="@+id/deleteButton"
style="@style/DashboardGeneralButton"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_marginLeft="@dimen/showAllButtonMarginRight"
android:gravity="center"
android:text="@string/shared_string_delete"
android:visibility="gone"
app:textAllCapsCompat="true"
tools:visibility="visible"
android:layout_marginStart="@dimen/showAllButtonMarginRight" />

<Space
android:layout_width="0dp"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_weight="1"/>

<net.osmand.plus.widgets.ButtonEx
android:id="@+id/cancelButton"
style="@style/DashboardGeneralButton"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:gravity="center"
android:text="@string/shared_string_cancel"
app:textAllCapsCompat="true"/>

<net.osmand.plus.widgets.ButtonEx
android:id="@+id/saveButton"
style="@style/DashboardGeneralButton"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:gravity="center"
app:textAllCapsCompat="true"
tools:text="Save"/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/spinnerListBackground"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
tools:context="net.osmand.plus.plugins.osmedit.dialogs.EditPoiDialogFragment">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="?attr/pstsTabBackground"
android:minHeight="@dimen/dashboard_map_toolbar"
android:theme="?attr/toolbar_theme"
app:contentInsetEnd="0dp"
app:contentInsetLeft="@dimen/divider_color_light_margin_start"
app:contentInsetRight="0dp"
app:contentInsetStart="@dimen/divider_color_light_margin_start" />

<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical">

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/pstsTabBackground"
android:theme="?attr/appbar_layout_theme">
<!-- TODO change theme -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll">

<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/divider_color_light_margin_start"
android:layout_marginEnd="@dimen/content_padding"
android:importantForAutofill="noExcludeDescendants"
app:colorControlHighlight="@color/color_transparent"
app:labelText="@string/shared_string_name"
app:panelBackgroundColor="@color/color_transparent"
app:primaryColor="@color/card_and_list_background_light"
app:secondaryColor="@color/white_50_transparent"
app:useDenseSpacing="true">

<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/poiNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_transparent"
android:imeOptions="actionNext"
android:importantForAutofill="noExcludeDescendants"
android:inputType="textCapSentences" />

</net.osmand.plus.widgets.OsmandTextFieldBoxes>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding_half"
app:layout_scrollFlags="scroll">
<!--android:layout_marginLeft="72dp"-->
<ImageButton
android:id="@+id/poiTypeButton"
android:layout_width="@dimen/context_menu_buttons_bottom_height"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_gravity="bottom"
android:background="@null"
android:contentDescription="@string/poi_dialog_poi_type"
app:srcCompat="@drawable/ic_action_label" />

<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:id="@+id/poiTypeTextInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_weight="1"
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/card_and_list_background_light"
app:secondaryColor="@color/white_50_transparent">

<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/poiTypeEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:gravity="bottom|start"
android:imeOptions="actionSend"
android:importantForAutofill="noExcludeDescendants"
android:inputType="text"
android:paddingBottom="@dimen/text_margin_small" />

</net.osmand.plus.widgets.OsmandTextFieldBoxes>

<ImageButton
android:id="@+id/onlineDocumentationButton"
android:layout_width="@dimen/context_menu_buttons_bottom_height"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_gravity="bottom"
android:background="@null"
android:contentDescription="@string/shared_string_help"
tools:src="@drawable/ic_action_help" />
</LinearLayout>

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
app:layout_scrollFlags="scroll"
app:tabIndicatorColor="@color/osmand_orange"
app:tabSelectedTextColor="@color/osmand_orange"
app:tabTextColor="@android:color/darker_gray" />
</com.google.android.material.appbar.AppBarLayout>

<net.osmand.plus.plugins.osmedit.EditPoiViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

</androidx.core.widget.NestedScrollView>

<View
android:id="@+id/buttonDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/divider_color" />

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="end">

<net.osmand.plus.widgets.ButtonEx
android:id="@+id/deleteButton"
style="@style/DashboardGeneralButton"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_marginStart="@dimen/showAllButtonMarginRight"
android:gravity="center"
android:text="@string/shared_string_delete"
android:visibility="gone"
app:textAllCapsCompat="true"
tools:visibility="visible" />

<Space
android:layout_width="0dp"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_weight="1" />

<net.osmand.plus.widgets.ButtonEx
android:id="@+id/cancelButton"
style="@style/DashboardGeneralButton"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:gravity="center"
android:text="@string/shared_string_cancel"
app:textAllCapsCompat="true" />

<net.osmand.plus.widgets.ButtonEx
android:id="@+id/saveButton"
style="@style/DashboardGeneralButton"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:gravity="center"
app:textAllCapsCompat="true"
tools:text="Save" />
</LinearLayout>
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.ViewCompat;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
Expand Down Expand Up @@ -544,7 +545,7 @@ public void setSubCategory(String subCategory) {
}

public void smoothScrollToBottom() {
ScrollView scrollView = view.findViewById(R.id.scroll_view);
NestedScrollView scrollView = view.findViewById(R.id.nested_scroll);
int height = scrollView.getHeight();
int bottom = scrollView.getChildAt(0).getBottom();
int maxScrollY = Math.max(0, bottom - height);
Expand Down
Loading