Extracted code to disable Lint warning when using newer API

This commit is contained in:
cketti 2012-07-07 15:03:23 +02:00
parent 1f2104cae1
commit a281b3401e
1 changed files with 9 additions and 10 deletions

View File

@ -1,5 +1,6 @@
package com.fsck.k9.view;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
@ -98,16 +99,7 @@ public class MessageWebView extends WebView {
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
}
/*
* Build.VERSION.SDK is deprecated cause it just returns the
* "its raw String representation"
* http://developer.android.com/reference/android/os/Build.VERSION_CODES.html#GINGERBREAD
* http://developer.android.com/reference/android/os/Build.VERSION.html#SDK
*/
if (Build.VERSION.SDK_INT >= 9) {
setOverScrollMode(OVER_SCROLL_NEVER);
}
disableOverscrolling();
webSettings.setTextSize(K9.getFontSizes().getMessageViewContent());
@ -116,6 +108,13 @@ public class MessageWebView extends WebView {
}
@TargetApi(9)
private void disableOverscrolling() {
if (Build.VERSION.SDK_INT >= 9) {
setOverScrollMode(OVER_SCROLL_NEVER);
}
}
public void setText(String text, String contentType) {
String content = text;
if (K9.getK9Theme() == K9.THEME_DARK) {