1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Move AOSP files.

Patch RigidWebView for K9.
MessageWebView would need to extend RigidWebView.
This commit is contained in:
Joe Steele 2013-03-23 22:41:40 -04:00
parent 97d571cb43
commit fa962e7bd7
5 changed files with 27 additions and 14 deletions

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.email; package com.fsck.k9;
/** /**
* A class provide the current time (like {@link System#currentTimeMillis()}). * A class provide the current time (like {@link System#currentTimeMillis()}).

View File

@ -14,9 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.email; package com.fsck.k9;
import com.android.emailcommon.Logging;
import android.os.Handler; import android.os.Handler;
import android.util.Log; import android.util.Log;
@ -96,7 +94,7 @@ public class Throttle {
} }
private void debugLog(String message) { private void debugLog(String message) {
Log.d(Logging.LOG_TAG, "Throttle: [" + mName + "] " + message); Log.d(K9.LOG_TAG, "Throttle: [" + mName + "] " + message);
} }
private boolean isCallbackScheduled() { private boolean isCallbackScheduled() {

View File

@ -8,6 +8,8 @@ import android.database.Cursor;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.Build; import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.Editable; import android.text.Editable;
import android.util.Log; import android.util.Log;
import android.widget.EditText; import android.widget.EditText;
@ -65,6 +67,8 @@ public class Utility {
private static final Pattern TAG_PATTERN = Pattern.compile("\\[[-_a-z0-9]+\\] ", private static final Pattern TAG_PATTERN = Pattern.compile("\\[[-_a-z0-9]+\\] ",
Pattern.CASE_INSENSITIVE); Pattern.CASE_INSENSITIVE);
private static Handler sMainThreadHandler;
public static boolean arrayContains(Object[] a, Object o) { public static boolean arrayContains(Object[] a, Object o) {
for (Object element : a) { for (Object element : a) {
if (element.equals(o)) { if (element.equals(o)) {
@ -714,4 +718,16 @@ public class Utility {
return newArray; return newArray;
} }
/**
* @return a {@link Handler} tied to the main thread.
*/
public static Handler getMainThreadHandler() {
if (sMainThreadHandler == null) {
// No need to synchronize -- it's okay to create an extra Handler, which will be used
// only once and then thrown away.
sMainThreadHandler = new Handler(Looper.getMainLooper());
}
return sMainThreadHandler;
}
} }

View File

@ -17,7 +17,7 @@ import com.fsck.k9.helper.HtmlConverter;
import java.lang.reflect.Method; import java.lang.reflect.Method;
public class MessageWebView extends WebView { public class MessageWebView extends RigidWebView {
/** /**

View File

@ -15,18 +15,17 @@
*/ */
package com.android.email.view; package com.fsck.k9.view;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.webkit.WebView; import android.webkit.WebView;
import com.android.email.Clock; import com.fsck.k9.Clock;
import com.android.email.Email; import com.fsck.k9.K9;
import com.android.email.Throttle; import com.fsck.k9.Throttle;
import com.android.emailcommon.Logging; import com.fsck.k9.helper.Utility;
import com.android.emailcommon.utility.Utility;
/** /**
* A custom WebView that is robust to rapid resize events in sequence. * A custom WebView that is robust to rapid resize events in sequence.
@ -75,8 +74,8 @@ public class RigidWebView extends WebView {
if (mIgnoreNext) { if (mIgnoreNext) {
mIgnoreNext = false; mIgnoreNext = false;
if (recentlySized) { if (recentlySized) {
if (Email.DEBUG) { if (K9.DEBUG) {
Log.w(Logging.LOG_TAG, "Supressing size change in RigidWebView"); Log.w(K9.LOG_TAG, "Supressing size change in RigidWebView");
} }
return; return;
} }