mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2025-12-25 16:17:53 -05:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ad02ae9cc | ||
|
|
99fc568419 | ||
|
|
5f835716e0 | ||
|
|
1f6fe787eb | ||
|
|
1b08d30611 | ||
|
|
05ad33a756 | ||
|
|
b103366a10 | ||
|
|
343d37d4b8 | ||
|
|
60dc050633 | ||
|
|
96c3583393 | ||
|
|
43656dbcca | ||
|
|
7c38bbe6ab | ||
|
|
c6c6448501 | ||
|
|
7ff9da2d7f | ||
|
|
39893cc66d | ||
|
|
5110618d7d | ||
|
|
a856831ee1 | ||
|
|
c5fc6a4212 | ||
|
|
7708646c68 | ||
|
|
c84dbac020 | ||
|
|
56c2297e02 | ||
|
|
6956805e62 | ||
|
|
7736e30043 | ||
|
|
ace441f072 | ||
|
|
a37e99ce39 | ||
|
|
6b1bdbaa78 | ||
|
|
b4077a2fc3 | ||
|
|
2f660c6fec | ||
|
|
cc0511a2aa | ||
|
|
2f367efa70 | ||
|
|
bff1b54b7e | ||
|
|
010e9556b8 |
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '33 1 * * 4'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'java' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
@@ -15,7 +15,7 @@ with open('CHANGELOG.md') as changelog:
|
||||
changelogs[version_code] = text
|
||||
|
||||
text = []
|
||||
match = re.match("## \S* - (\d*) \(\d{4}-\d{2}-\d{2}\)", line)
|
||||
match = re.match("## \S* - (\d*).*", line)
|
||||
if not match:
|
||||
raise ValueError(f"Invalid version line: {line}")
|
||||
version_code = match.group(1)
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## v2.6.0 - 83 (2021-09-19)
|
||||
|
||||
- Support for changing the sorting order
|
||||
- Prevent Out Of Memory on scanning large pictures for barcode
|
||||
|
||||
## v2.5.0 - 82 (2021-09-10)
|
||||
|
||||
- Improved support for screen readers
|
||||
|
||||
155
Gemfile.lock
155
Gemfile.lock
@@ -1,58 +1,75 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.2)
|
||||
CFPropertyList (3.0.3)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
artifactory (3.0.15)
|
||||
atomos (0.1.3)
|
||||
aws-eventstream (1.1.0)
|
||||
aws-partitions (1.388.0)
|
||||
aws-sdk-core (3.109.1)
|
||||
aws-eventstream (1.2.0)
|
||||
aws-partitions (1.501.0)
|
||||
aws-sdk-core (3.121.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.239.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
jmespath (~> 1.0)
|
||||
aws-sdk-kms (1.39.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sdk-kms (1.48.0)
|
||||
aws-sdk-core (~> 3, >= 3.120.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-s3 (1.83.1)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sdk-s3 (1.102.0)
|
||||
aws-sdk-core (~> 3, >= 3.120.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sigv4 (1.2.2)
|
||||
aws-sigv4 (~> 1.4)
|
||||
aws-sigv4 (1.4.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
babosa (1.0.4)
|
||||
claide (1.0.3)
|
||||
colored (1.2)
|
||||
colored2 (3.1.2)
|
||||
commander-fastlane (4.4.6)
|
||||
highline (~> 1.7.2)
|
||||
commander (4.6.0)
|
||||
highline (~> 2.0.0)
|
||||
declarative (0.0.20)
|
||||
declarative-option (0.1.0)
|
||||
digest-crc (0.6.1)
|
||||
rake (~> 13.0)
|
||||
digest-crc (0.6.4)
|
||||
rake (>= 12.0.0, < 14.0.0)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
dotenv (2.7.6)
|
||||
emoji_regex (3.2.0)
|
||||
excon (0.78.0)
|
||||
faraday (1.1.0)
|
||||
emoji_regex (3.2.2)
|
||||
excon (0.85.0)
|
||||
faraday (1.7.2)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
faraday-httpclient (~> 1.0.1)
|
||||
faraday-net_http (~> 1.0)
|
||||
faraday-net_http_persistent (~> 1.1)
|
||||
faraday-patron (~> 1.0)
|
||||
faraday-rack (~> 1.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ruby2_keywords
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-cookie_jar (0.0.7)
|
||||
faraday (>= 0.8.0)
|
||||
http-cookie (~> 1.0.0)
|
||||
faraday_middleware (1.0.0)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.0)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-httpclient (1.0.1)
|
||||
faraday-net_http (1.0.1)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday-patron (1.0.0)
|
||||
faraday-rack (1.0.0)
|
||||
faraday_middleware (1.1.0)
|
||||
faraday (~> 1.0)
|
||||
fastimage (2.2.0)
|
||||
fastlane (2.165.0)
|
||||
fastimage (2.2.5)
|
||||
fastlane (2.193.1)
|
||||
CFPropertyList (>= 2.3, < 4.0.0)
|
||||
addressable (>= 2.3, < 3.0.0)
|
||||
addressable (>= 2.8, < 3.0.0)
|
||||
artifactory (~> 3.0)
|
||||
aws-sdk-s3 (~> 1.0)
|
||||
babosa (>= 1.0.3, < 2.0.0)
|
||||
bundler (>= 1.12.0, < 3.0.0)
|
||||
colored
|
||||
commander-fastlane (>= 4.4.6, < 5.0.0)
|
||||
commander (~> 4.6)
|
||||
dotenv (>= 2.1.1, < 3.0.0)
|
||||
emoji_regex (>= 0.1, < 4.0)
|
||||
excon (>= 0.71.0, < 1.0.0)
|
||||
@@ -61,18 +78,20 @@ GEM
|
||||
faraday_middleware (~> 1.0)
|
||||
fastimage (>= 2.1.0, < 3.0.0)
|
||||
gh_inspector (>= 1.1.2, < 2.0.0)
|
||||
google-api-client (>= 0.37.0, < 0.39.0)
|
||||
google-cloud-storage (>= 1.15.0, < 2.0.0)
|
||||
highline (>= 1.7.2, < 2.0.0)
|
||||
google-apis-androidpublisher_v3 (~> 0.3)
|
||||
google-apis-playcustomapp_v1 (~> 0.1)
|
||||
google-cloud-storage (~> 1.31)
|
||||
highline (~> 2.0)
|
||||
json (< 3.0.0)
|
||||
jwt (>= 2.1.0, < 3)
|
||||
mini_magick (>= 4.9.4, < 5.0.0)
|
||||
multipart-post (~> 2.0.0)
|
||||
naturally (~> 2.2)
|
||||
optparse (~> 0.1.1)
|
||||
plist (>= 3.1.0, < 4.0.0)
|
||||
rubyzip (>= 2.0.0, < 3.0.0)
|
||||
security (= 0.1.3)
|
||||
simctl (~> 1.6.3)
|
||||
slack-notifier (>= 2.0.0, < 3.0.0)
|
||||
terminal-notifier (>= 2.0.0, < 3.0.0)
|
||||
terminal-table (>= 1.4.5, < 2.0.0)
|
||||
tty-screen (>= 0.6.3, < 1.0.0)
|
||||
@@ -82,73 +101,85 @@ GEM
|
||||
xcpretty (~> 0.3.0)
|
||||
xcpretty-travis-formatter (>= 0.0.3)
|
||||
gh_inspector (1.1.3)
|
||||
google-api-client (0.38.0)
|
||||
google-apis-androidpublisher_v3 (0.11.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-core (0.4.1)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (~> 0.9)
|
||||
httpclient (>= 2.8.1, < 3.0)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
httpclient (>= 2.8.1, < 3.a)
|
||||
mini_mime (~> 1.0)
|
||||
representable (~> 3.0)
|
||||
retriable (>= 2.0, < 4.0)
|
||||
signet (~> 0.12)
|
||||
google-cloud-core (1.5.0)
|
||||
retriable (>= 2.0, < 4.a)
|
||||
rexml
|
||||
webrick
|
||||
google-apis-iamcredentials_v1 (0.7.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-playcustomapp_v1 (0.5.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-storage_v1 (0.6.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-cloud-core (1.6.0)
|
||||
google-cloud-env (~> 1.0)
|
||||
google-cloud-errors (~> 1.0)
|
||||
google-cloud-env (1.4.0)
|
||||
google-cloud-env (1.5.0)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
google-cloud-errors (1.0.1)
|
||||
google-cloud-storage (1.29.1)
|
||||
google-cloud-errors (1.1.0)
|
||||
google-cloud-storage (1.34.1)
|
||||
addressable (~> 2.5)
|
||||
digest-crc (~> 0.4)
|
||||
google-api-client (~> 0.33)
|
||||
google-cloud-core (~> 1.2)
|
||||
googleauth (~> 0.9)
|
||||
google-apis-iamcredentials_v1 (~> 0.1)
|
||||
google-apis-storage_v1 (~> 0.1)
|
||||
google-cloud-core (~> 1.6)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
mini_mime (~> 1.0)
|
||||
googleauth (0.14.0)
|
||||
googleauth (0.17.1)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
jwt (>= 1.4, < 3.0)
|
||||
memoist (~> 0.16)
|
||||
multi_json (~> 1.11)
|
||||
os (>= 0.9, < 2.0)
|
||||
signet (~> 0.14)
|
||||
highline (1.7.10)
|
||||
http-cookie (1.0.3)
|
||||
signet (~> 0.15)
|
||||
highline (2.0.3)
|
||||
http-cookie (1.0.4)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
jmespath (1.4.0)
|
||||
json (2.3.1)
|
||||
jwt (2.2.2)
|
||||
json (2.5.1)
|
||||
jwt (2.2.3)
|
||||
memoist (0.16.2)
|
||||
mini_magick (4.10.1)
|
||||
mini_mime (1.0.2)
|
||||
mini_magick (4.11.0)
|
||||
mini_mime (1.1.1)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.0.0)
|
||||
nanaimo (0.3.0)
|
||||
naturally (2.2.0)
|
||||
naturally (2.2.1)
|
||||
optparse (0.1.1)
|
||||
os (1.1.1)
|
||||
plist (3.5.0)
|
||||
plist (3.6.0)
|
||||
public_suffix (4.0.6)
|
||||
rake (13.0.1)
|
||||
representable (3.0.4)
|
||||
rake (13.0.6)
|
||||
representable (3.1.1)
|
||||
declarative (< 0.1.0)
|
||||
declarative-option (< 0.2.0)
|
||||
trailblazer-option (>= 0.1.1, < 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
retriable (3.1.2)
|
||||
rexml (3.2.5)
|
||||
rouge (2.0.7)
|
||||
ruby2_keywords (0.0.2)
|
||||
rubyzip (2.3.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
security (0.1.3)
|
||||
signet (0.14.0)
|
||||
addressable (~> 2.3)
|
||||
signet (0.16.0)
|
||||
addressable (~> 2.8)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
multi_json (~> 1.10)
|
||||
simctl (1.6.8)
|
||||
CFPropertyList
|
||||
naturally
|
||||
slack-notifier (2.3.2)
|
||||
terminal-notifier (2.0.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
trailblazer-option (0.1.1)
|
||||
tty-cursor (0.7.1)
|
||||
tty-screen (0.8.1)
|
||||
tty-spinner (0.9.3)
|
||||
@@ -156,18 +187,20 @@ GEM
|
||||
uber (0.1.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.7)
|
||||
unf_ext (0.0.8)
|
||||
unicode-display_width (1.7.0)
|
||||
webrick (1.7.0)
|
||||
word_wrap (1.0.0)
|
||||
xcodeproj (1.19.0)
|
||||
xcodeproj (1.21.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.3.0)
|
||||
rexml (~> 3.2.4)
|
||||
xcpretty (0.3.0)
|
||||
rouge (~> 2.0.7)
|
||||
xcpretty-travis-formatter (1.0.0)
|
||||
xcpretty-travis-formatter (1.0.1)
|
||||
xcpretty (~> 0.2, >= 0.0.7)
|
||||
|
||||
PLATFORMS
|
||||
|
||||
@@ -18,8 +18,8 @@ android {
|
||||
applicationId "me.hackerchick.catima"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 30
|
||||
versionCode 82
|
||||
versionName "2.5.0"
|
||||
versionCode 83
|
||||
versionName "2.6.0"
|
||||
|
||||
vectorDrawables.useSupportLibrary true
|
||||
multiDexEnabled true
|
||||
|
||||
@@ -20,7 +20,7 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
{
|
||||
public static final String DATABASE_NAME = "Catima.db";
|
||||
public static final int ORIGINAL_DATABASE_VERSION = 1;
|
||||
public static final int DATABASE_VERSION = 10;
|
||||
public static final int DATABASE_VERSION = 11;
|
||||
|
||||
public static class LoyaltyCardDbGroups
|
||||
{
|
||||
@@ -44,6 +44,7 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
public static final String BARCODE_ID = "barcodeid";
|
||||
public static final String BARCODE_TYPE = "barcodetype";
|
||||
public static final String STAR_STATUS = "starstatus";
|
||||
public static final String LAST_USED = "lastused";
|
||||
}
|
||||
|
||||
public static class LoyaltyCardDbIdsGroups
|
||||
@@ -53,6 +54,17 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
public static final String groupID = "groupId";
|
||||
}
|
||||
|
||||
public enum LoyaltyCardOrder {
|
||||
Alpha,
|
||||
LastUsed,
|
||||
Expiry
|
||||
}
|
||||
|
||||
public enum LoyaltyCardOrderDirection {
|
||||
Ascending,
|
||||
Descending
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public DBHelper(Context context)
|
||||
@@ -83,7 +95,8 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
LoyaltyCardDbIds.CARD_ID + " TEXT not null," +
|
||||
LoyaltyCardDbIds.BARCODE_ID + " TEXT," +
|
||||
LoyaltyCardDbIds.BARCODE_TYPE + " TEXT," +
|
||||
LoyaltyCardDbIds.STAR_STATUS + " INTEGER DEFAULT '0')");
|
||||
LoyaltyCardDbIds.STAR_STATUS + " INTEGER DEFAULT '0'," +
|
||||
LoyaltyCardDbIds.LAST_USED + " INTEGER DEFAULT '0')");
|
||||
|
||||
// create associative table for cards in groups
|
||||
db.execSQL("create table " + LoyaltyCardDbIdsGroups.TABLE + "(" +
|
||||
@@ -250,13 +263,19 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
if(oldVersion < 11 && newVersion >= 11)
|
||||
{
|
||||
db.execSQL("ALTER TABLE " + LoyaltyCardDbIds.TABLE
|
||||
+ " ADD COLUMN " + LoyaltyCardDbIds.LAST_USED + " INTEGER DEFAULT '0'");
|
||||
}
|
||||
}
|
||||
|
||||
public long insertLoyaltyCard(final String store, final String note, final Date expiry,
|
||||
final BigDecimal balance, final Currency balanceType,
|
||||
final String cardId, final String barcodeId,
|
||||
final CatimaBarcode barcodeType, final Integer headerColor,
|
||||
final int starStatus)
|
||||
final int starStatus, final Long lastUsed)
|
||||
{
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
ContentValues contentValues = new ContentValues();
|
||||
@@ -270,14 +289,16 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_TYPE, barcodeType != null ? barcodeType.name() : null);
|
||||
contentValues.put(LoyaltyCardDbIds.HEADER_COLOR, headerColor);
|
||||
contentValues.put(LoyaltyCardDbIds.STAR_STATUS, starStatus);
|
||||
contentValues.put(LoyaltyCardDbIds.LAST_USED, lastUsed != null ? lastUsed : Utils.getUnixTime());
|
||||
return db.insert(LoyaltyCardDbIds.TABLE, null, contentValues);
|
||||
}
|
||||
|
||||
public long insertLoyaltyCard(final SQLiteDatabase db, final String store,
|
||||
final String note, final Date expiry, final BigDecimal balance,
|
||||
final Currency balanceType, final String cardId,
|
||||
final String barcodeId, final CatimaBarcode barcodeType,
|
||||
final Integer headerColor, final int starStatus)
|
||||
final String note, final Date expiry, final BigDecimal balance,
|
||||
final Currency balanceType, final String cardId,
|
||||
final String barcodeId, final CatimaBarcode barcodeType,
|
||||
final Integer headerColor, final int starStatus,
|
||||
final Long lastUsed)
|
||||
{
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put(LoyaltyCardDbIds.STORE, store);
|
||||
@@ -289,15 +310,17 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_ID, barcodeId);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_TYPE, barcodeType != null ? barcodeType.name() : null);
|
||||
contentValues.put(LoyaltyCardDbIds.HEADER_COLOR, headerColor);
|
||||
contentValues.put(LoyaltyCardDbIds.STAR_STATUS,starStatus);
|
||||
contentValues.put(LoyaltyCardDbIds.STAR_STATUS, starStatus);
|
||||
contentValues.put(LoyaltyCardDbIds.LAST_USED, lastUsed != null ? lastUsed : Utils.getUnixTime());
|
||||
return db.insert(LoyaltyCardDbIds.TABLE, null, contentValues);
|
||||
}
|
||||
|
||||
public long insertLoyaltyCard(final SQLiteDatabase db, final int id, final String store,
|
||||
final String note, final Date expiry, final BigDecimal balance,
|
||||
final Currency balanceType, final String cardId,
|
||||
final String barcodeId, final CatimaBarcode barcodeType,
|
||||
final Integer headerColor, final int starStatus)
|
||||
final String note, final Date expiry, final BigDecimal balance,
|
||||
final Currency balanceType, final String cardId,
|
||||
final String barcodeId, final CatimaBarcode barcodeType,
|
||||
final Integer headerColor, final int starStatus,
|
||||
final Long lastUsed)
|
||||
{
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put(LoyaltyCardDbIds.ID, id);
|
||||
@@ -310,7 +333,8 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_ID, barcodeId);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_TYPE, barcodeType != null ? barcodeType.name() : null);
|
||||
contentValues.put(LoyaltyCardDbIds.HEADER_COLOR, headerColor);
|
||||
contentValues.put(LoyaltyCardDbIds.STAR_STATUS,starStatus);
|
||||
contentValues.put(LoyaltyCardDbIds.STAR_STATUS, starStatus);
|
||||
contentValues.put(LoyaltyCardDbIds.LAST_USED, lastUsed != null ? lastUsed : Utils.getUnixTime());
|
||||
return db.insert(LoyaltyCardDbIds.TABLE, null, contentValues);
|
||||
}
|
||||
|
||||
@@ -347,6 +371,16 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
return (rowsUpdated == 1);
|
||||
}
|
||||
|
||||
public boolean updateLoyaltyCardLastUsed(final int id) {
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put(LoyaltyCardDbIds.LAST_USED, System.currentTimeMillis() / 1000);
|
||||
int rowsUpdated = db.update(LoyaltyCardDbIds.TABLE, contentValues,
|
||||
whereAttrs(LoyaltyCardDbIds.ID),
|
||||
withArgs(id));
|
||||
return (rowsUpdated == 1);
|
||||
}
|
||||
|
||||
public LoyaltyCard getLoyaltyCard(final int id)
|
||||
{
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
@@ -475,6 +509,18 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
*/
|
||||
public Cursor getLoyaltyCardCursor(final String filter, Group group)
|
||||
{
|
||||
return getLoyaltyCardCursor(filter, group, LoyaltyCardOrder.Alpha, LoyaltyCardOrderDirection.Ascending);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a cursor to all loyalty cards with the filter text in either the store or note in a certain group sorted as requested.
|
||||
*
|
||||
* @param filter
|
||||
* @param group
|
||||
* @param order
|
||||
* @return Cursor
|
||||
*/
|
||||
public Cursor getLoyaltyCardCursor(final String filter, Group group, LoyaltyCardOrder order, LoyaltyCardOrderDirection direction) {
|
||||
String actualFilter = String.format("%%%s%%", filter);
|
||||
String[] selectionArgs = { actualFilter, actualFilter };
|
||||
StringBuilder groupFilter = new StringBuilder();
|
||||
@@ -501,11 +547,16 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
}
|
||||
}
|
||||
|
||||
String orderField = getFieldForOrder(order);
|
||||
|
||||
return db.rawQuery("select * from " + LoyaltyCardDbIds.TABLE +
|
||||
" WHERE (" + LoyaltyCardDbIds.STORE + " LIKE ? " +
|
||||
" OR " + LoyaltyCardDbIds.NOTE + " LIKE ? )" +
|
||||
groupFilter.toString() +
|
||||
" ORDER BY " + LoyaltyCardDbIds.STAR_STATUS + " DESC," + LoyaltyCardDbIds.STORE + " COLLATE NOCASE ASC " +
|
||||
" ORDER BY " + LoyaltyCardDbIds.STAR_STATUS + " DESC, " +
|
||||
" (CASE WHEN " + orderField + " IS NULL THEN 1 ELSE 0 END), " +
|
||||
orderField + " COLLATE NOCASE " + getDbDirection(order, direction) + ", " +
|
||||
LoyaltyCardDbIds.STORE + " COLLATE NOCASE ASC " +
|
||||
limitString, selectionArgs, null);
|
||||
}
|
||||
|
||||
@@ -737,4 +788,29 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
.map(String::valueOf)
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
|
||||
private String getFieldForOrder(LoyaltyCardOrder order) {
|
||||
if (order == LoyaltyCardOrder.Alpha) {
|
||||
return LoyaltyCardDbIds.STORE;
|
||||
}
|
||||
|
||||
if (order == LoyaltyCardOrder.LastUsed) {
|
||||
return LoyaltyCardDbIds.LAST_USED;
|
||||
}
|
||||
|
||||
if (order == LoyaltyCardOrder.Expiry) {
|
||||
return LoyaltyCardDbIds.EXPIRY;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Unknown order " + order);
|
||||
}
|
||||
|
||||
private String getDbDirection(LoyaltyCardOrder order, LoyaltyCardOrderDirection direction) {
|
||||
if (order == LoyaltyCardOrder.LastUsed) {
|
||||
// We want the default sorting to put the most recently used first
|
||||
return direction == LoyaltyCardOrderDirection.Descending ? "ASC" : "DESC";
|
||||
}
|
||||
|
||||
return direction == LoyaltyCardOrderDirection.Ascending ? "ASC" : "DESC";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class ImportURIHelper {
|
||||
headerColor = Integer.parseInt(unparsedHeaderColor);
|
||||
}
|
||||
|
||||
return new LoyaltyCard(-1, store, note, expiry, balance, balanceType, cardId, barcodeId, barcodeType, headerColor, 0);
|
||||
return new LoyaltyCard(-1, store, note, expiry, balance, balanceType, cardId, barcodeId, barcodeType, headerColor, 0, Utils.getUnixTime());
|
||||
} catch (NullPointerException | NumberFormatException | UnsupportedEncodingException ex) {
|
||||
throw new InvalidObjectException("Not a valid import URI");
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import android.database.Cursor;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Currency;
|
||||
import java.util.Date;
|
||||
@@ -31,11 +29,12 @@ public class LoyaltyCard implements Parcelable {
|
||||
public final Integer headerColor;
|
||||
|
||||
public final int starStatus;
|
||||
public final long lastUsed;
|
||||
|
||||
public LoyaltyCard(final int id, final String store, final String note, final Date expiry,
|
||||
final BigDecimal balance, final Currency balanceType, final String cardId,
|
||||
@Nullable final String barcodeId, @Nullable final CatimaBarcode barcodeType, @Nullable final Integer headerColor,
|
||||
final int starStatus)
|
||||
@Nullable final String barcodeId, @Nullable final CatimaBarcode barcodeType,
|
||||
@Nullable final Integer headerColor, final int starStatus, final long lastUsed)
|
||||
{
|
||||
this.id = id;
|
||||
this.store = store;
|
||||
@@ -48,6 +47,7 @@ public class LoyaltyCard implements Parcelable {
|
||||
this.barcodeType = barcodeType;
|
||||
this.headerColor = headerColor;
|
||||
this.starStatus = starStatus;
|
||||
this.lastUsed = lastUsed;
|
||||
}
|
||||
|
||||
protected LoyaltyCard(Parcel in) {
|
||||
@@ -65,6 +65,7 @@ public class LoyaltyCard implements Parcelable {
|
||||
int tmpHeaderColor = in.readInt();
|
||||
headerColor = tmpHeaderColor != -1 ? tmpHeaderColor : null;
|
||||
starStatus = in.readInt();
|
||||
lastUsed = in.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,6 +81,7 @@ public class LoyaltyCard implements Parcelable {
|
||||
parcel.writeString(barcodeType != null ? barcodeType.name() : "");
|
||||
parcel.writeInt(headerColor != null ? headerColor : -1);
|
||||
parcel.writeInt(starStatus);
|
||||
parcel.writeLong(lastUsed);
|
||||
}
|
||||
|
||||
public static LoyaltyCard toLoyaltyCard(Cursor cursor)
|
||||
@@ -92,6 +94,7 @@ public class LoyaltyCard implements Parcelable {
|
||||
String cardId = cursor.getString(cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.CARD_ID));
|
||||
String barcodeId = cursor.getString(cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.BARCODE_ID));
|
||||
int starred = cursor.getInt(cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.STAR_STATUS));
|
||||
long lastUsed = cursor.getLong(cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.LAST_USED));
|
||||
|
||||
int barcodeTypeColumn = cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.BARCODE_TYPE);
|
||||
int balanceTypeColumn = cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.BALANCE_TYPE);
|
||||
@@ -122,7 +125,7 @@ public class LoyaltyCard implements Parcelable {
|
||||
headerColor = cursor.getInt(headerColorColumn);
|
||||
}
|
||||
|
||||
return new LoyaltyCard(id, store, note, expiry, balance, balanceType, cardId, barcodeId, barcodeType, headerColor, starred);
|
||||
return new LoyaltyCard(id, store, note, expiry, balance, balanceType, cardId, barcodeId, barcodeType, headerColor, starred, lastUsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -152,7 +152,8 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity
|
||||
(String) (fieldName == LoyaltyCardField.barcodeId ? value : loyaltyCard.barcodeId),
|
||||
(CatimaBarcode) (fieldName == LoyaltyCardField.barcodeType ? value : loyaltyCard.barcodeType),
|
||||
(Integer) (fieldName == LoyaltyCardField.headerColor ? value : loyaltyCard.headerColor),
|
||||
(int) (fieldName == LoyaltyCardField.starStatus ? value : loyaltyCard.starStatus)
|
||||
(int) (fieldName == LoyaltyCardField.starStatus ? value : loyaltyCard.starStatus),
|
||||
Utils.getUnixTime()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -549,7 +550,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity
|
||||
setTitle(R.string.addCardTitle);
|
||||
} else {
|
||||
// New card, use default values
|
||||
tempLoyaltyCard = new LoyaltyCard(-1, "", "", null, new BigDecimal("0"), null, "", null, null, null, 0);
|
||||
tempLoyaltyCard = new LoyaltyCard(-1, "", "", null, new BigDecimal("0"), null, "", null, null, null, 0, Utils.getUnixTime());
|
||||
setTitle(R.string.addCardTitle);
|
||||
}
|
||||
}
|
||||
@@ -991,7 +992,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity
|
||||
}
|
||||
else
|
||||
{
|
||||
loyaltyCardId = (int)db.insertLoyaltyCard(tempLoyaltyCard.store, tempLoyaltyCard.note, tempLoyaltyCard.expiry, tempLoyaltyCard.balance, tempLoyaltyCard.balanceType, tempLoyaltyCard.cardId, tempLoyaltyCard.barcodeId, tempLoyaltyCard.barcodeType, tempLoyaltyCard.headerColor, 0);
|
||||
loyaltyCardId = (int) db.insertLoyaltyCard(tempLoyaltyCard.store, tempLoyaltyCard.note, tempLoyaltyCard.expiry, tempLoyaltyCard.balance, tempLoyaltyCard.balanceType, tempLoyaltyCard.cardId, tempLoyaltyCard.barcodeId, tempLoyaltyCard.barcodeType, tempLoyaltyCard.headerColor, 0, tempLoyaltyCard.lastUsed);
|
||||
try {
|
||||
Utils.saveCardImage(this, (Bitmap) cardImageFront.getTag(), loyaltyCardId, true);
|
||||
Utils.saveCardImage(this, (Bitmap) cardImageBack.getTag(), loyaltyCardId, false);
|
||||
|
||||
@@ -581,6 +581,8 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements
|
||||
}
|
||||
|
||||
setFullscreen(isFullscreen);
|
||||
|
||||
db.updateLoyaltyCardLastUsed(loyaltyCard.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,9 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
@@ -42,6 +44,9 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
private Menu mMenu;
|
||||
private GestureDetector mGestureDetector;
|
||||
protected String mFilter = "";
|
||||
protected Object mGroup = null;
|
||||
protected DBHelper.LoyaltyCardOrder mOrder = DBHelper.LoyaltyCardOrder.Alpha;
|
||||
protected DBHelper.LoyaltyCardOrderDirection mOrderDirection = DBHelper.LoyaltyCardOrderDirection.Ascending;
|
||||
protected int selectedTab = 0;
|
||||
private RecyclerView mCardList;
|
||||
private View mHelpText;
|
||||
@@ -141,8 +146,9 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
}
|
||||
|
||||
TabLayout.Tab tab = ((TabLayout) findViewById(R.id.groups)).getTabAt(selectedTab);
|
||||
mGroup = tab != null ? tab.getTag() : null;
|
||||
|
||||
updateLoyaltyCardList(mFilter, tab != null ? tab.getTag() : null);
|
||||
updateLoyaltyCardList();
|
||||
|
||||
dialog.dismiss();
|
||||
});
|
||||
@@ -187,14 +193,15 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
selectedTab = tab.getPosition();
|
||||
updateLoyaltyCardList(mFilter, tab.getTag());
|
||||
mGroup = tab.getTag();
|
||||
updateLoyaltyCardList();
|
||||
|
||||
// Store active tab in Shared Preference to restore next app launch
|
||||
SharedPreferences activeTabPref = getApplicationContext().getSharedPreferences(
|
||||
getString(R.string.sharedpreference_active_tab),
|
||||
Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor activeTabPrefEditor = activeTabPref.edit();
|
||||
activeTabPrefEditor.putInt(getString(R.string.sharedpreference_active_tab), selectedTab);
|
||||
activeTabPrefEditor.putInt(getString(R.string.sharedpreference_active_tab), tab.getPosition());
|
||||
activeTabPrefEditor.apply();
|
||||
}
|
||||
|
||||
@@ -226,7 +233,8 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
mCardList.setAdapter(mAdapter);
|
||||
registerForContextMenu(mCardList);
|
||||
|
||||
updateLoyaltyCardList(mFilter, null);
|
||||
mGroup = null;
|
||||
updateLoyaltyCardList();
|
||||
|
||||
/*
|
||||
* This was added for Huawei, but Huawei is just too much of a fucking pain.
|
||||
@@ -285,13 +293,20 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
TabLayout groupsTabLayout = findViewById(R.id.groups);
|
||||
updateTabGroups(groupsTabLayout);
|
||||
|
||||
// Restore active tab from Shared Preference
|
||||
// Restore settings from Shared Preference
|
||||
SharedPreferences activeTabPref = getApplicationContext().getSharedPreferences(
|
||||
getString(R.string.sharedpreference_active_tab),
|
||||
Context.MODE_PRIVATE);
|
||||
selectedTab = activeTabPref.getInt(getString(R.string.sharedpreference_active_tab), 0);
|
||||
SharedPreferences sortPref = getApplicationContext().getSharedPreferences(
|
||||
getString(R.string.sharedpreference_sort),
|
||||
Context.MODE_PRIVATE);
|
||||
try {
|
||||
mOrder = DBHelper.LoyaltyCardOrder.valueOf(sortPref.getString(getString(R.string.sharedpreference_sort_order), null));
|
||||
mOrderDirection = DBHelper.LoyaltyCardOrderDirection.valueOf(sortPref.getString(getString(R.string.sharedpreference_sort_direction), null));
|
||||
} catch (IllegalArgumentException | NullPointerException ignored) {}
|
||||
|
||||
Object group = null;
|
||||
mGroup = null;
|
||||
|
||||
if (groupsTabLayout.getTabCount() != 0) {
|
||||
TabLayout.Tab tab = groupsTabLayout.getTabAt(selectedTab);
|
||||
@@ -301,9 +316,9 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
|
||||
groupsTabLayout.selectTab(tab);
|
||||
assert tab != null;
|
||||
group = tab.getTag();
|
||||
mGroup = tab.getTag();
|
||||
}
|
||||
updateLoyaltyCardList(mFilter, group);
|
||||
updateLoyaltyCardList();
|
||||
// End of active tab logic
|
||||
|
||||
FloatingActionButton addButton = findViewById(R.id.fabAdd);
|
||||
@@ -368,14 +383,13 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void updateLoyaltyCardList(String filterText, Object tag)
|
||||
{
|
||||
private void updateLoyaltyCardList() {
|
||||
Group group = null;
|
||||
if (tag != null) {
|
||||
group = (Group) tag;
|
||||
if (mGroup != null) {
|
||||
group = (Group) mGroup;
|
||||
}
|
||||
|
||||
mAdapter.swapCursor(mDB.getLoyaltyCardCursor(filterText, group));
|
||||
mAdapter.swapCursor(mDB.getLoyaltyCardCursor(mFilter, group, mOrder, mOrderDirection));
|
||||
|
||||
if(mDB.getLoyaltyCardCount() > 0)
|
||||
{
|
||||
@@ -391,7 +405,7 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!filterText.isEmpty()) {
|
||||
if(!mFilter.isEmpty()) {
|
||||
// Actual Empty Search Result
|
||||
mNoMatchingCardsText.setVisibility(View.VISIBLE);
|
||||
mNoGroupCardsText.setVisibility(View.GONE);
|
||||
@@ -486,11 +500,9 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
|
||||
TabLayout groupsTabLayout = findViewById(R.id.groups);
|
||||
TabLayout.Tab currentTab = groupsTabLayout.getTabAt(groupsTabLayout.getSelectedTabPosition());
|
||||
mGroup = currentTab != null ? currentTab.getTag() : null;
|
||||
|
||||
updateLoyaltyCardList(
|
||||
mFilter,
|
||||
currentTab != null ? currentTab.getTag() : null
|
||||
);
|
||||
updateLoyaltyCardList();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -504,6 +516,40 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
{
|
||||
int id = inputItem.getItemId();
|
||||
|
||||
if (id == R.id.action_sort)
|
||||
{
|
||||
TabLayout.Tab tab = ((TabLayout) findViewById(R.id.groups)).getTabAt(selectedTab);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.sort_by);
|
||||
|
||||
AtomicInteger currentIndex = new AtomicInteger();
|
||||
List<DBHelper.LoyaltyCardOrder> loyaltyCardOrders = Arrays.asList(DBHelper.LoyaltyCardOrder.values());
|
||||
for (int i = 0; i < loyaltyCardOrders.size(); i++) {
|
||||
if (mOrder == loyaltyCardOrders.get(i)) {
|
||||
currentIndex.set(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
builder.setSingleChoiceItems(R.array.sort_types_array, currentIndex.get(), (dialog, which) -> currentIndex.set(which));
|
||||
builder.setPositiveButton(R.string.sort, (dialog, which) -> {
|
||||
setSort(loyaltyCardOrders.get(currentIndex.get()), DBHelper.LoyaltyCardOrderDirection.Ascending);
|
||||
|
||||
dialog.dismiss();
|
||||
});
|
||||
builder.setNeutralButton(R.string.reverse, (dialog, which) -> {
|
||||
setSort(loyaltyCardOrders.get(currentIndex.get()), DBHelper.LoyaltyCardOrderDirection.Descending);
|
||||
|
||||
dialog.dismiss();
|
||||
});
|
||||
builder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (id == R.id.action_manage_groups)
|
||||
{
|
||||
Intent i = new Intent(getApplicationContext(), ManageGroupsActivity.class);
|
||||
@@ -541,6 +587,24 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
return super.onOptionsItemSelected(inputItem);
|
||||
}
|
||||
|
||||
private void setSort(DBHelper.LoyaltyCardOrder order, DBHelper.LoyaltyCardOrderDirection direction) {
|
||||
// Update values
|
||||
mOrder = order;
|
||||
mOrderDirection = direction;
|
||||
|
||||
// Store in Shared Preference to restore next app launch
|
||||
SharedPreferences sortPref = getApplicationContext().getSharedPreferences(
|
||||
getString(R.string.sharedpreference_sort),
|
||||
Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor sortPrefEditor = sortPref.edit();
|
||||
sortPrefEditor.putString(getString(R.string.sharedpreference_sort_order), order.name());
|
||||
sortPrefEditor.putString(getString(R.string.sharedpreference_sort_direction), direction.name());
|
||||
sortPrefEditor.apply();
|
||||
|
||||
// Update card list
|
||||
updateLoyaltyCardList();
|
||||
}
|
||||
|
||||
protected static boolean isDarkModeEnabled(Context inputContext)
|
||||
{
|
||||
Configuration config = inputContext.getResources().getConfiguration();
|
||||
|
||||
@@ -146,6 +146,21 @@ public class Utils {
|
||||
}
|
||||
|
||||
static public BarcodeValues getBarcodeFromBitmap(Bitmap bitmap) {
|
||||
// This function is vulnerable to OOM, so we try again with a smaller bitmap is we get OOM
|
||||
for (int i = 0; i < 10; i++) {
|
||||
try {
|
||||
return Utils.getBarcodeFromBitmapReal(bitmap);
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.w(TAG, "Ran OOM in getBarcodeFromBitmap! Trying again with smaller picture! Retry " + i + " of 10.");
|
||||
bitmap = Bitmap.createScaledBitmap(bitmap, (int) Math.round(0.75 * bitmap.getWidth()), (int) Math.round(0.75 * bitmap.getHeight()), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Give up
|
||||
return new BarcodeValues(null, null);
|
||||
}
|
||||
|
||||
static private BarcodeValues getBarcodeFromBitmapReal(Bitmap bitmap) {
|
||||
// In order to decode it, the Bitmap must first be converted into a pixel array...
|
||||
int[] intArray = new int[bitmap.getWidth() * bitmap.getHeight()];
|
||||
bitmap.getPixels(intArray, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
@@ -376,4 +391,8 @@ public class Utils {
|
||||
configuration.setLocales(localeList);
|
||||
return context.createConfigurationContext(configuration);
|
||||
}
|
||||
|
||||
static public long getUnixTime() {
|
||||
return System.currentTimeMillis() / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,8 @@ public class CatimaExporter implements Exporter
|
||||
DBHelper.LoyaltyCardDbIds.BARCODE_ID,
|
||||
DBHelper.LoyaltyCardDbIds.BARCODE_TYPE,
|
||||
DBHelper.LoyaltyCardDbIds.HEADER_COLOR,
|
||||
DBHelper.LoyaltyCardDbIds.STAR_STATUS);
|
||||
DBHelper.LoyaltyCardDbIds.STAR_STATUS,
|
||||
DBHelper.LoyaltyCardDbIds.LAST_USED);
|
||||
|
||||
Cursor cardCursor = db.getLoyaltyCardCursor();
|
||||
|
||||
@@ -145,7 +146,8 @@ public class CatimaExporter implements Exporter
|
||||
card.barcodeId,
|
||||
card.barcodeType != null ? card.barcodeType.name() : "",
|
||||
card.headerColor,
|
||||
card.starStatus);
|
||||
card.starStatus,
|
||||
card.lastUsed);
|
||||
|
||||
if(Thread.currentThread().isInterrupted())
|
||||
{
|
||||
|
||||
@@ -349,13 +349,21 @@ public class CatimaImporter implements Importer
|
||||
int starStatus = 0;
|
||||
try {
|
||||
starStatus = CSVHelpers.extractInt(DBHelper.LoyaltyCardDbIds.STAR_STATUS, record, false);
|
||||
} catch (FormatException _e ) {
|
||||
// This field did not exist in versions 0.278 and before
|
||||
} catch (FormatException _e) {
|
||||
// This field did not exist in versions 0.28 and before
|
||||
// We catch this exception so we can still import old backups
|
||||
}
|
||||
if (starStatus != 1) starStatus = 0;
|
||||
|
||||
helper.insertLoyaltyCard(database, id, store, note, expiry, balance, balanceType, cardId, barcodeId, barcodeType, headerColor, starStatus);
|
||||
Long lastUsed = 0L;
|
||||
try {
|
||||
lastUsed = CSVHelpers.extractLong(DBHelper.LoyaltyCardDbIds.LAST_USED, record, false);
|
||||
} catch (FormatException _e) {
|
||||
// This field did not exist in versions 2.5.0 and before
|
||||
// We catch this exception so we can still import old backups
|
||||
}
|
||||
|
||||
helper.insertLoyaltyCard(database, id, store, note, expiry, balance, balanceType, cardId, barcodeId, barcodeType, headerColor, starStatus, lastUsed);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.text.ParseException;
|
||||
import protect.card_locker.CatimaBarcode;
|
||||
import protect.card_locker.DBHelper;
|
||||
import protect.card_locker.FormatException;
|
||||
import protect.card_locker.Utils;
|
||||
|
||||
/**
|
||||
* Class for importing a database from CSV (Comma Separate Values)
|
||||
@@ -135,6 +136,6 @@ public class FidmeImporter implements Importer
|
||||
|
||||
// TODO: Front and back image
|
||||
|
||||
helper.insertLoyaltyCard(database, store, note, null, BigDecimal.valueOf(0), null, cardId, null, barcodeType, null, starStatus);
|
||||
helper.insertLoyaltyCard(database, store, note, null, BigDecimal.valueOf(0), null, cardId, null, barcodeType, null, starStatus, null);
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public class StocardImporter implements Importer
|
||||
}
|
||||
}
|
||||
|
||||
long loyaltyCardInternalId = db.insertLoyaltyCard(database, store, note, null, BigDecimal.valueOf(0), null, cardId, null, barcodeType, null, 0);
|
||||
long loyaltyCardInternalId = db.insertLoyaltyCard(database, store, note, null, BigDecimal.valueOf(0), null, cardId, null, barcodeType, null, 0, null);
|
||||
|
||||
if (loyaltyCardData.containsKey("frontImage")) {
|
||||
Utils.saveCardImage(context, (Bitmap) loyaltyCardData.get("frontImage"), (int) loyaltyCardInternalId, true);
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.TimeZone;
|
||||
import protect.card_locker.CatimaBarcode;
|
||||
import protect.card_locker.DBHelper;
|
||||
import protect.card_locker.FormatException;
|
||||
import protect.card_locker.Utils;
|
||||
|
||||
/**
|
||||
* Class for importing a database from CSV (Comma Separate Values)
|
||||
@@ -129,7 +130,7 @@ public class VoucherVaultImporter implements Importer
|
||||
throw new FormatException("Unknown colour type found: " + colorFromJSON);
|
||||
}
|
||||
|
||||
db.insertLoyaltyCard(store, "", expiry, balance, balanceType, cardId, null, barcodeType, headerColor, 0);
|
||||
db.insertLoyaltyCard(store, "", expiry, balance, balanceType, cardId, null, barcodeType, headerColor, 0, Utils.getUnixTime());
|
||||
}
|
||||
|
||||
database.setTransactionSuccessful();
|
||||
|
||||
5
app/src/main/res/drawable/ic_baseline_sort_24.xml
Normal file
5
app/src/main/res/drawable/ic_baseline_sort_24.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:tint="#FFFFFF" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M3,18h6v-2L3,16v2zM3,6v2h18L21,6L3,6zM3,13h12v-2L3,11v2z"/>
|
||||
</vector>
|
||||
@@ -8,11 +8,16 @@
|
||||
android:icon="@drawable/ic_search_white"
|
||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||
app:showAsAction="always|collapseActionView"/>
|
||||
<item
|
||||
android:id="@+id/action_sort"
|
||||
android:title="@string/sort"
|
||||
android:icon="@drawable/ic_baseline_sort_24"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@+id/action_manage_groups"
|
||||
android:icon="@drawable/ic_folder_white"
|
||||
android:title="@string/groups"
|
||||
app:showAsAction="always"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/action_import_export"
|
||||
android:icon="@drawable/ic_import_export_white_24dp"
|
||||
|
||||
@@ -8,20 +8,21 @@ mondstern
|
||||
Taco
|
||||
Gediminas Murauskas
|
||||
IllusiveMan196
|
||||
Joel A
|
||||
Samantaz Fox
|
||||
arno-github
|
||||
Sergio Paredes
|
||||
Joel A
|
||||
Nyatsuki
|
||||
StoyanDimitrov
|
||||
arshbeerSingh
|
||||
Oğuz Ersen
|
||||
huuhaa
|
||||
Michael Moroni
|
||||
Petr Novák
|
||||
betsythefc
|
||||
K. Herbert
|
||||
Oğuz Ersen
|
||||
Quentin PAGÈS
|
||||
String E. Fighter
|
||||
Yurical
|
||||
Adolfo Jayme-Barrientos
|
||||
Alessandro Mandelli
|
||||
@@ -33,7 +34,6 @@ Jane Kong
|
||||
Lukas Grassauer
|
||||
Michalis
|
||||
schirinowski
|
||||
String E. Fighter
|
||||
inesre
|
||||
lgasp
|
||||
phlostically
|
||||
@@ -42,6 +42,7 @@ Kevin Sicong Jiang
|
||||
Miha Frangež
|
||||
Airat
|
||||
BMN
|
||||
Flav
|
||||
Franciszek Stefan
|
||||
Izzy
|
||||
Karol Kosek
|
||||
|
||||
@@ -191,4 +191,11 @@
|
||||
<string name="toggleMoreInfo">Umschalten, um weitere Informationen anzuzeigen</string>
|
||||
<string name="barcodeImageDescriptionWithType">Bild des Kartenstrichcodes des Typs <xliff:g>%s</xliff:g></string>
|
||||
<string name="swipeToSwitchImages">Wischen oder langes Drücken zum Wechseln der Bilder</string>
|
||||
<string name="sort_by">Sortieren nach</string>
|
||||
<string name="sort_by_balance">Kontostand</string>
|
||||
<string name="sort_by_expiry">Ablaufdatum</string>
|
||||
<string name="sort_by_most_recently_used">Zuletzt verwendet</string>
|
||||
<string name="sort_by_name">Name</string>
|
||||
<string name="sort">Sortieren</string>
|
||||
<string name="reverse">Umgekehrt</string>
|
||||
</resources>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" xmlns:tools="http://schemas.android.com/tools">
|
||||
<string name="action_add">Ajouter</string>
|
||||
<string name="noGiftCards">Cliquez sur le bouton + plus pour ajouter une carte, ou importez-en d’abord depuis le menu ⋮</string>
|
||||
<string name="noGiftCards">Cliquez sur le bouton + plus pour ajouter une carte, ou importez les depuis le menu ⋮</string>
|
||||
<string name="storeName">Nom</string>
|
||||
<string name="note">Notes</string>
|
||||
<string name="cardId">Numéro</string>
|
||||
@@ -191,4 +191,11 @@
|
||||
<string name="toggleMoreInfo">Activer/désactiver l\'affichage de plus d\'infos</string>
|
||||
<string name="barcodeImageDescriptionWithType">Image du code-barres de la carte de type <xliff:g>%s</xliff:g></string>
|
||||
<string name="swipeToSwitchImages">Balayez ou appuyez longuement pour changer d\'image</string>
|
||||
<string name="sort">Trier</string>
|
||||
<string name="sort_by">Trier par</string>
|
||||
<string name="reverse">Inversé</string>
|
||||
<string name="sort_by_expiry">Date d\'expiration</string>
|
||||
<string name="sort_by_most_recently_used">Les plus récemment utilisées</string>
|
||||
<string name="sort_by_name">Nom</string>
|
||||
<string name="sort_by_balance">Solde</string>
|
||||
</resources>
|
||||
@@ -191,4 +191,11 @@
|
||||
<string name="toggleMoreInfo">Attiva/disattiva la visualizzazione di altre informazioni</string>
|
||||
<string name="barcodeImageDescriptionWithType">Immagine del codice a barre della carta del tipo <xliff:g>%s</xliff:g></string>
|
||||
<string name="swipeToSwitchImages">Scorri o premi a lungo per cambiare immagine</string>
|
||||
<string name="sort_by">Ordina per</string>
|
||||
<string name="reverse">Inverti</string>
|
||||
<string name="sort_by_balance">Saldo</string>
|
||||
<string name="sort_by_expiry">Scadenza</string>
|
||||
<string name="sort_by_most_recently_used">Usate più di recente</string>
|
||||
<string name="sort_by_name">Nome</string>
|
||||
<string name="sort">Ordina</string>
|
||||
</resources>
|
||||
@@ -195,4 +195,11 @@
|
||||
<string name="toggleMoreInfo">Perjungti išsamios informacijos rodymą</string>
|
||||
<string name="barcodeImageDescriptionWithType"><xliff:g>%s</xliff:g> tipo kortelės brūkšninio kodo vaizdas</string>
|
||||
<string name="swipeToSwitchImages">Perbraukite arba ilgai palaikykite paspaudę, kad perjungtumėte vaizdus</string>
|
||||
<string name="sort_by">Rikiuoti pagal</string>
|
||||
<string name="reverse">Atvirkštinis</string>
|
||||
<string name="sort_by_balance">Balansas</string>
|
||||
<string name="sort_by_expiry">Galiojimo pabaiga</string>
|
||||
<string name="sort_by_most_recently_used">Vėliausiai naudota</string>
|
||||
<string name="sort_by_name">Pavadinimas</string>
|
||||
<string name="sort">Rikiuoti</string>
|
||||
</resources>
|
||||
@@ -191,4 +191,11 @@
|
||||
<string name="toggleMoreInfo">Meer informatie tonen/verbergen</string>
|
||||
<string name="barcodeImageDescriptionWithType">Afbeelding van de barcode, type <xliff:g>%s</xliff:g></string>
|
||||
<string name="swipeToSwitchImages">Veeg of houd lang ingedrukt om te bladeren</string>
|
||||
<string name="sort_by">Sorteren op</string>
|
||||
<string name="reverse">Omdraaien</string>
|
||||
<string name="sort_by_balance">Op saldo</string>
|
||||
<string name="sort_by_expiry">Op vervaldatum</string>
|
||||
<string name="sort_by_most_recently_used">Op onlangs gebruikt</string>
|
||||
<string name="sort_by_name">Op naam</string>
|
||||
<string name="sort">Sorteren</string>
|
||||
</resources>
|
||||
@@ -199,4 +199,11 @@
|
||||
<string name="barcodeImageDescriptionWithType">Изображение штрих-кода карты типа <xliff:g>%s</xliff:g></string>
|
||||
<string name="toggleMoreInfo">Переключение отображения дополнительной информации</string>
|
||||
<string name="swipeToSwitchImages">Смахивание или долгое нажатие для переключения изображений</string>
|
||||
<string name="sort_by_expiry">Срок действия</string>
|
||||
<string name="sort_by">Сортировать по</string>
|
||||
<string name="reverse">Обратный порядок</string>
|
||||
<string name="sort_by_balance">Баланс</string>
|
||||
<string name="sort_by_most_recently_used">Частота использования</string>
|
||||
<string name="sort_by_name">Название</string>
|
||||
<string name="sort">Сортировка</string>
|
||||
</resources>
|
||||
@@ -35,7 +35,7 @@
|
||||
<string name="importing">Importujem…</string>
|
||||
<string name="exporting">Exportujem…</string>
|
||||
<string name="noExternalStoragePermissionError">Nie je možné importovať a exportovať karty bez prístupu k externému úložisku</string>
|
||||
<string name="importOptionFilesystemTitle">Import zo súborového systému.</string>
|
||||
<string name="importOptionFilesystemTitle">Import zo súborového systému</string>
|
||||
<string name="importOptionFilesystemExplanation">Vyberte súbor zo súborového systému.</string>
|
||||
<string name="importOptionFilesystemButton">Zo súborového systému</string>
|
||||
<string name="importOptionApplicationTitle">Použite externú aplikáciu</string>
|
||||
@@ -61,4 +61,44 @@
|
||||
<string name="barcodeType">Typ čiarových kódov</string>
|
||||
<string name="noMatchingGiftCards">Nenašiel som nič. Skúste zmeniť vyhľadávanie.</string>
|
||||
<string name="action_search">Vyhľadávanie</string>
|
||||
<string name="chooseImportType">Importovať údaje z\?</string>
|
||||
<string name="points">Body</string>
|
||||
<string name="currency">Mena</string>
|
||||
<string name="balance">Vyváženie</string>
|
||||
<string name="errorReadingImage">Obrázok sa nepodarilo prečítať</string>
|
||||
<string name="noBarcodeFound">Nenašiel sa žiadny čiarový kód</string>
|
||||
<string name="moveBarcodeToCenterOfScreen">Vycentrovanie čiarového kódu na obrazovke</string>
|
||||
<string name="moveBarcodeToTopOfScreen">Presun čiarového kódu do hornej časti obrazovky</string>
|
||||
<string name="chooseExpiryDate">Zvoľte dátum skončenia platnosti</string>
|
||||
<string name="never">Nikdy</string>
|
||||
<string name="addFromImage">Vyberte obrázok z galérie</string>
|
||||
<string name="addManually">Ručné zadanie ID karty</string>
|
||||
<string name="leaveWithoutSaveConfirmation">Odísť bez uloženia\?</string>
|
||||
<string name="leaveWithoutSaveTitle">Výstup</string>
|
||||
<string name="moveDown">Pohyb smerom nadol</string>
|
||||
<string name="moveUp">Pohyb smerom nahor</string>
|
||||
<string name="failedOpeningFileManager">Najprv nainštalujte správcu súborov.</string>
|
||||
<string name="deleteConfirmationGroup">Vymazať skupinu\?</string>
|
||||
<string name="all">Všetky</string>
|
||||
<string name="noGroupCards">Táto skupina neobsahuje karty</string>
|
||||
<string name="noGroups">Ak chcete najprv pridať skupiny na kategorizáciu, kliknite na tlačidlo + plus.</string>
|
||||
<string name="groups">Skupiny</string>
|
||||
<string name="enter_group_name">Zadajte názov skupiny</string>
|
||||
<string name="exportSuccessful">Export údajov z karty</string>
|
||||
<string name="importSuccessful">Import údajov z karty</string>
|
||||
<string name="intent_import_card_from_url_share_text">Chcem sa s vami podeliť o pohľadnicu</string>
|
||||
<string name="settings_disable_lockscreen_while_viewing_card">Zabráňte uzamknutiu obrazovky</string>
|
||||
<string name="settings_keep_screen_on">Nechajte obrazovku zapnutú</string>
|
||||
<string name="settings_max_font_size_scale">Maximálna veľkosť písma</string>
|
||||
<string name="card_ids_copied">Skopírované ID karty</string>
|
||||
<string name="unstar">Odstrániť z obľúbených</string>
|
||||
<string name="settings_dark_theme">Tmavé</string>
|
||||
<string name="settings_light_theme">Svetlo</string>
|
||||
<string name="settings_system_theme">Systém</string>
|
||||
<string name="settings_theme">Téma</string>
|
||||
<string name="starImage">Obľúbená hviezda</string>
|
||||
<string name="enterBarcodeInstructions">Zadajte ID karty a vyberte typ čiarového kódu nižšie alebo \"Táto karta nemá čiarový kód\".</string>
|
||||
<string name="exportOptionExplanation">Údaje sa zapíšu na vami zvolené miesto.</string>
|
||||
<string name="failedParsingImportUriError">Nepodarilo sa analyzovať import URI</string>
|
||||
<string name="share">Zdieľať</string>
|
||||
</resources>
|
||||
@@ -190,4 +190,12 @@
|
||||
<string name="noGroupCards">Denna grupp innehåller inga kort</string>
|
||||
<string name="toggleMoreInfo">Växla mellan att visa mer info</string>
|
||||
<string name="barcodeImageDescriptionWithType">Bild av kortstreckkod av typen <xliff:g>%s</xliff:g></string>
|
||||
<string name="swipeToSwitchImages">Svep eller tryck länge för att växla bild</string>
|
||||
<string name="reverse">Vänd ordning</string>
|
||||
<string name="sort_by">Sortera efter</string>
|
||||
<string name="sort_by_balance">Saldo</string>
|
||||
<string name="sort_by_expiry">Förfallodag</string>
|
||||
<string name="sort_by_most_recently_used">Senast använda</string>
|
||||
<string name="sort_by_name">Namn</string>
|
||||
<string name="sort">Sortera</string>
|
||||
</resources>
|
||||
@@ -191,4 +191,11 @@
|
||||
</plurals>
|
||||
<string name="action_add">Ekle</string>
|
||||
<string name="action_search">Ara</string>
|
||||
<string name="sort_by">Sıralama ölçütü</string>
|
||||
<string name="reverse">Ters</string>
|
||||
<string name="sort_by_balance">Bakiye</string>
|
||||
<string name="sort_by_expiry">Son kullanma tarihi</string>
|
||||
<string name="sort_by_most_recently_used">En Son Kullanılan</string>
|
||||
<string name="sort_by_name">Ad</string>
|
||||
<string name="sort">Sırala</string>
|
||||
</resources>
|
||||
@@ -7,4 +7,10 @@
|
||||
<item>Stocard</item>
|
||||
<item>Voucher Vault</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="sort_types_array">
|
||||
<item>@string/sort_by_name</item>
|
||||
<item>@string/sort_by_most_recently_used</item>
|
||||
<item>@string/sort_by_expiry</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -124,6 +124,9 @@
|
||||
|
||||
<string name="sharedpreference_active_tab" translatable="false">sharedpreference_active_tab</string>
|
||||
<string name="sharedpreference_privacy_policy_shown" translatable="false">sharedpreference_privacy_policy_shown</string>
|
||||
<string name="sharedpreference_sort" translatable="false">sharedpreference_sort</string>
|
||||
<string name="sharedpreference_sort_order" translatable="false">sharedpreference_sort_order</string>
|
||||
<string name="sharedpreference_sort_direction" translatable="false">sharedpreference_sort_direction</string>
|
||||
|
||||
<string name="intent_import_card_from_url_share_text">I want to share a card with you</string>
|
||||
<string name="intent_import_card_from_url_host_catima_app" translatable="false">catima.app</string>
|
||||
@@ -239,7 +242,14 @@
|
||||
<string name="settings_key_grey_theme" translatable="false">grey_theme</string>
|
||||
<string name="settings_key_brown_theme" translatable="false">brown_theme</string>
|
||||
<string name="app_contributors">Made possible by: <xliff:g id="app_contributors">%s</xliff:g></string>
|
||||
<string name="sort">Sort</string>
|
||||
|
||||
<string name="toggleMoreInfo">Toggle showing more info</string>
|
||||
<string name="swipeToSwitchImages">Swipe or long press to switch images</string>
|
||||
<string name="sort_by_name">Name</string>
|
||||
<string name="sort_by_most_recently_used">Most Recently Used</string>
|
||||
<string name="sort_by_expiry">Expiry</string>
|
||||
<string name="sort_by_balance">Balance</string>
|
||||
<string name="reverse">Reverse</string>
|
||||
<string name="sort_by">Sort by</string>
|
||||
</resources>
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DatabaseTest
|
||||
public void addRemoveOneGiftCard()
|
||||
{
|
||||
assertEquals(0, db.getLoyaltyCardCount());
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0);
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
assertEquals(1, db.getLoyaltyCardCount());
|
||||
@@ -72,7 +72,7 @@ public class DatabaseTest
|
||||
@Test
|
||||
public void updateGiftCard()
|
||||
{
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0);
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
assertEquals(1, db.getLoyaltyCardCount());
|
||||
@@ -98,7 +98,7 @@ public class DatabaseTest
|
||||
@Test
|
||||
public void updateGiftCardOnlyStar()
|
||||
{
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0);
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
assertEquals(1, db.getLoyaltyCardCount());
|
||||
@@ -135,7 +135,7 @@ public class DatabaseTest
|
||||
@Test
|
||||
public void emptyGiftCardValues()
|
||||
{
|
||||
long id = db.insertLoyaltyCard("", "", null, new BigDecimal("0"), null, "", null, null, null, 0);
|
||||
long id = db.insertLoyaltyCard("", "", null, new BigDecimal("0"), null, "", null, null, null, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
assertEquals(1, db.getLoyaltyCardCount());
|
||||
@@ -164,7 +164,7 @@ public class DatabaseTest
|
||||
for(int index = CARDS_TO_ADD-1; index >= 0; index--)
|
||||
{
|
||||
long id = db.insertLoyaltyCard("store" + index, "note" + index, null, new BigDecimal("0"), null, "cardId" + index,
|
||||
null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), index, 0);
|
||||
null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), index, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
}
|
||||
@@ -210,12 +210,12 @@ public class DatabaseTest
|
||||
{
|
||||
if (index == CARDS_TO_ADD-1) {
|
||||
id = db.insertLoyaltyCard("store" + index, "note" + index, null, new BigDecimal("0"), null, "cardId" + index,
|
||||
null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), index, 1);
|
||||
null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), index, 1, null);
|
||||
}
|
||||
|
||||
else {
|
||||
id = db.insertLoyaltyCard("store" + index, "note" + index, null, new BigDecimal("0"), null, "cardId" + index,
|
||||
null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), index, 0);
|
||||
null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), index, 0, null);
|
||||
}
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
@@ -316,7 +316,7 @@ public class DatabaseTest
|
||||
{
|
||||
// Create card
|
||||
assertEquals(0, db.getLoyaltyCardCount());
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0);
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
assertEquals(1, db.getLoyaltyCardCount());
|
||||
@@ -433,7 +433,7 @@ public class DatabaseTest
|
||||
{
|
||||
// Create card
|
||||
assertEquals(0, db.getLoyaltyCardCount());
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0);
|
||||
long id = db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), DEFAULT_HEADER_COLOR, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
assertEquals(1, db.getLoyaltyCardCount());
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ImportExportTest
|
||||
{
|
||||
String storeName = String.format("store, \"%4d", index);
|
||||
String note = String.format("note, \"%4d", index);
|
||||
long id = db.insertLoyaltyCard(storeName, note, null, new BigDecimal(String.valueOf(index)), null, BARCODE_DATA, null, BARCODE_TYPE, index, 0);
|
||||
long id = db.insertLoyaltyCard(storeName, note, null, new BigDecimal(String.valueOf(index)), null, BARCODE_DATA, null, BARCODE_TYPE, index, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class ImportExportTest
|
||||
{
|
||||
String storeName = String.format("store, \"%4d", index);
|
||||
String note = String.format("note, \"%4d", index);
|
||||
long id = db.insertLoyaltyCard(storeName, note, null, new BigDecimal(String.valueOf(index)), null, BARCODE_DATA, null, BARCODE_TYPE, index, 1);
|
||||
long id = db.insertLoyaltyCard(storeName, note, null, new BigDecimal(String.valueOf(index)), null, BARCODE_DATA, null, BARCODE_TYPE, index, 1, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class ImportExportTest
|
||||
String storeName = String.format("store, \"%4d", index);
|
||||
String note = String.format("note, \"%4d", index);
|
||||
//if index is even
|
||||
long id = db.insertLoyaltyCard(storeName, note, null, new BigDecimal(String.valueOf(index)), null, BARCODE_DATA, null, BARCODE_TYPE, index, 0);
|
||||
long id = db.insertLoyaltyCard(storeName, note, null, new BigDecimal(String.valueOf(index)), null, BARCODE_DATA, null, BARCODE_TYPE, index, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class ImportExportTest
|
||||
@Test
|
||||
public void addLoyaltyCardsWithExpiryNeverPastTodayFuture()
|
||||
{
|
||||
long id = db.insertLoyaltyCard("No Expiry", "", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, 0, 0);
|
||||
long id = db.insertLoyaltyCard("No Expiry", "", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, 0, 0, null);
|
||||
boolean result = (id != -1);
|
||||
assertTrue(result);
|
||||
|
||||
@@ -142,7 +142,7 @@ public class ImportExportTest
|
||||
assertEquals(Integer.valueOf(0), card.headerColor);
|
||||
assertEquals(0, card.starStatus);
|
||||
|
||||
id = db.insertLoyaltyCard("Past", "", new Date((long) 1), new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, 0, 0);
|
||||
id = db.insertLoyaltyCard("Past", "", new Date((long) 1), new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, 0, 0, null);
|
||||
result = (id != -1);
|
||||
assertTrue(result);
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ImportExportTest
|
||||
assertEquals(Integer.valueOf(0), card.headerColor);
|
||||
assertEquals(0, card.starStatus);
|
||||
|
||||
id = db.insertLoyaltyCard("Today", "", new Date(), new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, 0, 0);
|
||||
id = db.insertLoyaltyCard("Today", "", new Date(), new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, 0, 0, null);
|
||||
result = (id != -1);
|
||||
assertTrue(result);
|
||||
|
||||
@@ -177,7 +177,7 @@ public class ImportExportTest
|
||||
|
||||
// This will break after 19 January 2038
|
||||
// If someone is still maintaining this code base by then: I love you
|
||||
id = db.insertLoyaltyCard("Future", "", new Date(2147483648000L), new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, 0, 0);
|
||||
id = db.insertLoyaltyCard("Future", "", new Date(2147483648000L), new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, 0, 0, null);
|
||||
result = (id != -1);
|
||||
assertTrue(result);
|
||||
|
||||
@@ -884,7 +884,7 @@ public class ImportExportTest
|
||||
HashMap<Integer, Bitmap> loyaltyCardBackImages = new HashMap<>();
|
||||
|
||||
// Create card 1
|
||||
int loyaltyCardId = (int) db.insertLoyaltyCard("Card 1", "Note 1", new Date(1618053234), new BigDecimal("100"), Currency.getInstance("USD"), "1234", "5432", CatimaBarcode.fromBarcode(BarcodeFormat.QR_CODE), 1, 0);
|
||||
int loyaltyCardId = (int) db.insertLoyaltyCard("Card 1", "Note 1", new Date(1618053234), new BigDecimal("100"), Currency.getInstance("USD"), "1234", "5432", CatimaBarcode.fromBarcode(BarcodeFormat.QR_CODE), 1, 0, null);
|
||||
loyaltyCardHashMap.put(loyaltyCardId, db.getLoyaltyCard(loyaltyCardId));
|
||||
db.insertGroup("One");
|
||||
List<Group> groups = Arrays.asList(db.getGroup("One"));
|
||||
@@ -896,7 +896,7 @@ public class ImportExportTest
|
||||
loyaltyCardBackImages.put(loyaltyCardId, roundLauncherBitmap);
|
||||
|
||||
// Create card 2
|
||||
loyaltyCardId = (int) db.insertLoyaltyCard("Card 2", "", null, new BigDecimal(0), null, "123456", null, null, 2, 1);
|
||||
loyaltyCardId = (int) db.insertLoyaltyCard("Card 2", "", null, new BigDecimal(0), null, "123456", null, null, 2, 1, null);
|
||||
loyaltyCardHashMap.put(loyaltyCardId, db.getLoyaltyCard(loyaltyCardId));
|
||||
|
||||
// Export everything
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ImportURITest {
|
||||
// Generate card
|
||||
Date date = new Date();
|
||||
|
||||
db.insertLoyaltyCard("store", "This note contains evil symbols like & and = that will break the parser if not escaped right $#!%()*+;:á", date, new BigDecimal("100"), null, BarcodeFormat.UPC_E.toString(), BarcodeFormat.UPC_A.toString(), CatimaBarcode.fromBarcode(BarcodeFormat.QR_CODE), Color.BLACK, 1);
|
||||
db.insertLoyaltyCard("store", "This note contains evil symbols like & and = that will break the parser if not escaped right $#!%()*+;:á", date, new BigDecimal("100"), null, BarcodeFormat.UPC_E.toString(), BarcodeFormat.UPC_A.toString(), CatimaBarcode.fromBarcode(BarcodeFormat.QR_CODE), Color.BLACK, 1, null);
|
||||
|
||||
// Get card
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
@@ -70,7 +70,7 @@ public class ImportURITest {
|
||||
@Test
|
||||
public void ensureNoCrashOnMissingHeaderFields() throws InvalidObjectException, UnsupportedEncodingException {
|
||||
// Generate card
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("10.00"), Currency.getInstance("EUR"), BarcodeFormat.UPC_A.toString(), null, CatimaBarcode.fromBarcode(BarcodeFormat.QR_CODE), null, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("10.00"), Currency.getInstance("EUR"), BarcodeFormat.UPC_A.toString(), null, CatimaBarcode.fromBarcode(BarcodeFormat.QR_CODE), null, 0, null);
|
||||
|
||||
// Get card
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
@@ -120,7 +120,7 @@ public class LoyaltyCardCursorAdapterTest
|
||||
@Test
|
||||
public void TestCursorAdapterEmptyNote()
|
||||
{
|
||||
db.insertLoyaltyCard("store", "", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
Cursor cursor = db.getLoyaltyCardCursor();
|
||||
@@ -136,7 +136,7 @@ public class LoyaltyCardCursorAdapterTest
|
||||
@Test
|
||||
public void TestCursorAdapterWithNote()
|
||||
{
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
Cursor cursor = db.getLoyaltyCardCursor();
|
||||
@@ -156,7 +156,7 @@ public class LoyaltyCardCursorAdapterTest
|
||||
Date expiryDate = new Date();
|
||||
String dateString = DateFormat.getDateInstance(DateFormat.LONG).format(expiryDate);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", expiryDate, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", expiryDate, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
Cursor cursor = db.getLoyaltyCardCursor();
|
||||
@@ -177,9 +177,9 @@ public class LoyaltyCardCursorAdapterTest
|
||||
@Test
|
||||
public void TestCursorAdapterStarring()
|
||||
{
|
||||
assertNotEquals(-1, db.insertLoyaltyCard("storeA", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0));
|
||||
assertNotEquals(-1, db.insertLoyaltyCard("storeB", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 1));
|
||||
assertNotEquals(-1, db.insertLoyaltyCard("storeC", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 1));
|
||||
assertNotEquals(-1, db.insertLoyaltyCard("storeA", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null));
|
||||
assertNotEquals(-1, db.insertLoyaltyCard("storeB", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 1, null));
|
||||
assertNotEquals(-1, db.insertLoyaltyCard("storeC", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 1, null));
|
||||
|
||||
assertEquals(3, db.getLoyaltyCardCount());
|
||||
|
||||
@@ -220,7 +220,7 @@ public class LoyaltyCardCursorAdapterTest
|
||||
@Test
|
||||
public void TestCursorAdapter0Points()
|
||||
{
|
||||
db.insertLoyaltyCard("store", "", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
Cursor cursor = db.getLoyaltyCardCursor();
|
||||
@@ -236,7 +236,7 @@ public class LoyaltyCardCursorAdapterTest
|
||||
@Test
|
||||
public void TestCursorAdapter0EUR()
|
||||
{
|
||||
db.insertLoyaltyCard("store", "", null, new BigDecimal("0"), Currency.getInstance("EUR"), "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "", null, new BigDecimal("0"), Currency.getInstance("EUR"), "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
Cursor cursor = db.getLoyaltyCardCursor();
|
||||
@@ -252,7 +252,7 @@ public class LoyaltyCardCursorAdapterTest
|
||||
@Test
|
||||
public void TestCursorAdapter100Points()
|
||||
{
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("100"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("100"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
Cursor cursor = db.getLoyaltyCardCursor();
|
||||
@@ -268,7 +268,7 @@ public class LoyaltyCardCursorAdapterTest
|
||||
@Test
|
||||
public void TestCursorAdapter10USD()
|
||||
{
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("10.00"), Currency.getInstance("USD"), "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("10.00"), Currency.getInstance("USD"), "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
Cursor cursor = db.getLoyaltyCardCursor();
|
||||
|
||||
@@ -369,7 +369,7 @@ public class LoyaltyCardViewActivityTest
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
if (!newCard) {
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
}
|
||||
|
||||
activityController.start();
|
||||
@@ -612,7 +612,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -631,7 +631,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -650,7 +650,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -674,7 +674,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -712,7 +712,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -745,7 +745,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", new Date(), new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", new Date(), new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -770,7 +770,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -821,7 +821,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("10.00"), Currency.getInstance("USD"), EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("10.00"), Currency.getInstance("USD"), EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -862,7 +862,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -894,7 +894,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, null, EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -928,7 +928,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, "123456", EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, "123456", EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -965,7 +965,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, "123456", EAN_BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, EAN_BARCODE_DATA, "123456", EAN_BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -1001,7 +1001,7 @@ public class LoyaltyCardViewActivityTest
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -1049,7 +1049,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -1069,7 +1069,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, null, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, null, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -1088,7 +1088,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, null, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, null, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -1106,7 +1106,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, null, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, null, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -1125,7 +1125,7 @@ public class LoyaltyCardViewActivityTest
|
||||
final Context context = activity.getApplicationContext();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -1154,7 +1154,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
final int LARGE_FONT_SIZE = 40;
|
||||
|
||||
@@ -1191,7 +1191,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = new DBHelper(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
settings.edit()
|
||||
@@ -1228,7 +1228,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity) activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
activityController.resume();
|
||||
@@ -1263,7 +1263,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, BARCODE_TYPE, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
@@ -1369,7 +1369,7 @@ public class LoyaltyCardViewActivityTest
|
||||
|
||||
Activity activity = (Activity)activityController.get();
|
||||
DBHelper db = TestHelpers.getEmptyDb(activity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, null, Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, null, null, Color.BLACK, 0, null);
|
||||
|
||||
activityController.start();
|
||||
activityController.visible();
|
||||
|
||||
@@ -59,8 +59,9 @@ public class MainActivityTest
|
||||
assertNotNull(menu);
|
||||
|
||||
// The settings, import/export, groups, search and add button should be present
|
||||
assertEquals(menu.size(), 6);
|
||||
assertEquals(menu.size(), 7);
|
||||
assertEquals("Search", menu.findItem(R.id.action_search).getTitle().toString());
|
||||
assertEquals("Sort", menu.findItem(R.id.action_sort).getTitle().toString());
|
||||
assertEquals("Groups", menu.findItem(R.id.action_manage_groups).getTitle().toString());
|
||||
assertEquals("Import/Export", menu.findItem(R.id.action_import_export).getTitle().toString());
|
||||
assertEquals("Privacy Policy", menu.findItem(R.id.action_privacy_policy).getTitle().toString());
|
||||
@@ -95,7 +96,7 @@ public class MainActivityTest
|
||||
assertEquals(0, list.getAdapter().getItemCount());
|
||||
|
||||
DBHelper db = TestHelpers.getEmptyDb(mainActivity);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
|
||||
assertEquals(View.VISIBLE, helpText.getVisibility());
|
||||
assertEquals(View.GONE, noMatchingCardsText.getVisibility());
|
||||
@@ -130,10 +131,10 @@ public class MainActivityTest
|
||||
assertEquals(0, list.getAdapter().getItemCount());
|
||||
|
||||
DBHelper db = TestHelpers.getEmptyDb(mainActivity);
|
||||
db.insertLoyaltyCard("storeB", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("storeA", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("storeD", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 1);
|
||||
db.insertLoyaltyCard("storeC", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 1);
|
||||
db.insertLoyaltyCard("storeB", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
db.insertLoyaltyCard("storeA", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
db.insertLoyaltyCard("storeD", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 1, null);
|
||||
db.insertLoyaltyCard("storeC", "note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 1, null);
|
||||
|
||||
assertEquals(View.VISIBLE, helpText.getVisibility());
|
||||
assertEquals(View.GONE, noMatchingCardsText.getVisibility());
|
||||
@@ -226,8 +227,8 @@ public class MainActivityTest
|
||||
TabLayout groupTabs = mainActivity.findViewById(R.id.groups);
|
||||
|
||||
DBHelper db = TestHelpers.getEmptyDb(mainActivity);
|
||||
db.insertLoyaltyCard("The First Store", "Initial note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("The Second Store", "Secondary note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0);
|
||||
db.insertLoyaltyCard("The First Store", "Initial note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
db.insertLoyaltyCard("The Second Store", "Secondary note", null, new BigDecimal("0"), null, "cardId", null, CatimaBarcode.fromBarcode(BarcodeFormat.UPC_A), Color.BLACK, 0, null);
|
||||
|
||||
db.insertGroup("Group one");
|
||||
List<Group> groups = new ArrayList<>();
|
||||
|
||||
@@ -4,7 +4,7 @@ Copylefted libre software (GPLv3+) card management app.
|
||||
|
||||
[](https://github.com/TheLastProject/Catima/releases)
|
||||
[](https://f-droid.org/packages/me.hackerchick.catima/)
|
||||
[](https://play.google.com/store/apps/details?id=me.hackerchick.catima)
|
||||
[](https://play.google.com/store/apps/details?id=me.hackerchick.catima)
|
||||
|
||||

|
||||
[](https://hosted.weblate.org/engage/catima/)
|
||||
|
||||
2
fastlane/metadata/android/en-US/changelogs/83.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/83.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
- Support for changing the sorting order
|
||||
- Prevent Out Of Memory on scanning large pictures for barcode
|
||||
@@ -1,10 +1,10 @@
|
||||
Stop the search for plastic reward cards during store or webshop checkout.
|
||||
<b>Scan barcodes to your device using its camera, forget about cards.</b>
|
||||
😺
|
||||
|
||||
Forget your wallet, or keep it ultralight for valuables.
|
||||
😺
|
||||
|
||||
With this essential everyday carry (EDC) tool you can replace useless plastic with cash.
|
||||
😺
|
||||
|
||||
- Avoid spying with very few permissions. No Internet access and no ads.
|
||||
- Add cards or codes with names and customizable colours.
|
||||
- Manual code entry if there is no barcode to store, or it can't be used.
|
||||
@@ -17,7 +17,6 @@ With this essential everyday carry (EDC) tool you can replace useless plastic wi
|
||||
- Gratis, supported by community contributions.
|
||||
- Use, study, change and share it as you wish; <i>with all</i>.
|
||||
- Not only Free Software / Open Source. <i>Copylefted</i> libre software (GPLv3+) card management.
|
||||
😺
|
||||
|
||||
Simplify your life and shopping, and never lose a paper receipt, in-store payment gift card or airplane ticket again.
|
||||
Take all your rewards and bonuses with you, and save as you go.
|
||||
😺
|
||||
|
||||
2
fastlane/metadata/android/tr-TR/changelogs/83.txt
Normal file
2
fastlane/metadata/android/tr-TR/changelogs/83.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
- Sıralama düzenini değiştirme desteği
|
||||
- Barkod için büyük resimleri tararken yetersiz bellek durumunu önle
|
||||
Reference in New Issue
Block a user