mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2025-12-24 15:47:53 -05:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bc992f7f8 | ||
|
|
a2ab434d01 | ||
|
|
9593b94a2b | ||
|
|
075a440e4f | ||
|
|
c6967f6a3f | ||
|
|
a8ca5470c7 | ||
|
|
4d277eff51 | ||
|
|
c51531e367 | ||
|
|
5e57d66daa | ||
|
|
73aff4aeb8 | ||
|
|
e6241b5a47 |
14
README.md
14
README.md
@@ -4,7 +4,19 @@
|
||||
[](https://f-droid.org/repository/browse/?fdid=protect.card_locker "Loyalty Card Locker on F-Droid")
|
||||
|
||||
|
||||
Stores all of your store loyalty cards on your phone, removing the need to carry them around.
|
||||
Stores all of your store loyalty cards on your phone, removing the need to carry them around. Currently the following barcode types are supported:
|
||||
|
||||
- AZTEC
|
||||
- CODABAR
|
||||
- CODE_39
|
||||
- CODE_128
|
||||
- DATA_MATRIX
|
||||
- EAN_8
|
||||
- EAN_13
|
||||
- ITF
|
||||
- PDF_417
|
||||
- QR_CODE
|
||||
- UPC_A
|
||||
|
||||
If there is any interest in improving this project, kindly submit a pull request with
|
||||
proposed changes.
|
||||
|
||||
@@ -8,8 +8,8 @@ android {
|
||||
applicationId "protect.card_locker"
|
||||
minSdkVersion 17
|
||||
targetSdkVersion 23
|
||||
versionCode 2
|
||||
versionName "0.2"
|
||||
versionCode 3
|
||||
versionName "0.3"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -31,8 +31,8 @@ dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||
compile 'com.android.support:design:23.1.1'
|
||||
compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
|
||||
compile 'com.google.zxing:core:3.2.0'
|
||||
compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
|
||||
compile 'com.google.zxing:core:3.2.1'
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile "org.robolectric:robolectric:3.0"
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
android:name=".LoyaltyCardViewActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:windowSoftInputMode="stateHidden"
|
||||
android:parentActivityName="protect.card_locker.MainActivity"/>
|
||||
</application>
|
||||
|
||||
|
||||
@@ -23,11 +23,32 @@ import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.integration.android.IntentIntegrator;
|
||||
import com.google.zxing.integration.android.IntentResult;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
|
||||
public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
{
|
||||
private static final String TAG = "CardLocker";
|
||||
|
||||
// These are all the barcode types that the zxing library
|
||||
// is able to generate a barcode for, and thus should be
|
||||
// the only barcodes which we should attempt to scan.
|
||||
Collection<String> supportedBarcodeTypes = Collections.unmodifiableList(Arrays.asList(
|
||||
BarcodeFormat.AZTEC.name(),
|
||||
BarcodeFormat.CODE_39.name(),
|
||||
BarcodeFormat.CODE_128.name(),
|
||||
BarcodeFormat.CODABAR.name(),
|
||||
BarcodeFormat.DATA_MATRIX.name(),
|
||||
BarcodeFormat.EAN_8.name(),
|
||||
BarcodeFormat.EAN_13.name(),
|
||||
BarcodeFormat.ITF.name(),
|
||||
BarcodeFormat.PDF_417.name(),
|
||||
BarcodeFormat.QR_CODE.name(),
|
||||
BarcodeFormat.UPC_A.name()
|
||||
));
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
@@ -126,11 +147,14 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
throw new IllegalArgumentException("Unrecognized barcode format: " + formatString);
|
||||
}
|
||||
|
||||
int generateWidth = 100;
|
||||
int generateHeight = 100;
|
||||
|
||||
String cardIdString = cardIdField.getText().toString();
|
||||
|
||||
Log.i(TAG, "Card: " + cardIdString);
|
||||
|
||||
result = writer.encode(cardIdString, format, 1500, 400, null);
|
||||
result = writer.encode(cardIdString, format, generateWidth, generateHeight, null);
|
||||
|
||||
final int WHITE = 0xFFFFFFFF;
|
||||
final int BLACK = 0xFF000000;
|
||||
@@ -170,7 +194,7 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
public void onClick(View v)
|
||||
{
|
||||
IntentIntegrator integrator = new IntentIntegrator(LoyaltyCardViewActivity.this);
|
||||
integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
|
||||
integrator.setDesiredBarcodeFormats(supportedBarcodeTypes);
|
||||
|
||||
String prompt = getResources().getString(R.string.scanCardBarcode);
|
||||
integrator.setPrompt(prompt);
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
<dimen name="no_data_textSize">16sp</dimen>
|
||||
<dimen name="no_data_padding">22dp</dimen>
|
||||
|
||||
<dimen name="barcode_disp_height">50dp</dimen>
|
||||
<dimen name="barcode_disp_height">200dp</dimen>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user