fix landscape dialog outsides interaction bug
This commit is contained in:
Nazar 2019-09-23 11:54:21 +03:00
parent 609f4d45ae
commit 271d14612a
6 changed files with 20 additions and 15 deletions

View file

@ -6,8 +6,8 @@
<item>
<shape>
<solid android:color="@color/list_background_color_dark" />
<corners android:bottomRightRadius="4dp"
android:bottomLeftRadius="4dp" />
<corners android:bottomRightRadius="3dp"
android:bottomLeftRadius="3dp" />
</shape>
</item>
</layer-list>

View file

@ -6,8 +6,8 @@
<item>
<shape>
<solid android:color="@color/list_background_color_light" />
<corners android:bottomRightRadius="4dp"
android:bottomLeftRadius="4dp" />
<corners android:bottomRightRadius="3dp"
android:bottomLeftRadius="3dp" />
</shape>
</item>
</layer-list>

View file

@ -6,8 +6,8 @@
<item>
<shape>
<solid android:color="@color/list_background_color_dark"/>
<corners android:bottomRightRadius="4dp"
android:bottomLeftRadius="4dp" />
<corners android:bottomRightRadius="3dp"
android:bottomLeftRadius="3dp" />
</shape>
</item>
</layer-list>

View file

@ -6,8 +6,8 @@
<item>
<shape>
<solid android:color="@color/list_background_color_light"/>
<corners android:bottomRightRadius="4dp"
android:bottomLeftRadius="4dp" />
<corners android:bottomRightRadius="3dp"
android:bottomLeftRadius="3dp" />
</shape>
</item>
</layer-list>

View file

@ -17,12 +17,12 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import net.osmand.plus.R;
import static net.osmand.plus.base.SheetDialogType.*;
public class OsmandSheetDialog extends Dialog {
public final static int CONTAINER_ID = 111111;
private boolean cancelable = true;
private boolean canceledOnTouchOutside = true;
private boolean interactWithOutside = false;
@ -168,6 +168,7 @@ public class OsmandSheetDialog extends Dialog {
params.gravity = gravity;
FrameLayout container = new FrameLayout(getContext());
container.setLayoutParams(params);
container.setId(CONTAINER_ID);
return container;
}

View file

@ -23,6 +23,7 @@ import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.OsmAndSheetDialogFragment;
import net.osmand.plus.base.OsmandSheetDialog;
import net.osmand.plus.base.SheetDialogType;
import net.osmand.plus.download.DownloadValidationManager;
import net.osmand.plus.download.IndexItem;
@ -84,12 +85,15 @@ public class DownloadMapDialogFragment extends OsmAndSheetDialogFragment {
@Override
public void onStart() {
super.onStart();
final Window window = getDialog().getWindow();
FragmentActivity activity = requireActivity();
if (window != null && !AndroidUiHelper.isOrientationPortrait(activity)) {
WindowManager.LayoutParams params = window.getAttributes();
params.width = activity.getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
window.setAttributes(params);
if (!AndroidUiHelper.isOrientationPortrait(activity)) {
final Window window = getDialog().getWindow();
if (window != null) {
View container = window.findViewById(OsmandSheetDialog.CONTAINER_ID);
if (container != null) {
container.getLayoutParams().width = activity.getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
}
}
}
}