Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0799e9433f | |||
| 63d02cc8de | |||
| c2ea28ab90 | |||
| 4cd6252713 | |||
| 876b29ef5f | |||
| a50ca1b21a | |||
| a810eaf46f | |||
| b0438e082a | |||
| b79de5d47a | |||
| 5801b63370 | |||
| d4484a58c6 | |||
| 1a3ea5c323 | |||
| d11d76693b | |||
| 087a67fce7 | |||
| 4c6cdcc8c5 | |||
| a9c9bd7585 | |||
| 08eac66e5d | |||
| f6d9380359 |
+15
-4
@@ -1,15 +1,26 @@
|
||||
### 2.1.0
|
||||
### 2.3.0 (2015-04-01)
|
||||
|
||||
* Fix issues with portrait orientation.
|
||||
* Fix camera id used when resuming (from upstream ZXing)
|
||||
* Change default result duration to 0.
|
||||
* Remove more unused code.
|
||||
|
||||
### 2.2.0 (2015-03-28)
|
||||
|
||||
* Experimental setOrientation() option.
|
||||
|
||||
### 2.1.0 (2015-03-20)
|
||||
|
||||
* Update to ZXing 3.2.0.
|
||||
* Removed HelpActivity and EncodeActivity. If there is a need for EncodeActivity, it can be split
|
||||
off as a separate lib. Thanks to @rehan-vanzyl.
|
||||
* Remove some permissions and `<supports-screens>` section from the AndroidManifest.xml.
|
||||
|
||||
### 2.0.1
|
||||
### 2.0.1 (2014-12-20)
|
||||
|
||||
* Changed group name, artifact name, GitHub organization and Maven repository.
|
||||
|
||||
### 2.0.0
|
||||
### 2.0.0 (2014-06-03)
|
||||
|
||||
There are now three libraries:
|
||||
* zxing-android-minimal (equivalent to Barcode Scanner 4.7.0)
|
||||
@@ -24,7 +35,7 @@ Other changes:
|
||||
* Rewrote IntentIntegrator, based on the official IntentIntegrator 3.0.1.
|
||||
|
||||
|
||||
### 1.2.1
|
||||
### 1.2.1 (2014-05-16)
|
||||
|
||||
* Add support for custom capture layouts thanks to @martar.
|
||||
* Add some helper methods to IntentIntegrator.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# ZXing Android Minimal
|
||||
# ZXing Android Embedded
|
||||
|
||||
This is a port of the [ZXing Android Barcode Scanner application](https://github.com/zxing/zxing/) as an Android
|
||||
library project, for embedding in other Android applications. This is not affiliated with the official ZXing project.
|
||||
@@ -12,6 +12,11 @@ There are however some cases in which it is not feasible:
|
||||
|
||||
In these cases, this library may be more suitable.
|
||||
|
||||
**Note: A rewrite of a large part of the codebase is currently in progress on the
|
||||
[3.x branch](https://github.com/journeyapps/zxing-android-embedded/tree/3.x). This
|
||||
will provide much more control over the UI for applications that require it. Any
|
||||
new contributions should be done on the 3.x branch.**
|
||||
|
||||
## Adding aar dependency with Gradle
|
||||
|
||||
**Please note that the repository, group name and artifact names changed in 2.0.1.**
|
||||
@@ -20,25 +25,21 @@ Add the following to your build.gradle file:
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url "http://dl.bintray.com/journeyapps/maven"
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Supports Android 4.0.3 and later (API level 15)
|
||||
compile 'com.journeyapps:zxing-android-embedded:2.1.0@aar'
|
||||
compile 'com.journeyapps:zxing-android-embedded:2.3.0@aar'
|
||||
|
||||
// Supports Android 2.1 and later (API level 7), but not optimal for later Android versions.
|
||||
// If you only plan on supporting Android 4.0.3 and up, you don't need to include this.
|
||||
compile 'com.journeyapps:zxing-android-legacy:2.1.0@aar'
|
||||
compile 'com.journeyapps:zxing-android-legacy:2.3.0@aar'
|
||||
|
||||
// Convenience library to launch the scanning Activities.
|
||||
// It automatically picks the best scanning library from the above two, depending on the
|
||||
// Android version and what is available.
|
||||
compile 'com.journeyapps:zxing-android-integration:2.1.0@aar'
|
||||
compile 'com.journeyapps:zxing-android-integration:2.3.0@aar'
|
||||
|
||||
// Version 3.0.x of zxing core contains some code that is not compatible on Android 2.2 and earlier.
|
||||
// This mostly affects encoding, but you should test if you plan to support these versions.
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ subprojects {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
version = '2.2.0'
|
||||
version = '2.3.0'
|
||||
group = 'com.journeyapps'
|
||||
apply plugin: 'android-sdk-manager'
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
|
||||
|
||||
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="21"/>
|
||||
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="22"/>
|
||||
|
||||
<!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false"/>
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> À propos de codes à barres 1D </title>
|
||||
<title> À propos des codes barres 1D </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Codes à barres traditionnels, tels que ceux imprimés sur l'emballage du produit, sont également connus comme une dimension codes à barres. Il existe plusieurs types couramment utilisés, y compris l'UPC et EAN. La plupart ressembler à ceci: </p>
|
||||
<p> Les codes barres traditionnels, tels que ceux imprimés sur l'emballage des produits commerciaux, sont appelés codes barres 1D. Il existe plusieurs types couramment utilisés, par exemple UPC et EAN. La plupart ressemblent à ceci : </p>
|
||||
<p class="imgcenter"><img src="../images/big-1d.png"/></p>
|
||||
<p> Ces codes à barres 1D contient un code unique qui décrit typiquement un produit, comme un CD ou un livre. Vous pouvez regarder ce code sur internet pour trouver les prix, critiques et autres. </p>
|
||||
<p> Si vous numérisez un livre, vous pouvez également rechercher le contenu du livre pour un mot ou une phrase, et de trouver toutes les pages où il apparaît: </p>
|
||||
<p> Ces codes barres 1D contiennent un code unique qui décrit typiquement un produit, comme un CD ou un livre. Vous pouvez chercher ce code sur Internet pour trouver les prix ou les critiques d'un article. </p>
|
||||
<p> Si vous scannez un livre, vous pouvez également chercher un mot ou une phrase dans le contenu du livre, et trouver toutes les pages où ils apparaissent : </p>
|
||||
<p class="imgcenter"><img src="../images/search-book-contents.jpg"/></p>
|
||||
<p>Traduit par Google Translate.</p></body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -2,26 +2,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> À propos de codes-barres 2D </title>
|
||||
<title> À propos des codes barres 2D </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p><strong> Barcode Scanner </strong> comprend également comment lire deux dimensions, comme les codes-barres QR Codes et les codes Data Matrix. Par exemple, les codes ci-dessous contiennent un lien hypertexte vers la page d'accueil du projet ZXing: </p>
|
||||
<p><strong> Barcode Scanner </strong> permet aussi de lire les codes barres à deux dimensions, comme les codes QR et les codes Data Matrix. Par exemple, les codes ci-dessous contiennent un lien hypertexte vers la page d'accueil du projet ZXing : </p>
|
||||
<p class="imgcenter">
|
||||
<img src="../images/big-qr.png"/>
|
||||
<img src="../images/big-datamatrix.png"/>
|
||||
<img src="../images/big-pdf417.png"/>
|
||||
<img src="../images/big-aztec.png"/></p>
|
||||
<p> Vous pouvez également représenter des informations de contact dans un QR Code, et le mettre sur une carte de visite ou un site Web. Lorsque vous scannez, l'écran de résultats fournit un choix d'actions: </p>
|
||||
<p> Il est également possible de fournir des informations de contact dans un code QR, et le mettre sur une carte de visite ou un site Web. Lorsque vous scannez, l'écran de résultat fournit un choix d'actions : </p>
|
||||
<p class="imgcenter"><img src="../images/contact-results-screen.jpg"/></p>
|
||||
<p> Outre les URL et les informations de contact, les codes QR peuvent aussi contenir: </p>
|
||||
<p> En plus d'une URL ou d'informations de contact, les codes QR peuvent aussi contenir : </p>
|
||||
<ul>
|
||||
<li> Calendrier des événements que vous pouvez ajouter à votre agenda </li>
|
||||
<li> Les numéros de téléphone que vous pouvez composer </li>
|
||||
<li> Numéros SMS, que vous pouvez Texte du message </li>
|
||||
<li> Adresses e-mail, que vous pouvez envoyer un courriel </li>
|
||||
<li> Coordonnées géographiques, que vous pouvez ouvrir dans Google Maps </li>
|
||||
<li> Texte, que vous pouvez lire, puis partager avec un ami </li>
|
||||
<li> Des événements/invitations, que vous pouvez ajouter à votre agenda </li>
|
||||
<li> Des numéros de téléphone que vous pouvez appeler, ou à qui vous pouvez envoyer un SMS </li>
|
||||
<li> Des adresses e-mail, à qui vous pouvez écrire </li>
|
||||
<li> Des coordonnées géographiques, que vous pouvez ouvrir dans Maps </li>
|
||||
<li> Du texte, que vous pouvez lire, puis partager avec un ami </li>
|
||||
</ul>
|
||||
<p>Traduit par Google Translate.</p></body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> L'application officielle Android du projet ZXing open source:<br/>
|
||||
<p> L'application officielle Android du projet open-source ZXing :<br/>
|
||||
<a href="http://github.com/zxing/zxing"> http://github.com/zxing/zxing </a></p>
|
||||
<p> Barcode Scanner utilise la caméra de votre téléphone pour lire des codes barres et de rechercher des informations sur des produits tels que les prix et les critiques. </p>
|
||||
<p> Barcode Scanner utilise la caméra de votre téléphone pour lire des codes barres, et rechercher des informations produit, telles que les prix et les critiques. </p>
|
||||
<p class="imgcenter"><img src="../images/scan-example.png"/></p>
|
||||
<p> Il lit également les codes à barres 2D tels que les codes QR et Data Matrix. Ceux-ci peuvent contenir des liens vers des sites Web, communiquer avec des informations telles que les numéros de téléphone et adresses e-mail, et plus encore. </p>
|
||||
<p> Il lit également les codes barres 2D tels que les codes QR et Data Matrix. Ceux-ci peuvent contenir des liens vers des sites Web, des informations de contact comme des numéros de téléphone et des adresses e-mail, et plus encore. </p>
|
||||
<ul class="touchable">
|
||||
<li><a href="whatsnew.html"> Quoi de neuf dans cette version </a></li>
|
||||
<li><a href="scanning.html"> Comment numériser </a></li>
|
||||
@@ -19,5 +19,5 @@
|
||||
<li><a href="sharing.html"> Comment créer des codes QR </a></li>
|
||||
<li><a href="license.html"> Politique de confidentialité, Informations légales et licence </a></li>
|
||||
</ul>
|
||||
<p>Traduit par Google Translate.</p></body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
<h3> Politique de confidentialité </h3>
|
||||
|
||||
<p><strong class="notranslate">Barcode Scanner</strong> ne pas collecter, stocker ou transmettre des informations sur ses utilisateurs, ni l'utilisation de l'application. L'application accède à des informations personnelles telles que les contacts et les signets seulement dans le but de mettre en œuvre des fonctionnalités de l'application, tels que le partage des contacts et des signets par les codes QR sur l'écran. </p>
|
||||
<p><strong class="notranslate">Barcode Scanner</strong> ne collecte pas, stocke pas ni ne transmet des informations sur ses utilisateurs, ni l'utilisation de l'application. L'application accède à des informations personnelles telles que les contacts et les signets seulement dans le but de mettre en œuvre des fonctionnalités de l'application, tels que le partage des contacts et des signets par les codes QR sur l'écran. </p>
|
||||
|
||||
<p> Notez que cette application accède à des services tiers, y compris Google Books, Google Recherche d'un produit et Amazon, afin de récupérer des informations supplémentaires à la suite d'une analyse. Ces tierces parties reçoivent et peuvent se connecter à ces demandes. En outre, il peut être nécessaire d'envoyer la requête à un serveur exploité par cette application, afin de transformer la demande pour une utilisation avec le service tiers, tels que la signature de la demande. Aucune information supplémentaire n'est ajouté aux demandes en dehors des termes de la requête. </p>
|
||||
<p> Notez que cette application accède à des services tiers, y compris Google Books, Google Recherche d'un produit et Amazon, afin de récupérer des informations supplémentaires à la suite d'une analyse. Ces tierces parties reçoivent ces demandes, et peuvent éventuellement les stocker. En outre, il peut être nécessaire d'envoyer la requête à un serveur exploité par cette application, afin de transformer la demande pour une utilisation avec le service tiers, tels que la signature de la demande. Aucune information supplémentaire n'est ajoutée aux demandes en dehors des termes de la requête. </p>
|
||||
|
||||
<p> A noter également que cette liens d'applications vers des sites et des applications Web de tiers. Encore une fois, aucune information autre que les termes de requête sont transmis dans le cadre de ces liens. Ces sites et applications sont séparés et ne pas affiliée à cette demande, et ne sont pas couverts par la présente Politique de confidentialité. </p>
|
||||
<p> A noter également que cette application fournit des liens vers des sites et des applications Web de tiers. Encore une fois, aucune information autre que les termes de requête ne sont transmis dans le cadre de ces liens. Ces sites et applications sont séparés et ne sont pas affiliés à cette application, et ne sont pas couverts par la présente Politique de confidentialité. </p>
|
||||
|
||||
<h3> Marques </h3>
|
||||
|
||||
@@ -22,9 +22,9 @@ Barcode Scanner, ZXing, QR Code, Data Matrix, Aztec</span> sont tous des marques
|
||||
|
||||
<h3> Licence et droits d'auteur </h3>
|
||||
|
||||
<p> Ce projet est basé sur la <a class="notranslate" href="http://github.com/zxing/zxing">ZXing</a> code à barres open source de numérisation bibliothèque, et est autorisé à vous en vertu de la <a class="notranslate" href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</a> : </p>
|
||||
<p> Ce projet est basé sur la bibliothèque open source de scanning de codes barres <a class="notranslate" href="http://github.com/zxing/zxing">ZXing</a>, et est publié sous <a class="notranslate" href="http://www.apache.org/licenses/LICENSE-2.0.html">Licence Apache 2.0</a> : </p>
|
||||
|
||||
<p style="font-size:200%"><a class="notranslate" href="../html/apache-license.txt">Apache License 2.0</a></p>
|
||||
<p style="font-size:200%"><a class="notranslate" href="../html/apache-license.txt">Licence Apache 2.0</a></p>
|
||||
|
||||
<p>Traduit par Google Translate.</p></body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Barcode Scanner scanne en permanence une zone carrée affichée sur votre écran - ligne juste le téléphone de sorte que le code à barres est complètement à l'intérieur du rectangle du viseur: </p>
|
||||
<p> Barcode Scanner scanne en permanence une zone carrée affichée sur votre écran -- tenez le téléphone droit, de sorte que le code barres soit droit et complètement à l'intérieur du rectangle du viseur : </p>
|
||||
<p class="imgcenter"><img src="../images/demo-yes.png" style="padding:5px"/><img src="../images/demo-no.png" style="padding:5px"/></p>
|
||||
<p> Codes à barres 1D comme ceux qu'on trouve sur les produits nécessitent un téléphone avec autofocus. Sans elle, seuls les codes QR et les codes Data Matrix sera analysable. </p>
|
||||
<p> Quand un code-barres est lu, un bip sonore se jouer et vous verrez les résultats de l'analyse, une description de ce que le code à barres contient, et les options à prendre des mesures sur le contenu. </p>
|
||||
<p> Si vous rencontrez des problèmes de numérisation, assurez-vous de tenir le téléphone fixe. Si l'appareil photo est incapable de se concentrer, essayez de déplacer le téléphone supplémentaire ou plus près du code à barres. </p>
|
||||
<p> Les code barres 1D comme ceux qu'on trouve sur les produits nécessitent un téléphone avec autofocus. Sans autofocus, seuls les codes QR et les codes Data Matrix seront scannables. </p>
|
||||
<p> Quand un code barres est lu, un bip sonore est émis, et le résultat de l'analyse s'affiche : une description de ce que le code barres contient, et ce que vous pouvez faire à partir de ces données. </p>
|
||||
<p> Si vous rencontrez des problèmes pour scanner un code barres, assurez-vous de tenir le téléphone sans trop bouger. Si l'appareil photo n'arrive pas à fournir une image nette, essayez de déplacer le téléphone plus loin ou plus près du code barres. </p>
|
||||
<ul class="touchable">
|
||||
<li><a href="about1d.html"> À propos de codes à barres 1D </a></li>
|
||||
<li><a href="about2d.html"> À propos de codes-barres 2D </a></li>
|
||||
<li><a href="about1d.html"> À propos des codes barres 1D </a></li>
|
||||
<li><a href="about2d.html"> À propos des codes barres 2D </a></li>
|
||||
</ul>
|
||||
<p>Traduit par Google Translate.</p></body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> En plus de la numérisation des codes à barres 2D, Barcode Scanner peut aussi générer un QR Code et l'afficher sur votre écran. Ensuite, vous pouvez le montrer à un ami, et laissez-les scanner le code-barres avec leur téléphone: </p>
|
||||
<p> En plus de scanner des codes barres, Barcode Scanner peut aussi créér un code QR et l'afficher sur votre écran. Ensuite, vous pouvez le montrer à un ami, pour qu'il le scanne avec son téléphone : </p>
|
||||
<p class="imgcenter"><img src="../images/scan-from-phone.png"/></p>
|
||||
<p> Pour utiliser cette fonction, appuyez sur la touche Menu depuis l'écran du balayage principal, puis appuyez sur Partager. Ensuite, choisissez si vous voulez partager un contact, un signet, une application ou le contenu du presse-papiers. Un Code QR est généré automatiquement. Lorsque vous avez terminé, appuyez sur Retour ou d'accueil. </p>
|
||||
<p> Pour utiliser cette fonction, appuyez sur la touche Menu depuis l'écran principal, puis appuyez sur Partager. Ensuite, choisissez si vous voulez partager un contact, un signet, une application ou le contenu du presse-papiers. Un code QR est généré automatiquement. Lorsque vous avez terminé, appuyez sur Retour. </p>
|
||||
<p> Pour générer les codes QR à partir de votre ordinateur, essayez le générateur de code QR ZXing: <a href="http://zxing.appspot.com/generator/"> http://zxing.appspot.com/generator/ </a></p>
|
||||
<p>Traduit par Google Translate.</p></body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
<li> La fonction Historique peut être désactivée </li>
|
||||
<li> Corrections de bugs </li>
|
||||
</ul>
|
||||
<p>Traduit par Google Translate.</p></body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<string name="zxing_preferences_front_light_off">Inactivo</string>
|
||||
<string name="zxing_preferences_front_light_on">Activo</string>
|
||||
<string name="zxing_preferences_front_light_summary">Mejora la exploración en condiciones de poca luz en algunos teléfonos, pero puede causar deslumbramiento. No funciona en todos los teléfonos.</string>
|
||||
<string name="zxing_preferences_front_light_title">Utilizar luz delantera</string>
|
||||
<string name="zxing_preferences_front_light_title">Utilizar flash</string>
|
||||
<string name="zxing_preferences_general_title">Configuración general</string>
|
||||
<string name="zxing_preferences_history_summary">Almacene escáneres en la historia</string>
|
||||
<string name="zxing_preferences_history_title">Añadir a Historia</string>
|
||||
|
||||
@@ -112,8 +112,8 @@
|
||||
<string name="zxing_preferences_front_light_summary">Améliore le balayage lors d\'une faible luminosité sur certains téléphone, mais peut causer un reflet. Ne fonctionne pas sur tous les téléphones.</string>
|
||||
<string name="zxing_preferences_front_light_title">Utiliser la lumière frontale</string>
|
||||
<string name="zxing_preferences_general_title">Paramètres généraux</string>
|
||||
<string name="zxing_preferences_history_summary">Stockez vos scans dans l\'histoire</string>
|
||||
<string name="zxing_preferences_history_title">Ajouter à Histoire</string>
|
||||
<string name="zxing_preferences_history_summary">Stockez vos scans dans l\'historique</string>
|
||||
<string name="zxing_preferences_history_title">Ajouter à l\'historique</string>
|
||||
<string name="zxing_preferences_invert_scan_summary">Balayer des codes-barres blancs sur fond noir. Non disponible sur certains appareils.</string>
|
||||
<string name="zxing_preferences_invert_scan_title">Balayage négatif</string>
|
||||
<string name="zxing_preferences_name">Paramètres</string>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<string name="zxing_msg_redirect">Inoltra</string>
|
||||
<string name="zxing_msg_sbc_book_not_searchable">Spiacenti, questo libro non è ricercabile.</string>
|
||||
<string name="zxing_msg_sbc_failed">Spiacenti, la ricerca ha avuto un problema.</string>
|
||||
<string name="zxing_msg_sbc_no_page_returned">Nessuna pagina restitiuta</string>
|
||||
<string name="zxing_msg_sbc_no_page_returned">Nessuna pagina restituita</string>
|
||||
<string name="zxing_msg_sbc_page">Pagina</string>
|
||||
<string name="zxing_msg_sbc_results">Risultati</string>
|
||||
<string name="zxing_msg_sbc_searching_book">Ricerca libro\u2026</string>
|
||||
@@ -97,7 +97,7 @@
|
||||
<string name="zxing_preferences_decode_1D_industrial_title">1D industriali</string>
|
||||
<string name="zxing_preferences_decode_1D_product_title">1D prodotto</string>
|
||||
<string name="zxing_preferences_decode_Aztec_title">Aztec</string>
|
||||
<string name="zxing_preferences_decode_Data_Matrix_title">Matrice Dati</string>
|
||||
<string name="zxing_preferences_decode_Data_Matrix_title">Data Matrix</string>
|
||||
<string name="zxing_preferences_decode_PDF417_title">PDF417 (β)</string>
|
||||
<string name="zxing_preferences_decode_QR_title">Codici QR</string>
|
||||
<string name="zxing_preferences_device_bug_workarounds_title">Soluzioni alternative dispositivo Bug</string>
|
||||
|
||||
@@ -112,8 +112,8 @@
|
||||
<string name="zxing_preferences_front_light_summary">Улучшает распознавание в условиях низкой освещенности, но может вызвать блики. Работает не на всех устройствах.</string>
|
||||
<string name="zxing_preferences_front_light_title">Фонарик</string>
|
||||
<string name="zxing_preferences_general_title">Общие настройки</string>
|
||||
<string name="zxing_preferences_history_summary">Храните ваши сканы в истории</string>
|
||||
<string name="zxing_preferences_history_title">Добавить в истории</string>
|
||||
<string name="zxing_preferences_history_summary">Сохранять распознанные штрих-коды в истории</string>
|
||||
<string name="zxing_preferences_history_title">Добавлять в историю</string>
|
||||
<string name="zxing_preferences_invert_scan_summary">Сканирование белых штрих-кодов на черном фоне. Не работает на некоторых устройствах.</string>
|
||||
<string name="zxing_preferences_invert_scan_title">Инвертировать</string>
|
||||
<string name="zxing_preferences_name">Настройки</string>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<string name="zxing_button_search_book_contents">Vyhľadať obsah</string>
|
||||
<string name="zxing_button_share_app">Aplikácia</string>
|
||||
<string name="zxing_button_share_bookmark">Záložka</string>
|
||||
<string name="zxing_button_share_by_email">Zdieľať cez e-mail</string>
|
||||
<string name="zxing_button_share_by_email">Zdieľať cez email</string>
|
||||
<string name="zxing_button_share_by_sms">Zdieľať cez SMS</string>
|
||||
<string name="zxing_button_share_clipboard">Schránka</string>
|
||||
<string name="zxing_button_share_contact">Kontakt</string>
|
||||
@@ -42,14 +42,14 @@
|
||||
<string name="zxing_button_web_search">Hľadať na webe</string>
|
||||
<string name="zxing_button_wifi">Pripojiť sa sieti</string>
|
||||
<string name="zxing_contents_contact">Informácie o kontakte</string>
|
||||
<string name="zxing_contents_email">E-mailová adresa</string>
|
||||
<string name="zxing_contents_email">Emailová adresa</string>
|
||||
<string name="zxing_contents_location">Geografické súradnice</string>
|
||||
<string name="zxing_contents_phone">Telefónne číslo</string>
|
||||
<string name="zxing_contents_sms">SMS adresa</string>
|
||||
<string name="zxing_contents_text">Obyčajný text</string>
|
||||
<string name="zxing_history_clear_one_history_text">Vymazať</string>
|
||||
<string name="zxing_history_clear_text">Vymazať históriu</string>
|
||||
<string name="zxing_history_email_title">História Barcode Scanneru</string>
|
||||
<string name="zxing_history_email_title">História Barcode Scannera</string>
|
||||
<string name="zxing_history_empty">Prázdna</string>
|
||||
<string name="zxing_history_empty_detail">Žiadne čiarové kódy neboli zaznamenané</string>
|
||||
<string name="zxing_history_send">Poslať históriu</string>
|
||||
@@ -65,18 +65,18 @@
|
||||
<string name="zxing_msg_default_format">Formát</string>
|
||||
<string name="zxing_msg_default_meta">Metadáta</string>
|
||||
<string name="zxing_msg_default_mms_subject">Ahoj</string>
|
||||
<string name="zxing_msg_default_status">Umiestnite čiarový kód do vnútra obdĺžnika hľadáčiku pre skenovanie.</string>
|
||||
<string name="zxing_msg_default_status">Umiestnite čiarový kód do vnútra obdĺžnika hľadáčiku pre skenovanie</string>
|
||||
<string name="zxing_msg_default_time">Čas</string>
|
||||
<string name="zxing_msg_default_type">Typ</string>
|
||||
<string name="zxing_msg_encode_contents_failed">Nie je možné zakódovať čiarový kód z poskytnutých údajov.</string>
|
||||
<string name="zxing_msg_encode_contents_failed">Nie je možné zakódovať čiarový kód z poskytnutých údajov</string>
|
||||
<string name="zxing_msg_error">Chyba</string>
|
||||
<string name="zxing_msg_google_books">Google</string>
|
||||
<string name="zxing_msg_google_product">Google</string>
|
||||
<string name="zxing_msg_intent_failed">Ospravedlňujeme sa, požadovaná aplikácia nemohla byť spustená. Obsah čiarového kódu je možno neplatný.</string>
|
||||
<string name="zxing_msg_invalid_value">Neplatná hodnota</string>
|
||||
<string name="zxing_msg_redirect">Presmerovať</string>
|
||||
<string name="zxing_msg_sbc_book_not_searchable">Ospravedlňujeme sa, táto kniha nie je prehliadateľná.</string>
|
||||
<string name="zxing_msg_sbc_failed">Ospravedlňujeme sa, vyhľadávanie narazilo na problém.</string>
|
||||
<string name="zxing_msg_sbc_book_not_searchable">Ospravedlňujeme sa, táto kniha nie je prehliadateľná</string>
|
||||
<string name="zxing_msg_sbc_failed">Ospravedlňujeme sa, vyhľadávanie narazilo na problém</string>
|
||||
<string name="zxing_msg_sbc_no_page_returned">Nenašla sa žiadna stránka</string>
|
||||
<string name="zxing_msg_sbc_page">Stránka</string>
|
||||
<string name="zxing_msg_sbc_results">Výsledky</string>
|
||||
@@ -85,10 +85,10 @@
|
||||
<string name="zxing_msg_share_explanation">Môžete zdieľať dáta zobrazením čiarového kódu na displeji vášho zariadenia a jeho zoskenovaním iným zariadením</string>
|
||||
<string name="zxing_msg_share_text">Alebo zadajte nejaký text</string>
|
||||
<string name="zxing_msg_sure">Ste si istí?</string>
|
||||
<string name="zxing_msg_unmount_usb">Ospravedlňujeme sa, SD karta nie je prístupná.</string>
|
||||
<string name="zxing_msg_unmount_usb">Ospravedlňujeme sa, SD karta nie je prístupná</string>
|
||||
<string name="zxing_preferences_actions_title">Pri zistení čiarového kódu</string>
|
||||
<string name="zxing_preferences_auto_focus_title">Použiť automatické zaostrenie</string>
|
||||
<string name="zxing_preferences_auto_open_web_title">Otvorte webové stránky automaticky</string>
|
||||
<string name="zxing_preferences_auto_open_web_title">Otvoriť webové stránky automaticky</string>
|
||||
<string name="zxing_preferences_bulk_mode_summary">Skenovať a ukladať veľa čiarových kódov bez prerušenia</string>
|
||||
<string name="zxing_preferences_bulk_mode_title">Hromadný režim skenovania</string>
|
||||
<string name="zxing_preferences_copy_to_clipboard_title">Kopírovať do schránky</string>
|
||||
@@ -102,7 +102,7 @@
|
||||
<string name="zxing_preferences_decode_QR_title">QR kódy</string>
|
||||
<string name="zxing_preferences_device_bug_workarounds_title">Možné chyby zariadenia</string>
|
||||
<string name="zxing_preferences_disable_barcode_scene_mode_title">Bez scénického režimu čiarového kódu</string>
|
||||
<string name="zxing_preferences_disable_continuous_focus_summary">Použiť iba štandardné zaostrenie.</string>
|
||||
<string name="zxing_preferences_disable_continuous_focus_summary">Použiť iba štandardné zaostrenie</string>
|
||||
<string name="zxing_preferences_disable_continuous_focus_title">Bez nepretržitého zaostrovania</string>
|
||||
<string name="zxing_preferences_disable_exposure_title">Bez expozície</string>
|
||||
<string name="zxing_preferences_disable_metering_title">Bez úpravy jasu</string>
|
||||
@@ -112,9 +112,9 @@
|
||||
<string name="zxing_preferences_front_light_summary">Použiť prisvetlenie</string>
|
||||
<string name="zxing_preferences_front_light_title">Použiť predné svetlo</string>
|
||||
<string name="zxing_preferences_general_title">Všeobecné nastavenia</string>
|
||||
<string name="zxing_preferences_history_summary">Uložte si skeny v histórii</string>
|
||||
<string name="zxing_preferences_history_title">Pridať do dejín</string>
|
||||
<string name="zxing_preferences_invert_scan_summary">Skenovať biele čiarové kódy na čiernom pozadí. Nie je k dispozícii na všetkých zariadeniach.</string>
|
||||
<string name="zxing_preferences_history_summary">Uložiť si skeny v histórii</string>
|
||||
<string name="zxing_preferences_history_title">Pridať do histórie</string>
|
||||
<string name="zxing_preferences_invert_scan_summary">Skenovať biele čiarové kódy na čiernom pozadí. Nie je k dispozícii na všetkých zariadeniach</string>
|
||||
<string name="zxing_preferences_invert_scan_title">Invertované skenovanie</string>
|
||||
<string name="zxing_preferences_name">Nastavenia</string>
|
||||
<string name="zxing_preferences_orientation_title">Neotáčať automaticky</string>
|
||||
@@ -129,7 +129,7 @@
|
||||
<string name="zxing_preferences_vibrate_title">Vibrovať</string>
|
||||
<string name="zxing_result_address_book">Nájdená informácia o kontakte</string>
|
||||
<string name="zxing_result_calendar">Nájdená udalosť kalendára</string>
|
||||
<string name="zxing_result_email_address">Nájdená e-mailová adresa</string>
|
||||
<string name="zxing_result_email_address">Nájdená emailová adresa</string>
|
||||
<string name="zxing_result_geo">Nájdená zemepisná súradnica</string>
|
||||
<string name="zxing_result_isbn">Nájdená kniha</string>
|
||||
<string name="zxing_result_product">Nájdený tovar</string>
|
||||
|
||||
@@ -176,16 +176,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
|
||||
resetStatusView();
|
||||
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.zxing_preview_view);
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
if (hasSurface) {
|
||||
// The activity was paused but not stopped, so the surface still exists. Therefore
|
||||
// surfaceCreated() won't be called, so init the camera here.
|
||||
initCamera(surfaceHolder);
|
||||
} else {
|
||||
// Install the callback and wait for surfaceCreated() to init the camera.
|
||||
surfaceHolder.addCallback(this);
|
||||
}
|
||||
|
||||
beepManager.updatePrefs();
|
||||
ambientLightManager.start(cameraManager);
|
||||
@@ -261,6 +251,17 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);
|
||||
|
||||
}
|
||||
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.zxing_preview_view);
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
if (hasSurface) {
|
||||
// The activity was paused but not stopped, so the surface still exists. Therefore
|
||||
// surfaceCreated() won't be called, so init the camera here.
|
||||
initCamera(surfaceHolder);
|
||||
} else {
|
||||
// Install the callback and wait for surfaceCreated() to init the camera.
|
||||
surfaceHolder.addCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
private int getCurrentOrientation() {
|
||||
|
||||
+5
-5
@@ -19,7 +19,6 @@ package com.google.zxing.client.android.share;
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Browser;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -49,8 +48,8 @@ public final class BookmarkPickerActivity extends ListActivity {
|
||||
private Cursor cursor;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
cursor = getContentResolver().query(Browser.BOOKMARKS_URI, BOOKMARK_PROJECTION,
|
||||
BOOKMARK_SELECTION, null, null);
|
||||
if (cursor == null) {
|
||||
@@ -62,11 +61,12 @@ public final class BookmarkPickerActivity extends ListActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
protected void onPause() {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
cursor = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1 +1 @@
|
||||
zxing-3.2.0
|
||||
zxing-3.2.0-21-gbc3c8e3
|
||||
|
||||
@@ -1,204 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
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.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<SurfaceView android:id="@+id/zxing_preview_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<com.google.zxing.client.android.ViewfinderView
|
||||
android:id="@+id/zxing_viewfinder_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<LinearLayout android:id="@+id/zxing_result_view"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/zxing_result_view"
|
||||
android:visibility="gone"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="top"
|
||||
android:padding="@dimen/zxing_standard_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="right">
|
||||
|
||||
<ImageView android:id="@+id/zxing_barcode_image_view"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="150dip"
|
||||
android:maxHeight="150dip"
|
||||
android:layout_marginBottom="@dimen/zxing_half_padding"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
tools:ignore="ContentDescription"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_format"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_format_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_type"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_type_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_time"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/zxing_meta_text_view_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_meta"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_meta_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/zxing_contents_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_text"
|
||||
android:textColorLink="@color/zxing_result_text"
|
||||
android:textSize="22sp"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_contents_supplement_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_text"
|
||||
android:textColorLink="@color/zxing_result_text"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/zxing_result_button_view"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/zxing_status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/zxing_transparent"
|
||||
android:text="@string/zxing_msg_default_status"
|
||||
android:textColor="@color/zxing_status_text"/>
|
||||
|
||||
</merge>
|
||||
@@ -1,204 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
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.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<SurfaceView android:id="@+id/zxing_preview_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<com.google.zxing.client.android.ViewfinderView
|
||||
android:id="@+id/zxing_viewfinder_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<LinearLayout android:id="@+id/zxing_result_view"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/zxing_result_view"
|
||||
android:visibility="gone"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/zxing_standard_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="right|center_vertical">
|
||||
|
||||
<ImageView android:id="@+id/zxing_barcode_image_view"
|
||||
android:layout_width="160dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="160dip"
|
||||
android:maxHeight="160dip"
|
||||
android:layout_marginBottom="@dimen/zxing_half_padding"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
tools:ignore="ContentDescription"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_format"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_format_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_type"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_type_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_time"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/zxing_meta_text_view_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_meta"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_meta_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/zxing_contents_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_text"
|
||||
android:textColorLink="@color/zxing_result_text"
|
||||
android:textSize="22sp"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_contents_supplement_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_text"
|
||||
android:textColorLink="@color/zxing_result_text"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/zxing_result_button_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/zxing_status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/zxing_transparent"
|
||||
android:text="@string/zxing_msg_default_status"
|
||||
android:textColor="@color/zxing_status_text"/>
|
||||
|
||||
</merge>
|
||||
@@ -19,7 +19,7 @@
|
||||
<string name="zxing_button_cancel">Zrušiť</string>
|
||||
<string name="zxing_button_ok">OK</string>
|
||||
<string name="zxing_contents_contact">Informácie o kontakte</string>
|
||||
<string name="zxing_contents_email">E-mailová adresa</string>
|
||||
<string name="zxing_contents_email">Emailová adresa</string>
|
||||
<string name="zxing_contents_location">Geografické súradnice</string>
|
||||
<string name="zxing_contents_phone">Telefónne číslo</string>
|
||||
<string name="zxing_contents_sms">SMS adresa</string>
|
||||
@@ -27,8 +27,8 @@
|
||||
<string name="zxing_msg_camera_framework_bug">Ospravedlňujeme sa, fotoaparát narazil na problém. Možno bude potrebné reštartovať zariadenie.</string>
|
||||
<string name="zxing_msg_default_format">Formát</string>
|
||||
<string name="zxing_msg_default_meta">Metadáta</string>
|
||||
<string name="zxing_msg_default_status">Umiestnite čiarový kód do vnútra obdĺžnika hľadáčiku pre skenovanie.</string>
|
||||
<string name="zxing_msg_default_status">Umiestnite čiarový kód do vnútra obdĺžnika hľadáčiku pre skenovanie</string>
|
||||
<string name="zxing_msg_default_time">Čas</string>
|
||||
<string name="zxing_msg_default_type">Typ</string>
|
||||
<string name="zxing_msg_unmount_usb">Ospravedlňujeme sa, SD karta nie je prístupná.</string>
|
||||
<string name="zxing_msg_unmount_usb">Ospravedlňujeme sa, SD karta nie je prístupná</string>
|
||||
</resources>
|
||||
|
||||
+185
-3
@@ -1,3 +1,181 @@
|
||||
diff --git a/res-orig/layout/zxing_capture.xml b/res/layout/zxing_capture.xml
|
||||
index a41b156..582e7f6 100755
|
||||
--- a/res-orig/layout/zxing_capture.xml
|
||||
+++ b/res/layout/zxing_capture.xml
|
||||
@@ -26,173 +26,6 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
- <LinearLayout android:id="@+id/zxing_result_view"
|
||||
- android:orientation="vertical"
|
||||
- android:layout_width="fill_parent"
|
||||
- android:layout_height="fill_parent"
|
||||
- android:background="@color/zxing_result_view"
|
||||
- android:visibility="gone"
|
||||
- android:baselineAligned="false">
|
||||
-
|
||||
- <LinearLayout
|
||||
- android:orientation="horizontal"
|
||||
- android:layout_width="fill_parent"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:layout_weight="1"
|
||||
- android:gravity="center"
|
||||
- android:padding="@dimen/zxing_standard_padding">
|
||||
-
|
||||
- <LinearLayout
|
||||
- android:orientation="vertical"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="fill_parent"
|
||||
- android:gravity="right|center_vertical">
|
||||
-
|
||||
- <ImageView android:id="@+id/zxing_barcode_image_view"
|
||||
- android:layout_width="160dip"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:maxWidth="160dip"
|
||||
- android:maxHeight="160dip"
|
||||
- android:layout_marginBottom="@dimen/zxing_half_padding"
|
||||
- android:adjustViewBounds="true"
|
||||
- android:scaleType="centerInside"
|
||||
- tools:ignore="ContentDescription"/>
|
||||
-
|
||||
- <LinearLayout
|
||||
- android:orientation="horizontal"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content">
|
||||
-
|
||||
- <TextView android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:text="@string/zxing_msg_default_format"
|
||||
- android:textColor="@color/zxing_result_minor_text"
|
||||
- android:textStyle="bold"
|
||||
- android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
-
|
||||
- <TextView android:id="@+id/zxing_format_text_view"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:textColor="@color/zxing_result_minor_text"/>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
- <LinearLayout
|
||||
- android:orientation="horizontal"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content">
|
||||
-
|
||||
- <TextView android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:text="@string/zxing_msg_default_type"
|
||||
- android:textColor="@color/zxing_result_minor_text"
|
||||
- android:textStyle="bold"
|
||||
- android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
-
|
||||
- <TextView android:id="@+id/zxing_type_text_view"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:textColor="@color/zxing_result_minor_text"/>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
- <LinearLayout
|
||||
- android:orientation="horizontal"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content">
|
||||
-
|
||||
- <TextView android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:text="@string/zxing_msg_default_time"
|
||||
- android:textColor="@color/zxing_result_minor_text"
|
||||
- android:textStyle="bold"
|
||||
- android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
-
|
||||
- <TextView android:id="@+id/zxing_time_text_view"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:textColor="@color/zxing_result_minor_text"/>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
- <LinearLayout
|
||||
- android:orientation="horizontal"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content">
|
||||
-
|
||||
- <TextView android:id="@+id/zxing_meta_text_view_label"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:text="@string/zxing_msg_default_meta"
|
||||
- android:textColor="@color/zxing_result_minor_text"
|
||||
- android:textStyle="bold"
|
||||
- android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
-
|
||||
- <TextView android:id="@+id/zxing_meta_text_view"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:textColor="@color/zxing_result_minor_text"/>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
- <ScrollView
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content">
|
||||
-
|
||||
- <LinearLayout
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:orientation="vertical">
|
||||
-
|
||||
- <TextView android:id="@+id/zxing_contents_text_view"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:textColor="@color/zxing_result_text"
|
||||
- android:textColorLink="@color/zxing_result_text"
|
||||
- android:textSize="22sp"
|
||||
- android:paddingLeft="12dip"
|
||||
- android:autoLink="web"
|
||||
- android:textIsSelectable="true"/>
|
||||
-
|
||||
- <TextView android:id="@+id/zxing_contents_supplement_text_view"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:textColor="@color/zxing_result_text"
|
||||
- android:textColorLink="@color/zxing_result_text"
|
||||
- android:paddingLeft="12dip"
|
||||
- android:autoLink="web"
|
||||
- android:textIsSelectable="true"/>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
- </ScrollView>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
- <LinearLayout android:id="@+id/zxing_result_button_view"
|
||||
- android:layout_width="fill_parent"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:orientation="horizontal"
|
||||
- android:gravity="center">
|
||||
-
|
||||
- <Button style="@style/zxing_ResultButton"
|
||||
- android:visibility="gone"/>
|
||||
-
|
||||
- <Button style="@style/zxing_ResultButton"
|
||||
- android:visibility="gone"/>
|
||||
-
|
||||
- <Button style="@style/zxing_ResultButton"
|
||||
- android:visibility="gone"/>
|
||||
-
|
||||
- <Button style="@style/zxing_ResultButton"
|
||||
- android:visibility="gone"/>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
<TextView android:id="@+id/zxing_status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
diff --git a/res-orig/values/zxing_themes.xml b/res/values/zxing_themes.xml
|
||||
index 18ac886..f219cf0 100644
|
||||
--- a/res-orig/values/zxing_themes.xml
|
||||
@@ -18,12 +196,16 @@ index 18ac886..f219cf0 100644
|
||||
+</resources>
|
||||
\ No newline at end of file
|
||||
diff --git a/res-orig/values/zxing_ids.xml b/res/values/zxing_ids.xml
|
||||
index 1671f0b..afd30fd 100755
|
||||
index 1671f0b..c01a270 100755
|
||||
--- a/res-orig/values/zxing_ids.xml
|
||||
+++ b/res/values/zxing_ids.xml
|
||||
@@ -22,4 +22,5 @@
|
||||
@@ -18,8 +18,7 @@
|
||||
<item type="id" name="zxing_decode"/>
|
||||
<item type="id" name="zxing_decode_failed"/>
|
||||
<item type="id" name="zxing_decode_succeeded"/>
|
||||
- <item type="id" name="zxing_launch_product_query"/>
|
||||
<item type="id" name="zxing_quit"/>
|
||||
<item type="id" name="zxing_restart_preview"/>
|
||||
- <item type="id" name="zxing_restart_preview"/>
|
||||
<item type="id" name="zxing_return_scan_result"/>
|
||||
+ <item type="id" name="zxing_back_button"/>
|
||||
</resources>
|
||||
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
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.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<SurfaceView android:id="@+id/zxing_preview_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<com.google.zxing.client.android.ViewfinderView
|
||||
android:id="@+id/zxing_viewfinder_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/zxing_transparent"
|
||||
android:text="@string/zxing_msg_default_status"
|
||||
android:textColor="@color/zxing_status_text"/>
|
||||
|
||||
</merge>
|
||||
@@ -18,9 +18,7 @@
|
||||
<item type="id" name="zxing_decode"/>
|
||||
<item type="id" name="zxing_decode_failed"/>
|
||||
<item type="id" name="zxing_decode_succeeded"/>
|
||||
<item type="id" name="zxing_launch_product_query"/>
|
||||
<item type="id" name="zxing_quit"/>
|
||||
<item type="id" name="zxing_restart_preview"/>
|
||||
<item type="id" name="zxing_return_scan_result"/>
|
||||
<item type="id" name="zxing_back_button"/>
|
||||
</resources>
|
||||
|
||||
+610
-164
@@ -1,8 +1,8 @@
|
||||
diff --git a/src-orig/com/google/zxing/client/android/CaptureActivityHandler.java b/src/com/google/zxing/client/android/CaptureActivityHandler.java
|
||||
index 9ec3ecf..3aa269f 100755
|
||||
index 9ec3ecf..e30f43a 100755
|
||||
--- a/src-orig/com/google/zxing/client/android/CaptureActivityHandler.java
|
||||
+++ b/src/com/google/zxing/client/android/CaptureActivityHandler.java
|
||||
@@ -77,58 +77,61 @@ public final class CaptureActivityHandler extends Handler {
|
||||
@@ -77,58 +77,29 @@ public final class CaptureActivityHandler extends Handler {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
@@ -44,10 +44,7 @@ index 9ec3ecf..3aa269f 100755
|
||||
- if (resolveInfo != null && resolveInfo.activityInfo != null) {
|
||||
- browserPackageName = resolveInfo.activityInfo.packageName;
|
||||
- Log.d(TAG, "Using browser in package " + browserPackageName);
|
||||
+ if (message.what == R.id.zxing_restart_preview) {
|
||||
+ restartPreviewAndDecode();
|
||||
+
|
||||
+ } else if (message.what == R.id.zxing_decode_succeeded) {
|
||||
+ if (message.what == R.id.zxing_decode_succeeded) {
|
||||
+ state = State.SUCCESS;
|
||||
+ Bundle bundle = message.getData();
|
||||
+ Bitmap barcode = null;
|
||||
@@ -72,112 +69,251 @@ index 9ec3ecf..3aa269f 100755
|
||||
+ } else if (message.what == R.id.zxing_decode_failed) {// We're decoding as fast as possible, so when one decode fails, start another.
|
||||
+ state = State.PREVIEW;
|
||||
+ cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.zxing_decode);
|
||||
+
|
||||
+ } else if (message.what == R.id.zxing_return_scan_result) {
|
||||
+ activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
||||
+ activity.finish();
|
||||
+
|
||||
+ } else if (message.what == R.id.zxing_launch_product_query) {
|
||||
+ String url = (String) message.obj;
|
||||
+
|
||||
+ Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
+ intent.setData(Uri.parse(url));
|
||||
+
|
||||
+ ResolveInfo resolveInfo =
|
||||
+ activity.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
+ String browserPackageName = null;
|
||||
+ if (resolveInfo != null && resolveInfo.activityInfo != null) {
|
||||
+ browserPackageName = resolveInfo.activityInfo.packageName;
|
||||
+ Log.d(TAG, "Using browser in package " + browserPackageName);
|
||||
+ }
|
||||
+
|
||||
+ // Needed for default Android browser / Chrome only apparently
|
||||
+ if ("com.android.browser".equals(browserPackageName) || "com.android.chrome".equals(browserPackageName)) {
|
||||
+ intent.setPackage(browserPackageName);
|
||||
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
+ intent.putExtra(Browser.EXTRA_APPLICATION_ID, browserPackageName);
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ activity.startActivity(intent);
|
||||
+ } catch (ActivityNotFoundException ignored) {
|
||||
+ Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
|
||||
+ }
|
||||
|
||||
- try {
|
||||
- activity.startActivity(intent);
|
||||
- } catch (ActivityNotFoundException ignored) {
|
||||
- Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
|
||||
- }
|
||||
+ } else if (message.what == R.id.zxing_return_scan_result) {
|
||||
+ activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
||||
+ activity.finish();
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src-orig/com/google/zxing/client/android/PreferencesFragment.java b/src/com/google/zxing/client/android/PreferencesFragment.java
|
||||
index b325064..2da24ac 100644
|
||||
--- a/src-orig/com/google/zxing/client/android/PreferencesFragment.java
|
||||
+++ b/src/com/google/zxing/client/android/PreferencesFragment.java
|
||||
@@ -51,10 +51,6 @@ public final class PreferencesFragment
|
||||
PreferencesActivity.KEY_DECODE_AZTEC,
|
||||
PreferencesActivity.KEY_DECODE_PDF417);
|
||||
disableLastCheckedPref();
|
||||
-
|
||||
- EditTextPreference customProductSearch = (EditTextPreference)
|
||||
- preferences.findPreference(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH);
|
||||
- customProductSearch.setOnPreferenceChangeListener(new CustomSearchURLValidator());
|
||||
}
|
||||
diff --git a/src-orig/com/google/zxing/client/android/PreferencesActivity.java b/src/com/google/zxing/client/android/PreferencesActivity.java
|
||||
index 0644362..cfcdc05 100755
|
||||
--- a/src-orig/com/google/zxing/client/android/PreferencesActivity.java
|
||||
+++ b/src/com/google/zxing/client/android/PreferencesActivity.java
|
||||
@@ -16,57 +16,21 @@
|
||||
|
||||
private static CheckBoxPreference[] findDecodePrefs(PreferenceScreen preferences, String... keys) {
|
||||
@@ -83,44 +79,4 @@ public final class PreferencesFragment
|
||||
}
|
||||
}
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
- private class CustomSearchURLValidator implements Preference.OnPreferenceChangeListener {
|
||||
- @Override
|
||||
- public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
- if (!isValid(newValue)) {
|
||||
- AlertDialog.Builder builder =
|
||||
- new AlertDialog.Builder(PreferencesFragment.this.getActivity());
|
||||
- builder.setTitle(R.string.zxing_msg_error);
|
||||
- builder.setMessage(R.string.zxing_msg_invalid_value);
|
||||
- builder.setCancelable(true);
|
||||
- builder.show();
|
||||
- return false;
|
||||
- }
|
||||
- return true;
|
||||
- }
|
||||
-import android.app.Activity;
|
||||
-import android.os.Bundle;
|
||||
-
|
||||
- private boolean isValid(Object newValue) {
|
||||
- // Allow empty/null value
|
||||
- if (newValue == null) {
|
||||
- return true;
|
||||
- }
|
||||
- String valueString = newValue.toString();
|
||||
- if (valueString.isEmpty()) {
|
||||
- return true;
|
||||
- }
|
||||
- // Before validating, remove custom placeholders, which will not
|
||||
- // be considered valid parts of the URL in some locations:
|
||||
- // Blank %t and %s:
|
||||
- valueString = valueString.replaceAll("%[st]", "");
|
||||
- // Blank %f but not if followed by digit or a-f as it may be a hex sequence
|
||||
- valueString = valueString.replaceAll("%f(?![0-9a-f])", "");
|
||||
- // Require a scheme otherwise:
|
||||
- try {
|
||||
- URI uri = new URI(valueString);
|
||||
- return uri.getScheme() != null;
|
||||
- } catch (URISyntaxException use) {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
/**
|
||||
* The main settings activity.
|
||||
*
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
* @author Sean Owen
|
||||
*/
|
||||
-public final class PreferencesActivity extends Activity {
|
||||
-
|
||||
- public static final String KEY_DECODE_1D_PRODUCT = "zxing_preferences_decode_1D_product";
|
||||
- public static final String KEY_DECODE_1D_INDUSTRIAL = "zxing_preferences_decode_1D_industrial";
|
||||
- public static final String KEY_DECODE_QR = "zxing_preferences_decode_QR";
|
||||
- public static final String KEY_DECODE_DATA_MATRIX = "zxing_preferences_decode_Data_Matrix";
|
||||
- public static final String KEY_DECODE_AZTEC = "zxing_preferences_decode_Aztec";
|
||||
- public static final String KEY_DECODE_PDF417 = "zxing_preferences_decode_PDF417";
|
||||
-
|
||||
- public static final String KEY_CUSTOM_PRODUCT_SEARCH = "zxing_preferences_custom_product_search";
|
||||
-
|
||||
+public final class PreferencesActivity {
|
||||
public static final String KEY_PLAY_BEEP = "zxing_preferences_play_beep";
|
||||
public static final String KEY_VIBRATE = "zxing_preferences_vibrate";
|
||||
- public static final String KEY_COPY_TO_CLIPBOARD = "zxing_preferences_copy_to_clipboard";
|
||||
public static final String KEY_FRONT_LIGHT_MODE = "zxing_preferences_front_light_mode";
|
||||
- public static final String KEY_BULK_MODE = "zxing_preferences_bulk_mode";
|
||||
- public static final String KEY_REMEMBER_DUPLICATES = "zxing_preferences_remember_duplicates";
|
||||
- public static final String KEY_ENABLE_HISTORY = "zxing_preferences_history";
|
||||
- public static final String KEY_SUPPLEMENTAL = "zxing_preferences_supplemental";
|
||||
public static final String KEY_AUTO_FOCUS = "zxing_preferences_auto_focus";
|
||||
- public static final String KEY_INVERT_SCAN = "zxing_preferences_invert_scan";
|
||||
- public static final String KEY_SEARCH_COUNTRY = "zxing_preferences_search_country";
|
||||
- public static final String KEY_DISABLE_AUTO_ORIENTATION = "zxing_preferences_orientation";
|
||||
+ public static final String KEY_INVERT_SCAN = "zxing_preferences_invert_scan";
|
||||
|
||||
public static final String KEY_DISABLE_CONTINUOUS_FOCUS = "zxing_preferences_disable_continuous_focus";
|
||||
public static final String KEY_DISABLE_EXPOSURE = "zxing_preferences_disable_exposure";
|
||||
public static final String KEY_DISABLE_METERING = "zxing_preferences_disable_metering";
|
||||
public static final String KEY_DISABLE_BARCODE_SCENE_MODE = "zxing_preferences_disable_barcode_scene_mode";
|
||||
- public static final String KEY_AUTO_OPEN_WEB = "zxing_preferences_auto_open_web";
|
||||
-
|
||||
- @Override
|
||||
- protected void onCreate(Bundle icicle) {
|
||||
- super.onCreate(icicle);
|
||||
- getFragmentManager().beginTransaction().replace(android.R.id.content, new PreferencesFragment()).commit();
|
||||
- }
|
||||
-
|
||||
- // Apparently this will be necessary when targeting API 19+:
|
||||
- /*
|
||||
- @Override
|
||||
- protected boolean isValidFragment(String fragmentName) {
|
||||
- return true;
|
||||
- }
|
||||
- */
|
||||
-
|
||||
}
|
||||
diff --git a/src-orig/com/google/zxing/client/android/camera/open/OpenCameraInterface.java b/src/com/google/zxing/client/android/camera/open/OpenCameraInterface.java
|
||||
index 1f53bdb..134805e 100644
|
||||
--- a/src-orig/com/google/zxing/client/android/camera/open/OpenCameraInterface.java
|
||||
+++ b/src/com/google/zxing/client/android/camera/open/OpenCameraInterface.java
|
||||
@@ -29,21 +29,15 @@ public final class OpenCameraInterface {
|
||||
/** For {@link #open(int)}, means no preference for which camera to open. */
|
||||
public static final int NO_REQUESTED_CAMERA = -1;
|
||||
|
||||
- /**
|
||||
- * Opens the requested camera with {@link Camera#open(int)}, if one exists.
|
||||
- *
|
||||
- * @param cameraId camera ID of the camera to use. A negative value
|
||||
- * or {@link #NO_REQUESTED_CAMERA} means "no preference"
|
||||
- * @return handle to {@link Camera} that was opened
|
||||
- */
|
||||
- public static Camera open(int cameraId) {
|
||||
-
|
||||
+ public static int getCameraId(int requestedId) {
|
||||
int numCameras = Camera.getNumberOfCameras();
|
||||
if (numCameras == 0) {
|
||||
Log.w(TAG, "No cameras!");
|
||||
- return null;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
+ int cameraId = requestedId;
|
||||
+
|
||||
boolean explicitRequest = cameraId >= 0;
|
||||
|
||||
if (!explicitRequest) {
|
||||
@@ -57,25 +51,34 @@ public final class OpenCameraInterface {
|
||||
}
|
||||
index++;
|
||||
}
|
||||
-
|
||||
+
|
||||
cameraId = index;
|
||||
}
|
||||
|
||||
- Camera camera;
|
||||
if (cameraId < numCameras) {
|
||||
- Log.i(TAG, "Opening camera #" + cameraId);
|
||||
- camera = Camera.open(cameraId);
|
||||
+ return cameraId;
|
||||
} else {
|
||||
if (explicitRequest) {
|
||||
- Log.w(TAG, "Requested camera does not exist: " + cameraId);
|
||||
- camera = null;
|
||||
+ return -1;
|
||||
} else {
|
||||
- Log.i(TAG, "No camera facing back; returning camera #0");
|
||||
- camera = Camera.open(0);
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
-
|
||||
- return camera;
|
||||
+ }
|
||||
+ /**
|
||||
+ * Opens the requested camera with {@link Camera#open(int)}, if one exists.
|
||||
+ *
|
||||
+ * @param requestedId camera ID of the camera to use. A negative value
|
||||
+ * or {@link #NO_REQUESTED_CAMERA} means "no preference"
|
||||
+ * @return handle to {@link Camera} that was opened
|
||||
+ */
|
||||
+ public static Camera open(int requestedId) {
|
||||
+ int cameraId = getCameraId(requestedId);
|
||||
+ if(cameraId == -1) {
|
||||
+ return null;
|
||||
+ } else {
|
||||
+ return Camera.open(cameraId);
|
||||
+ }
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src-orig/com/google/zxing/client/android/camera/CameraConfigurationManager.java b/src/com/google/zxing/client/android/camera/CameraConfigurationManager.java
|
||||
index 6faac7a..e1643af 100644
|
||||
--- a/src-orig/com/google/zxing/client/android/camera/CameraConfigurationManager.java
|
||||
+++ b/src/com/google/zxing/client/android/camera/CameraConfigurationManager.java
|
||||
@@ -23,6 +23,7 @@ import android.hardware.Camera;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
+import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.google.zxing.client.android.PreferencesActivity;
|
||||
@@ -77,10 +78,10 @@ final class CameraConfigurationManager {
|
||||
initializeTorch(parameters, prefs, safeMode);
|
||||
|
||||
CameraConfigurationUtils.setFocus(
|
||||
- parameters,
|
||||
- prefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true),
|
||||
- prefs.getBoolean(PreferencesActivity.KEY_DISABLE_CONTINUOUS_FOCUS, true),
|
||||
- safeMode);
|
||||
+ parameters,
|
||||
+ prefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true),
|
||||
+ prefs.getBoolean(PreferencesActivity.KEY_DISABLE_CONTINUOUS_FOCUS, true),
|
||||
+ safeMode);
|
||||
|
||||
if (!safeMode) {
|
||||
if (prefs.getBoolean(PreferencesActivity.KEY_INVERT_SCAN, false)) {
|
||||
@@ -105,6 +106,7 @@ final class CameraConfigurationManager {
|
||||
|
||||
camera.setParameters(parameters);
|
||||
|
||||
+
|
||||
Camera.Parameters afterParameters = camera.getParameters();
|
||||
Camera.Size afterSize = afterParameters.getPreviewSize();
|
||||
if (afterSize!= null && (cameraResolution.x != afterSize.width || cameraResolution.y != afterSize.height)) {
|
||||
@@ -115,6 +117,30 @@ final class CameraConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ public void setCameraDisplayOrientation(int cameraId, android.hardware.Camera camera) {
|
||||
+ android.hardware.Camera.CameraInfo info =
|
||||
+ new android.hardware.Camera.CameraInfo();
|
||||
+ android.hardware.Camera.getCameraInfo(cameraId, info);
|
||||
+ int rotation = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
|
||||
+ .getRotation();
|
||||
+ int degrees = 0;
|
||||
+ switch (rotation) {
|
||||
+ case Surface.ROTATION_0: degrees = 0; break;
|
||||
+ case Surface.ROTATION_90: degrees = 90; break;
|
||||
+ case Surface.ROTATION_180: degrees = 180; break;
|
||||
+ case Surface.ROTATION_270: degrees = 270; break;
|
||||
+ }
|
||||
+
|
||||
+ int result;
|
||||
+ if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
|
||||
+ result = (info.orientation + degrees) % 360;
|
||||
+ result = (360 - result) % 360; // compensate the mirror
|
||||
+ } else { // back-facing
|
||||
+ result = (info.orientation - degrees + 360) % 360;
|
||||
+ }
|
||||
+ camera.setDisplayOrientation(result);
|
||||
+ }
|
||||
+
|
||||
Point getCameraResolution() {
|
||||
return cameraResolution;
|
||||
}
|
||||
diff --git a/src-orig/com/google/zxing/client/android/camera/CameraManager.java b/src/com/google/zxing/client/android/camera/CameraManager.java
|
||||
index c0caa2b..fd89508 100755
|
||||
--- a/src-orig/com/google/zxing/client/android/camera/CameraManager.java
|
||||
+++ b/src/com/google/zxing/client/android/camera/CameraManager.java
|
||||
@@ -97,7 +97,9 @@ public final class CameraManager {
|
||||
|
||||
Camera.Parameters parameters = theCamera.getParameters();
|
||||
String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
|
||||
+
|
||||
try {
|
||||
+ configManager.setCameraDisplayOrientation(OpenCameraInterface.getCameraId(requestedCameraId), theCamera);
|
||||
configManager.setDesiredCameraParameters(theCamera, false);
|
||||
} catch (RuntimeException re) {
|
||||
// Driver failed
|
||||
@@ -117,6 +119,8 @@ public final class CameraManager {
|
||||
}
|
||||
}
|
||||
|
||||
+
|
||||
+
|
||||
}
|
||||
|
||||
public synchronized boolean isOpen() {
|
||||
diff --git a/src-orig/com/google/zxing/client/android/CaptureActivity.java b/src/com/google/zxing/client/android/CaptureActivity.java
|
||||
index 84592e9..c24ad9e 100755
|
||||
index 35ec55b..283c4ae 100755
|
||||
--- a/src-orig/com/google/zxing/client/android/CaptureActivity.java
|
||||
+++ b/src/com/google/zxing/client/android/CaptureActivity.java
|
||||
@@ -16,29 +16,12 @@
|
||||
@@ -16,58 +16,41 @@
|
||||
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
@@ -197,21 +333,26 @@ index 84592e9..c24ad9e 100755
|
||||
-import com.google.zxing.client.android.result.supplement.SupplementalInfoRetriever;
|
||||
-import com.google.zxing.client.android.share.ShareActivity;
|
||||
-
|
||||
+import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
-import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Bitmap;
|
||||
-import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.net.Uri;
|
||||
@@ -47,26 +30,25 @@ import android.os.Handler;
|
||||
-import android.net.Uri;
|
||||
+import android.graphics.Point;
|
||||
+import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
-import android.util.TypedValue;
|
||||
+import android.view.Display;
|
||||
import android.view.KeyEvent;
|
||||
-import android.view.Menu;
|
||||
-import android.view.MenuInflater;
|
||||
@@ -239,31 +380,45 @@ index 84592e9..c24ad9e 100755
|
||||
-import java.text.DateFormat;
|
||||
import java.util.Collection;
|
||||
-import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
-import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -87,13 +69,12 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
/**
|
||||
@@ -78,39 +61,23 @@ import java.util.Map;
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
* @author Sean Owen
|
||||
*/
|
||||
+@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
|
||||
public final class CaptureActivity extends Activity implements SurfaceHolder.Callback {
|
||||
|
||||
private static final String[] ZXING_URLS = { "http://zxing.appspot.com/scan", "zxing://scan/" };
|
||||
private static final String TAG = CaptureActivity.class.getSimpleName();
|
||||
|
||||
- private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 1500L;
|
||||
- private static final long BULK_MODE_SCAN_DELAY_MS = 1000L;
|
||||
-
|
||||
- private static final String[] ZXING_URLS = { "http://zxing.appspot.com/scan", "zxing://scan/" };
|
||||
+ private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 0L;
|
||||
|
||||
- public static final int HISTORY_REQUEST_CODE = 0x0000bacc;
|
||||
-
|
||||
private static final Collection<ResultMetadataType> DISPLAYABLE_METADATA_TYPES =
|
||||
EnumSet.of(ResultMetadataType.ISSUE_NUMBER,
|
||||
ResultMetadataType.SUGGESTED_PRICE,
|
||||
ResultMetadataType.ERROR_CORRECTION_LEVEL,
|
||||
ResultMetadataType.POSSIBLE_COUNTRY);
|
||||
- private static final Collection<ResultMetadataType> DISPLAYABLE_METADATA_TYPES =
|
||||
- EnumSet.of(ResultMetadataType.ISSUE_NUMBER,
|
||||
- ResultMetadataType.SUGGESTED_PRICE,
|
||||
- ResultMetadataType.ERROR_CORRECTION_LEVEL,
|
||||
- ResultMetadataType.POSSIBLE_COUNTRY);
|
||||
+ public static final java.lang.String ZXING_CAPTURE_LAYOUT_ID_KEY = "ZXING_CAPTURE_LAYOUT_ID_KEY";
|
||||
|
||||
private CameraManager cameraManager;
|
||||
private CaptureActivityHandler handler;
|
||||
@@ -103,18 +84,17 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
private View resultView;
|
||||
private Result lastResult;
|
||||
- private Result savedResultToShow;
|
||||
private ViewfinderView viewfinderView;
|
||||
private TextView statusView;
|
||||
- private View resultView;
|
||||
- private Result lastResult;
|
||||
private boolean hasSurface;
|
||||
- private boolean copyToClipboard;
|
||||
private IntentSource source;
|
||||
private String sourceUrl;
|
||||
- private IntentSource source;
|
||||
- private String sourceUrl;
|
||||
- private ScanFromWebPageManager scanFromWebPageManager;
|
||||
private Collection<BarcodeFormat> decodeFormats;
|
||||
private Map<DecodeHintType,?> decodeHints;
|
||||
@@ -272,19 +427,13 @@ index 84592e9..c24ad9e 100755
|
||||
private InactivityTimer inactivityTimer;
|
||||
private BeepManager beepManager;
|
||||
private AmbientLightManager ambientLightManager;
|
||||
|
||||
+ private Button cancelButton;
|
||||
+
|
||||
ViewfinderView getViewfinderView() {
|
||||
return viewfinderView;
|
||||
}
|
||||
@@ -133,7 +113,15 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
@@ -133,7 +100,15 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
- setContentView(R.layout.zxing_capture);
|
||||
+
|
||||
+ // If the resource id with a layout was provided, set up this leyout
|
||||
+ // If the resource id with a layout was provided, set up this layout
|
||||
+ Bundle extras = getIntent().getExtras();
|
||||
+
|
||||
+ int zxingCaptureLayoutResourceId = R.layout.zxing_capture;
|
||||
@@ -295,22 +444,22 @@ index 84592e9..c24ad9e 100755
|
||||
|
||||
hasSurface = false;
|
||||
inactivityTimer = new InactivityTimer(this);
|
||||
@@ -141,15 +129,25 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
@@ -141,15 +116,25 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
ambientLightManager = new AmbientLightManager(this);
|
||||
|
||||
PreferenceManager.setDefaultValues(this, R.xml.zxing_preferences, false);
|
||||
+
|
||||
+ cancelButton = (Button) findViewById(R.id.zxing_back_button);
|
||||
+ Button cancelButton = (Button) findViewById(R.id.zxing_back_button);
|
||||
+
|
||||
+ // Since the layout can be dynamically set by the Intent, cancelButton may not be present
|
||||
+ if (cancelButton != null) {
|
||||
+ cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
+ @Override
|
||||
+ public void onClick(View view) {
|
||||
+ setResult(RESULT_CANCELED);
|
||||
+ finish();
|
||||
+ }
|
||||
+ });
|
||||
+ @Override
|
||||
+ public void onClick(View view) {
|
||||
+ setResult(RESULT_CANCELED);
|
||||
+ finish();
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
}
|
||||
@@ -325,20 +474,90 @@ index 84592e9..c24ad9e 100755
|
||||
|
||||
// CameraManager must be initialized here, not in onCreate(). This is necessary because we don't
|
||||
// want to open the camera driver and measure the screen size if we're going to show the help on
|
||||
@@ -194,12 +192,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
@@ -160,23 +145,23 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
viewfinderView = (ViewfinderView) findViewById(R.id.zxing_viewfinder_view);
|
||||
viewfinderView.setCameraManager(cameraManager);
|
||||
|
||||
- resultView = findViewById(R.id.zxing_result_view);
|
||||
statusView = (TextView) findViewById(R.id.zxing_status_view);
|
||||
|
||||
handler = null;
|
||||
- lastResult = null;
|
||||
|
||||
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
+ resetStatusView();
|
||||
|
||||
- if (prefs.getBoolean(PreferencesActivity.KEY_DISABLE_AUTO_ORIENTATION, true)) {
|
||||
- setRequestedOrientation(getCurrentOrientation());
|
||||
+ SurfaceView surfaceView = (SurfaceView) findViewById(R.id.zxing_preview_view);
|
||||
+ SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
+ if (hasSurface) {
|
||||
+ // The activity was paused but not stopped, so the surface still exists. Therefore
|
||||
+ // surfaceCreated() won't be called, so init the camera here.
|
||||
+ initCamera(surfaceHolder);
|
||||
} else {
|
||||
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
+ // Install the callback and wait for surfaceCreated() to init the camera.
|
||||
+ surfaceHolder.addCallback(this);
|
||||
}
|
||||
|
||||
- resetStatusView();
|
||||
-
|
||||
-
|
||||
beepManager.updatePrefs();
|
||||
ambientLightManager.start(cameraManager);
|
||||
|
||||
@@ -184,28 +169,40 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
||||
- copyToClipboard = prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true)
|
||||
- && (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true));
|
||||
-
|
||||
source = IntentSource.NONE;
|
||||
- source = IntentSource.NONE;
|
||||
- sourceUrl = null;
|
||||
- scanFromWebPageManager = null;
|
||||
decodeFormats = null;
|
||||
characterSet = null;
|
||||
|
||||
@@ -229,7 +222,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
if (intent != null) {
|
||||
|
||||
String action = intent.getAction();
|
||||
- String dataString = intent.getDataString();
|
||||
|
||||
if (Intents.Scan.ACTION.equals(action)) {
|
||||
|
||||
// Scan the formats the intent requested, and return the result to the calling activity.
|
||||
- source = IntentSource.NATIVE_APP_INTENT;
|
||||
decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);
|
||||
decodeHints = DecodeHintManager.parseDecodeHints(intent);
|
||||
|
||||
- if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) {
|
||||
+
|
||||
+ int orientation = intent.getIntExtra(Intents.Scan.ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
+ if(orientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
|
||||
+ // Lock to landscape or reverse landscape
|
||||
+ //noinspection ResourceType
|
||||
+ setRequestedOrientation(getCurrentOrientation());
|
||||
+ } else {
|
||||
+ //noinspection ResourceType
|
||||
+ setRequestedOrientation(orientation);
|
||||
+ }
|
||||
+
|
||||
+ if (intent.getBooleanExtra(Intents.Scan.WIDE, false)) {
|
||||
+ WindowManager window = getWindowManager();
|
||||
+ Display display = window.getDefaultDisplay();
|
||||
+ Point displaySize = new Point();
|
||||
+ display.getSize(displaySize);
|
||||
+
|
||||
+ int desiredWidth = displaySize.x * 9 / 10; // 90% width
|
||||
+ int desiredHeight = Math.min(displaySize.y * 3 / 4, 400); // 75% height, limit to 400px
|
||||
+ cameraManager.setManualFramingRect(desiredWidth, desiredHeight);
|
||||
+ } else if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) {
|
||||
int width = intent.getIntExtra(Intents.Scan.WIDTH, 0);
|
||||
int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0);
|
||||
if (width > 0 && height > 0) {
|
||||
@@ -219,49 +216,17 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
cameraManager.setManualCameraId(cameraId);
|
||||
}
|
||||
}
|
||||
@@ -347,24 +566,68 @@ index 84592e9..c24ad9e 100755
|
||||
String customPromptMessage = intent.getStringExtra(Intents.Scan.PROMPT_MESSAGE);
|
||||
if (customPromptMessage != null) {
|
||||
statusView.setText(customPromptMessage);
|
||||
@@ -251,7 +244,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
source = IntentSource.ZXING_LINK;
|
||||
sourceUrl = dataString;
|
||||
Uri inputUri = Uri.parse(dataString);
|
||||
}
|
||||
|
||||
- } else if (dataString != null &&
|
||||
- dataString.contains("http://www.google") &&
|
||||
- dataString.contains("/m/products/scan")) {
|
||||
-
|
||||
- // Scan only products and send the result to mobile Product Search.
|
||||
- source = IntentSource.PRODUCT_SEARCH_LINK;
|
||||
- sourceUrl = dataString;
|
||||
- decodeFormats = DecodeFormatManager.PRODUCT_FORMATS;
|
||||
-
|
||||
- } else if (isZXingURL(dataString)) {
|
||||
-
|
||||
- // Scan formats requested in query string (all formats if none specified).
|
||||
- // If a return URL is specified, send the results there. Otherwise, handle it ourselves.
|
||||
- source = IntentSource.ZXING_LINK;
|
||||
- sourceUrl = dataString;
|
||||
- Uri inputUri = Uri.parse(dataString);
|
||||
- scanFromWebPageManager = new ScanFromWebPageManager(inputUri);
|
||||
decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri);
|
||||
// Allow a sub-set of the hints to be specified by the caller.
|
||||
decodeHints = DecodeHintManager.parseDecodeHints(inputUri);
|
||||
@@ -273,7 +265,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
- decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri);
|
||||
- // Allow a sub-set of the hints to be specified by the caller.
|
||||
- decodeHints = DecodeHintManager.parseDecodeHints(inputUri);
|
||||
-
|
||||
}
|
||||
|
||||
characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);
|
||||
|
||||
}
|
||||
-
|
||||
- SurfaceView surfaceView = (SurfaceView) findViewById(R.id.zxing_preview_view);
|
||||
- SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
- if (hasSurface) {
|
||||
- // The activity was paused but not stopped, so the surface still exists. Therefore
|
||||
- // surfaceCreated() won't be called, so init the camera here.
|
||||
- initCamera(surfaceHolder);
|
||||
- } else {
|
||||
- // Install the callback and wait for surfaceCreated() to init the camera.
|
||||
- surfaceHolder.addCallback(this);
|
||||
- }
|
||||
}
|
||||
|
||||
private int getCurrentOrientation() {
|
||||
@@ -274,18 +239,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
private static boolean isZXingURL(String dataString) {
|
||||
if (dataString == null) {
|
||||
return false;
|
||||
@@ -296,7 +288,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
- private static boolean isZXingURL(String dataString) {
|
||||
- if (dataString == null) {
|
||||
- return false;
|
||||
- }
|
||||
- for (String url : ZXING_URLS) {
|
||||
- if (dataString.startsWith(url)) {
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
- return false;
|
||||
- }
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
@@ -297,7 +250,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
ambientLightManager.stop();
|
||||
beepManager.close();
|
||||
cameraManager.closeDriver();
|
||||
@@ -372,11 +635,30 @@ index 84592e9..c24ad9e 100755
|
||||
if (!hasSurface) {
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.zxing_preview_view);
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
@@ -340,49 +331,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
return super.onKeyDown(keyCode, event);
|
||||
@@ -316,16 +268,9 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_BACK:
|
||||
- if (source == IntentSource.NATIVE_APP_INTENT) {
|
||||
- setResult(RESULT_CANCELED);
|
||||
- finish();
|
||||
- return true;
|
||||
- }
|
||||
- if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
|
||||
- restartPreviewAfterDelay(0L);
|
||||
- return true;
|
||||
- }
|
||||
- break;
|
||||
+ setResult(RESULT_CANCELED);
|
||||
+ finish();
|
||||
+ return true;
|
||||
case KeyEvent.KEYCODE_FOCUS:
|
||||
case KeyEvent.KEYCODE_CAMERA:
|
||||
// Handle these events so they don't launch the Camera app
|
||||
@@ -342,65 +287,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
}
|
||||
|
||||
- @Override
|
||||
@Override
|
||||
- public boolean onCreateOptionsMenu(Menu menu) {
|
||||
- MenuInflater menuInflater = getMenuInflater();
|
||||
- menuInflater.inflate(R.menu.zxing_capture, menu);
|
||||
@@ -419,10 +701,27 @@ index 84592e9..c24ad9e 100755
|
||||
- }
|
||||
- }
|
||||
-
|
||||
private void decodeOrStoreSavedBitmap(Bitmap bitmap, Result result) {
|
||||
// Bitmap isn't used yet -- will be used soon
|
||||
if (handler == null) {
|
||||
@@ -424,47 +372,20 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
- private void decodeOrStoreSavedBitmap(Bitmap bitmap, Result result) {
|
||||
- // Bitmap isn't used yet -- will be used soon
|
||||
- if (handler == null) {
|
||||
- savedResultToShow = result;
|
||||
- } else {
|
||||
- if (result != null) {
|
||||
- savedResultToShow = result;
|
||||
- }
|
||||
- if (savedResultToShow != null) {
|
||||
- Message message = Message.obtain(handler, R.id.zxing_decode_succeeded, savedResultToShow);
|
||||
- handler.sendMessage(message);
|
||||
- }
|
||||
- savedResultToShow = null;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
if (holder == null) {
|
||||
Log.e(TAG, "*** WARNING *** surfaceCreated() gave us a null surface!");
|
||||
@@ -425,47 +311,19 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
* A valid barcode has been found, so give an indication of success and show the results.
|
||||
*
|
||||
* @param rawResult The contents of the barcode.
|
||||
@@ -431,7 +730,7 @@ index 84592e9..c24ad9e 100755
|
||||
*/
|
||||
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
|
||||
inactivityTimer.onActivity();
|
||||
lastResult = rawResult;
|
||||
- lastResult = rawResult;
|
||||
- ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
|
||||
|
||||
boolean fromLiveScan = barcode != null;
|
||||
@@ -471,7 +770,7 @@ index 84592e9..c24ad9e 100755
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -510,99 +431,8 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
@@ -511,180 +369,51 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,10 +871,17 @@ index 84592e9..c24ad9e 100755
|
||||
|
||||
if (barcode != null) {
|
||||
viewfinderView.drawResultBitmap(barcode);
|
||||
@@ -616,19 +446,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
DEFAULT_INTENT_RESULT_DURATION_MS);
|
||||
}
|
||||
|
||||
- long resultDurationMS;
|
||||
- if (getIntent() == null) {
|
||||
- resultDurationMS = DEFAULT_INTENT_RESULT_DURATION_MS;
|
||||
- } else {
|
||||
- resultDurationMS = getIntent().getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS,
|
||||
+ long resultDurationMS = getIntent().getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS,
|
||||
DEFAULT_INTENT_RESULT_DURATION_MS);
|
||||
- }
|
||||
|
||||
- if (resultDurationMS > 0) {
|
||||
- String rawResultString = String.valueOf(rawResult);
|
||||
- if (rawResultString.length() > 32) {
|
||||
@@ -587,15 +893,63 @@ index 84592e9..c24ad9e 100755
|
||||
- if (copyToClipboard && !resultHandler.areContentsSecure()) {
|
||||
- CharSequence text = resultHandler.getDisplayContents();
|
||||
- ClipboardInterface.setText(text, this);
|
||||
- }
|
||||
+ // Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
|
||||
+ // the deprecated intent is retired.
|
||||
+ Intent intent = new Intent(getIntent().getAction());
|
||||
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
+ intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
|
||||
+ intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString());
|
||||
+ byte[] rawBytes = rawResult.getRawBytes();
|
||||
+ if (rawBytes != null && rawBytes.length > 0) {
|
||||
+ intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
|
||||
}
|
||||
-
|
||||
if (source == IntentSource.NATIVE_APP_INTENT) {
|
||||
|
||||
// Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
|
||||
@@ -667,22 +484,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
- if (source == IntentSource.NATIVE_APP_INTENT) {
|
||||
-
|
||||
- // Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
|
||||
- // the deprecated intent is retired.
|
||||
- Intent intent = new Intent(getIntent().getAction());
|
||||
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
- intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
|
||||
- intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString());
|
||||
- byte[] rawBytes = rawResult.getRawBytes();
|
||||
- if (rawBytes != null && rawBytes.length > 0) {
|
||||
- intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
|
||||
+ Map<ResultMetadataType,?> metadata = rawResult.getResultMetadata();
|
||||
+ if (metadata != null) {
|
||||
+ if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) {
|
||||
+ intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION,
|
||||
+ metadata.get(ResultMetadataType.UPC_EAN_EXTENSION).toString());
|
||||
}
|
||||
sendReplyMessage(R.id.zxing_return_scan_result, intent, resultDurationMS);
|
||||
|
||||
- Map<ResultMetadataType,?> metadata = rawResult.getResultMetadata();
|
||||
- if (metadata != null) {
|
||||
- if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) {
|
||||
- intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION,
|
||||
- metadata.get(ResultMetadataType.UPC_EAN_EXTENSION).toString());
|
||||
- }
|
||||
- Number orientation = (Number) metadata.get(ResultMetadataType.ORIENTATION);
|
||||
- if (orientation != null) {
|
||||
- intent.putExtra(Intents.Scan.RESULT_ORIENTATION, orientation.intValue());
|
||||
- }
|
||||
- String ecLevel = (String) metadata.get(ResultMetadataType.ERROR_CORRECTION_LEVEL);
|
||||
- if (ecLevel != null) {
|
||||
- intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, ecLevel);
|
||||
- }
|
||||
- @SuppressWarnings("unchecked")
|
||||
- Iterable<byte[]> byteSegments = (Iterable<byte[]>) metadata.get(ResultMetadataType.BYTE_SEGMENTS);
|
||||
- if (byteSegments != null) {
|
||||
- int i = 0;
|
||||
- for (byte[] byteSegment : byteSegments) {
|
||||
- intent.putExtra(Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, byteSegment);
|
||||
- i++;
|
||||
- }
|
||||
- }
|
||||
+ Number orientation = (Number) metadata.get(ResultMetadataType.ORIENTATION);
|
||||
+ if (orientation != null) {
|
||||
+ intent.putExtra(Intents.Scan.RESULT_ORIENTATION, orientation.intValue());
|
||||
}
|
||||
- sendReplyMessage(R.id.zxing_return_scan_result, intent, resultDurationMS);
|
||||
-
|
||||
- } else if (source == IntentSource.PRODUCT_SEARCH_LINK) {
|
||||
-
|
||||
- // Reformulate the URL which triggered us into a query, so that the request goes to the same
|
||||
@@ -610,11 +964,53 @@ index 84592e9..c24ad9e 100755
|
||||
- String replyURL = scanFromWebPageManager.buildReplyURL(rawResult, resultHandler);
|
||||
- scanFromWebPageManager = null;
|
||||
- sendReplyMessage(R.id.zxing_launch_product_query, replyURL, resultDurationMS);
|
||||
- }
|
||||
+ String ecLevel = (String) metadata.get(ResultMetadataType.ERROR_CORRECTION_LEVEL);
|
||||
+ if (ecLevel != null) {
|
||||
+ intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, ecLevel);
|
||||
+ }
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ Iterable<byte[]> byteSegments = (Iterable<byte[]>) metadata.get(ResultMetadataType.BYTE_SEGMENTS);
|
||||
+ if (byteSegments != null) {
|
||||
+ int i = 0;
|
||||
+ for (byte[] byteSegment : byteSegments) {
|
||||
+ intent.putExtra(Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, byteSegment);
|
||||
+ i++;
|
||||
+ }
|
||||
}
|
||||
-
|
||||
}
|
||||
+ sendReplyMessage(R.id.zxing_return_scan_result, intent, resultDurationMS);
|
||||
}
|
||||
|
||||
private void sendReplyMessage(int id, Object arg, long delayMS) {
|
||||
@@ -712,7 +441,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
if (handler == null) {
|
||||
handler = new CaptureActivityHandler(this, decodeFormats, decodeHints, characterSet, cameraManager);
|
||||
}
|
||||
- decodeOrStoreSavedBitmap(null, null);
|
||||
} catch (IOException ioe) {
|
||||
Log.w(TAG, ioe);
|
||||
displayFrameworkBugMessageAndExit();
|
||||
@@ -733,19 +461,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
builder.show();
|
||||
}
|
||||
|
||||
- public void restartPreviewAfterDelay(long delayMS) {
|
||||
- if (handler != null) {
|
||||
- handler.sendEmptyMessageDelayed(R.id.zxing_restart_preview, delayMS);
|
||||
- }
|
||||
- resetStatusView();
|
||||
- }
|
||||
-
|
||||
private void resetStatusView() {
|
||||
- resultView.setVisibility(View.GONE);
|
||||
statusView.setText(R.string.zxing_msg_default_status);
|
||||
statusView.setVisibility(View.VISIBLE);
|
||||
viewfinderView.setVisibility(View.VISIBLE);
|
||||
- lastResult = null;
|
||||
}
|
||||
|
||||
public void drawViewfinder() {
|
||||
diff --git a/src-orig/com/google/zxing/client/android/DecodeHandler.java b/src/com/google/zxing/client/android/DecodeHandler.java
|
||||
index b6a5561..eb8c0ca 100644
|
||||
--- a/src-orig/com/google/zxing/client/android/DecodeHandler.java
|
||||
@@ -657,10 +1053,26 @@ index b6a5561..eb8c0ca 100644
|
||||
} finally {
|
||||
multiFormatReader.reset();
|
||||
diff --git a/src-orig/com/google/zxing/client/android/Intents.java b/src/com/google/zxing/client/android/Intents.java
|
||||
index 6e59e80..5cbe328 100755
|
||||
index 6e59e80..ce4ea63 100755
|
||||
--- a/src-orig/com/google/zxing/client/android/Intents.java
|
||||
+++ b/src/com/google/zxing/client/android/Intents.java
|
||||
@@ -119,7 +119,7 @@ public final class Intents {
|
||||
@@ -102,6 +102,15 @@ public final class Intents {
|
||||
public static final String HEIGHT = "SCAN_HEIGHT";
|
||||
|
||||
/**
|
||||
+ * Boolen parameter to indicate that a wide scanning rectangle should be used.
|
||||
+ */
|
||||
+ public static final String WIDE = "SCAN_WIDE";
|
||||
+
|
||||
+
|
||||
+ public static final String ORIENTATION = "SCAN_ORIENTATION";
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
* Desired duration in milliseconds for which to pause after a successful scan before
|
||||
* returning to the calling intent. Specified as a long, not an integer!
|
||||
* For example: 1000L, not 1000.
|
||||
@@ -119,7 +128,7 @@ public final class Intents {
|
||||
* of the app which requested the scan via
|
||||
* {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
|
||||
* The barcodes contents can be retrieved with
|
||||
@@ -669,7 +1081,7 @@ index 6e59e80..5cbe328 100755
|
||||
* If the user presses Back, the result code will be {@link android.app.Activity#RESULT_CANCELED}.
|
||||
*/
|
||||
public static final String RESULT = "SCAN_RESULT";
|
||||
@@ -165,114 +165,7 @@ public final class Intents {
|
||||
@@ -165,114 +174,7 @@ public final class Intents {
|
||||
*/
|
||||
public static final String RESULT_BYTE_SEGMENTS_PREFIX = "SCAN_RESULT_BYTE_SEGMENTS_";
|
||||
|
||||
@@ -784,3 +1196,37 @@ index 6e59e80..5cbe328 100755
|
||||
- }
|
||||
- }
|
||||
}
|
||||
diff --git a/src-orig/com/google/zxing/client/android/DecodeThread.java b/src/com/google/zxing/client/android/DecodeThread.java
|
||||
index fab4039..90f4285 100755
|
||||
--- a/src-orig/com/google/zxing/client/android/DecodeThread.java
|
||||
+++ b/src/com/google/zxing/client/android/DecodeThread.java
|
||||
@@ -61,29 +61,6 @@ final class DecodeThread extends Thread {
|
||||
hints.putAll(baseHints);
|
||||
}
|
||||
|
||||
- // The prefs can't change while the thread is running, so pick them up once here.
|
||||
- if (decodeFormats == null || decodeFormats.isEmpty()) {
|
||||
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
- decodeFormats = EnumSet.noneOf(BarcodeFormat.class);
|
||||
- if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D_PRODUCT, true)) {
|
||||
- decodeFormats.addAll(DecodeFormatManager.PRODUCT_FORMATS);
|
||||
- }
|
||||
- if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D_INDUSTRIAL, true)) {
|
||||
- decodeFormats.addAll(DecodeFormatManager.INDUSTRIAL_FORMATS);
|
||||
- }
|
||||
- if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_QR, true)) {
|
||||
- decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
|
||||
- }
|
||||
- if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_DATA_MATRIX, true)) {
|
||||
- decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
|
||||
- }
|
||||
- if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_AZTEC, false)) {
|
||||
- decodeFormats.addAll(DecodeFormatManager.AZTEC_FORMATS);
|
||||
- }
|
||||
- if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_PDF417, false)) {
|
||||
- decodeFormats.addAll(DecodeFormatManager.PDF417_FORMATS);
|
||||
- }
|
||||
- }
|
||||
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
|
||||
|
||||
if (characterSet != null) {
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ZXing authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
enum IntentSource {
|
||||
|
||||
NATIVE_APP_INTENT,
|
||||
PRODUCT_SEARCH_LINK,
|
||||
ZXING_LINK,
|
||||
NONE
|
||||
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 ZXing authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Handles any locale-specific logic for the client.
|
||||
*
|
||||
* @author Sean Owen
|
||||
*/
|
||||
public final class LocaleManager {
|
||||
|
||||
private static final String DEFAULT_TLD = "com";
|
||||
private static final String DEFAULT_COUNTRY = "US";
|
||||
private static final String DEFAULT_LANGUAGE = "en";
|
||||
|
||||
/**
|
||||
* Locales (well, countries) where Google web search is available.
|
||||
* These should be kept in sync with our translations.
|
||||
*/
|
||||
private static final Map<String,String> GOOGLE_COUNTRY_TLD;
|
||||
static {
|
||||
GOOGLE_COUNTRY_TLD = new HashMap<>();
|
||||
GOOGLE_COUNTRY_TLD.put("AR", "com.ar"); // ARGENTINA
|
||||
GOOGLE_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA
|
||||
GOOGLE_COUNTRY_TLD.put("BR", "com.br"); // BRAZIL
|
||||
GOOGLE_COUNTRY_TLD.put("BG", "bg"); // BULGARIA
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.CANADA.getCountry(), "ca");
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn");
|
||||
GOOGLE_COUNTRY_TLD.put("CZ", "cz"); // CZECH REPUBLIC
|
||||
GOOGLE_COUNTRY_TLD.put("DK", "dk"); // DENMARK
|
||||
GOOGLE_COUNTRY_TLD.put("FI", "fi"); // FINLAND
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.FRANCE.getCountry(), "fr");
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.GERMANY.getCountry(), "de");
|
||||
GOOGLE_COUNTRY_TLD.put("GR", "gr"); // GREECE
|
||||
GOOGLE_COUNTRY_TLD.put("HU", "hu"); // HUNGARY
|
||||
GOOGLE_COUNTRY_TLD.put("ID", "co.id"); // INDONESIA
|
||||
GOOGLE_COUNTRY_TLD.put("IL", "co.il"); // ISRAEL
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.ITALY.getCountry(), "it");
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.JAPAN.getCountry(), "co.jp");
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.KOREA.getCountry(), "co.kr");
|
||||
GOOGLE_COUNTRY_TLD.put("NL", "nl"); // NETHERLANDS
|
||||
GOOGLE_COUNTRY_TLD.put("PL", "pl"); // POLAND
|
||||
GOOGLE_COUNTRY_TLD.put("PT", "pt"); // PORTUGAL
|
||||
GOOGLE_COUNTRY_TLD.put("RO", "ro"); // ROMANIA
|
||||
GOOGLE_COUNTRY_TLD.put("RU", "ru"); // RUSSIA
|
||||
GOOGLE_COUNTRY_TLD.put("SK", "sk"); // SLOVAK REPUBLIC
|
||||
GOOGLE_COUNTRY_TLD.put("SI", "si"); // SLOVENIA
|
||||
GOOGLE_COUNTRY_TLD.put("ES", "es"); // SPAIN
|
||||
GOOGLE_COUNTRY_TLD.put("SE", "se"); // SWEDEN
|
||||
GOOGLE_COUNTRY_TLD.put("CH", "ch"); // SWITZERLAND
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.TAIWAN.getCountry(), "tw");
|
||||
GOOGLE_COUNTRY_TLD.put("TR", "com.tr"); // TURKEY
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.UK.getCountry(), "co.uk");
|
||||
GOOGLE_COUNTRY_TLD.put(Locale.US.getCountry(), "com");
|
||||
}
|
||||
|
||||
/**
|
||||
* Google Product Search for mobile is available in fewer countries than web search. See here:
|
||||
* http://support.google.com/merchants/bin/answer.py?hl=en-GB&answer=160619
|
||||
*/
|
||||
private static final Map<String,String> GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD;
|
||||
static {
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD = new HashMap<>();
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA
|
||||
//GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn");
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.FRANCE.getCountry(), "fr");
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.GERMANY.getCountry(), "de");
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.ITALY.getCountry(), "it");
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.JAPAN.getCountry(), "co.jp");
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("NL", "nl"); // NETHERLANDS
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("ES", "es"); // SPAIN
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("CH", "ch"); // SWITZERLAND
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.UK.getCountry(), "co.uk");
|
||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.US.getCountry(), "com");
|
||||
}
|
||||
|
||||
/**
|
||||
* Book search is offered everywhere that web search is available.
|
||||
*/
|
||||
private static final Map<String,String> GOOGLE_BOOK_SEARCH_COUNTRY_TLD = GOOGLE_COUNTRY_TLD;
|
||||
|
||||
private static final Collection<String> TRANSLATED_HELP_ASSET_LANGUAGES =
|
||||
Arrays.asList("de", "en", "es", "fr", "it", "ja", "ko", "nl", "pt", "ru", "zh-rCN", "zh-rTW", "zh-rHK");
|
||||
|
||||
private LocaleManager() {}
|
||||
|
||||
/**
|
||||
* @param context application's {@link Context}
|
||||
* @return country-specific TLD suffix appropriate for the current default locale
|
||||
* (e.g. "co.uk" for the United Kingdom)
|
||||
*/
|
||||
public static String getCountryTLD(Context context) {
|
||||
return doGetTLD(GOOGLE_COUNTRY_TLD, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* The same as above, but specifically for Google Product Search.
|
||||
*
|
||||
* @param context application's {@link Context}
|
||||
* @return The top-level domain to use.
|
||||
*/
|
||||
public static String getProductSearchCountryTLD(Context context) {
|
||||
return doGetTLD(GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* The same as above, but specifically for Google Book Search.
|
||||
*
|
||||
* @param context application's {@link Context}
|
||||
* @return The top-level domain to use.
|
||||
*/
|
||||
public static String getBookSearchCountryTLD(Context context) {
|
||||
return doGetTLD(GOOGLE_BOOK_SEARCH_COUNTRY_TLD, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a given URL point to Google Book Search, regardless of domain.
|
||||
*
|
||||
* @param url The address to check.
|
||||
* @return True if this is a Book Search URL.
|
||||
*/
|
||||
public static boolean isBookSearchUrl(String url) {
|
||||
return url.startsWith("http://google.com/books") || url.startsWith("http://books.google.");
|
||||
}
|
||||
|
||||
private static String getSystemCountry() {
|
||||
Locale locale = Locale.getDefault();
|
||||
return locale == null ? DEFAULT_COUNTRY : locale.getCountry();
|
||||
}
|
||||
|
||||
private static String getSystemLanguage() {
|
||||
Locale locale = Locale.getDefault();
|
||||
if (locale == null) {
|
||||
return DEFAULT_LANGUAGE;
|
||||
}
|
||||
String language = locale.getLanguage();
|
||||
// Special case Chinese
|
||||
if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(language)) {
|
||||
return language + "-r" + getSystemCountry();
|
||||
}
|
||||
return language;
|
||||
}
|
||||
|
||||
public static String getTranslatedAssetLanguage() {
|
||||
String language = getSystemLanguage();
|
||||
return TRANSLATED_HELP_ASSET_LANGUAGES.contains(language) ? language : DEFAULT_LANGUAGE;
|
||||
}
|
||||
|
||||
private static String doGetTLD(Map<String,String> map, Context context) {
|
||||
String tld = map.get(getCountry(context));
|
||||
return tld == null ? DEFAULT_TLD : tld;
|
||||
}
|
||||
|
||||
public static String getCountry(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String countryOverride = prefs.getString(PreferencesActivity.KEY_SEARCH_COUNTRY, "-");
|
||||
if (countryOverride != null && !countryOverride.isEmpty() && !"-".equals(countryOverride)) {
|
||||
return countryOverride;
|
||||
}
|
||||
return getSystemCountry();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 ZXing authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* The main settings activity.
|
||||
*
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
* @author Sean Owen
|
||||
*/
|
||||
public final class PreferencesActivity extends Activity {
|
||||
|
||||
public static final String KEY_DECODE_1D_PRODUCT = "zxing_preferences_decode_1D_product";
|
||||
public static final String KEY_DECODE_1D_INDUSTRIAL = "zxing_preferences_decode_1D_industrial";
|
||||
public static final String KEY_DECODE_QR = "zxing_preferences_decode_QR";
|
||||
public static final String KEY_DECODE_DATA_MATRIX = "zxing_preferences_decode_Data_Matrix";
|
||||
public static final String KEY_DECODE_AZTEC = "zxing_preferences_decode_Aztec";
|
||||
public static final String KEY_DECODE_PDF417 = "zxing_preferences_decode_PDF417";
|
||||
|
||||
public static final String KEY_CUSTOM_PRODUCT_SEARCH = "zxing_preferences_custom_product_search";
|
||||
|
||||
public static final String KEY_PLAY_BEEP = "zxing_preferences_play_beep";
|
||||
public static final String KEY_VIBRATE = "zxing_preferences_vibrate";
|
||||
public static final String KEY_COPY_TO_CLIPBOARD = "zxing_preferences_copy_to_clipboard";
|
||||
public static final String KEY_FRONT_LIGHT_MODE = "zxing_preferences_front_light_mode";
|
||||
public static final String KEY_BULK_MODE = "zxing_preferences_bulk_mode";
|
||||
public static final String KEY_REMEMBER_DUPLICATES = "zxing_preferences_remember_duplicates";
|
||||
public static final String KEY_ENABLE_HISTORY = "zxing_preferences_history";
|
||||
public static final String KEY_SUPPLEMENTAL = "zxing_preferences_supplemental";
|
||||
public static final String KEY_AUTO_FOCUS = "zxing_preferences_auto_focus";
|
||||
public static final String KEY_INVERT_SCAN = "zxing_preferences_invert_scan";
|
||||
public static final String KEY_SEARCH_COUNTRY = "zxing_preferences_search_country";
|
||||
public static final String KEY_DISABLE_AUTO_ORIENTATION = "zxing_preferences_orientation";
|
||||
|
||||
public static final String KEY_DISABLE_CONTINUOUS_FOCUS = "zxing_preferences_disable_continuous_focus";
|
||||
public static final String KEY_DISABLE_EXPOSURE = "zxing_preferences_disable_exposure";
|
||||
public static final String KEY_DISABLE_METERING = "zxing_preferences_disable_metering";
|
||||
public static final String KEY_DISABLE_BARCODE_SCENE_MODE = "zxing_preferences_disable_barcode_scene_mode";
|
||||
public static final String KEY_AUTO_OPEN_WEB = "zxing_preferences_auto_open_web";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new PreferencesFragment()).commit();
|
||||
}
|
||||
|
||||
// Apparently this will be necessary when targeting API 19+:
|
||||
/*
|
||||
@Override
|
||||
protected boolean isValidFragment(String fragmentName) {
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -67,9 +66,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
|
||||
private static final String TAG = CaptureActivity.class.getSimpleName();
|
||||
|
||||
private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 1500L;
|
||||
|
||||
private static final String[] ZXING_URLS = { "http://zxing.appspot.com/scan", "zxing://scan/" };
|
||||
private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 0L;
|
||||
|
||||
public static final java.lang.String ZXING_CAPTURE_LAYOUT_ID_KEY = "ZXING_CAPTURE_LAYOUT_ID_KEY";
|
||||
|
||||
@@ -77,10 +74,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
private CaptureActivityHandler handler;
|
||||
private ViewfinderView viewfinderView;
|
||||
private TextView statusView;
|
||||
private View resultView;
|
||||
private Result lastResult;
|
||||
private boolean hasSurface;
|
||||
private IntentSource source;
|
||||
private Collection<BarcodeFormat> decodeFormats;
|
||||
private Map<DecodeHintType,?> decodeHints;
|
||||
private String characterSet;
|
||||
@@ -107,7 +101,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
// If the resource id with a layout was provided, set up this leyout
|
||||
// If the resource id with a layout was provided, set up this layout
|
||||
Bundle extras = getIntent().getExtras();
|
||||
|
||||
int zxingCaptureLayoutResourceId = R.layout.zxing_capture;
|
||||
@@ -151,25 +145,12 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
viewfinderView = (ViewfinderView) findViewById(R.id.zxing_viewfinder_view);
|
||||
viewfinderView.setCameraManager(cameraManager);
|
||||
|
||||
resultView = findViewById(R.id.zxing_result_view);
|
||||
statusView = (TextView) findViewById(R.id.zxing_status_view);
|
||||
|
||||
handler = null;
|
||||
lastResult = null;
|
||||
|
||||
resetStatusView();
|
||||
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.zxing_preview_view);
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
if (hasSurface) {
|
||||
// The activity was paused but not stopped, so the surface still exists. Therefore
|
||||
// surfaceCreated() won't be called, so init the camera here.
|
||||
initCamera(surfaceHolder);
|
||||
} else {
|
||||
// Install the callback and wait for surfaceCreated() to init the camera.
|
||||
surfaceHolder.addCallback(this);
|
||||
}
|
||||
|
||||
beepManager.updatePrefs();
|
||||
ambientLightManager.start(cameraManager);
|
||||
|
||||
@@ -177,19 +158,16 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
||||
source = IntentSource.NONE;
|
||||
decodeFormats = null;
|
||||
characterSet = null;
|
||||
|
||||
if (intent != null) {
|
||||
|
||||
String action = intent.getAction();
|
||||
String dataString = intent.getDataString();
|
||||
|
||||
if (Intents.Scan.ACTION.equals(action)) {
|
||||
|
||||
// Scan the formats the intent requested, and return the result to the calling activity.
|
||||
source = IntentSource.NATIVE_APP_INTENT;
|
||||
decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);
|
||||
decodeHints = DecodeHintManager.parseDecodeHints(intent);
|
||||
|
||||
@@ -233,28 +211,20 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
statusView.setText(customPromptMessage);
|
||||
}
|
||||
|
||||
} else if (dataString != null &&
|
||||
dataString.contains("http://www.google") &&
|
||||
dataString.contains("/m/products/scan")) {
|
||||
|
||||
// Scan only products and send the result to mobile Product Search.
|
||||
source = IntentSource.PRODUCT_SEARCH_LINK;
|
||||
decodeFormats = DecodeFormatManager.PRODUCT_FORMATS;
|
||||
|
||||
} else if (isZXingURL(dataString)) {
|
||||
|
||||
// Scan formats requested in query string (all formats if none specified).
|
||||
// If a return URL is specified, send the results there. Otherwise, handle it ourselves.
|
||||
source = IntentSource.ZXING_LINK;
|
||||
Uri inputUri = Uri.parse(dataString);
|
||||
decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri);
|
||||
// Allow a sub-set of the hints to be specified by the caller.
|
||||
decodeHints = DecodeHintManager.parseDecodeHints(inputUri);
|
||||
|
||||
}
|
||||
|
||||
characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);
|
||||
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.zxing_preview_view);
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
if (hasSurface) {
|
||||
// The activity was paused but not stopped, so the surface still exists. Therefore
|
||||
// surfaceCreated() won't be called, so init the camera here.
|
||||
initCamera(surfaceHolder);
|
||||
} else {
|
||||
// Install the callback and wait for surfaceCreated() to init the camera.
|
||||
surfaceHolder.addCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,18 +239,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isZXingURL(String dataString) {
|
||||
if (dataString == null) {
|
||||
return false;
|
||||
}
|
||||
for (String url : ZXING_URLS) {
|
||||
if (dataString.startsWith(url)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (handler != null) {
|
||||
@@ -309,16 +267,9 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_BACK:
|
||||
if (source == IntentSource.NATIVE_APP_INTENT) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
|
||||
restartPreviewAfterDelay(0L);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
return true;
|
||||
case KeyEvent.KEYCODE_FOCUS:
|
||||
case KeyEvent.KEYCODE_CAMERA:
|
||||
// Handle these events so they don't launch the Camera app
|
||||
@@ -363,7 +314,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
*/
|
||||
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
|
||||
inactivityTimer.onActivity();
|
||||
lastResult = rawResult;
|
||||
|
||||
boolean fromLiveScan = barcode != null;
|
||||
if (fromLiveScan) {
|
||||
@@ -425,53 +375,44 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
viewfinderView.drawResultBitmap(barcode);
|
||||
}
|
||||
|
||||
long resultDurationMS;
|
||||
if (getIntent() == null) {
|
||||
resultDurationMS = DEFAULT_INTENT_RESULT_DURATION_MS;
|
||||
} else {
|
||||
resultDurationMS = getIntent().getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS,
|
||||
long resultDurationMS = getIntent().getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS,
|
||||
DEFAULT_INTENT_RESULT_DURATION_MS);
|
||||
}
|
||||
|
||||
if (source == IntentSource.NATIVE_APP_INTENT) {
|
||||
|
||||
// Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
|
||||
// the deprecated intent is retired.
|
||||
Intent intent = new Intent(getIntent().getAction());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
|
||||
intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString());
|
||||
byte[] rawBytes = rawResult.getRawBytes();
|
||||
if (rawBytes != null && rawBytes.length > 0) {
|
||||
intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
|
||||
}
|
||||
Map<ResultMetadataType,?> metadata = rawResult.getResultMetadata();
|
||||
if (metadata != null) {
|
||||
if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) {
|
||||
intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION,
|
||||
metadata.get(ResultMetadataType.UPC_EAN_EXTENSION).toString());
|
||||
}
|
||||
Number orientation = (Number) metadata.get(ResultMetadataType.ORIENTATION);
|
||||
if (orientation != null) {
|
||||
intent.putExtra(Intents.Scan.RESULT_ORIENTATION, orientation.intValue());
|
||||
}
|
||||
String ecLevel = (String) metadata.get(ResultMetadataType.ERROR_CORRECTION_LEVEL);
|
||||
if (ecLevel != null) {
|
||||
intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, ecLevel);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterable<byte[]> byteSegments = (Iterable<byte[]>) metadata.get(ResultMetadataType.BYTE_SEGMENTS);
|
||||
if (byteSegments != null) {
|
||||
int i = 0;
|
||||
for (byte[] byteSegment : byteSegments) {
|
||||
intent.putExtra(Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, byteSegment);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
sendReplyMessage(R.id.zxing_return_scan_result, intent, resultDurationMS);
|
||||
|
||||
// Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
|
||||
// the deprecated intent is retired.
|
||||
Intent intent = new Intent(getIntent().getAction());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
|
||||
intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString());
|
||||
byte[] rawBytes = rawResult.getRawBytes();
|
||||
if (rawBytes != null && rawBytes.length > 0) {
|
||||
intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
|
||||
}
|
||||
Map<ResultMetadataType,?> metadata = rawResult.getResultMetadata();
|
||||
if (metadata != null) {
|
||||
if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) {
|
||||
intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION,
|
||||
metadata.get(ResultMetadataType.UPC_EAN_EXTENSION).toString());
|
||||
}
|
||||
Number orientation = (Number) metadata.get(ResultMetadataType.ORIENTATION);
|
||||
if (orientation != null) {
|
||||
intent.putExtra(Intents.Scan.RESULT_ORIENTATION, orientation.intValue());
|
||||
}
|
||||
String ecLevel = (String) metadata.get(ResultMetadataType.ERROR_CORRECTION_LEVEL);
|
||||
if (ecLevel != null) {
|
||||
intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, ecLevel);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterable<byte[]> byteSegments = (Iterable<byte[]>) metadata.get(ResultMetadataType.BYTE_SEGMENTS);
|
||||
if (byteSegments != null) {
|
||||
int i = 0;
|
||||
for (byte[] byteSegment : byteSegments) {
|
||||
intent.putExtra(Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, byteSegment);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
sendReplyMessage(R.id.zxing_return_scan_result, intent, resultDurationMS);
|
||||
}
|
||||
|
||||
private void sendReplyMessage(int id, Object arg, long delayMS) {
|
||||
@@ -519,19 +460,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||
builder.show();
|
||||
}
|
||||
|
||||
public void restartPreviewAfterDelay(long delayMS) {
|
||||
if (handler != null) {
|
||||
handler.sendEmptyMessageDelayed(R.id.zxing_restart_preview, delayMS);
|
||||
}
|
||||
resetStatusView();
|
||||
}
|
||||
|
||||
private void resetStatusView() {
|
||||
resultView.setVisibility(View.GONE);
|
||||
statusView.setText(R.string.zxing_msg_default_status);
|
||||
statusView.setVisibility(View.VISIBLE);
|
||||
viewfinderView.setVisibility(View.VISIBLE);
|
||||
lastResult = null;
|
||||
}
|
||||
|
||||
public void drawViewfinder() {
|
||||
|
||||
@@ -77,10 +77,7 @@ public final class CaptureActivityHandler extends Handler {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
if (message.what == R.id.zxing_restart_preview) {
|
||||
restartPreviewAndDecode();
|
||||
|
||||
} else if (message.what == R.id.zxing_decode_succeeded) {
|
||||
if (message.what == R.id.zxing_decode_succeeded) {
|
||||
state = State.SUCCESS;
|
||||
Bundle bundle = message.getData();
|
||||
Bitmap barcode = null;
|
||||
@@ -103,35 +100,6 @@ public final class CaptureActivityHandler extends Handler {
|
||||
} else if (message.what == R.id.zxing_return_scan_result) {
|
||||
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
||||
activity.finish();
|
||||
|
||||
} else if (message.what == R.id.zxing_launch_product_query) {
|
||||
String url = (String) message.obj;
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
intent.setData(Uri.parse(url));
|
||||
|
||||
ResolveInfo resolveInfo =
|
||||
activity.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
String browserPackageName = null;
|
||||
if (resolveInfo != null && resolveInfo.activityInfo != null) {
|
||||
browserPackageName = resolveInfo.activityInfo.packageName;
|
||||
Log.d(TAG, "Using browser in package " + browserPackageName);
|
||||
}
|
||||
|
||||
// Needed for default Android browser / Chrome only apparently
|
||||
if ("com.android.browser".equals(browserPackageName) || "com.android.chrome".equals(browserPackageName)) {
|
||||
intent.setPackage(browserPackageName);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Browser.EXTRA_APPLICATION_ID, browserPackageName);
|
||||
}
|
||||
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
} catch (ActivityNotFoundException ignored) {
|
||||
Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-23
@@ -61,29 +61,6 @@ final class DecodeThread extends Thread {
|
||||
hints.putAll(baseHints);
|
||||
}
|
||||
|
||||
// The prefs can't change while the thread is running, so pick them up once here.
|
||||
if (decodeFormats == null || decodeFormats.isEmpty()) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
decodeFormats = EnumSet.noneOf(BarcodeFormat.class);
|
||||
if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D_PRODUCT, true)) {
|
||||
decodeFormats.addAll(DecodeFormatManager.PRODUCT_FORMATS);
|
||||
}
|
||||
if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D_INDUSTRIAL, true)) {
|
||||
decodeFormats.addAll(DecodeFormatManager.INDUSTRIAL_FORMATS);
|
||||
}
|
||||
if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_QR, true)) {
|
||||
decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
|
||||
}
|
||||
if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_DATA_MATRIX, true)) {
|
||||
decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
|
||||
}
|
||||
if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_AZTEC, false)) {
|
||||
decodeFormats.addAll(DecodeFormatManager.AZTEC_FORMATS);
|
||||
}
|
||||
if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_PDF417, false)) {
|
||||
decodeFormats.addAll(DecodeFormatManager.PDF417_FORMATS);
|
||||
}
|
||||
}
|
||||
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
|
||||
|
||||
if (characterSet != null) {
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2008 ZXing authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/**
|
||||
* The main settings activity.
|
||||
*
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
* @author Sean Owen
|
||||
*/
|
||||
public final class PreferencesActivity {
|
||||
public static final String KEY_PLAY_BEEP = "zxing_preferences_play_beep";
|
||||
public static final String KEY_VIBRATE = "zxing_preferences_vibrate";
|
||||
public static final String KEY_FRONT_LIGHT_MODE = "zxing_preferences_front_light_mode";
|
||||
public static final String KEY_AUTO_FOCUS = "zxing_preferences_auto_focus";
|
||||
public static final String KEY_INVERT_SCAN = "zxing_preferences_invert_scan";
|
||||
|
||||
public static final String KEY_DISABLE_CONTINUOUS_FOCUS = "zxing_preferences_disable_continuous_focus";
|
||||
public static final String KEY_DISABLE_EXPOSURE = "zxing_preferences_disable_exposure";
|
||||
public static final String KEY_DISABLE_METERING = "zxing_preferences_disable_metering";
|
||||
public static final String KEY_DISABLE_BARCODE_SCENE_MODE = "zxing_preferences_disable_barcode_scene_mode";
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 ZXing authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceScreen;
|
||||
|
||||
public final class PreferencesFragment
|
||||
extends PreferenceFragment
|
||||
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private CheckBoxPreference[] checkBoxPrefs;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
addPreferencesFromResource(R.xml.zxing_preferences);
|
||||
|
||||
PreferenceScreen preferences = getPreferenceScreen();
|
||||
preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
checkBoxPrefs = findDecodePrefs(preferences,
|
||||
PreferencesActivity.KEY_DECODE_1D_PRODUCT,
|
||||
PreferencesActivity.KEY_DECODE_1D_INDUSTRIAL,
|
||||
PreferencesActivity.KEY_DECODE_QR,
|
||||
PreferencesActivity.KEY_DECODE_DATA_MATRIX,
|
||||
PreferencesActivity.KEY_DECODE_AZTEC,
|
||||
PreferencesActivity.KEY_DECODE_PDF417);
|
||||
disableLastCheckedPref();
|
||||
}
|
||||
|
||||
private static CheckBoxPreference[] findDecodePrefs(PreferenceScreen preferences, String... keys) {
|
||||
CheckBoxPreference[] prefs = new CheckBoxPreference[keys.length];
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
prefs[i] = (CheckBoxPreference) preferences.findPreference(keys[i]);
|
||||
}
|
||||
return prefs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
disableLastCheckedPref();
|
||||
}
|
||||
|
||||
private void disableLastCheckedPref() {
|
||||
Collection<CheckBoxPreference> checked = new ArrayList<>(checkBoxPrefs.length);
|
||||
for (CheckBoxPreference pref : checkBoxPrefs) {
|
||||
if (pref.isChecked()) {
|
||||
checked.add(pref);
|
||||
}
|
||||
}
|
||||
boolean disable = checked.size() <= 1;
|
||||
for (CheckBoxPreference pref : checkBoxPrefs) {
|
||||
pref.setEnabled(!(disable && checked.contains(pref)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -141,10 +141,35 @@ final class CameraConfigurationManager {
|
||||
camera.setDisplayOrientation(result);
|
||||
}
|
||||
|
||||
public boolean isDisplayRotated() {
|
||||
int rotation = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
|
||||
.getRotation();
|
||||
switch (rotation) {
|
||||
case Surface.ROTATION_0:
|
||||
case Surface.ROTATION_180:
|
||||
return true;
|
||||
case Surface.ROTATION_90:
|
||||
case Surface.ROTATION_270:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Point getCameraResolution() {
|
||||
return cameraResolution;
|
||||
}
|
||||
|
||||
Point getRotatedCameraResolution() {
|
||||
if(cameraResolution == null) {
|
||||
return null;
|
||||
} else if(isDisplayRotated()) {
|
||||
//noinspection SuspiciousNameCombination
|
||||
return new Point(cameraResolution.y, cameraResolution.x);
|
||||
} else {
|
||||
return cameraResolution;
|
||||
}
|
||||
}
|
||||
|
||||
Point getScreenResolution() {
|
||||
return screenResolution;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ public final class CameraManager {
|
||||
return null;
|
||||
}
|
||||
Rect rect = new Rect(framingRect);
|
||||
Point cameraResolution = configManager.getCameraResolution();
|
||||
Point cameraResolution = configManager.getRotatedCameraResolution();
|
||||
Point screenResolution = configManager.getScreenResolution();
|
||||
if (cameraResolution == null || screenResolution == null) {
|
||||
// Called early, before init even finished
|
||||
@@ -323,9 +323,38 @@ public final class CameraManager {
|
||||
if (rect == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Go ahead and assume it's YUV rather than die.
|
||||
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
|
||||
rect.width(), rect.height(), false);
|
||||
if(configManager.isDisplayRotated()) {
|
||||
byte[] rotated = rotate(data, width, height);
|
||||
//noinspection SuspiciousNameCombination
|
||||
return new PlanarYUVLuminanceSource(rotated, height, width, rect.left, rect.top, rect.width(), rect.height(), false);
|
||||
} else {
|
||||
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, rect.width(), rect.height(), false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate an image by 90 degrees CCW.
|
||||
*
|
||||
* @param data the image data, in with the first width * height bytes being the luminance data.
|
||||
* @param imageWidth the width of the image
|
||||
* @param imageHeight the height of the image
|
||||
* @return the rotated bytes
|
||||
*/
|
||||
public static byte[] rotate(byte[] data, int imageWidth, int imageHeight) {
|
||||
// Adapted from http://stackoverflow.com/a/15775173
|
||||
// data may contain more than just y (u and v), but we are only interested in the y section.
|
||||
//
|
||||
byte[] yuv = new byte[imageWidth * imageHeight];
|
||||
int i = 0;
|
||||
for (int x = 0; x < imageWidth; x++) {
|
||||
for (int y = imageHeight - 1; y >= 0; y--) {
|
||||
yuv[i] = data[y * imageWidth + x];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return yuv;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+16
-11
@@ -27,22 +27,20 @@ end
|
||||
|
||||
# Remove unsused source files
|
||||
orig_prefix = 'src-orig/com/google/zxing/client/android/'
|
||||
remove_all orig_prefix, %w(HttpHelper.java HelpActivity.java ScanFromWebPageManager.java Contents.java book history result share wifi clipboard encode)
|
||||
|
||||
|
||||
# We have custom versions of each of these files - remove the original ones and log the diff
|
||||
FileUtils.rm_f 'source.patch'
|
||||
Dir['src/com/google/zxing/client/android/*.java'].each do |our_file|
|
||||
Dir['src/com/google/zxing/client/android/**/*.java'].each do |our_file|
|
||||
orig_file = our_file.gsub(/src/, 'src-orig')
|
||||
`git diff --no-index #{orig_file} #{our_file} >> source.patch`
|
||||
FileUtils.rm orig_file
|
||||
if File.exists? orig_file
|
||||
`git diff --no-index #{orig_file} #{our_file} >> source.patch`
|
||||
FileUtils.rm orig_file
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Remove unsused resource files
|
||||
remove_all 'res-orig/', %w(drawable drawable-*)
|
||||
remove_all 'res-orig/layout/', %w(zxing_encode.xml zxing_help.xml zxing_share.xml *_list_item.xml zxing_search_book_*.xml)
|
||||
remove_all 'res-orig/', %w(layout-land menu)
|
||||
remove_all orig_prefix, %w(HttpHelper.java HelpActivity.java ScanFromWebPageManager.java Contents.java IntentSource.java LocaleManager.java PreferencesFragment.java book history result share wifi clipboard encode)
|
||||
|
||||
|
||||
|
||||
# Remove strings we don't use
|
||||
@@ -131,6 +129,13 @@ end
|
||||
FileUtils.rm_f 'res.patch'
|
||||
Dir['res/**/*.xml'].each do |our_file|
|
||||
orig_file = our_file.gsub(/res/, 'res-orig')
|
||||
`git diff --no-index #{orig_file} #{our_file} >> res.patch`
|
||||
FileUtils.rm orig_file
|
||||
if File.exists? orig_file
|
||||
`git diff --no-index #{orig_file} #{our_file} >> res.patch`
|
||||
FileUtils.rm orig_file
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Remove unused resource files
|
||||
remove_all 'res-orig/', %w(drawable drawable-*)
|
||||
remove_all 'res-orig/', %w(layout layout-ldpi layout-land menu)
|
||||
|
||||
Reference in New Issue
Block a user