summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoey Rizzoli <joey@lineageos.org>2017-12-15 21:54:27 +0100
committerChippa-a <vusal1372@gmail.com>2019-10-25 15:55:25 +0300
commit61e7e7791a25f87ad31c903873c30ccd053e1f45 (patch)
tree5a28ae2b50ecfaa64ea00df1e8302f5fbbc441e7
parent5b7dae23ee6eb5d83ec48566c96321b286bb3159 (diff)
downloadandroid_packages_apps_Snap-61e7e7791a25f87ad31c903873c30ccd053e1f45.zip
android_packages_apps_Snap-61e7e7791a25f87ad31c903873c30ccd053e1f45.tar.gz
android_packages_apps_Snap-61e7e7791a25f87ad31c903873c30ccd053e1f45.tar.bz2
Snap: add QReader to module switch
Author: Joey Rizzoli <joey@lineageos.org> Date: Fri Dec 15 21:54:27 2017 +0100 Snap: add QReader to module switch Change-Id: I7cc33c7ebc6de35d19979a9a70f198029e46d88f Signed-off-by: Joey Rizzoli <joey@lineageos.org> Author: Arne Coucheron <arco68@gmail.com> Date: Sun Jan 14 16:53:49 2018 +0100 QuickReader: Match switch icon size and fill color with other icons Change-Id: I9bfa84ed1ea188470cb9a58c5d59cf8a6b270215 Change-Id: Ia7f575bf6cab7d24a6d1ad167b44a02feb1457d2
-rw-r--r--quickReader/res/drawable/ic_cam_switcher_qr.xml24
-rw-r--r--quickReader/res/values/strings.xml3
-rwxr-xr-xsrc/com/android/camera/CameraActivity.java8
-rw-r--r--src/com/android/camera/ui/ModuleSwitcher.java14
4 files changed, 45 insertions, 4 deletions
diff --git a/quickReader/res/drawable/ic_cam_switcher_qr.xml b/quickReader/res/drawable/ic_cam_switcher_qr.xml
new file mode 100644
index 0000000..0a5ca6a
--- /dev/null
+++ b/quickReader/res/drawable/ic_cam_switcher_qr.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2017 The LineageOS Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="32dp"
+ android:width="32dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="@color/white"
+ android:pathData="M3,11H5V13H3V11M11,5H13V9H11V5M9,11H13V15H11V13H9V11M15,11H17V13H19V11H21V13H19V15H21V19H19V21H17V19H13V21H11V17H15V15H17V13H15V11M19,19V15H17V19H19M15,3H21V9H15V3M17,5V7H19V5H17M3,3H9V9H3V3M5,5V7H7V5H5M3,15H9V21H3V15M5,17V19H7V17H5Z" />
+</vector>
diff --git a/quickReader/res/values/strings.xml b/quickReader/res/values/strings.xml
index 7be2b6f..8974831 100644
--- a/quickReader/res/values/strings.xml
+++ b/quickReader/res/values/strings.xml
@@ -16,6 +16,9 @@
<resources>
<string name="quick_reader_name" translatable="false">QReader</string>
+ <!-- QuickReader: switcher item for qr -->
+ <string name="accessibility_switch_to_qr">QR reader</string>
+
<!-- QuickReader: dismiss button for dialogs -->
<string name="quick_reader_action_dismiss">Dismiss</string>
<!-- QuickReader: toast shown when there's no app installed to open the qr code content -->
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index fca43c9..5d2ae5e 100755
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -121,6 +121,8 @@ import com.android.camera.util.PhotoSphereHelper.PanoramaViewHelper;
import com.android.camera.util.UsageStatistics;
import org.codeaurora.snapcam.R;
+import org.lineageos.quickreader.ScannerActivity;
+
import java.io.File;
import java.io.IOException;
@@ -2184,6 +2186,12 @@ public class CameraActivity extends Activity
@Override
public void onModuleSelected(int moduleIndex) {
+ if (moduleIndex == ModuleSwitcher.QR_MODULE_INDEX) {
+ startActivity(new Intent(this, ScannerActivity.class));
+ finish();
+ return;
+ }
+
mForceReleaseCamera = moduleIndex == ModuleSwitcher.CAPTURE_MODULE_INDEX ||
(mCamera2enabled && moduleIndex == ModuleSwitcher.PHOTO_MODULE_INDEX);
if (mForceReleaseCamera) {
diff --git a/src/com/android/camera/ui/ModuleSwitcher.java b/src/com/android/camera/ui/ModuleSwitcher.java
index e9a9a54..058e64d 100644
--- a/src/com/android/camera/ui/ModuleSwitcher.java
+++ b/src/com/android/camera/ui/ModuleSwitcher.java
@@ -51,10 +51,11 @@ public class ModuleSwitcher extends RotateImageView
public static final int PHOTO_MODULE_INDEX = 0;
public static final int VIDEO_MODULE_INDEX = 1;
public static final int WIDE_ANGLE_PANO_MODULE_INDEX = 2;
- public static final int LIGHTCYCLE_MODULE_INDEX = 3;
- public static final int GCAM_MODULE_INDEX = 4;
- public static final int CAPTURE_MODULE_INDEX = 5;
- public static final int PANOCAPTURE_MODULE_INDEX = 6;
+ public static final int QR_MODULE_INDEX = 3;
+ public static final int LIGHTCYCLE_MODULE_INDEX = 4;
+ public static final int GCAM_MODULE_INDEX = 5;
+ public static final int CAPTURE_MODULE_INDEX = 6;
+ public static final int PANOCAPTURE_MODULE_INDEX = 7;
private boolean mTouchEnabled = true;
private boolean mIsVisible = true;
@@ -63,6 +64,7 @@ public class ModuleSwitcher extends RotateImageView
R.drawable.ic_switch_camera,
R.drawable.ic_switch_video,
R.drawable.ic_switch_pan,
+ R.drawable.ic_cam_switcher_qr,
R.drawable.ic_switch_photosphere,
R.drawable.ic_switch_gcam,
};
@@ -231,6 +233,10 @@ public class ModuleSwitcher extends RotateImageView
item.setContentDescription(getContext().getResources().getString(
R.string.accessibility_switch_to_panorama));
break;
+ case R.drawable.ic_cam_switcher_qr:
+ item.setContentDescription(getContext().getResources().getString(
+ R.string.accessibility_switch_to_qr));
+ break;
case R.drawable.ic_switch_photosphere:
item.setContentDescription(getContext().getResources().getString(
R.string.accessibility_switch_to_photo_sphere));