Prevent SDK Updater progress dialog from showing off screen.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.sdkuilib.internal.tasks;
|
||||
|
||||
import com.android.sdklib.SdkConstants;
|
||||
import com.android.sdklib.internal.repository.ITaskMonitor;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
@@ -46,6 +47,12 @@ import org.eclipse.swt.events.ShellEvent;
|
||||
*/
|
||||
final class ProgressDialog extends Dialog {
|
||||
|
||||
/**
|
||||
* Min Y location for dialog. Need to deal with the menu bar on mac os.
|
||||
*/
|
||||
private final static int MIN_Y = SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN ?
|
||||
20 : 0;
|
||||
|
||||
private static enum CancelMode {
|
||||
/** Cancel button says "Cancel" and is enabled. Waiting for user to cancel. */
|
||||
ACTIVE,
|
||||
@@ -388,7 +395,13 @@ final class ProgressDialog extends Dialog {
|
||||
int cw = childSize.x;
|
||||
int ch = childSize.y;
|
||||
|
||||
child.setLocation(px + (pw - cw) / 2, py + (ph - ch) / 2);
|
||||
int x = px + (pw - cw) / 2;
|
||||
if (x < 0) x = 0;
|
||||
|
||||
int y = py + (ph - ch) / 2;
|
||||
if (y < MIN_Y) y = MIN_Y;
|
||||
|
||||
child.setLocation(x, y);
|
||||
child.setSize(cw, ch);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user