Changed fragments so that they can be used in Xml. Made demo 2-pane activity working
Bug: 2579760
Change-Id: I1d499643efd5911aa1387bfdd97b7b973c4a929a
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 05797f3..0eb5809 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -384,6 +384,19 @@
</intent-filter>
</activity>
+ <!-- Shows the List and Details in two panes. This is probably temporary -->
+ <activity android:name=".activities.TwoPaneActivity"
+ android:label="Contacts Goop"
+ android:theme="@style/TallTitleBarTheme">
+
+ <intent-filter android:label="Contacts Goop">
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ </intent-filter>
+ </activity>
+
<!-- Edit or insert details for a contact -->
<activity
android:name=".ui.EditContactActivity"
diff --git a/res/layout/contact_detail_activity.xml b/res/layout/contact_detail_activity.xml
new file mode 100644
index 0000000..9b63fec
--- /dev/null
+++ b/res/layout/contact_detail_activity.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <fragment android:name="com.android.contacts.views.detail.ContactDetailFragment"
+ android:id="@+id/contact_detail_fragment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+</LinearLayout>
diff --git a/res/layout/contact_edit_activity.xml b/res/layout/contact_edit_activity.xml
new file mode 100644
index 0000000..d01d031
--- /dev/null
+++ b/res/layout/contact_edit_activity.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <fragment android:name="com.android.contacts.views.edit.ContactEditFragment"
+ android:id="@+id/contact_edit_fragment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+</LinearLayout>
diff --git a/res/layout/two_pane_activity.xml b/res/layout/two_pane_activity.xml
new file mode 100644
index 0000000..a352ec3
--- /dev/null
+++ b/res/layout/two_pane_activity.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/two_pane_activity"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <fragment android:name="com.android.contacts.list.DefaultContactBrowseListFragment"
+ android:id="@+id/two_pane_list"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+
+ <fragment android:name="com.android.contacts.views.detail.ContactDetailFragment"
+ android:id="@+id/two_pane_detail"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+</LinearLayout>
diff --git a/src/com/android/contacts/activities/ContactDetailActivity.java b/src/com/android/contacts/activities/ContactDetailActivity.java
index a843141..55ad98e 100644
--- a/src/com/android/contacts/activities/ContactDetailActivity.java
+++ b/src/com/android/contacts/activities/ContactDetailActivity.java
@@ -29,26 +29,28 @@
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
public class ContactDetailActivity extends Activity {
- private ContactDetailFragment mFragment;
-
private static final String TAG = "ContactDetailActivity";
+ private ContactDetailFragment mFragment;
+
private final FragmentCallbackHandler mCallbackHandler = new FragmentCallbackHandler();
@Override
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
- setContentView(R.layout.contact_detail);
+ setContentView(R.layout.contact_detail_activity);
- mFragment = new ContactDetailFragment(this, findViewById(R.id.contact_detail),
- mCallbackHandler, getIntent().getData());
+ Log.i(TAG, getIntent().getData().toString());
- openFragmentTransaction()
- .add(mFragment, R.id.contact_detail)
- .commit();
+ final View view = findViewById(R.id.contact_detail_fragment);
+// mFragment = (ContactDetailFragment) findFragmentById(R.id.contact_detail_fragment);
+ mFragment = ContactDetailFragment.sLastInstance;
+ mFragment.setCallbacks(mCallbackHandler);
+ mFragment.loadUri(getIntent().getData());
}
@Override
diff --git a/src/com/android/contacts/activities/ContactEditActivity.java b/src/com/android/contacts/activities/ContactEditActivity.java
index cf1fbac..8834daf 100644
--- a/src/com/android/contacts/activities/ContactEditActivity.java
+++ b/src/com/android/contacts/activities/ContactEditActivity.java
@@ -44,7 +44,7 @@
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
- setContentView(R.layout.contact_edit);
+ setContentView(R.layout.contact_edit_activity);
final Intent intent = getIntent();
final String action = intent.getAction();
@@ -52,14 +52,9 @@
final String mimeType = intent.resolveType(getContentResolver());
final Bundle intentExtras = intent.getExtras();
- mFragment = new ContactEditFragment(
- this, findViewById(R.id.contact_edit),
- action, uri, mimeType, intentExtras,
- mCallbackHandler);
-
- openFragmentTransaction()
- .add(mFragment, R.id.contact_edit)
- .commit();
+ mFragment = ContactEditFragment.sLastInstance;
+ mFragment.setCallbacks(mCallbackHandler);
+ mFragment.load(action, uri, mimeType, intentExtras);
}
private class FragmentCallbackHandler implements ContactEditFragment.Callbacks {
diff --git a/src/com/android/contacts/activities/TwoPaneActivity.java b/src/com/android/contacts/activities/TwoPaneActivity.java
new file mode 100644
index 0000000..cd5a378
--- /dev/null
+++ b/src/com/android/contacts/activities/TwoPaneActivity.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2010 Google Inc.
+ *
+ * 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.contacts.activities;
+
+import com.android.contacts.R;
+import com.android.contacts.list.DefaultContactBrowseListFragment;
+import com.android.contacts.list.OnContactBrowserActionListener;
+import com.android.contacts.views.detail.ContactDetailFragment;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.widget.Toast;
+
+public class TwoPaneActivity extends Activity {
+ private final static String TAG = "TwoPaneActivity";
+ private DefaultContactBrowseListFragment mListFragment;
+ private ContactDetailFragment mDetailFragment;
+ private DetailCallbackHandler mDetailCallbackHandler = new DetailCallbackHandler();
+ private ListCallbackHandler mListCallbackHandler = new ListCallbackHandler();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.two_pane_activity);
+
+// mListFragment = (DefaultContactBrowseListFragment) findFragmentById(R.id.two_pane_list);
+ mListFragment = DefaultContactBrowseListFragment.sLastFragment;
+ mListFragment.setOnContactListActionListener(mListCallbackHandler);
+
+// mDetailFragment = (ContactDetailFragment) findFragmentById(R.id.two_pane_detail);
+ mDetailFragment = ContactDetailFragment.sLastInstance;
+ mDetailFragment.setCallbacks(mDetailCallbackHandler);
+ }
+
+ private class ListCallbackHandler implements OnContactBrowserActionListener {
+ public void onAddToFavoritesAction(Uri contactUri) {
+ Toast.makeText(TwoPaneActivity.this, "onAddToFavoritesAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onCallContactAction(Uri contactUri) {
+ Toast.makeText(TwoPaneActivity.this, "onCallContactAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onCreateNewContactAction() {
+ Toast.makeText(TwoPaneActivity.this, "onCreateNewContactAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onDeleteContactAction(Uri contactUri) {
+ Toast.makeText(TwoPaneActivity.this, "onDeleteContactAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onEditContactAction(Uri contactLookupUri) {
+ Toast.makeText(TwoPaneActivity.this, "onEditContactAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onFinishAction() {
+ Toast.makeText(TwoPaneActivity.this, "onFinishAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onRemoveFromFavoritesAction(Uri contactUri) {
+ Toast.makeText(TwoPaneActivity.this, "onRemoveFromFavoritesAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onSearchAllContactsAction(String string) {
+ Toast.makeText(TwoPaneActivity.this, "onSearchAllContactsAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onSmsContactAction(Uri contactUri) {
+ Toast.makeText(TwoPaneActivity.this, "onSmsContactAction",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void onViewContactAction(Uri contactLookupUri) {
+ mDetailFragment.loadUri(contactLookupUri);
+ }
+ }
+
+ private class DetailCallbackHandler implements ContactDetailFragment.Callbacks {
+ public void closeBecauseContactNotFound() {
+ Toast.makeText(TwoPaneActivity.this, "closeBecauseContactNotFound",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void editContact(Uri rawContactUri) {
+ Toast.makeText(TwoPaneActivity.this, "editContact",
+ Toast.LENGTH_LONG).show();
+ }
+
+ public void itemClicked(Intent intent) {
+ startActivity(intent);
+ }
+ }
+}
diff --git a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
index 3bf4a3e..8ea4901 100644
--- a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
@@ -36,8 +36,13 @@
private boolean mCreateContactEnabled;
private boolean mContactsWithPhoneNumbersOnly;
+ // TODO: Remove this horrible hack once the framework can lookup fragments via findFragmentById
+ public static DefaultContactBrowseListFragment sLastFragment = null;
+
public DefaultContactBrowseListFragment() {
setPhotoLoaderEnabled(true);
+
+ sLastFragment = this;
}
@Override
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index fb781a9..51c115b 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -32,6 +32,7 @@
import com.android.internal.telephony.ITelephony;
import com.android.internal.widget.ContactHeaderWidget;
+import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.patterns.Loader;
@@ -98,10 +99,11 @@
private static final int LOADER_DETAILS = 1;
- private final Context mContext;
- private final View mView;
- private final LayoutInflater mInflater;
- private final Uri mLookupUri;
+ // TODO: Remove this horrible hack once findFragmentById works
+ public static ContactDetailFragment sLastInstance = null;
+
+ private Context mContext;
+ private Uri mLookupUri;
private Callbacks mCallbacks;
private ContactDetailLoader.Result mContactData;
@@ -139,26 +141,8 @@
private ArrayList<ViewEntry> mOtherEntries = new ArrayList<ViewEntry>();
private ArrayList<ArrayList<ViewEntry>> mSections = new ArrayList<ArrayList<ViewEntry>>();
- public ContactDetailFragment(Context context, View view, Callbacks callbacks, Uri lookupUri) {
- super();
- if (callbacks == null) throw new IllegalArgumentException("callbacks must be provided");
- mContext = context;
- mView = view;
- mCallbacks = callbacks;
-
- mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mContactHeaderWidget = (ContactHeaderWidget) view.findViewById(R.id.contact_header_widget);
- mContactHeaderWidget.showStar(true);
- mContactHeaderWidget.setExcludeMimes(new String[] {
- Contacts.CONTENT_ITEM_TYPE
- });
-
- mListView = (ListView) view.findViewById(android.R.id.list);
- mListView.setOnCreateContextMenuListener(this);
- mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
- mListView.setOnItemClickListener(this);
- // Don't set it to mListView yet. We do so later when we bind the adapter.
- mEmptyView = view.findViewById(android.R.id.empty);
+ public ContactDetailFragment() {
+ // Explicit constructor for inflation
// Build the list of sections. The order they're added to mSections dictates the
// order they are displayed in the list.
@@ -172,15 +156,50 @@
mSections.add(mGroupEntries);
mSections.add(mOtherEntries);
+ sLastInstance = this;
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ mContext = activity;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container) {
+ final View view = inflater.inflate(R.layout.contact_detail, container, false);
+
+ mContactHeaderWidget = (ContactHeaderWidget) view.findViewById(R.id.contact_header_widget);
+ mContactHeaderWidget.showStar(true);
+ mContactHeaderWidget.setExcludeMimes(new String[] {
+ Contacts.CONTENT_ITEM_TYPE
+ });
+
+ mListView = (ListView) view.findViewById(android.R.id.list);
+ mListView.setOnCreateContextMenuListener(this);
+ mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
+ mListView.setOnItemClickListener(this);
+ // Don't set it to mListView yet. We do so later when we bind the adapter.
+ mEmptyView = view.findViewById(android.R.id.empty);
+
//TODO Read this value from a preference
mShowSmsLinksForAllPhones = true;
+ return view;
+ }
+
+ public void setCallbacks(Callbacks value) {
+ mCallbacks = value;
+ }
+
+ public void loadUri(Uri lookupUri) {
mLookupUri = lookupUri;
+ super.startLoading(LOADER_DETAILS, null);
}
@Override
protected void onInitializeLoaders() {
- startLoading(LOADER_DETAILS, null);
+// startLoading(LOADER_DETAILS, null);
}
@Override
diff --git a/src/com/android/contacts/views/edit/ContactEditFragment.java b/src/com/android/contacts/views/edit/ContactEditFragment.java
index 4666c44..87c2638 100644
--- a/src/com/android/contacts/views/edit/ContactEditFragment.java
+++ b/src/com/android/contacts/views/edit/ContactEditFragment.java
@@ -122,15 +122,13 @@
private static final File PHOTO_DIR = new File(
Environment.getExternalStorageDirectory() + "/DCIM/Camera");
- private final Context mContext;
- private final View mView;
- private final LayoutInflater mInflater;
+ private Context mContext;
private final EntityDeltaComparator mComparator = new EntityDeltaComparator();
- private final String mAction;
- private final Uri mUri;
- private final String mMimeType;
- private final Bundle mIntentExtras;
- private final Callbacks mCallbacks;
+ private String mAction;
+ private Uri mUri;
+ private String mMimeType;
+ private Bundle mIntentExtras;
+ private Callbacks mCallbacks;
private File mCurrentPhotoFile;
@@ -144,23 +142,23 @@
private ViewIdGenerator mViewIdGenerator;
- // TODO: We might not need to pass Context and View manually here as the framework should
- // take care of this...?
- public ContactEditFragment(Context context, View view, String action, Uri uri,
- String mimeType, Bundle intentExtras, Callbacks callbacks) {
- super();
+ // TODO: Remove this temp instance once findFragmentById works
+ public static ContactEditFragment sLastInstance = null;
- if (callbacks == null) throw new IllegalArgumentException("callbacks must be given");
+ public ContactEditFragment() {
+ sLastInstance = this;
+ }
- mContext = context;
- mView = view;
- mAction = action;
- mUri = uri;
- mMimeType = mimeType;
- mIntentExtras = intentExtras;
- mCallbacks = callbacks;
- mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- // Build editor and listen for photo requests
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ mContext = activity;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container) {
+ final View view = inflater.inflate(R.layout.contact_edit, container, false);
+
mContent = (LinearLayout) view.findViewById(R.id.editors);
view.findViewById(R.id.btn_done).setOnClickListener(new OnClickListener() {
@@ -170,9 +168,45 @@
});
view.findViewById(R.id.btn_discard).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- mCallbacks.closeAfterRevert();
+ if (mCallbacks != null) mCallbacks.closeAfterRevert();
}
});
+
+ return view;
+ }
+
+ public void load(String action, Uri uri, String mimeType, Bundle intentExtras) {
+ mAction = action;
+ mUri = uri;
+ mMimeType = mimeType;
+ mIntentExtras = intentExtras;
+
+ if (Intent.ACTION_EDIT.equals(mAction)) {
+ // Read initial state from database
+ if (mCallbacks != null) mCallbacks.setTitleTo(R.string.editContact_title_edit);
+ startLoading(LOADER_DATA, null);
+ } else if (Intent.ACTION_INSERT.equals(mAction)) {
+ if (mCallbacks != null) mCallbacks.setTitleTo(R.string.editContact_title_insert);
+
+ // Load Accounts async so that we can present them
+ AsyncTask<Void, Void, ArrayList<Account>> loadAccountsTask =
+ new AsyncTask<Void, Void, ArrayList<Account>>() {
+ @Override
+ protected ArrayList<Account> doInBackground(Void... params) {
+ return Sources.getInstance(mContext).getAccounts(true);
+ }
+ @Override
+ protected void onPostExecute(ArrayList<Account> result) {
+ selectAccountAndCreateContact(result, true);
+ }
+ };
+ loadAccountsTask.execute();
+ } else throw new IllegalArgumentException("Unknown Action String " + mAction +
+ ". Only support " + Intent.ACTION_EDIT + " or " + Intent.ACTION_INSERT);
+ }
+
+ public void setCallbacks(Callbacks callbacks) {
+ mCallbacks = callbacks;
}
@Override
@@ -185,28 +219,28 @@
savedState != null && savedState.containsKey(KEY_EDIT_STATE);
if (!hasIncomingState) {
- if (Intent.ACTION_EDIT.equals(mAction)) {
- // Read initial state from database
- mCallbacks.setTitleTo(R.string.editContact_title_edit);
- startLoading(LOADER_DATA, null);
- } else if (Intent.ACTION_INSERT.equals(mAction)) {
- mCallbacks.setTitleTo(R.string.editContact_title_insert);
-
- // Load Accounts async so that we can present them
- AsyncTask<Void, Void, ArrayList<Account>> loadAccountsTask =
- new AsyncTask<Void, Void, ArrayList<Account>>() {
- @Override
- protected ArrayList<Account> doInBackground(Void... params) {
- return Sources.getInstance(mContext).getAccounts(true);
- }
- @Override
- protected void onPostExecute(ArrayList<Account> result) {
- selectAccountAndCreateContact(result, true);
- }
- };
- loadAccountsTask.execute();
- } else throw new IllegalArgumentException("Unknown Action String " + mAction +
- ". Only support " + Intent.ACTION_EDIT + " or " + Intent.ACTION_INSERT);
+// if (Intent.ACTION_EDIT.equals(mAction)) {
+// // Read initial state from database
+// if (mCallbacks != null) mCallbacks.setTitleTo(R.string.editContact_title_edit);
+// startLoading(LOADER_DATA, null);
+// } else if (Intent.ACTION_INSERT.equals(mAction)) {
+// if (mCallbacks != null) mCallbacks.setTitleTo(R.string.editContact_title_insert);
+//
+// // Load Accounts async so that we can present them
+// AsyncTask<Void, Void, ArrayList<Account>> loadAccountsTask =
+// new AsyncTask<Void, Void, ArrayList<Account>>() {
+// @Override
+// protected ArrayList<Account> doInBackground(Void... params) {
+// return Sources.getInstance(mContext).getAccounts(true);
+// }
+// @Override
+// protected void onPostExecute(ArrayList<Account> result) {
+// selectAccountAndCreateContact(result, true);
+// }
+// };
+// loadAccountsTask.execute();
+// } else throw new IllegalArgumentException("Unknown Action String " + mAction +
+// ". Only support " + Intent.ACTION_EDIT + " or " + Intent.ACTION_INSERT);
}
if (savedState == null) {
@@ -230,7 +264,7 @@
if (data == ContactEditLoader.Result.NOT_FOUND) {
// Item has been deleted
Log.i(TAG, "No contact found. Closing fragment");
- mCallbacks.closeBecauseContactNotFound();
+ if (mCallbacks != null) mCallbacks.closeBecauseContactNotFound();
return;
}
setData(data);
@@ -643,7 +677,7 @@
resultCode = Activity.RESULT_CANCELED;
resultIntent = null;
}
- mCallbacks.closeAfterSaving(resultCode, resultIntent);
+ if (mCallbacks != null) mCallbacks.closeAfterSaving(resultCode, resultIntent);
break;
// TODO: Other save modes