Example usage for org.apache.commons.validator.routines.checkdigit EAN13CheckDigit EAN13_CHECK_DIGIT

List of usage examples for org.apache.commons.validator.routines.checkdigit EAN13CheckDigit EAN13_CHECK_DIGIT

Introduction

In this page you can find the example usage for org.apache.commons.validator.routines.checkdigit EAN13CheckDigit EAN13_CHECK_DIGIT.

Prototype

CheckDigit EAN13_CHECK_DIGIT

To view the source code for org.apache.commons.validator.routines.checkdigit EAN13CheckDigit EAN13_CHECK_DIGIT.

Click Source Link

Document

Singleton EAN-13 Check Digit instance

Usage

From source file:com.scrachx.foodfacts.checker.ui.main.MainActivity.java

@Override
protected void onNewIntent(Intent intent) {
    setIntent(intent);/*  w ww  .  j av  a2s  .com*/
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        Bundle args = new Bundle();
        args.putString("query", query);
        if (EAN13CheckDigit.EAN13_CHECK_DIGIT.isValid(query) && (!query.substring(0, 3).contains("977")
                || !query.substring(0, 3).contains("978") || !query.substring(0, 3).contains("979"))) {
            mPresenter.loadProduct(query);
        } else {
            mSearchView.clearFocus();
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragment_container, SearchFragment.newInstance(args), SearchFragment.TAG)
                    .commit();
        }
    }
}