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

Commit a5c94e61 authored by Anna Bauza's avatar Anna Bauza Committed by Gerrit Code Review
Browse files

Merge "Integrating new Avatar Picker App in Settings" into main

parents 487165c6 c6487432
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -56,3 +56,11 @@ flag {
    description: "Add support to lock private space automatically after a time period"
    bug: "303201022"
}

flag {
    name: "avatar_sync"
    namespace: "multiuser"
    description: "Implement new Avatar Picker outside of SetttingsLib with ability to select avatars from Google Account and synchronise to any changes."
    bug: "296829976"
    is_fixed_read_only: true
}
+11 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.multiuser.Flags;
import android.net.Uri;
import android.util.Log;
import android.widget.ImageView;
@@ -59,6 +60,9 @@ public class EditUserPhotoController {
    private static final String IMAGES_DIR = "multi_user";
    private static final String NEW_USER_PHOTO_FILE_NAME = "NewUserPhoto.png";

    private static final String AVATAR_PICKER_ACTION = "com.android.avatarpicker"
            + ".FULL_SCREEN_ACTIVITY";

    private final Activity mActivity;
    private final ActivityStarter mActivityStarter;
    private final ImageView mImageView;
@@ -105,7 +109,6 @@ public class EditUserPhotoController {
                onPhotoCropped(data.getData());
                return true;
            }

        }
        return false;
    }
@@ -115,7 +118,13 @@ public class EditUserPhotoController {
    }

    private void showAvatarPicker() {
        Intent intent = new Intent(mImageView.getContext(), AvatarPickerActivity.class);
        Intent intent;
        if (Flags.avatarSync()) {
            intent = new Intent(AVATAR_PICKER_ACTION);
            intent.addCategory(Intent.CATEGORY_DEFAULT);
        } else {
            intent = new Intent(mImageView.getContext(), AvatarPickerActivity.class);
        }
        intent.putExtra(AvatarPickerActivity.EXTRA_FILE_AUTHORITY, mFileAuthority);
        mActivityStarter.startActivityForResult(intent, REQUEST_CODE_PICK_AVATAR);
    }