The new Android client, featuring:
[zxing.git] / android / src / com / google / zxing / client / android / Intents.java
1 /*
2  * Copyright (C) 2008 ZXing authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.google.zxing.client.android;
18
19 public final class Intents {
20
21   public static final class Scan {
22     /**
23      * Send this intent to open the Barcodes app in scanning mode, find a barcode, and return
24      * the results.
25      */
26     public static final String ACTION = "com.google.zxing.client.android.SCAN";
27
28     // For compatibility only - do not use in new code, this will go away!
29     public static final String DEPRECATED_ACTION = "com.android.barcodes.SCAN";
30
31     /**
32      * By default, sending Scan.ACTION will decode all barcodes that we understand. However it
33      * may be useful to limit scanning to certain formats. Use Intent.putExtra(MODE, value) with
34      * one of the values below (optional).
35      */
36     public static final String MODE = "SCAN_MODE";
37
38     /**
39      * Decode only UPC and EAN barcodes. This is the right choice for shopping apps which get
40      * prices, reviews, etc. for products.
41      */
42     public static final String PRODUCT_MODE = "PRODUCT_MODE";
43
44     /**
45      * Decode only 1D barcodes (currently UPC, EAN, Code 39, and Code 128).
46      */
47     public static final String ONE_D_MODE = "ONE_D_MODE";
48
49     /**
50      * Decode only QR codes.
51      */
52     public static final String QR_CODE_MODE = "QR_CODE_MODE";
53
54     /**
55      * If a barcode is found, Barcodes returns RESULT_OK to onActivityResult() of the app which
56      * requested the scan via startSubActivity(). The barcodes contents can be retrieved with
57      * intent.getStringExtra(RESULT). If the user presses Back, the result code will be
58      * RESULT_CANCELED.
59      */
60     public static final String RESULT = "SCAN_RESULT";
61
62     /**
63      * Call intent.getStringExtra(RESULT_FORMAT) to determine which barcode format was found.
64      * See Contents.Format for possible values.
65      */
66     public static final String RESULT_FORMAT = "SCAN_RESULT_FORMAT";
67   }
68
69   public static final class Encode {
70     /**
71      * Send this intent to encode a piece of data as a QR code and display it full screen, so
72      * that another person can scan the barcode from your screen.
73      */
74     public static final String ACTION = "com.google.zxing.client.android.ENCODE";
75
76     // For compatibility only - do not use in new code, this will go away!
77     public static final String DEPRECATED_ACTION = "com.android.barcodes.ENCODE";
78
79     /**
80      * The data to encode. Use Intent.putExtra(DATA, data) where data is either a String or a
81      * Bundle, depending on the type specified. See Contents for details.
82      */
83     public static final String DATA = "ENCODE_DATA";
84
85     /**
86      * The type of data being supplied. Use Intent.putExtra(TYPE, type) with one of
87      * Contents.Type.
88      */
89     public static final String TYPE = "ENCODE_TYPE";
90   }
91
92   public static final class SearchBookContents {
93     /**
94      * Use Google Book Search to search the contents of the book provided.
95      */
96     public static final String ACTION = "com.google.zxing.client.android.SEARCH_BOOK_CONTENTS";
97
98     // For compatibility only - do not use in new code, this will go away!
99     public static final String DEPRECATED_ACTION = "com.android.barcodes.SEARCH_BOOK_CONTENTS";
100
101     /**
102      * The book to search, identified by ISBN number.
103      */
104     public static final String ISBN = "ISBN";
105
106     /**
107      * An optional field which is the text to search for.
108      */
109     public static final String QUERY = "QUERY";
110   }
111
112 }