Fix empty space on bottom map screen
This commit is contained in:
parent
c6ba5159b7
commit
594ed86b60
3 changed files with 24 additions and 44 deletions
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
@ -37,6 +38,7 @@ import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewStub;
|
import android.view.ViewStub;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
@ -373,14 +375,32 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
mIsDestroyed = false;
|
mIsDestroyed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exitFromFullScreen() {
|
public void exitFromFullScreen(View view) {
|
||||||
|
runLayoutListener(view);
|
||||||
AndroidUtils.exitFromFullScreen(this);
|
AndroidUtils.exitFromFullScreen(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enterToFullScreen() {
|
public void enterToFullScreen() {
|
||||||
|
runLayoutListener(getLayout());
|
||||||
AndroidUtils.enterToFullScreen(this);
|
AndroidUtils.enterToFullScreen(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void runLayoutListener(final View view) {
|
||||||
|
if (view != null) {
|
||||||
|
ViewTreeObserver vto = view.getViewTreeObserver();
|
||||||
|
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
ViewTreeObserver obs = view.getViewTreeObserver();
|
||||||
|
obs.removeOnGlobalLayoutListener(this);
|
||||||
|
view.requestLayout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
if (removeFragment(PlanRouteFragment.TAG)) {
|
if (removeFragment(PlanRouteFragment.TAG)) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.osmand.plus.base;
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -14,13 +13,12 @@ import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewTreeObserver;
|
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import net.osmand.plus.UiUtilities;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
||||||
|
@ -47,25 +45,7 @@ public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
|
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
|
||||||
View view = getView();
|
((MapActivity) activity).exitFromFullScreen(getView());
|
||||||
if (view != null) {
|
|
||||||
ViewTreeObserver vto = view.getViewTreeObserver();
|
|
||||||
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
|
||||||
@Override
|
|
||||||
public void onGlobalLayout() {
|
|
||||||
|
|
||||||
View view = getView();
|
|
||||||
if (view != null) {
|
|
||||||
ViewTreeObserver obs = view.getViewTreeObserver();
|
|
||||||
obs.removeOnGlobalLayoutListener(this);
|
|
||||||
view.requestLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
((MapActivity) activity).exitFromFullScreen();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.settings;
|
package net.osmand.plus.settings;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
@ -36,7 +35,6 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.view.ViewTreeObserver;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -231,25 +229,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (activity instanceof MapActivity) {
|
if (activity instanceof MapActivity) {
|
||||||
View view = getView();
|
((MapActivity) activity).exitFromFullScreen(getView());
|
||||||
if (view != null) {
|
|
||||||
ViewTreeObserver vto = view.getViewTreeObserver();
|
|
||||||
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
|
||||||
@Override
|
|
||||||
public void onGlobalLayout() {
|
|
||||||
|
|
||||||
View view = getView();
|
|
||||||
if (view != null) {
|
|
||||||
ViewTreeObserver obs = view.getViewTreeObserver();
|
|
||||||
obs.removeOnGlobalLayoutListener(this);
|
|
||||||
view.requestLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
((MapActivity) activity).exitFromFullScreen();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue