X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=android%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fclient%2Fandroid%2Fresult%2FResultHandler.java;h=5f0f28f7e18cc52591fe2bb668e1dbecec702739;hb=4cbbf3bf20e39925ade3611213d757f5b3ff65f5;hp=e7fc5a12972a15bb805c98fd69199f1afde22a75;hpb=b0d8630b70b7259710fde94e203175006bdd5cc9;p=zxing.git diff --git a/android/src/com/google/zxing/client/android/result/ResultHandler.java b/android/src/com/google/zxing/client/android/result/ResultHandler.java index e7fc5a12..5f0f28f7 100644 --- a/android/src/com/google/zxing/client/android/result/ResultHandler.java +++ b/android/src/com/google/zxing/client/android/result/ResultHandler.java @@ -22,8 +22,10 @@ import com.google.zxing.client.android.LocaleManager; import com.google.zxing.client.android.PreferencesActivity; import com.google.zxing.client.android.R; import com.google.zxing.client.android.book.SearchBookContentsActivity; +import com.google.zxing.client.android.wifi.WifiActivity; import com.google.zxing.client.result.ParsedResult; import com.google.zxing.client.result.ParsedResultType; +import com.google.zxing.client.result.WifiParsedResult; import android.app.Activity; import android.app.AlertDialog; @@ -143,16 +145,27 @@ public abstract class ResultHandler { * @param summary A description of the event * @param start The start time as yyyyMMdd or yyyyMMdd'T'HHmmss or yyyyMMdd'T'HHmmss'Z' * @param end The end time as yyyyMMdd or yyyyMMdd'T'HHmmss or yyyyMMdd'T'HHmmss'Z' + * @param location a text description of the event location + * @param description a text description of the event itself */ - final void addCalendarEvent(String summary, String start, String end) { + final void addCalendarEvent(String summary, + String start, + String end, + String location, + String description) { Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", calculateMilliseconds(start)); if (start.length() == 8) { intent.putExtra("allDay", true); } + if (end == null) { + end = start; + } intent.putExtra("endTime", calculateMilliseconds(end)); intent.putExtra("title", summary); + intent.putExtra("eventLocation", location); + intent.putExtra("description", description); launchIntent(intent); } @@ -310,6 +323,15 @@ public abstract class ResultHandler { launchIntent(intent); } + final void wifiConnect(WifiParsedResult wifiResult) { + Intent intent = new Intent(Intents.WifiConnect.ACTION); + intent.setClassName(activity, WifiActivity.class.getName()); + putExtra(intent, Intents.WifiConnect.SSID, wifiResult.getSsid()); + putExtra(intent, Intents.WifiConnect.TYPE, wifiResult.getNetworkEncryption()); + putExtra(intent, Intents.WifiConnect.PASSWORD, wifiResult.getPassword()); + launchIntent(intent); + } + final void openURL(String url) { launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } @@ -376,4 +398,12 @@ public abstract class ResultHandler { } } -} + protected String parseCustomSearchURL() { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity); + String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH, null); + if (customProductSearch != null && customProductSearch.trim().length() == 0) { + return null; + } + return customProductSearch; + } +} \ No newline at end of file