1 /*
2  * Copyright (C) 2010 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.contacts.activities;
18 
19 import com.android.contacts.R;
20 import com.android.contacts.common.activity.RequestPermissionsActivity;
21 import com.android.contacts.editor.ContactEditorFragment;
22 import com.android.contacts.util.DialogManager;
23 
24 import android.content.Intent;
25 import android.net.Uri;
26 import android.os.Bundle;
27 
28 /**
29  * Contact editor with all fields displayed.
30  */
31 public class ContactEditorActivity extends ContactEditorBaseActivity
32         implements DialogManager.DialogShowingViewActivity {
33 
34     @Override
onCreate(Bundle savedState)35     public void onCreate(Bundle savedState) {
36         super.onCreate(savedState);
37 
38         if (RequestPermissionsActivity.startPermissionActivity(this)) {
39             return;
40         }
41 
42         setContentView(R.layout.contact_editor_activity);
43 
44         mFragment = (ContactEditorFragment) getFragmentManager().findFragmentById(
45                 R.id.contact_editor_fragment);
46         mFragment.setListener(mFragmentListener);
47 
48         final String action = getIntent().getAction();
49         final Uri uri = ContactEditorBaseActivity.ACTION_EDIT.equals(action)
50                 || Intent.ACTION_EDIT.equals(action) ? getIntent().getData() : null;
51         mFragment.load(action, uri, getIntent().getExtras());
52     }
53 }
54