drawer over fragment fix / fix list padding on import complete screen

This commit is contained in:
veliymolfar 2020-03-13 18:33:12 +02:00
parent f4c70db617
commit 5580a4fcda
3 changed files with 34 additions and 0 deletions

View file

@ -56,6 +56,7 @@
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:id="@+id/button_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
@ -100,6 +101,9 @@
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height_expanded"
android:background="?attr/colorPrimary"
osmand:expandedTitleMarginBottom="@dimen/content_padding_small"
osmand:expandedTitleMarginEnd="@dimen/content_padding"
osmand:expandedTitleMarginStart="@dimen/content_padding"
osmand:collapsedTitleTextAppearance="@style/AppBarTitle"
osmand:expandedTitleGravity="start|bottom"
osmand:expandedTitleTextAppearance="@style/AppBarTitle"
@ -110,6 +114,8 @@
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:minHeight="@dimen/toolbar_height"
osmand:titleMarginEnd="0dp"
osmand:titleMarginStart="0dp"
osmand:layout_collapseMode="pin"
osmand:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed"
osmand:title="@string/shared_string_import_complete"/>

View file

@ -8,6 +8,8 @@ import android.text.style.StyleSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -71,6 +73,7 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
View root = inflater.inflate(R.layout.fragment_import_complete, container, false);
TextView description = root.findViewById(R.id.description);
TextView btnClose = root.findViewById(R.id.button_close);
final LinearLayout buttonContainer = root.findViewById(R.id.button_container);
recyclerView = root.findViewById(R.id.list);
description.setText(UiUtilities.createSpannableString(
String.format(getString(R.string.import_complete_description), fileName),
@ -86,6 +89,20 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
if (Build.VERSION.SDK_INT >= 21) {
AndroidUtils.addStatusBarPadding21v(app, root);
}
ViewTreeObserver treeObserver = buttonContainer.getViewTreeObserver();
treeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
ViewTreeObserver vts = buttonContainer.getViewTreeObserver();
int height = buttonContainer.getMeasuredHeight();
recyclerView.setPadding(0, 0, 0, height);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
vts.removeOnGlobalLayoutListener(this);
} else {
vts.removeGlobalOnLayoutListener(this);
}
}
});
return root;
}

View file

@ -1,5 +1,6 @@
package net.osmand.plus.settings;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Typeface;
@ -37,6 +38,7 @@ import net.osmand.plus.SQLiteTileSource;
import net.osmand.plus.SettingsHelper;
import net.osmand.plus.SettingsHelper.*;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.poi.PoiUIFilter;
@ -184,6 +186,15 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
outState.putLong(DUPLICATES_START_TIME_KEY, duplicateStartTime);
}
@Override
public void onResume() {
super.onResume();
Activity activity = getActivity();
if (activity instanceof MapActivity) {
((MapActivity) activity).disableDrawer();
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {