本文整理汇总了Java中com.google.zxing.client.android.LocaleManager.getBookSearchCountryTLD方法的典型用法代码示例。如果您正苦于以下问题:Java LocaleManager.getBookSearchCountryTLD方法的具体用法?Java LocaleManager.getBookSearchCountryTLD怎么用?Java LocaleManager.getBookSearchCountryTLD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.client.android.LocaleManager
的用法示例。
在下文中一共展示了LocaleManager.getBookSearchCountryTLD方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClick
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
if (position < 1) {
// Clicked header, ignore it
return;
}
int itemOffset = position - 1;
if (itemOffset >= items.size()) {
return;
}
String pageId = items.get(itemOffset).getPageId();
String query = SearchBookContentsResult.getQuery();
if (LocaleManager.isBookSearchUrl(activity.getISBN()) && !pageId.isEmpty()) {
String uri = activity.getISBN();
int equals = uri.indexOf('=');
String volumeId = uri.substring(equals + 1);
String readBookURI = "http://books.google." +
LocaleManager.getBookSearchCountryTLD(activity) +
"/books?id=" + volumeId + "&pg=" + pageId + "&vq=" + query;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
}
}
示例2: onItemClick
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
if (position < 1) {
// Clicked header, ignore it
return;
}
int itemOffset = position - 1;
if (itemOffset >= items.size()) {
return;
}
String pageId = items.get(itemOffset).getPageId();
String query = SearchBookContentsResult.getQuery();
if (LocaleManager.isBookSearchUrl(activity.getISBN()) && !pageId.isEmpty()) {
String uri = activity.getISBN();
int equals = uri.indexOf('=');
String volumeId = uri.substring(equals + 1);
String readBookURI = "http://books.google." + LocaleManager.getBookSearchCountryTLD(activity) + "/books?id="
+ volumeId + "&pg=" + pageId + "&vq=" + query;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
}
}
示例3: onItemClick
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
if (position < 1) {
// Clicked header, ignore it
return;
}
int itemOffset = position - 1;
if (itemOffset >= items.size()) {
return;
}
String pageId = items.get(itemOffset).getPageId();
String query = SearchBookContentsResult.getQuery();
if (LocaleManager.isBookSearchUrl(activity.getISBN()) && pageId.length() > 0) {
String uri = activity.getISBN();
int equals = uri.indexOf('=');
String volumeId = uri.substring(equals + 1);
String readBookURI = "http://books.google." +
LocaleManager.getBookSearchCountryTLD(activity) +
"/books?id=" + volumeId + "&pg=" + pageId + "&vq=" + query;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
}
}
示例4: onItemClick
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
if (position < 1) {
// Clicked header, ignore it
return;
}
int itemOffset = position - 1;
if (itemOffset >= items.size()) {
return;
}
String pageId = items.get(itemOffset).getPageId();
String query = SearchBookContentsResult.getQuery();
if (LocaleManager.isBookSearchUrl(activity.getISBN()) && pageId.length() > 0) {
String uri = activity.getISBN();
int equals = uri.indexOf('=');
String volumeId = uri.substring(equals + 1);
String readBookURI = "http://books.google." +
LocaleManager.getBookSearchCountryTLD(activity) +
"/books?id=" + volumeId + "&pg=" + pageId + "&vq=" + query;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
}
}
示例5: onItemClick
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
// HACK(jbreiden) I have no idea where the heck our pageId off by one
// error is coming from. I should not have to put in this position - 1
// kludge.
String pageId = items.get(position - 1).getPageId();
String query = SearchBookContentsResult.getQuery();
if (activity.getISBN().startsWith("http://google.com/books?id=") && (pageId.length() > 0)) {
String uri = activity.getISBN();
int equals = uri.indexOf('=');
String volumeId = uri.substring(equals + 1);
String readBookURI = "http://books.google." +
LocaleManager.getBookSearchCountryTLD() +
"/books?id=" + volumeId + "&pg=" + pageId + "&vq=" + query;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
}
}
示例6: retrieveSupplementalInfo
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
void retrieveSupplementalInfo() throws IOException {
CharSequence contents = HttpHelper.downloadViaHttp("https://www.googleapis.com/books/v1/volumes?q=isbn:" + isbn,
HttpHelper.ContentType.JSON);
if (contents.length() == 0) {
return;
}
String title;
String pages;
Collection<String> authors = null;
try {
JSONObject topLevel = (JSONObject) new JSONTokener(contents.toString()).nextValue();
JSONArray items = topLevel.optJSONArray("items");
if (items == null || items.isNull(0)) {
return;
}
JSONObject volumeInfo = ((JSONObject) items.get(0)).getJSONObject("volumeInfo");
if (volumeInfo == null) {
return;
}
title = volumeInfo.optString("title");
pages = volumeInfo.optString("pageCount");
JSONArray authorsArray = volumeInfo.optJSONArray("authors");
if (authorsArray != null && !authorsArray.isNull(0)) {
authors = new ArrayList<>(authorsArray.length());
for (int i = 0; i < authorsArray.length(); i++) {
authors.add(authorsArray.getString(i));
}
}
} catch (JSONException e) {
throw new IOException(e);
}
Collection<String> newTexts = new ArrayList<>();
maybeAddText(title, newTexts);
maybeAddTextSeries(authors, newTexts);
maybeAddText(pages == null || pages.isEmpty() ? null : pages + "pp.", newTexts);
String baseBookUri = "http://www.google." + LocaleManager.getBookSearchCountryTLD(context)
+ "/search?tbm=bks&source=zxing&q=";
append(isbn, source, newTexts.toArray(new String[newTexts.size()]), baseBookUri + isbn);
}
示例7: retrieveSupplementalInfo
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
void retrieveSupplementalInfo() throws IOException {
CharSequence contents = HttpHelper.downloadViaHttp("https://www.googleapis.com/books/v1/volumes?q=isbn:" + isbn,
HttpHelper.ContentType.JSON);
if (contents.length() == 0) {
return;
}
String title;
String pages;
Collection<String> authors = null;
try {
JSONObject topLevel = (JSONObject) new JSONTokener(contents.toString()).nextValue();
JSONArray items = topLevel.optJSONArray("items");
if (items == null || items.isNull(0)) {
return;
}
JSONObject volumeInfo = ((JSONObject) items.get(0)).getJSONObject("volumeInfo");
if (volumeInfo == null) {
return;
}
title = volumeInfo.optString("title");
pages = volumeInfo.optString("pageCount");
JSONArray authorsArray = volumeInfo.optJSONArray("authors");
if (authorsArray != null && !authorsArray.isNull(0)) {
authors = new ArrayList<>(authorsArray.length());
for (int i = 0; i < authorsArray.length(); i++) {
authors.add(authorsArray.getString(i));
}
}
} catch (JSONException e) {
throw new IOException(e);
}
Collection<String> newTexts = new ArrayList<>();
maybeAddText(title, newTexts);
maybeAddTextSeries(authors, newTexts);
maybeAddText(pages == null || pages.isEmpty() ? null : pages + "pp.", newTexts);
String baseBookUri = "http://www.google." + LocaleManager.getBookSearchCountryTLD(context)
+ "/search?tbm=bks&source=zxing&q=";
append(isbn, source, newTexts.toArray(new String[newTexts.size()]), baseBookUri + isbn);
}
示例8: retrieveSupplementalInfo
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
void retrieveSupplementalInfo() throws IOException {
CharSequence contents = HttpHelper.downloadViaHttp("https://www.googleapis.com/books/v1/volumes?q=isbn:" + isbn,
HttpHelper.ContentType.JSON);
if (contents.length() == 0) {
return;
}
String title;
String pages;
Collection<String> authors = null;
try {
JSONObject topLevel = (JSONObject) new JSONTokener(contents.toString()).nextValue();
JSONArray items = topLevel.optJSONArray("items");
if (items == null || items.isNull(0)) {
return;
}
JSONObject volumeInfo = ((JSONObject) items.get(0)).getJSONObject("volumeInfo");
if (volumeInfo == null) {
return;
}
title = volumeInfo.optString("title");
pages = volumeInfo.optString("pageCount");
JSONArray authorsArray = volumeInfo.optJSONArray("authors");
if (authorsArray != null && !authorsArray.isNull(0)) {
authors = new ArrayList<String>(authorsArray.length());
for (int i = 0; i < authorsArray.length(); i++) {
authors.add(authorsArray.getString(i));
}
}
} catch (JSONException e) {
throw new IOException(e);
}
Collection<String> newTexts = new ArrayList<String>();
maybeAddText(title, newTexts);
maybeAddTextSeries(authors, newTexts);
maybeAddText(pages == null || pages.isEmpty() ? null : pages + "pp.", newTexts);
String baseBookUri = "http://www.google." + LocaleManager.getBookSearchCountryTLD(context)
+ "/search?tbm=bks&source=zxing&q=";
append(isbn, source, newTexts.toArray(new String[newTexts.size()]), baseBookUri + isbn);
}
示例9: retrieveSupplementalInfo
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
void retrieveSupplementalInfo() throws IOException {
CharSequence contents = HttpHelper.downloadViaHttp("https://www.googleapis.com/books/v1/volumes?q=isbn:" + isbn,
HttpHelper.ContentType.JSON);
if (contents.length() == 0) {
return;
}
String title;
String pages;
Collection<String> authors = null;
try {
JSONObject topLevel = (JSONObject) new JSONTokener(contents.toString()).nextValue();
JSONArray items = topLevel.optJSONArray("items");
if (items == null || items.isNull(0)) {
return;
}
JSONObject volumeInfo = ((JSONObject) items.get(0)).getJSONObject("volumeInfo");
if (volumeInfo == null) {
return;
}
title = volumeInfo.optString("title");
pages = volumeInfo.optString("pageCount");
JSONArray authorsArray = volumeInfo.optJSONArray("authors");
if (authorsArray != null && !authorsArray.isNull(0)) {
authors = new ArrayList<String>(authorsArray.length());
for (int i = 0; i < authorsArray.length(); i++) {
authors.add(authorsArray.getString(i));
}
}
} catch (JSONException e) {
throw new IOException(e.toString());
}
Collection<String> newTexts = new ArrayList<String>();
if (title != null && title.length() > 0) {
newTexts.add(title);
}
if (authors != null && !authors.isEmpty()) {
boolean first = true;
StringBuilder authorsText = new StringBuilder();
for (String author : authors) {
if (first) {
first = false;
} else {
authorsText.append(", ");
}
authorsText.append(author);
}
newTexts.add(authorsText.toString());
}
if (pages != null && pages.length() > 0) {
newTexts.add(pages + "pp.");
}
String baseBookUri = "http://www.google." + LocaleManager.getBookSearchCountryTLD(context)
+ "/search?tbm=bks&source=zxing&q=";
append(isbn, source, newTexts.toArray(new String[newTexts.size()]), baseBookUri + isbn);
}
示例10: retrieveSupplementalInfo
import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
void retrieveSupplementalInfo() throws IOException {
CharSequence contents = HttpHelper.downloadViaHttp("https://www.googleapis.com/books/v1/volumes?q=isbn:" + isbn,
HttpHelper.ContentType.JSON);
if (contents.length() == 0) {
return;
}
String title;
String pages;
Collection<String> authors = null;
try {
JSONObject topLevel = (JSONObject) new JSONTokener(contents.toString()).nextValue();
JSONArray items = topLevel.optJSONArray("items");
if (items == null || items.isNull(0)) {
return;
}
JSONObject volumeInfo = ((JSONObject) items.get(0)).getJSONObject("volumeInfo");
if (volumeInfo == null) {
return;
}
title = volumeInfo.optString("title");
pages = volumeInfo.optString("pageCount");
JSONArray authorsArray = volumeInfo.optJSONArray("authors");
if (authorsArray != null && !authorsArray.isNull(0)) {
authors = new ArrayList<String>(authorsArray.length());
for (int i = 0; i < authorsArray.length(); i++) {
authors.add(authorsArray.getString(i));
}
}
} catch (JSONException e) {
throw new IOException(e.toString());
}
Collection<String> newTexts = new ArrayList<String>();
maybeAddText(title, newTexts);
maybeAddTextSeries(authors, newTexts);
maybeAddText(pages == null || pages.length() == 0 ? null : pages + "pp.", newTexts);
String baseBookUri = "http://www.google." + LocaleManager.getBookSearchCountryTLD(context)
+ "/search?tbm=bks&source=zxing&q=";
append(isbn, source, newTexts.toArray(new String[newTexts.size()]), baseBookUri + isbn);
}