refactor import layout
This commit is contained in:
parent
38919196f0
commit
dd35175ae4
4 changed files with 39 additions and 66 deletions
|
@ -6,45 +6,18 @@
|
|||
android:layout_height="match_parent"
|
||||
android:background="?attr/activity_background_basic">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
<ExpandableListView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
osmand:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/list_header_settings_top_margin"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/list_header_settings_top_margin"
|
||||
android:text="@string/select_data_to_import"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size" />
|
||||
|
||||
<include layout="@layout/card_bottom_divider" />
|
||||
|
||||
<net.osmand.view.NonScrollExpandableList
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
android:drawSelectorOnTop="false"
|
||||
android:groupIndicator="@android:color/transparent"
|
||||
android:listSelector="@android:color/transparent"
|
||||
android:paddingBottom="@dimen/dialog_button_ex_height" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
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" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttons_container"
|
||||
|
|
23
OsmAnd/res/layout/list_item_description_header.xml
Normal file
23
OsmAnd/res/layout/list_item_description_header.xml
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/list_header_settings_top_margin"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/list_header_settings_top_margin"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="@string/select_data_to_import" />
|
||||
|
||||
<include layout="@layout/card_bottom_divider" />
|
||||
|
||||
</LinearLayout>
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue