ForwardMessageActivity.java revision 461a34b466cb4b13dbbc2ec6330b31e217b2ac4e
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
17package com.android.messaging.ui.conversationlist;
18
19import android.app.Fragment;
20import android.os.Bundle;
21
22import com.android.messaging.datamodel.data.ConversationListData;
23import com.android.messaging.datamodel.data.ConversationListItemData;
24import com.android.messaging.datamodel.data.MessageData;
25import com.android.messaging.ui.BaseBugleActivity;
26import com.android.messaging.ui.UIIntents;
27import com.android.messaging.ui.conversationlist.ConversationListFragment.ConversationListFragmentHost;
28import 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 */
34public class ForwardMessageActivity extends BaseBugleActivity
35    implements ConversationListFragmentHost {
36    private MessageData mDraftMessage;
37
38    @Override
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
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
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
63    public void onCreateConversationClick() {
64        UIIntents.get().launchCreateNewConversationActivity(this, mDraftMessage);
65    }
66
67    @Override
68    public boolean isConversationSelected(final String conversationId) {
69        return false;
70    }
71
72    @Override
73    public boolean isSwipeAnimatable() {
74        return false;
75    }
76
77    @Override
78    public boolean isSelectionMode() {
79        return false;
80    }
81}
82