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


Java LocaleManager.isBookSearchUrl方法代码示例

本文整理汇总了Java中com.google.zxing.client.android.LocaleManager.isBookSearchUrl方法的典型用法代码示例。如果您正苦于以下问题:Java LocaleManager.isBookSearchUrl方法的具体用法?Java LocaleManager.isBookSearchUrl怎么用?Java LocaleManager.isBookSearchUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.zxing.client.android.LocaleManager的用法示例。


在下文中一共展示了LocaleManager.isBookSearchUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: doInBackground

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
protected JSONObject doInBackground(String... args) {
  try {
    // These return a JSON result which describes if and where the query was found. This API may
    // break or disappear at any time in the future. Since this is an API call rather than a
    // website, we don't use LocaleManager to change the TLD.
    String theQuery = args[0];
    String theIsbn = args[1];
    String uri;
    if (LocaleManager.isBookSearchUrl(theIsbn)) {
      int equals = theIsbn.indexOf('=');
      String volumeId = theIsbn.substring(equals + 1);
      uri = "http://www.google.com/books?id=" + volumeId + "&jscmd=SearchWithinVolume2&q=" + theQuery;
    } else {
      uri = "http://www.google.com/books?vid=isbn" + theIsbn + "&jscmd=SearchWithinVolume2&q=" + theQuery;
    }
    CharSequence content = HttpHelper.downloadViaHttp(uri, HttpHelper.ContentType.JSON);
    return new JSONObject(content.toString());
  } catch (IOException ioe) {
    Log.w(TAG, "Error accessing book search", ioe);
    return null;
  } catch (JSONException je) {
    Log.w(TAG, "Error accessing book search", je);
    return null;
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:27,代码来源:SearchBookContentsActivity.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.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

示例5: 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

示例6: doInBackground

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
protected JSONObject doInBackground(String... args) {
    try {
        // These return a JSON result which describes if and where the query was found. This API may
        // break or disappear at any time in the future. Since this is an API call rather than a
        // website, we don't use LocaleManager to change the TLD.
        String theQuery = args[0];
        String theIsbn = args[1];
        String uri;
        if (LocaleManager.isBookSearchUrl(theIsbn)) {
            int equals = theIsbn.indexOf('=');
            String volumeId = theIsbn.substring(equals + 1);
            uri = "http://www.google.com/books?id=" + volumeId + "&jscmd=SearchWithinVolume2&q=" + theQuery;
        } else {
            uri = "http://www.google.com/books?vid=isbn" + theIsbn + "&jscmd=SearchWithinVolume2&q=" + theQuery;
        }
        CharSequence content = HttpHelper.downloadViaHttp(uri, HttpHelper.ContentType.JSON);
        return new JSONObject(content.toString());
    } catch (IOException ioe) {
        Log.w(TAG, "Error accessing book search", ioe);
        return null;
    } catch (JSONException je) {
        Log.w(TAG, "Error accessing book search", je);
        return null;
    }
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:27,代码来源:SearchBookContentsActivity.java

示例7: onCreate

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
  super.onCreate(icicle);

  // Make sure that expired cookies are removed on launch.
  CookieSyncManager.createInstance(this);
  CookieManager.getInstance().removeExpiredCookie();

  Intent intent = getIntent();
  if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) {
    finish();
    return;
  }

  isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
  if (LocaleManager.isBookSearchUrl(isbn)) {
    setTitle(getString(R.string.sbc_name));
  } else {
    setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
  }

  setContentView(R.layout.search_book_contents);
  queryTextView = (EditText) findViewById(R.id.query_text_view);

  String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
  if (initialQuery != null && !initialQuery.isEmpty()) {
    // Populate the search box but don't trigger the search
    queryTextView.setText(initialQuery);
  }
  queryTextView.setOnKeyListener(keyListener);

  queryButton = findViewById(R.id.query_button);
  queryButton.setOnClickListener(buttonListener);

  resultListView = (ListView) findViewById(R.id.result_list_view);
  LayoutInflater factory = LayoutInflater.from(this);
  headerView = (TextView) factory.inflate(R.layout.search_book_contents_header,
      resultListView, false);
  resultListView.addHeaderView(headerView);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:41,代码来源:SearchBookContentsActivity.java

示例8: getButtonCount

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public int getButtonCount() {
  if (LocaleManager.isBookSearchUrl(((URIParsedResult) getResult()).getURI())) {
    return buttons.length;
  }
  return buttons.length - 1;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:8,代码来源:URIResultHandler.java

示例9: getButtonCount

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public int getButtonCount() {
	if (LocaleManager.isBookSearchUrl(((URIParsedResult) getResult()).getURI())) {
		return buttons.length;
	}
	return buttons.length - 1;
}
 
开发者ID:xiong-it,项目名称:PortraitZXing,代码行数:8,代码来源:URIResultHandler.java

示例10: doInBackground

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
protected JSONObject doInBackground(String... args) {
	try {
		// These return a JSON result which describes if and where the
		// query was found. This API may
		// break or disappear at any time in the future. Since this is
		// an API call rather than a
		// website, we don't use LocaleManager to change the TLD.
		String theQuery = args[0];
		String theIsbn = args[1];
		String uri;
		if (LocaleManager.isBookSearchUrl(theIsbn)) {
			int equals = theIsbn.indexOf('=');
			String volumeId = theIsbn.substring(equals + 1);
			uri = "http://www.google.com/books?id=" + volumeId + "&jscmd=SearchWithinVolume2&q=" + theQuery;
		} else {
			uri = "http://www.google.com/books?vid=isbn" + theIsbn + "&jscmd=SearchWithinVolume2&q=" + theQuery;
		}
		CharSequence content = HttpHelper.downloadViaHttp(uri, HttpHelper.ContentType.JSON);
		return new JSONObject(content.toString());
	} catch (IOException ioe) {
		Log.w(TAG, "Error accessing book search", ioe);
		return null;
	} catch (JSONException je) {
		Log.w(TAG, "Error accessing book search", je);
		return null;
	}
}
 
开发者ID:xiong-it,项目名称:PortraitZXing,代码行数:29,代码来源:SearchBookContentsActivity.java

示例11: onCreate

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // Make sure that expired cookies are removed on launch.
    CookieSyncManager.createInstance(this);
    CookieManager.getInstance().removeExpiredCookie();

    Intent intent = getIntent();
    if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) {
        finish();
        return;
    }

    isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
    if (LocaleManager.isBookSearchUrl(isbn)) {
        setTitle(getString(R.string.sbc_name));
    } else {
        setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
    }

    setContentView(R.layout.search_book_contents);
    queryTextView = (EditText) findViewById(R.id.query_text_view);

    String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
    if (initialQuery != null && initialQuery.length() > 0) {
        // Populate the search box but don't trigger the search
        queryTextView.setText(initialQuery);
    }
    queryTextView.setOnKeyListener(keyListener);

    queryButton = (Button) findViewById(R.id.query_button);
    queryButton.setOnClickListener(buttonListener);

    resultListView = (ListView) findViewById(R.id.result_list_view);
    LayoutInflater factory = LayoutInflater.from(this);
    headerView = (TextView) factory.inflate(R.layout.search_book_contents_header,
            resultListView, false);
    resultListView.addHeaderView(headerView);
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:41,代码来源:SearchBookContentsActivity.java

示例12: getButtonCount

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public int getButtonCount() {
    if (LocaleManager.isBookSearchUrl(((URIParsedResult) getResult()).getURI())) {
        return buttons.length;
    }
    return buttons.length - 1;
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:8,代码来源:URIResultHandler.java

示例13: onCreate

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // Make sure that expired cookies are removed on launch.
    CookieSyncManager.createInstance(this);
    CookieManager.getInstance().removeExpiredCookie();

    Intent intent = getIntent();
    if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) {
        finish();
        return;
    }

    isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
    if (LocaleManager.isBookSearchUrl(isbn)) {
        setTitle(getString(R.string.sbc_name));
    } else {
        setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
    }

    setContentView(R.layout.search_book_contents);
    queryTextView = (EditText) findViewById(R.id.query_text_view);

    String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
    if (initialQuery != null && initialQuery.length() > 0) {
        // Populate the search box but don't trigger the search
        queryTextView.setText(initialQuery);
    }
    queryTextView.setOnKeyListener(keyListener);

    queryButton = (Button) findViewById(R.id.query_button);
    queryButton.setOnClickListener(buttonListener);

    resultListView = (ListView) findViewById(R.id.result_list_view);
    LayoutInflater factory = LayoutInflater.from(this);
    headerView = (TextView) factory.inflate(R.layout.search_book_contents_header, resultListView, false);
    resultListView.addHeaderView(headerView);
}
 
开发者ID:thomas-bornschlegel,项目名称:AndroidMultiChannelMiddleware,代码行数:40,代码来源:SearchBookContentsActivity.java

示例14: onCreate

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
  super.onCreate(icicle);

  // Make sure that expired cookies are removed on launch.
  CookieSyncManager.createInstance(this);
  CookieManager.getInstance().removeExpiredCookie();

  Intent intent = getIntent();
  if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) {
    finish();
    return;
  }

  isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
  if (LocaleManager.isBookSearchUrl(isbn)) {
    setTitle(getString(R.string.sbc_name));
  } else {
    setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
  }

  setContentView(R.layout.search_book_contents);
  queryTextView = (EditText) findViewById(R.id.query_text_view);

  String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
  if (initialQuery != null && initialQuery.length() > 0) {
    // Populate the search box but don't trigger the search
    queryTextView.setText(initialQuery);
  }
  queryTextView.setOnKeyListener(keyListener);

  queryButton = (Button) findViewById(R.id.query_button);
  queryButton.setOnClickListener(buttonListener);

  resultListView = (ListView) findViewById(R.id.result_list_view);
  LayoutInflater factory = LayoutInflater.from(this);
  headerView = (TextView) factory.inflate(R.layout.search_book_contents_header,
      resultListView, false);
  resultListView.addHeaderView(headerView);
}
 
