diff --git a/res/layout/debug.xml b/res/layout/debug.xml
index af67b2634..471438275 100644
--- a/res/layout/debug.xml
+++ b/res/layout/debug.xml
@@ -4,9 +4,9 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,17 +20,17 @@
android:layout_height="wrap_content"
>
+ android:id="@+id/version"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/debug_version_fmt"
+ />
+ android:id="@+id/debug_logging"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/debug_enable_debug_logging_label"
+ />
-
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 79a33418b..a2c5814d9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -236,6 +236,8 @@
Enable exchange parser logging? (Extremely verbose)
Enable exchange sd card logging?
+
+ Clear WebView cache
Accounts
diff --git a/src/com/android/email/activity/setup/DebugFragment.java b/src/com/android/email/activity/setup/DebugFragment.java
index db8c4c24c..219cf79a1 100644
--- a/src/com/android/email/activity/setup/DebugFragment.java
+++ b/src/com/android/email/activity/setup/DebugFragment.java
@@ -29,12 +29,14 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.webkit.WebView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener;
-public class DebugFragment extends Fragment implements OnCheckedChangeListener {
+public class DebugFragment extends Fragment implements OnCheckedChangeListener,
+ View.OnClickListener {
private TextView mVersionView;
private CheckBox mEnableDebugLoggingView;
private CheckBox mEnableExchangeLoggingView;
@@ -74,9 +76,12 @@ public class DebugFragment extends Fragment implements OnCheckedChangeListener {
mEnableExchangeFileLoggingView.setOnCheckedChangeListener(this);
//EXCHANGE-REMOVE-SECTION-END
+ view.findViewById(R.id.clear_webview_cache).setOnClickListener(this);
+
return view;
}
+ @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
switch (buttonView.getId()) {
case R.id.debug_logging:
@@ -98,4 +103,23 @@ public class DebugFragment extends Fragment implements OnCheckedChangeListener {
Email.updateLoggingFlags(getActivity());
}
+
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.clear_webview_cache:
+ clearWebViewCache();
+ break;
+ }
+ }
+
+ private void clearWebViewCache() {
+ WebView webview = new WebView(getActivity());
+ try {
+ webview.clearCache(true);
+ Log.w(Email.LOG_TAG, "Cleard WebView cache.");
+ } finally {
+ webview.destroy();
+ }
+ }
}