Commit fb99e0ea authored by Tanya Gupta's avatar Tanya Gupta Committed by Commit Bot

[QrCode] Added camera icon to repository.

Bug: 1046574
Change-Id: I083378139b51485ed632b5e911bd8487db962e3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2026254Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Tanya Gupta <tgupta@google.com>
Cr-Commit-Position: refs/heads/master@{#738025}
parent 0c8f6e9b
......@@ -8,12 +8,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<org.chromium.ui.widget.ChromeImageView
android:id="@+id/camera_icon"
android:layout_marginTop="200dp"
android:layout_gravity="center_horizontal"
android:layout_width="125dp"
android:layout_height="125dp"
android:scaleType="center"
android:importantForAccessibility="no"
android:src="@drawable/camera" />
<TextView
android:id="@+id/qrcode_permission_image"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:layout_marginTop="75dp"
android:drawablePadding="24dp"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
......
......@@ -43,11 +43,19 @@ class QrCodeScanView {
mView = new FrameLayout(context);
mView.setLayoutParams(
new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mPermissionsView = (View) LayoutInflater.from(context).inflate(
mPermissionsView = createPermissionView(context, permissionPrompter);
}
public View getView() {
return mView;
}
private View createPermissionView(Context context, PermissionPrompter permissionPrompter) {
View permissionView = (View) LayoutInflater.from(context).inflate(
org.chromium.chrome.browser.share.qrcode.R.layout.qrcode_permission_layout, null,
false);
ButtonCompat cameraPermissionPrompt = mPermissionsView.findViewById(
ButtonCompat cameraPermissionPrompt = permissionView.findViewById(
org.chromium.chrome.browser.share.qrcode.R.id.ask_for_permission);
cameraPermissionPrompt.setOnClickListener(new OnClickListener() {
@Override
......@@ -55,10 +63,7 @@ class QrCodeScanView {
permissionPrompter.promptForCameraPermission();
}
});
}
public View getView() {
return mView;
return permissionView;
}
/**
......@@ -67,8 +72,10 @@ class QrCodeScanView {
* @param hasCameraPermission Indicates whether camera permissions were granted.
*/
public void cameraPermissionsChanged(Boolean hasCameraPermission) {
// No change, nothing to do here (This really shouldn't happen)
if (mHasCameraPermission == hasCameraPermission) {
// No change, nothing to do here
// We need to make sure mHasCameraPermission was not set to false already as that
// is the default value and therefore nothing will get rendered the first time.
if (mHasCameraPermission && hasCameraPermission) {
return;
}
mHasCameraPermission = hasCameraPermission;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment