1 /* 2 * Copyright (C) 2015 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.messaging.ui.conversationlist; 18 19 import android.app.Fragment; 20 import android.os.Bundle; 21 22 import com.android.messaging.datamodel.data.ConversationListData; 23 import com.android.messaging.datamodel.data.ConversationListItemData; 24 import com.android.messaging.datamodel.data.MessageData; 25 import com.android.messaging.ui.BaseBugleActivity; 26 import com.android.messaging.ui.UIIntents; 27 import com.android.messaging.ui.conversationlist.ConversationListFragment.ConversationListFragmentHost; 28 import com.android.messaging.util.Assert; 29 30 /** 31 * An activity that lets the user forward a SMS/MMS message by picking from a conversation in the 32 * conversation list. 33 */ 34 public class ForwardMessageActivity extends BaseBugleActivity 35 implements ConversationListFragmentHost { 36 private MessageData mDraftMessage; 37 38 @Override onCreate(final Bundle savedInstanceState)39 protected void onCreate(final Bundle savedInstanceState) { 40 super.onCreate(savedInstanceState); 41 final ConversationListFragment fragment = 42 ConversationListFragment.createForwardMessageConversationListFragment(); 43 getFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit(); 44 mDraftMessage = getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_DRAFT_DATA); 45 } 46 47 @Override onAttachFragment(final Fragment fragment)48 public void onAttachFragment(final Fragment fragment) { 49 Assert.isTrue(fragment instanceof ConversationListFragment); 50 final ConversationListFragment clf = (ConversationListFragment) fragment; 51 clf.setHost(this); 52 } 53 54 @Override onConversationClick(final ConversationListData listData, final ConversationListItemData conversationListItemData, final boolean isLongClick, final ConversationListItemView converastionView)55 public void onConversationClick(final ConversationListData listData, 56 final ConversationListItemData conversationListItemData, 57 final boolean isLongClick, final ConversationListItemView converastionView) { 58 UIIntents.get().launchConversationActivity( 59 this, conversationListItemData.getConversationId(), mDraftMessage); 60 } 61 62 @Override onCreateConversationClick()63 public void onCreateConversationClick() { 64 UIIntents.get().launchCreateNewConversationActivity(this, mDraftMessage); 65 } 66 67 @Override isConversationSelected(final String conversationId)68 public boolean isConversationSelected(final String conversationId) { 69 return false; 70 } 71 72 @Override isSwipeAnimatable()73 public boolean isSwipeAnimatable() { 74 return false; 75 } 76 77 @Override isSelectionMode()78 public boolean isSelectionMode() { 79 return false; 80 } 81 } 82