Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bdd415a authored by Wenyi Wang's avatar Wenyi Wang Committed by android-build-merger
Browse files

Merge "Revert "Show check mark when none is primary in photo picker"" into...

Merge "Revert "Show check mark when none is primary in photo picker"" into ub-contactsdialer-b-dev am: b1c2c2ca
am: e1c960e8

* commit 'e1c960e8':
  Revert "Show check mark when none is primary in photo picker"
parents c399f9b1 e1c960e8
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import com.android.contacts.common.model.RawContactDeltaList;
import com.android.contacts.detail.PhotoSelectionHandler;
import com.android.contacts.editor.CompactContactEditorFragment;
import com.android.contacts.editor.CompactPhotoSelectionFragment;
import com.android.contacts.editor.ContactEditorBaseFragment;
import com.android.contacts.editor.PhotoSourceDialogFragment;

import android.app.FragmentTransaction;
@@ -139,7 +138,6 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity impl
            // Create the editor and photo selection fragments
            mFragment = new CompactContactEditorFragment();
            mPhotoSelectionFragment = new CompactPhotoSelectionFragment();
            mPhotoSelectionFragment.setArguments(getIntent().getExtras());
            getFragmentManager().beginTransaction()
                    .add(R.id.fragment_container, getEditorFragment(), TAG_COMPACT_EDITOR)
                    .add(R.id.fragment_container, mPhotoSelectionFragment, TAG_PHOTO_SELECTION)
