diff --git a/OsmAnd/res/layout/fragment_import.xml b/OsmAnd/res/layout/fragment_import.xml index b9e45abd12..6648553e18 100644 --- a/OsmAnd/res/layout/fragment_import.xml +++ b/OsmAnd/res/layout/fragment_import.xml @@ -1,135 +1,157 @@ - + android:background="?attr/activity_background_basic"> - + android:layout_height="match_parent" + osmand:layout_behavior="@string/appbar_scrolling_view_behavior"> - - - + android:orientation="vertical"> - + - + - + - + - + + android:orientation="vertical"> - + + + android:orientation="horizontal" + android:paddingLeft="@dimen/content_padding" + android:paddingTop="@dimen/content_padding_small" + android:paddingRight="@dimen/content_padding" + android:paddingBottom="@dimen/content_padding_small"> - + android:layout_weight="1"> - + - + - + - + android:layout_weight="1" + android:background="?attr/dlg_btn_primary"> - + + + + + - \ No newline at end of file + + + + + + + + + + + + + diff --git a/OsmAnd/res/layout/fragment_import_duplicates.xml b/OsmAnd/res/layout/fragment_import_duplicates.xml index 4d2561bd1f..a14a7c0cbb 100644 --- a/OsmAnd/res/layout/fragment_import_duplicates.xml +++ b/OsmAnd/res/layout/fragment_import_duplicates.xml @@ -1,105 +1,132 @@ - + android:background="?attr/activity_background_basic"> + + + + + + + + + + + + + + - + - + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="@dimen/content_padding"> + + + + + + + + + + + + + + + + - + android:background="?attr/actionModeBackground"> - - - - - - - - - + android:layout_height="@dimen/toolbar_height_expanded" + osmand:collapsedTitleTextAppearance="@style/AppBarTitle" + osmand:expandedTitleGravity="start|bottom" + osmand:expandedTitleTextAppearance="@style/AppBarTitle" + osmand:layout_scrollFlags="scroll|exitUntilCollapsed"> - + android:layout_height="@dimen/toolbar_height" + android:minHeight="@dimen/toolbar_height" + osmand:layout_collapseMode="pin" + osmand:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed" + osmand:title="@string/shared_string_import"> - + - + - + - - - - - \ No newline at end of file + diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 6e72c38b4d..fcd589b5d8 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -319,6 +319,7 @@ 56dp 56dp + 112dp 36dp 80dp diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml index 2450784402..4e221e33f8 100644 --- a/OsmAnd/res/values/styles.xml +++ b/OsmAnd/res/values/styles.xml @@ -749,4 +749,9 @@ ?attr/app_bar_primary_item_color + + diff --git a/OsmAnd/src/net/osmand/plus/settings/ImportDuplicatesFragment.java b/OsmAnd/src/net/osmand/plus/settings/ImportDuplicatesFragment.java index 81d1492432..a865b701bd 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ImportDuplicatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ImportDuplicatesFragment.java @@ -1,16 +1,20 @@ package net.osmand.plus.settings; import android.app.Dialog; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.FragmentManager; +import android.support.v4.widget.NestedScrollView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.widget.LinearLayout; import net.osmand.map.ITileSource; import net.osmand.plus.AppInitializer; @@ -38,9 +42,10 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement public static final String TAG = ImportSettingsFragment.class.getSimpleName(); private OsmandApplication app; private RecyclerView list; + private LinearLayout buttonsContainer; + private NestedScrollView nestedScroll; private List duplicatesList; private List settingsItems; - private DuplicatesSettingsAdapter adapter; private File file; private boolean nightMode; @@ -82,6 +87,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement setupToolbar((Toolbar) root.findViewById(R.id.toolbar)); ComplexButton replaceAllBtn = root.findViewById(R.id.replace_all_btn); ComplexButton keepBothBtn = root.findViewById(R.id.keep_both_btn); + buttonsContainer = root.findViewById(R.id.buttons_container); + nestedScroll = root.findViewById(R.id.nested_scroll); keepBothBtn.setIcon(getPaintedContentIcon(R.drawable.ic_action_keep_both, nightMode ? getResources().getColor(R.color.icon_color_active_dark) @@ -95,6 +102,22 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement keepBothBtn.setOnClickListener(this); replaceAllBtn.setOnClickListener(this); list = root.findViewById(R.id.list); + ViewTreeObserver treeObserver = buttonsContainer.getViewTreeObserver(); + treeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + if (buttonsContainer != null) { + ViewTreeObserver vts = buttonsContainer.getViewTreeObserver(); + int height = buttonsContainer.getMeasuredHeight(); + nestedScroll.setPadding(0, 0, 0, height); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + vts.removeOnGlobalLayoutListener(this); + } else { + vts.removeGlobalOnLayoutListener(this); + } + } + } + }); return root; } @@ -117,7 +140,7 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - adapter = new DuplicatesSettingsAdapter(getMyApplication(), prepareDuplicates(), nightMode); + DuplicatesSettingsAdapter adapter = new DuplicatesSettingsAdapter(getMyApplication(), prepareDuplicates(), nightMode); list.setLayoutManager(new LinearLayoutManager(getMyApplication())); list.setAdapter(adapter); } @@ -236,6 +259,7 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement dismiss(); } }); + toolbar.setTitle(getString(R.string.import_duplicates_title)); } public void setDuplicatesList(List duplicatesList) { diff --git a/OsmAnd/src/net/osmand/view/NonScrollExpandableList.java b/OsmAnd/src/net/osmand/view/NonScrollExpandableList.java new file mode 100644 index 0000000000..64e199b972 --- /dev/null +++ b/OsmAnd/src/net/osmand/view/NonScrollExpandableList.java @@ -0,0 +1,29 @@ +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(); + } +}