From dd35175ae4f8fb2604bb1cc9a5ce42ab01e64f6a Mon Sep 17 00:00:00 2001 From: veliymolfar Date: Tue, 25 Feb 2020 12:48:20 +0200 Subject: [PATCH] refactor import layout --- OsmAnd/res/layout/fragment_import.xml | 47 ++++--------------- .../layout/list_item_description_header.xml | 23 +++++++++ .../plus/settings/ImportSettingsFragment.java | 6 +++ .../osmand/view/NonScrollExpandableList.java | 29 ------------ 4 files changed, 39 insertions(+), 66 deletions(-) create mode 100644 OsmAnd/res/layout/list_item_description_header.xml delete mode 100644 OsmAnd/src/net/osmand/view/NonScrollExpandableList.java diff --git a/OsmAnd/res/layout/fragment_import.xml b/OsmAnd/res/layout/fragment_import.xml index 3ba99b4c59..589812ac28 100644 --- a/OsmAnd/res/layout/fragment_import.xml +++ b/OsmAnd/res/layout/fragment_import.xml @@ -6,45 +6,18 @@ android:layout_height="match_parent" android:background="?attr/activity_background_basic"> - - - - - - - - - - - - - + android:divider="@null" + android:dividerHeight="0dp" + android:drawSelectorOnTop="false" + android:focusable="false" + android:groupIndicator="@android:color/transparent" + android:listSelector="@android:color/transparent" + android:paddingBottom="@dimen/dialog_button_ex_height" + osmand:layout_behavior="@string/appbar_scrolling_view_behavior" /> + + + + + + + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/ImportSettingsFragment.java index 8ac947250e..0766ea2601 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ImportSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ImportSettingsFragment.java @@ -15,6 +15,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ExpandableListView; +import android.widget.TextView; import net.osmand.AndroidUtils; import net.osmand.map.ITileSource; @@ -81,6 +82,11 @@ public class ImportSettingsFragment extends BaseOsmAndFragment TextViewEx continueBtn = root.findViewById(R.id.continue_button); selectBtn = root.findViewById(R.id.select_button); expandableList = root.findViewById(R.id.list); + ViewCompat.setNestedScrollingEnabled(expandableList, true); + View header = inflater.inflate(R.layout.list_item_description_header, container, false); + TextView description = header.findViewById(R.id.description); + description.setText(R.string.select_data_to_import); + expandableList.addHeaderView(header); continueBtn.setOnClickListener(this); selectBtn.setOnClickListener(this); if (Build.VERSION.SDK_INT >= 21) { diff --git a/OsmAnd/src/net/osmand/view/NonScrollExpandableList.java b/OsmAnd/src/net/osmand/view/NonScrollExpandableList.java deleted file mode 100644 index 64e199b972..0000000000 --- a/OsmAnd/src/net/osmand/view/NonScrollExpandableList.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.osmand.view; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.ViewGroup; -import android.widget.ExpandableListView; - -public class NonScrollExpandableList extends ExpandableListView { - public NonScrollExpandableList(Context context) { - super(context); - } - - public NonScrollExpandableList(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public NonScrollExpandableList(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - @Override - public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( - Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); - super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); - ViewGroup.LayoutParams params = getLayoutParams(); - params.height = getMeasuredHeight(); - } -}