Remove my old email address from files. Might as well save spammers the trouble.
[zxing.git] / core / src / com / google / zxing / client / result / optional / NDEFSmartPosterParsedResult.java
1 /*
2  * Copyright 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.result.optional;
18
19 import com.google.zxing.client.result.ParsedResult;
20 import com.google.zxing.client.result.ParsedResultType;
21
22 /**
23  * @author Sean Owen
24  */
25 public final class NDEFSmartPosterParsedResult extends ParsedResult {
26
27   public static final int ACTION_UNSPECIFIED = -1;
28   public static final int ACTION_DO = 0;
29   public static final int ACTION_SAVE = 1;
30   public static final int ACTION_OPEN = 2;
31
32   private final String title;
33   private final String uri;
34   private final int action;
35
36   NDEFSmartPosterParsedResult(int action, String uri, String title) {
37     super(ParsedResultType.NDEF_SMART_POSTER);
38     this.action = action;
39     this.uri = uri;
40     this.title = title;
41   }
42
43   public String getTitle() {
44     return title;
45   }
46
47   public String getURI() {
48     return uri;
49   }
50
51   public int getAction() {
52     return action;
53   }
54
55   public String getDisplayResult() {
56     if (title == null) {
57       return uri;
58     } else {
59       return title + '\n' + uri;
60     }
61   }
62
63 }