1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.email; 18 19 import android.app.Application; 20 import android.content.Context; 21 import android.content.Intent; 22 23 import com.android.email.activity.setup.EmailPreferenceActivity; 24 import com.android.email.preferences.EmailPreferenceMigrator; 25 import com.android.mail.browse.ConversationMessage; 26 import com.android.mail.browse.InlineAttachmentViewIntentBuilder; 27 import com.android.mail.browse.InlineAttachmentViewIntentBuilderCreator; 28 import com.android.mail.browse.InlineAttachmentViewIntentBuilderCreatorHolder; 29 import com.android.mail.preferences.BasePreferenceMigrator; 30 import com.android.mail.preferences.PreferenceMigratorHolder; 31 import com.android.mail.preferences.PreferenceMigratorHolder.PreferenceMigratorCreator; 32 import com.android.mail.providers.Account; 33 import com.android.mail.ui.settings.PublicPreferenceActivity; 34 import com.android.mail.utils.LogTag; 35 36 public class EmailApplication extends Application { 37 private static final String LOG_TAG = "Email"; 38 39 static { 40 LogTag.setLogTag(LOG_TAG); 41 PreferenceMigratorHolder.setPreferenceMigratorCreator(new PreferenceMigratorCreator() { @Override public BasePreferenceMigrator createPreferenceMigrator() { return new EmailPreferenceMigrator(); } })42 PreferenceMigratorHolder.setPreferenceMigratorCreator(new PreferenceMigratorCreator() { 43 @Override 44 public BasePreferenceMigrator createPreferenceMigrator() { 45 return new EmailPreferenceMigrator(); 46 } 47 }); 48 InlineAttachmentViewIntentBuilderCreatorHolder.setInlineAttachmentViewIntentCreator( new InlineAttachmentViewIntentBuilderCreator() { @Override public InlineAttachmentViewIntentBuilder createInlineAttachmentViewIntentBuilder(Account account, long conversationId) { return new InlineAttachmentViewIntentBuilder() { @Override public Intent createInlineAttachmentViewIntent(Context context, String url, ConversationMessage message) { return null; } }; } })49 InlineAttachmentViewIntentBuilderCreatorHolder.setInlineAttachmentViewIntentCreator( 50 new InlineAttachmentViewIntentBuilderCreator() { 51 @Override 52 public InlineAttachmentViewIntentBuilder 53 createInlineAttachmentViewIntentBuilder(Account account, long conversationId) { 54 return new InlineAttachmentViewIntentBuilder() { 55 @Override 56 public Intent createInlineAttachmentViewIntent(Context context, 57 String url, ConversationMessage message) { 58 return null; 59 } 60 }; 61 } 62 }); 63 64 PublicPreferenceActivity.sPreferenceActivityClass = EmailPreferenceActivity.class; 65 NotificationControllerCreatorHolder.setNotificationControllerCreator( new NotificationControllerCreator() { @Override public NotificationController getInstance(Context context){ return EmailNotificationController.getInstance(context); } })66 NotificationControllerCreatorHolder.setNotificationControllerCreator( 67 new NotificationControllerCreator() { 68 @Override 69 public NotificationController getInstance(Context context){ 70 return EmailNotificationController.getInstance(context); 71 } 72 }); 73 } 74 } 75