If you think the Android project GlassCounter listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.github.barcodeeye.scan.result;
//fromwww.java2s.comimport android.content.Context;
import android.net.Uri;
import com.github.barcodeeye.scan.result.internal.IsbnResultProcessor;
import com.github.barcodeeye.scan.result.internal.ProductResultProcessor;
import com.github.barcodeeye.scan.result.internal.TextResultProcessor;
import com.github.barcodeeye.scan.result.internal.UriResultProcessor;
import com.google.zxing.Result;
import com.google.zxing.client.result.ISBNParsedResult;
import com.google.zxing.client.result.ParsedResult;
import com.google.zxing.client.result.ProductParsedResult;
import com.google.zxing.client.result.ResultParser;
import com.google.zxing.client.result.URIParsedResult;
publicfinalclass ResultProcessorFactory {
publicstatic ResultProcessor<? extends ParsedResult> makeResultProcessor(
Context context, Result result, Uri photoUri) {
ParsedResult parsedResult = ResultParser.parseResult(result);
switch (parsedResult.getType()) {
case PRODUCT:
returnnew ProductResultProcessor(context,
(ProductParsedResult) parsedResult, result, photoUri);
case URI:
returnnew UriResultProcessor(context,
(URIParsedResult) parsedResult, result, photoUri);
case ISBN:
returnnew IsbnResultProcessor(context,
(ISBNParsedResult) parsedResult, result, photoUri);
case SMS:
case GEO:
case TEL:
case CALENDAR:
case ADDRESSBOOK:
case EMAIL_ADDRESS:
case WIFI:
// currently unsupported so we let them fall through
default:
returnnew TextResultProcessor(context, parsedResult, result, photoUri);
}
}
}