Merge "Add "Clear WebView cache" button to debug preference"
This commit is contained in:
commit
966fd5ea0b
@ -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"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/debug_version_fmt"
|
||||
/>
|
||||
android:id="@+id/version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/debug_version_fmt"
|
||||
/>
|
||||
<CheckBox
|
||||
android:id="@+id/debug_logging"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/debug_enable_debug_logging_label"
|
||||
/>
|
||||
android:id="@+id/debug_logging"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/debug_enable_debug_logging_label"
|
||||
/>
|
||||
<!-- EXCHANGE-REMOVE-SECTION-START -->
|
||||
<CheckBox
|
||||
android:id="@+id/exchange_logging"
|
||||
@ -45,4 +45,10 @@
|
||||
android:text="@string/debug_enable_exchange_file_logging_label"
|
||||
/>
|
||||
<!-- EXCHANGE-REMOVE-SECTION-END -->
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/clear_webview_cache"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/debug_clear_webview_cache"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
@ -236,6 +236,8 @@
|
||||
<string name="debug_enable_exchange_logging_label" translatable="false">Enable exchange parser logging? (Extremely verbose)</string>
|
||||
<!-- Do Not Translate. Checkbox label, shown only on debug screen -->
|
||||
<string name="debug_enable_exchange_file_logging_label" translatable="false">Enable exchange sd card logging?</string>
|
||||
<!-- Do Not Translate. Button label, shown only on debug screen -->
|
||||
<string name="debug_clear_webview_cache" translatable="false">Clear WebView cache</string>
|
||||
|
||||
<!-- The text in the small separator between smart folders and the accounts -->
|
||||
<string name="account_folder_list_separator_accounts">Accounts</string>
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user