Skip to content

Commit 763398c

Browse files
authored
Merge pull request #86 from Leanplum/feature/BaseMessageDialog
refactor (BaseMessageDialog) Cleaning up a code, remove unnecessary c…
2 parents 88a7ad3 + 1139308 commit 763398c

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

AndroidSDK/src/com/leanplum/messagetemplates/BaseMessageDialog.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected BaseMessageDialog(Activity activity, boolean fullscreen, BaseMessageOp
143143
@Override
144144
public void onWindowFocusChanged(boolean hasFocus) {
145145
try {
146-
if (webView != null && Build.VERSION.SDK_INT >= 11) {
146+
if (webView != null) {
147147
if (hasFocus) {
148148
webView.onResume();
149149
} else {
@@ -250,12 +250,7 @@ private RelativeLayout createContainerView(Activity context, boolean fullscreen)
250250
// Make sure the dialog fits on screen.
251251
Display display = context.getWindowManager().getDefaultDisplay();
252252
Point size = new Point();
253-
if (Build.VERSION.SDK_INT >= 13) {
254-
display.getSize(size);
255-
} else {
256-
size = new Point(display.getHeight(), display.getHeight());
257-
}
258-
253+
display.getSize(size);
259254
int width = SizeUtil.dpToPx(context, ((CenterPopupOptions) options).getWidth());
260255
int height = SizeUtil.dpToPx(context, ((CenterPopupOptions) options).getHeight());
261256

@@ -321,6 +316,7 @@ private Shape createRoundRect(int cornerRadius) {
321316
return new RoundRectShape(outerRadii, null, null);
322317
}
323318

319+
// setBackgroundDrawable was deprecated at API 16.
324320
@SuppressWarnings("deprecation")
325321
private ImageView createBackgroundImageView(Context context, boolean fullscreen) {
326322
BackgroundImageView view = new BackgroundImageView(context, fullscreen);
@@ -457,10 +453,9 @@ public boolean onLongClick(View v) {
457453
webViewSettings.setAllowFileAccessFromFileURLs(true);
458454
webViewSettings.setAllowUniversalAccessFromFileURLs(true);
459455
}
460-
if (Build.VERSION.SDK_INT >= 11) {
461-
webViewSettings.setBuiltInZoomControls(false);
462-
webViewSettings.setDisplayZoomControls(false);
463-
}
456+
457+
webViewSettings.setBuiltInZoomControls(false);
458+
webViewSettings.setDisplayZoomControls(false);
464459
webViewSettings.setSupportZoom(false);
465460

466461
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
@@ -469,6 +464,7 @@ public boolean onLongClick(View v) {
469464
final Dialog currentDialog = this;
470465
webView.setWebChromeClient(new WebChromeClient());
471466
webView.setWebViewClient(new WebViewClient() {
467+
// shouldOverrideUrlLoading(WebView wView, String url) was deprecated at API 24.
472468
@SuppressWarnings("deprecation")
473469
@Override
474470
public boolean shouldOverrideUrlLoading(WebView wView, String url) {

0 commit comments

Comments
 (0)