summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/editor/CompactContactEditorFragment.java8
-rw-r--r--src/com/android/contacts/editor/ContactEditorBaseFragment.java37
-rw-r--r--src/com/android/contacts/editor/ContactEditorFragment.java28
3 files changed, 27 insertions, 46 deletions
diff --git a/src/com/android/contacts/editor/CompactContactEditorFragment.java b/src/com/android/contacts/editor/CompactContactEditorFragment.java
index 98339a667..fbde8c9d3 100644
--- a/src/com/android/contacts/editor/CompactContactEditorFragment.java
+++ b/src/com/android/contacts/editor/CompactContactEditorFragment.java
@@ -51,18 +51,10 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment
super.onActivityResult(requestCode, resultCode, data);
}
- //
- // ContactEditorBaseFragment
- //
-
@Override
protected void bindEditors() {
}
- @Override
- protected void setEnabled(boolean enabled) {
- }
-
//
// ContactEditor
//
diff --git a/src/com/android/contacts/editor/ContactEditorBaseFragment.java b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
index fcfb86d8c..e1a841a39 100644
--- a/src/com/android/contacts/editor/ContactEditorBaseFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
@@ -69,6 +69,7 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
+import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;
@@ -195,6 +196,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements
// Views
//
protected LinearLayout mContent;
+ protected View mAggregationSuggestionView;
//
// Parameters passed in on {@link #load}
@@ -721,7 +723,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements
return true;
}
- maybeSetEnabled(false);
+ setEnabled(false);
return doSaveAction(saveMode);
}
@@ -900,7 +902,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements
*/
protected void setStateForExistingContact(String displayName, boolean isUserProfile,
ImmutableList<RawContact> rawContacts) {
- maybeSetEnabled(true);
+ setEnabled(true);
mDefaultDisplayName = displayName;
mState.addAll(rawContacts.iterator());
@@ -933,8 +935,6 @@ abstract public class ContactEditorBaseFragment extends Fragment implements
/**
* Sets group metadata on all bound editors.
*/
- // TODO: can this be private? Does it really need to be called from
- // {@link ContactEditFragment#bindEdtiors}? If not we can remove mGroupMetaData too.
protected void setGroupMetaData() {
if (mGroupMetaData == null) {
return;
@@ -955,14 +955,31 @@ abstract public class ContactEditorBaseFragment extends Fragment implements
/**
* Set the enabled state of editors.
*/
- // TODO: The implementation in ContactEditorFragment can be moved to this class when
- // the aggregation Views are moved to the base and we can get rid of maybeSetEnabled
- abstract void setEnabled(boolean enabled);
-
- private void maybeSetEnabled(boolean enabled) {
+ private void setEnabled(boolean enabled) {
if (mEnabled != enabled) {
mEnabled = enabled;
- setEnabled(mEnabled);
+
+ // Enable/disable editors
+ if (mContent != null) {
+ int count = mContent.getChildCount();
+ for (int i = 0; i < count; i++) {
+ mContent.getChildAt(i).setEnabled(enabled);
+ }
+ }
+
+ // Enable/disable aggregation suggestion vies
+ if (mAggregationSuggestionView != null) {
+ LinearLayout itemList = (LinearLayout) mAggregationSuggestionView.findViewById(
+ R.id.aggregation_suggestions);
+ int count = itemList.getChildCount();
+ for (int i = 0; i < count; i++) {
+ itemList.getChildAt(i).setEnabled(enabled);
+ }
+ }
+
+ // Maybe invalidate the options menu
+ final Activity activity = getActivity();
+ if (activity != null) activity.invalidateOptionsMenu();
}
}
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index d78d1714c..dfa58ac2b 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -130,7 +130,6 @@ public class ContactEditorFragment extends ContactEditorBaseFragment implements
// Aggregations
private long mAggregationSuggestionsRawContactId;
- private View mAggregationSuggestionView;
private ListPopupWindow mAggregationSuggestionPopup;
private static final class AggregationSuggestionAdapter extends BaseAdapter {
@@ -190,20 +189,6 @@ public class ContactEditorFragment extends ContactEditorBaseFragment implements
public ContactEditorFragment() {
}
-
- @Override
- protected void setEnabled(boolean enabled) {
- if (mContent != null) {
- int count = mContent.getChildCount();
- for (int i = 0; i < count; i++) {
- mContent.getChildAt(i).setEnabled(enabled);
- }
- }
- setAggregationSuggestionViewEnabled(enabled);
- final Activity activity = getActivity();
- if (activity != null) activity.invalidateOptionsMenu();
- }
-
@Override
public void onStop() {
super.onStop();
@@ -889,19 +874,6 @@ public class ContactEditorFragment extends ContactEditorBaseFragment implements
}
}
- public void setAggregationSuggestionViewEnabled(boolean enabled) {
- if (mAggregationSuggestionView == null) {
- return;
- }
-
- LinearLayout itemList = (LinearLayout) mAggregationSuggestionView.findViewById(
- R.id.aggregation_suggestions);
- int count = itemList.getChildCount();
- for (int i = 0; i < count; i++) {
- itemList.getChildAt(i).setEnabled(enabled);
- }
- }
-
@Override
public void onSaveInstanceState(Bundle outState) {
// Joins