@@ -157,10 +155,6 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity impl
                    .findFragmentByTag(TAG_COMPACT_EDITOR);
            mPhotoSelectionFragment = (CompactPhotoSelectionFragment) getFragmentManager()
                    .findFragmentByTag(TAG_PHOTO_SELECTION);
            final Bundle bundle = mPhotoSelectionFragment.getArguments();
            bundle.putString(ContactEditorBaseFragment.INTENT_EXTRA_PHOTO_URI,
                    getIntent().getExtras().getString(
                            ContactEditorBaseFragment.INTENT_EXTRA_PHOTO_URI));
            final FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
            if (mIsPhotoSelection) {
                fragmentTransaction.hide(getEditorFragment()).show(mPhotoSelectionFragment);
+5 −28
Original line number Diff line number Diff line
@@ -50,8 +50,6 @@ public class CompactPhotoSelectionFragment extends Fragment {

    private static final String STATE_PHOTOS = "photos";
    private static final String STATE_PHOTO_MODE = "photoMode";
    private static final String STATE_HAS_PRIMARY = "hasPrimary";
    private static final String STATE_PHOTO_URI = "photoUri";
    private final int VIEW_TYPE_TAKE_PHOTO = 0;
    private final int VIEW_TYPE_ALL_PHOTOS = 1;
    private final int VIEW_TYPE_IMAGE = 2;
@@ -225,18 +223,16 @@ public class CompactPhotoSelectionFragment extends Fragment {
            }

            final Photo photo = mPhotos.get(position);
            Uri photoUri = Uri.EMPTY;

            // Bind the photo
            final ImageView imageView = (ImageView) photoItemView.findViewById(R.id.image);
            if (photo.updatedPhotoUri != null) {
                photoUri = photo.updatedPhotoUri;
                EditorUiUtils.loadPhoto(ContactPhotoManager.getInstance(mContext),
                        imageView, photoUri);
                        imageView, photo.updatedPhotoUri);
            } else {
                final Long photoFileId = EditorUiUtils.getPhotoFileId(photo.valuesDelta);
                if (photoFileId != null) {
                    photoUri = ContactsContract.DisplayPhoto.CONTENT_URI.buildUpon()
                    final Uri photoUri = ContactsContract.DisplayPhoto.CONTENT_URI.buildUpon()
                            .appendPath(photoFileId.toString()).build();
                    EditorUiUtils.loadPhoto(ContactPhotoManager.getInstance(mContext),
                            imageView, photoUri);
@@ -253,9 +249,7 @@ public class CompactPhotoSelectionFragment extends Fragment {

            // Display a check icon over the primary photo
            final ImageView checkImageView = (ImageView) photoItemView.findViewById(R.id.check);
            checkImageView.setVisibility(
                    photo.primary || photoUri.toString().equals(mEditorPhotoUri)
                            ? View.VISIBLE : View.GONE);
            checkImageView.setVisibility(photo.primary ? View.VISIBLE : View.GONE);

            photoItemView.setContentDescription(photo.contentDescription);

@@ -267,8 +261,6 @@ public class CompactPhotoSelectionFragment extends Fragment {
    private int mPhotoMode;
    private Listener mListener;
    private GridView mGridView;
    private String mEditorPhotoUri;
    private boolean mHasPrimary;

    public void setListener(Listener listener) {
        mListener = listener;
@@ -278,13 +270,6 @@ public class CompactPhotoSelectionFragment extends Fragment {
        mPhotos = photos;
        mPhotoMode = photoMode;
        mGridView.setAccessibilityDelegate(new View.AccessibilityDelegate() {});
        mHasPrimary = false;
        for (Photo photo : mPhotos) {
            if (photo.primary) {
                mHasPrimary = true;
                break;
            }
        }
    }

    @Override
@@ -293,12 +278,6 @@ public class CompactPhotoSelectionFragment extends Fragment {
        if (savedInstanceState != null) {
            mPhotos = savedInstanceState.getParcelableArrayList(STATE_PHOTOS);
            mPhotoMode = savedInstanceState.getInt(STATE_PHOTO_MODE, 0);
            mEditorPhotoUri = savedInstanceState.getString(STATE_PHOTO_URI);
            mHasPrimary = savedInstanceState.getBoolean(STATE_HAS_PRIMARY);
        }
        if (TextUtils.isEmpty(mEditorPhotoUri)) {
            mEditorPhotoUri = getArguments().getString(
                    ContactEditorBaseFragment.INTENT_EXTRA_PHOTO_URI);
        }
    }

@@ -336,8 +315,8 @@ public class CompactPhotoSelectionFragment extends Fragment {
        display.getMetrics(outMetrics);

        // portrait -- 3 columns; landscape -- 5 columns.
        mNumberOfColumns = outMetrics.heightPixels > outMetrics.widthPixels
                ? NUMBER_OF_COLUMNS_PORTRAIT : NUMBER_OF_COLUMNS_LANDSCAPE;
        mNumberOfColumns = outMetrics.heightPixels > outMetrics.widthPixels ?
                NUMBER_OF_COLUMNS_PORTRAIT : NUMBER_OF_COLUMNS_LANDSCAPE;
        final int paddingWidth = (int) getResources().getDimension(R.dimen
                .photo_picker_column_padding_width);
        float density  = getResources().getDisplayMetrics().density;
@@ -368,8 +347,6 @@ public class CompactPhotoSelectionFragment extends Fragment {
    public void onSaveInstanceState(Bundle outState) {
        outState.putParcelableArrayList(STATE_PHOTOS, mPhotos);
        outState.putInt(STATE_PHOTO_MODE, mPhotoMode);
        outState.putString(STATE_PHOTO_URI, mEditorPhotoUri);
        outState.putBoolean(STATE_HAS_PRIMARY, mHasPrimary);
        super.onSaveInstanceState(outState);
    }

+0 −5
Original line number Diff line number Diff line
@@ -190,11 +190,6 @@ abstract public class ContactEditorBaseFragment extends Fragment implements
     */
    public static final String INTENT_EXTRA_PHOTO_ID = "photo_id";

    /**
     * Intent key to pass the URI of the photo to display on the editor.
     */
    public static final String INTENT_EXTRA_PHOTO_URI = "photo_uri";

    /**
     * Intent key to pass the ID of the raw contact id that should be displayed in the full editor
     * by itself.
+1 −8
Original line number Diff line number Diff line
@@ -46,11 +46,10 @@ public class EditorIntents {
     * existing contact.
     */
    public static Intent createCompactEditContactIntent(Uri contactLookupUri,
            MaterialPalette materialPalette, long photoId, String photoUri) {
            MaterialPalette materialPalette, long photoId) {
        final Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
        putMaterialPalette(intent, materialPalette);
        putPhotoId(intent, photoId);
        putPhotoUri(intent, photoUri);
        return intent;
    }

@@ -160,12 +159,6 @@ public class EditorIntents {
        }
    }

    private static void putPhotoUri(Intent intent, String photoUri) {
        if (!Uri.EMPTY.toString().equals(photoUri)) {
            intent.putExtra(ContactEditorBaseFragment.INTENT_EXTRA_PHOTO_URI, photoUri);
        }
    }

    private static void putRawContactDeltaValues(Intent intent,
            RawContactDeltaList rawContactDeltaList, String displayName, String phoneticName) {
        // Pass on all the data that has been entered so far
+1 −2
Original line number Diff line number Diff line
@@ -2643,8 +2643,7 @@ public class QuickContactActivity extends ContactsActivity
                mContactData.getLookupUri(),
                mHasComputedThemeColor
                        ? new MaterialPalette(mColorFilterColor, mStatusBarColor) : null,
                mContactData.getPhotoId(),
                mContactData.getPhotoUri());
                mContactData.getPhotoId());
    }

    private void editContact() {