Remove dead code

Also, remove code that would crash when deciding not
to run the dead code

(If the fragment is detached before the animation finishes)

Bug: 8759728
Change-Id: I6b8ce3b03077ff779e4f0e7d0b7c19e13a79bff2
diff --git a/res/values/constants.xml b/res/values/constants.xml
index 84bfa4f..3eca8f0 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -98,9 +98,6 @@
     <!-- Whether or not to use a nice transition when showing the folder list fragment; used in 2-pane layouts -->
     <integer name="use_folder_list_fragment_transition">1</integer>
 
-    <!-- Whether or not to prompt the user to enable auto-fit the first time they encounter a wide message. TODO: Remove this when the email setting is added. -->
-    <integer name="prompt_auto_fit_on_first_wide_message">0</integer>
-
     <!-- The timeout, in milliseconds, before the "Undo" notification is removed. -->
     <integer name="undo_notification_timeout">6000</integer>
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0759db9..87a10af 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -800,11 +800,6 @@
     <!-- Dialog title for the What's New dialog. [CHAR LIMIT=50] -->
     <string name="whats_new_dialog_title">What\'s new</string>
 
-    <!-- Dialog title for the Auto-fit messages dialog. [CHAR LIMIT=50] -->
-    <string name="auto_fit_messages_dialog_title">Auto-fit messages?</string>
-    <!-- Dialog message for the Auto-fit messages dialog. -->
-    <string name="auto_fit_messages_dialog_message">Shrink wide messages to fit your screen and allow zooming in. To turn off this option, go to Settings > General\u00A0settings.</string>
-
     <!-- Notification action for replying to a message. [CHAR LIMIT=20] -->
     <string name="notification_action_reply">Reply</string>
     <!-- Notification action for replying-all to a message. [CHAR LIMIT=20] -->
diff --git a/src/com/android/mail/ui/AbstractConversationViewFragment.java b/src/com/android/mail/ui/AbstractConversationViewFragment.java
index 61d54d0..bb7c8cc 100644
--- a/src/com/android/mail/ui/AbstractConversationViewFragment.java
+++ b/src/com/android/mail/ui/AbstractConversationViewFragment.java
@@ -598,8 +598,6 @@
             }
         }
         activity.getListHandler().onConversationSeen(mConversation);
-
-        showAutoFitPrompt();
     }
 
     protected ConversationViewState getNewViewState() {
@@ -792,33 +790,6 @@
 
     }
 
-    private static boolean isConversationViewModeSet(final Account acct) {
-        return acct.settings.conversationViewMode != UIProvider.ConversationViewMode.UNDEFINED;
-    }
-
-    private void showAutoFitPrompt() {
-        // If the user has never set a conversation view mode, and they view a wide message, we
-        // should prompt them to turn on auto-fit
-        final boolean enablePrompt =
-                getResources().getInteger(R.integer.prompt_auto_fit_on_first_wide_message) == 1;
-        // TODO: Enable this dialog for Email and ensure it saves the setting properly, and remove
-        // R.integer.prompt_auto_fit_on_first_wide_message
-        if (enablePrompt && isUserVisible() && !isConversationViewModeSet(mAccount)) {
-            final boolean isWideContent =
-                    getWebView().canScrollHorizontally(1) || getWebView().canScrollHorizontally(-1);
-
-            final boolean dialogShowing =
-                    getFragmentManager().findFragmentByTag(AutoFitPromptDialogFragment.FRAGMENT_TAG)
-                    != null;
-
-            if (isWideContent && !dialogShowing) {
-                // Not everything fits, so let's prompt them to set an auto-fit value
-                AutoFitPromptDialogFragment.newInstance(mAccount.updateSettingsUri)
-                        .show(getFragmentManager(), AutoFitPromptDialogFragment.FRAGMENT_TAG);
-            }
-        }
-    }
-
     public void onDetachedModeEntered() {
         // If we have no messages, then we have nothing to display, so leave this view.
         // Otherwise, just set the detached flag.
diff --git a/src/com/android/mail/ui/AutoFitPromptDialogFragment.java b/src/com/android/mail/ui/AutoFitPromptDialogFragment.java
deleted file mode 100644
index a7cc433..0000000
--- a/src/com/android/mail/ui/AutoFitPromptDialogFragment.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc.
- * Licensed to The Android Open Source Project.
- *
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mail.ui;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.net.Uri;
-import android.os.Bundle;
-
-import com.android.mail.R;
-import com.android.mail.providers.UIProvider;
-import com.android.mail.providers.UIProvider.AccountColumns;
-
-public class AutoFitPromptDialogFragment extends DialogFragment {
-    public static final String FRAGMENT_TAG = "AutoFitPromptDialogFragment";
-
-    private static final String ARG_UPDATE_SETTINGS_URI = "updateSettingsUri";
-
-    public static AutoFitPromptDialogFragment newInstance(final Uri updateSettingsUri) {
-        final AutoFitPromptDialogFragment fragment = new AutoFitPromptDialogFragment();
-
-        final Bundle args = new Bundle(1);
-        args.putParcelable(ARG_UPDATE_SETTINGS_URI, updateSettingsUri);
-        fragment.setArguments(args);
-
-        return fragment;
-    }
-
-    @Override
-    public Dialog onCreateDialog(final Bundle savedInstanceState) {
-        return new AlertDialog.Builder(getActivity()).setTitle(
-                R.string.auto_fit_messages_dialog_title)
-                .setMessage(R.string.auto_fit_messages_dialog_message)
-                .setPositiveButton(R.string.yes, new OnClickListener() {
-                    @Override
-                    public void onClick(final DialogInterface dialog, final int which) {
-                        // Change the setting to enable auto-fit
-                        saveAutoFitSetting(UIProvider.ConversationViewMode.OVERVIEW);
-                    }
-                })
-                .setNegativeButton(R.string.no, new OnClickListener() {
-                    @Override
-                    public void onClick(final DialogInterface dialog, final int which) {
-                        // Change the setting to disable auto-fit
-                        saveAutoFitSetting(UIProvider.ConversationViewMode.READING);
-                    }
-                })
-                .create();
-    }
-
-    @Override
-    public void onCancel(final DialogInterface dialog) {
-        super.onCancel(dialog);
-
-        // Change the setting to disable auto-fit
-        saveAutoFitSetting(UIProvider.ConversationViewMode.READING);
-    }
-
-    private void saveAutoFitSetting(final int conversationViewMode) {
-        final Context context = getActivity();
-
-        if (context == null) {
-            return;
-        }
-
-        final ContentValues values = new ContentValues(1);
-        values.put(AccountColumns.SettingsColumns.CONVERSATION_VIEW_MODE, conversationViewMode);
-
-        final ContentResolver resolver = context.getContentResolver();
-        resolver.update(
-                (Uri) getArguments().getParcelable(ARG_UPDATE_SETTINGS_URI), values, null, null);
-    }
-}