Try adding current javadoc to SVN
[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   private Intents() {
22   }
23
24   public static final class Scan {
25     /**
26      * Send this intent to open the Barcodes app in scanning mode, find a barcode, and return
27      * the results.
28      */
29     public static final String ACTION = "com.google.zxing.client.android.SCAN";
30
31     // For compatibility only - do not use in new code, this will go away!
32     public static final String DEPRECATED_ACTION = "com.android.barcodes.SCAN";
33
34     /**
35      * By default, sending Scan.ACTION will decode all barcodes that we understand. However it
36      * may be useful to limit scanning to certain formats. Use Intent.putExtra(MODE, value) with
37      * one of the values below (optional).
38      */
39     public static final String MODE = "SCAN_MODE";
40
41     /**
42      * Decode only UPC and EAN barcodes. This is the right choice for shopping apps which get
43      * prices, reviews, etc. for products.
44      */
45     public static final String PRODUCT_MODE = "PRODUCT_MODE";
46
47     /**
48      * Decode only 1D barcodes (currently UPC, EAN, Code 39, and Code 128).
49      */
50     public static final String ONE_D_MODE = "ONE_D_MODE";
51
52     /**
53      * Decode only QR codes.
54      */
55     public static final String QR_CODE_MODE = "QR_CODE_MODE";
56
57     /**
58      * If a barcode is found, Barcodes returns RESULT_OK to onActivityResult() of the app which
59      * requested the scan via startSubActivity(). The barcodes contents can be retrieved with
60      * intent.getStringExtra(RESULT). If the user presses Back, the result code will be
61      * RESULT_CANCELED.
62      */
63     public static final String RESULT = "SCAN_RESULT";
64
65     /**
66      * Call intent.getStringExtra(RESULT_FORMAT) to determine which barcode format was found.
67      * See Contents.Format for possible values.
68      */
69     public static final String RESULT_FORMAT = "SCAN_RESULT_FORMAT";
70
71     private Scan() {
72     }
73   }
74
75   public static final class Encode {
76     /**
77      * Send this intent to encode a piece of data as a QR code and display it full screen, so
78      * that another person can scan the barcode from your screen.
79      */
80     public static final String ACTION = "com.google.zxing.client.android.ENCODE";
81
82     // For compatibility only - do not use in new code, this will go away!
83     public static final String DEPRECATED_ACTION = "com.android.barcodes.ENCODE";
84
85     /**
86      * The data to encode. Use Intent.putExtra(DATA, data) where data is either a String or a
87      * Bundle, depending on the type and format specified. Non-QR Code formats should
88      * just use a String here. For QR Code, see Contents for details.
89      */
90     public static final String DATA = "ENCODE_DATA";
91
92     /**
93      * The type of data being supplied if the format is QR Code. Use
94      * Intent.putExtra(TYPE, type) with one of Contents.Type.
95      */
96     public static final String TYPE = "ENCODE_TYPE";
97     
98     /**
99      * The barcode format to be displayed. If this isn't specified or is blank, 
100      * it defaults to QR Code. Use Intent.putExtra(FORMAT, format), where
101      * format is one of Contents.Format. 
102      */
103     public static final String FORMAT = "com.google.zxing.client.android.ENCODE_FORMAT";
104
105     private Encode() {
106     }
107   }
108
109   public static final class SearchBookContents {
110     /**
111      * Use Google Book Search to search the contents of the book provided.
112      */
113     public static final String ACTION = "com.google.zxing.client.android.SEARCH_BOOK_CONTENTS";
114
115     // For compatibility only - do not use in new code, this will go away!
116     public static final String DEPRECATED_ACTION = "com.android.barcodes.SEARCH_BOOK_CONTENTS";
117
118     /**
119      * The book to search, identified by ISBN number.
120      */
121     public static final String ISBN = "ISBN";
122
123     /**
124      * An optional field which is the text to search for.
125      */
126     public static final String QUERY = "QUERY";
127
128     private SearchBookContents() {
129     }
130   }
131
132   public static final class Share {
133     /**
134      * Give the user a choice of items to encode as a barcode, then render it as a QR Code and
135      * display onscreen for a friend to scan with their phone.
136      */
137     public static final String ACTION = "com.google.zxing.client.android.SHARE";
138
139     private Share() {
140     }
141   }
142
143 }