开发者ID:saqimtiaz,项目名称:BibSearch,代码行数:41,代码来源:SearchBookContentsActivity.java

示例15: onCreate

import com.google.zxing.client.android.LocaleManager; //导入方法依赖的package包/类
@Override
 public void onCreate(Bundle icicle) {
   super.onCreate(icicle);

fakeR = new FakeR(this);

   // Make sure that expired cookies are removed on launch.
   CookieSyncManager.createInstance(this);
   CookieManager.getInstance().removeExpiredCookie();

   Intent intent = getIntent();
   if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) {
     finish();
     return;
   }

   isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
   if (LocaleManager.isBookSearchUrl(isbn)) {
     setTitle(getString(fakeR.getId("string", "sbc_name")));
   } else {
     setTitle(getString(fakeR.getId("string", "sbc_name")) + ": ISBN " + isbn);
   }

   setContentView(fakeR.getId("layout", "search_book_contents"));
   queryTextView = (EditText) findViewById(fakeR.getId("id", "query_text_view"));

   String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
   if (initialQuery != null && initialQuery.length() > 0) {
     // Populate the search box but don't trigger the search
     queryTextView.setText(initialQuery);
   }
   queryTextView.setOnKeyListener(keyListener);

   queryButton = (Button) findViewById(fakeR.getId("id", "query_button"));
   queryButton.setOnClickListener(buttonListener);

   resultListView = (ListView) findViewById(fakeR.getId("id", "result_list_view"));
   LayoutInflater factory = LayoutInflater.from(this);
   headerView = (TextView) factory.inflate(fakeR.getId("layout", "search_book_contents_header"),
       resultListView, false);
   resultListView.addHeaderView(headerView);
 }
 
开发者ID:Thinkmill,项目名称:reacteu-app,代码行数:43,代码来源:SearchBookContentsActivity.java


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