当前位置: 首页>>代码示例>>Java>>正文


Java LocaleManager.getBookSearchCountryTLD方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:25,代码来源:BrowseBookListener.java

示例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);
	}
}
 
开发者ID:xiong-it,项目名称:PortraitZXing,代码行数:24,代码来源:BrowseBookListener.java

示例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);
  }
}
 
开发者ID:atomsheep,项目名称:sres-app,代码行数:25,代码来源:BrowseBookListener.java

示例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);
    }
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:25,代码来源:BrowseBookListener.java

示例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);
  }
}
 
开发者ID:saqimtiaz,项目名称:BibSearch,代码行数:19,代码来源:BrowseBookListener.java

示例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);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:53,代码来源:BookResultInfoRetriever.java

示例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);
}
 
开发者ID:xiong-it,项目名称:PortraitZXing,代码行数:53,代码来源:BookResultInfoRetriever.java

示例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);
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:53,代码来源:BookResultInfoRetriever.java

示例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);
}
 
开发者ID:atomsheep,项目名称:sres-app,代码行数:72,代码来源:BookResultInfoRetriever.java

示例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);
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:53,代码来源:BookResultInfoRetriever.java


注:本文中的com.google.zxing.client.android.LocaleManager.getBookSearchCountryTLD方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。