Android Open Source - AndroidCouponAssistant Parse U P C






From Project

Back to project page AndroidCouponAssistant.

License

The source code is released under:

MIT License

If you think the Android project AndroidCouponAssistant 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.corylucasjeffery.couponassistant;
/*from  ww w  . j  av a  2s  .c  o  m*/
import android.util.Log;

public class ParseUPC {
    public static final int UPC_IS_ITEM = 1;
    public static final int UPC_IS_COUPON = 2;

    private static final String TAG = "PARSE";

    public ParseUPC() {}

    public int determineBarcode(String upc) {
        int barcodeStyle;
        int leadingDigit = Integer.parseInt(upc.substring(0, 1));
        Log.v(TAG, "barcode: "+upc);
        Log.v(TAG, "leading digit: "+leadingDigit);
        switch(leadingDigit)
        {
            case 5:
                barcodeStyle = UPC_IS_COUPON;
                break;
            case 9:
                barcodeStyle = UPC_IS_COUPON;
                break;
            default:
                barcodeStyle = UPC_IS_ITEM;
                break;
        }
        Log.v(TAG, "style: "+barcodeStyle);
        return barcodeStyle;
    }

    public String getValueCode(String upc) {
        if (upc.equals("empty")) {
            return "--";
        }
        String valueCode = upc.substring(9, 11);
        return valueCode;
    }
}




Java Source Code List

com.corylucasjeffery.couponassistant.BMPtoBlob.java
com.corylucasjeffery.couponassistant.BarcodeGenerator.java
com.corylucasjeffery.couponassistant.BlobtoBMP.java
com.corylucasjeffery.couponassistant.CameraPreview.java
com.corylucasjeffery.couponassistant.CouponAdapter.java
com.corylucasjeffery.couponassistant.Coupon.java
com.corylucasjeffery.couponassistant.DateChooserDialog.java
com.corylucasjeffery.couponassistant.DbGetCoupons.java
com.corylucasjeffery.couponassistant.DbPurchaseItem.java
com.corylucasjeffery.couponassistant.DbSubmitCoupon.java
com.corylucasjeffery.couponassistant.DbSubmitItem.java
com.corylucasjeffery.couponassistant.DbUserRegister.java
com.corylucasjeffery.couponassistant.DbUserStats.java
com.corylucasjeffery.couponassistant.GlobalCart.java
com.corylucasjeffery.couponassistant.Item.java
com.corylucasjeffery.couponassistant.ManualEntryDialog.java
com.corylucasjeffery.couponassistant.ParseUPC.java
com.corylucasjeffery.couponassistant.PhpWrapper.java
com.corylucasjeffery.couponassistant.ProgressBarHelper.java
com.corylucasjeffery.couponassistant.Statistics.java
com.corylucasjeffery.couponassistant.UserInfo.java
com.corylucasjeffery.couponassistant.ValueCodeDict.java
com.corylucasjeffery.couponassistant.activities.AndroidBarcodeView.java
com.corylucasjeffery.couponassistant.activities.CheckoutActivity.java
com.corylucasjeffery.couponassistant.activities.LoginActivity.java
com.corylucasjeffery.couponassistant.activities.MainActivity.java
com.corylucasjeffery.couponassistant.activities.SettingsActivity.java
com.corylucasjeffery.couponassistant.activities.ShowCouponsActivity.java
com.corylucasjeffery.couponassistant.activities.StatisticsActivity.java
com.google.zxing.integration.android.IntentIntegrator.java
com.google.zxing.integration.android.IntentResult.java