diff options
author | Walter Jang <wjang@google.com> | 2015-07-20 21:06:52 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-07-20 21:06:52 +0000 |
commit | 558524d2f7dc68051f0b3353a5088f2f41001aee (patch) | |
tree | 70942743a54834f03191d30679edc384973c925b | |
parent | a378003ad985b77a680338ede1782d0811caaf72 (diff) | |
parent | 5ed4e8b97e613ec4ae0dd3bdcff9bb043e5ea006 (diff) | |
download | packages_apps_Contacts-558524d2f7dc68051f0b3353a5088f2f41001aee.tar.gz packages_apps_Contacts-558524d2f7dc68051f0b3353a5088f2f41001aee.tar.bz2 packages_apps_Contacts-558524d2f7dc68051f0b3353a5088f2f41001aee.zip |
am 5ed4e8b9: am 8b7e2ffa: am 03debc68: Pass MaterialPalete colors to contact editor as ints not Parcelable
* commit '5ed4e8b97e613ec4ae0dd3bdcff9bb043e5ea006':
Pass MaterialPalete colors to contact editor as ints not Parcelable
3 files changed, 24 insertions, 8 deletions
diff --git a/src/com/android/contacts/editor/CompactPhotoEditorView.java b/src/com/android/contacts/editor/CompactPhotoEditorView.java index 1cb45380d..5f3e9afad 100644 --- a/src/com/android/contacts/editor/CompactPhotoEditorView.java +++ b/src/com/android/contacts/editor/CompactPhotoEditorView.java @@ -278,7 +278,7 @@ public class CompactPhotoEditorView extends RelativeLayout implements View.OnCli private void setDefaultPhotoTint() { final int color = mMaterialPalette == null ? MaterialColorMapUtils.getDefaultPrimaryAndSecondaryColors( - getResources()).mPrimaryColor + getResources()).mPrimaryColor : mMaterialPalette.mPrimaryColor; mPhotoImageView.setTint(color); } diff --git a/src/com/android/contacts/editor/ContactEditorBaseFragment.java b/src/com/android/contacts/editor/ContactEditorBaseFragment.java index 32c3d3784..18b138190 100644 --- a/src/com/android/contacts/editor/ContactEditorBaseFragment.java +++ b/src/com/android/contacts/editor/ContactEditorBaseFragment.java @@ -163,11 +163,20 @@ abstract public class ContactEditorBaseFragment extends Fragment implements "disableDeleteMenuOption"; /** - * Intent key to pass the photo palette calculated by - * {@link com.android.contacts.quickcontact.QuickContactActivity} to and between the compact - * editor and fully expanded editor. + * Intent key to pass the photo palette primary color calculated by + * {@link com.android.contacts.quickcontact.QuickContactActivity} to the editor and between + * the compact and fully expanded editors. */ - public static final String INTENT_EXTRA_MATERIAL_PALETTE = "material_palette"; + public static final String INTENT_EXTRA_MATERIAL_PALETTE_PRIMARY_COLOR = + "material_palette_primary_color"; + + /** + * Intent key to pass the photo palette secondary color calculated by + * {@link com.android.contacts.quickcontact.QuickContactActivity} to the editor and between + * the compact and fully expanded editors. + */ + public static final String INTENT_EXTRA_MATERIAL_PALETTE_SECONDARY_COLOR = + "material_palette_secondary_color"; /** * Intent key to pass a Bundle of raw contact IDs to photos URIs between the compact editor @@ -1358,7 +1367,12 @@ abstract public class ContactEditorBaseFragment extends Fragment implements mIntentExtras.getBoolean(INTENT_EXTRA_NEW_LOCAL_PROFILE); mDisableDeleteMenuOption = mIntentExtras.getBoolean(INTENT_EXTRA_DISABLE_DELETE_MENU_OPTION); - mMaterialPalette = mIntentExtras.getParcelable(INTENT_EXTRA_MATERIAL_PALETTE); + if (mIntentExtras.containsKey(INTENT_EXTRA_MATERIAL_PALETTE_PRIMARY_COLOR) + && mIntentExtras.containsKey(INTENT_EXTRA_MATERIAL_PALETTE_SECONDARY_COLOR)) { + mMaterialPalette = new MaterialColorMapUtils.MaterialPalette( + mIntentExtras.getInt(INTENT_EXTRA_MATERIAL_PALETTE_PRIMARY_COLOR), + mIntentExtras.getInt(INTENT_EXTRA_MATERIAL_PALETTE_SECONDARY_COLOR)); + } if (mIntentExtras.containsKey(INTENT_EXTRA_UPDATED_PHOTOS)) { mUpdatedPhotos = mIntentExtras.getParcelable(INTENT_EXTRA_UPDATED_PHOTOS); } diff --git a/src/com/android/contacts/editor/EditorIntents.java b/src/com/android/contacts/editor/EditorIntents.java index 1ec6db945..a3c29fc8c 100644 --- a/src/com/android/contacts/editor/EditorIntents.java +++ b/src/com/android/contacts/editor/EditorIntents.java @@ -129,8 +129,10 @@ public class EditorIntents { private static void putMaterialPalette(Intent intent, MaterialPalette materialPalette) { if (materialPalette != null) { - intent.putExtra(ContactEditorBaseFragment.INTENT_EXTRA_MATERIAL_PALETTE, - materialPalette); + intent.putExtra(ContactEditorBaseFragment.INTENT_EXTRA_MATERIAL_PALETTE_PRIMARY_COLOR, + materialPalette.mPrimaryColor); + intent.putExtra(ContactEditorBaseFragment.INTENT_EXTRA_MATERIAL_PALETTE_SECONDARY_COLOR, + materialPalette.mSecondaryColor); } } |