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

Commit bfea74f3 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Further UI tweak of photo picker

- When photo picker is shown, the action bar title will be "Choose photo".
- Modified column width of GridView in photo picker to use entire screen
  width.
- Changed the folder of all photos button to "all photos"

Bug: 24988706

Change-Id: Ia3e3ddf515c308e1cf6cdabc4c99fd7f9d983bc0
parent 82acd42c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -815,10 +815,13 @@
    <!-- Title of profile photos that are from your various accounts -->
    <string name="from_your_accounts">From your accounts</string>

    <!-- Button used in photo picker to open camera -->
    <!-- Button used in photo picker to open camera [CHAR LIMIT=30]-->
    <string name="take_a_photo_button">Take a photo</string>

    <!-- Button used in photo picker to open photo/gallery -->
    <!-- Button used in photo picker to open photo/gallery [CHAR LIMIT=20]-->
    <string name="all_photos_button">All photos</string>

    <!-- Title of photo picker [CHAR LIMIT=30]-->
    <string name="photo_picker_title">Choose photo</string>

</resources>
+8 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity impl

    private static final String STATE_PHOTO_MODE = "photo_mode";
    private static final String STATE_IS_PHOTO_SELECTION = "is_photo_selection";
    private static final String STATE_ACTION_BAR_TITLE = "action_bar_title";

    /**
     * Displays a PopupWindow with photo edit options.
@@ -145,6 +146,7 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity impl
            // Restore state
            mPhotoMode = savedState.getInt(STATE_PHOTO_MODE);
            mIsPhotoSelection = savedState.getBoolean(STATE_IS_PHOTO_SELECTION);
            mActionBarTitleResId = savedState.getInt(STATE_ACTION_BAR_TITLE);

            // Show/hide the editor and photo selection fragments (w/o animations)
            mFragment = (CompactContactEditorFragment) getFragmentManager()
@@ -154,8 +156,10 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity impl
            final FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
            if (mIsPhotoSelection) {
                fragmentTransaction.hide(getEditorFragment()).show(mPhotoSelectionFragment);
                getActionBar().setTitle(getResources().getString(R.string.photo_picker_title));
            } else {
                fragmentTransaction.show(getEditorFragment()).hide(mPhotoSelectionFragment);
                getActionBar().setTitle(getResources().getString(mActionBarTitleResId));
            }
            fragmentTransaction.commit();
        }
@@ -174,6 +178,7 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity impl
        super.onSaveInstanceState(outState);
        outState.putInt(STATE_PHOTO_MODE, mPhotoMode);
        outState.putBoolean(STATE_IS_PHOTO_SELECTION, mIsPhotoSelection);
        outState.putInt(STATE_ACTION_BAR_TITLE, mActionBarTitleResId);
    }

    @Override
@@ -221,6 +226,7 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity impl
                .hide(getEditorFragment())
                .show(mPhotoSelectionFragment)
                .commit();
        getActionBar().setTitle(getResources().getString(R.string.photo_picker_title));
    }

    private void showEditorFragment() {
@@ -229,7 +235,7 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity impl
                .hide(mPhotoSelectionFragment)
                .show((CompactContactEditorFragment) mFragment)
                .commit();

        getActionBar().setTitle(getResources().getString(mActionBarTitleResId));
        mIsPhotoSelection = false;
    }

+5 −4
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity
    public static final String ACTION_JOIN_COMPLETED = "joinCompleted";
    public static final String ACTION_SAVE_COMPLETED = "saveCompleted";

    protected int mActionBarTitleResId;

    /**
     * Contract for contact editors Fragments that are managed by this Activity.
     */
@@ -218,12 +220,11 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            if (Intent.ACTION_EDIT.equals(action) || ACTION_EDIT.equals(action)) {
                actionBar.setTitle(getResources().getString(
                        R.string.contact_editor_title_existing_contact));
                mActionBarTitleResId = R.string.contact_editor_title_existing_contact;
            } else {
                actionBar.setTitle(getResources().getString(
                        R.string.contact_editor_title_new_contact));
                mActionBarTitleResId = R.string.contact_editor_title_new_contact;
            }
            actionBar.setTitle(getResources().getString(mActionBarTitleResId));
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayHomeAsUpEnabled(true);
        }
+1 −1
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ public abstract class PhotoSelectionHandler implements OnClickListener {
     * Constructs an intent for picking a photo from Gallery, and returning the bitmap.
     */
    private Intent getPhotoPickIntent(Uri outputUri) {
        final Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
        final Intent intent = new Intent(Intent.ACTION_PICK, null);
        intent.setType("image/*");
        ContactPhotoUtils.addPhotoPickerExtras(intent, outputUri);
        return intent;
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl
            final ArrayList<CompactPhotoSelectionFragment.Photo> photos = getContent().getPhotos();
            if (photos.size() > 1) {
                // For aggregate contacts, the user may select a new super primary photo from among
                // the (non-default) raw contact photos, or source a new photo from the ActionBar
                // the (non-default) raw contact photos, or source a new photo.
                getEditorActivity().selectPhoto(photos, getPhotoMode());
                return;
            }
Loading