Compare commits

...

88 Commits

Author SHA1 Message Date
Sylvia van Os
252efabdc6 Increase versioncode for forgotten translation update 2021-03-30 18:51:32 +02:00
Sylvia van Os
018efaeebb Merge branch 'master' of github.com:TheLastProject/loyalty-card-locker 2021-03-30 18:46:14 +02:00
Sylvia van Os
56522b42e2 Release 1.12 2021-03-30 18:45:54 +02:00
Sylvia van Os
122a80f29c Merge pull request #176 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-29 20:58:07 +02:00
Samantaz Fox
9363a31a77 Translated using Weblate (French)
Currently translated at 100.0% (148 of 148 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/fr/
2021-03-29 20:57:13 +02:00
Sylvia van Os
21f3c58e32 Merge pull request #175 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-29 17:43:08 +02:00
solokot
205f7bb59d Translated using Weblate (Russian)
Currently translated at 100.0% (148 of 148 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-29 17:26:59 +02:00
Heimen Stoffels
1cc0f11a5d Translated using Weblate (Dutch)
Currently translated at 100.0% (148 of 148 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nl/
2021-03-29 17:26:59 +02:00
Sylvia van Os
d2168f4d91 Merge pull request #174 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-28 15:57:57 +02:00
Sylvia van Os
ba46e2a0b8 Fix Weblate's incorrect escaping 2021-03-28 15:33:56 +02:00
solokot
6fb102d9b5 Translated using Weblate (Russian)
Currently translated at 100.0% (145 of 145 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-28 15:32:04 +02:00
J. Lavoie
83b3d5d31c Translated using Weblate (Spanish)
Currently translated at 86.2% (125 of 145 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/es/
2021-03-28 15:32:04 +02:00
Sylvia van Os
c93b7527ad Merge pull request #173 from TheLastProject/feature/import-local-image
Added ability to import a barcode from a local image
2021-03-28 15:31:59 +02:00
Sylvia van Os
07bfc95bf9 Update CHANGELOG 2021-03-28 15:25:23 +02:00
Sylvia van Os
d34554ac07 Split up code more 2021-03-28 15:20:54 +02:00
Sylvia van Os
63754798ef Fix error toasts not showing 2021-03-26 19:48:17 +01:00
Sylvia van Os
9ca4b7fbe1 Merge branch 'master' of github.com:TheLastProject/loyalty-card-locker into feature/import-local-image 2021-03-25 21:35:28 +01:00
Sylvia van Os
4d6021ad8c Merge pull request #171 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-25 21:32:26 +01:00
Alessandro Mandelli
f76df0d252 Translated using Weblate (Italian)
Currently translated at 100.0% (3 of 3 strings)

Translation: Catima/Fastlane
Translate-URL: https://hosted.weblate.org/projects/catima/fastlane/it/
2021-03-25 21:29:58 +01:00
solokot
60a172813f Translated using Weblate (Russian)
Currently translated at 100.0% (145 of 145 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-25 21:29:58 +01:00
Heimen Stoffels
01025e862a Translated using Weblate (Dutch)
Currently translated at 100.0% (145 of 145 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nl/
2021-03-25 21:29:58 +01:00
Alessandro Mandelli
7e9c7db813 Translated using Weblate (Italian)
Currently translated at 100.0% (145 of 145 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/it/
2021-03-25 21:29:57 +01:00
J. Lavoie
d8b121f503 Translated using Weblate (Italian)
Currently translated at 100.0% (145 of 145 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/it/
2021-03-25 21:29:56 +01:00
J. Lavoie
79a143ebaf Translated using Weblate (French)
Currently translated at 100.0% (145 of 145 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/fr/
2021-03-25 21:29:56 +01:00
J. Lavoie
0b78f36784 Translated using Weblate (German)
Currently translated at 100.0% (145 of 145 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/de/
2021-03-25 21:29:55 +01:00
Sylvia van Os
a4c24c6436 Fix multiline note cutoff 2021-03-25 00:00:44 +01:00
Sylvia van Os
f59f9ddec8 Make spotBugs happy 2021-03-24 21:33:36 +01:00
Sylvia van Os
d21f2d12c9 Merge branch 'master' of github.com:TheLastProject/loyalty-card-locker 2021-03-24 21:17:22 +01:00
Sylvia van Os
30971b7e85 Fix unit tests 2021-03-24 21:17:02 +01:00
Sylvia van Os
7ab9e0f8b0 Merge pull request #169 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-24 20:52:34 +01:00
J. Lavoie
6e63543cd1 Translated using Weblate (Italian)
Currently translated at 66.6% (2 of 3 strings)

Translation: Catima/Fastlane
Translate-URL: https://hosted.weblate.org/projects/catima/fastlane/it/
2021-03-24 20:36:16 +01:00
J. Lavoie
d2de5db792 Translated using Weblate (Korean)
Currently translated at 73.7% (101 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ko/
2021-03-24 20:36:16 +01:00
Heimen Stoffels
a1bb6e3bed Translated using Weblate (Dutch)
Currently translated at 100.0% (3 of 3 strings)

Translation: Catima/Fastlane
Translate-URL: https://hosted.weblate.org/projects/catima/fastlane/nl/
2021-03-24 20:36:16 +01:00
J. Lavoie
e937fc60a7 Translated using Weblate (German)
Currently translated at 100.0% (3 of 3 strings)

Translation: Catima/Fastlane
Translate-URL: https://hosted.weblate.org/projects/catima/fastlane/de/
2021-03-24 20:36:16 +01:00
J. Lavoie
1213ee99da Translated using Weblate (French)
Currently translated at 100.0% (3 of 3 strings)

Translation: Catima/Fastlane
Translate-URL: https://hosted.weblate.org/projects/catima/fastlane/fr/
2021-03-24 20:36:16 +01:00
solokot
7dadce600b Translated using Weblate (Russian)
Currently translated at 100.0% (137 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-24 20:36:16 +01:00
Heimen Stoffels
bb1eae6f79 Translated using Weblate (Dutch)
Currently translated at 100.0% (137 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nl/
2021-03-24 20:36:16 +01:00
Allan Nordhøy
cf871e9606 Translated using Weblate (Norwegian Bokmål)
Currently translated at 97.8% (134 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nb_NO/
2021-03-24 20:36:16 +01:00
J. Lavoie
0b92a12694 Translated using Weblate (Italian)
Currently translated at 100.0% (137 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/it/
2021-03-24 20:36:16 +01:00
J. Lavoie
7636c3648c Translated using Weblate (French)
Currently translated at 100.0% (137 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/fr/
2021-03-24 20:36:16 +01:00
J. Lavoie
f62352cf05 Translated using Weblate (Spanish (Argentina))
Currently translated at 14.5% (20 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/es_AR/
2021-03-24 20:36:16 +01:00
J. Lavoie
8fbbfb137e Translated using Weblate (Greek)
Currently translated at 44.5% (61 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/el/
2021-03-24 20:36:16 +01:00
J. Lavoie
afb960257e Translated using Weblate (German)
Currently translated at 100.0% (137 of 137 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/de/
2021-03-24 20:36:16 +01:00
Sylvia van Os
b9e152e3c4 Add Fidme import support 2021-03-24 20:35:58 +01:00
Sylvia van Os
bd1d33867d Comply with Huawei's pedantic nonsense
https://twitter.com/SylvieLorxu/status/1374251557735256065
2021-03-23 21:01:56 +01:00
Sylvia van Os
eba1ed63a6 Release 1.11 2021-03-23 09:35:43 +01:00
Sylvia van Os
74fbdc7a5e Merge pull request #167 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-21 10:34:44 +01:00
solokot
ef61aaeac6 Translated using Weblate (Russian)
Currently translated at 100.0% (3 of 3 strings)

Translation: Catima/Fastlane
Translate-URL: https://hosted.weblate.org/projects/catima/fastlane/ru/
2021-03-21 06:30:31 +01:00
Sylvia van Os
b5ee7d7a2d Merge pull request #165 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-17 18:10:38 +01:00
solokot
f51ad0295a Translated using Weblate (Russian)
Currently translated at 100.0% (138 of 138 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-17 15:18:07 +01:00
Sylvia van Os
d0d3289efa Merge remote-tracking branch 'weblate/master' 2021-03-15 19:39:52 +01:00
Sylvia van Os
353d8a7ecd Fix typo 2021-03-15 19:37:45 +01:00
solokot
d221969b5e Translated using Weblate (Russian)
Currently translated at 100.0% (138 of 138 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-15 19:34:03 +01:00
Heimen Stoffels
97553e9253 Translated using Weblate (Dutch)
Currently translated at 100.0% (138 of 138 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nl/
2021-03-15 19:34:02 +01:00
Sylvia van Os
11b839dabe Merge pull request #164 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-15 19:33:57 +01:00
Sylvia van Os
bc5252b2ef Update incorrect Weblate escaping 2021-03-15 19:33:44 +01:00
solokot
5a6b7944b1 Translated using Weblate (Russian)
Currently translated at 100.0% (138 of 138 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-15 14:13:24 +01:00
solokot
a9794daca5 Translated using Weblate (Russian)
Currently translated at 100.0% (138 of 138 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-15 13:54:15 +01:00
solokot
aee59550e4 Translated using Weblate (Russian)
Currently translated at 100.0% (138 of 138 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/ru/
2021-03-15 13:33:14 +01:00
Sylvia van Os
dcc5e5921c Fix unit tests 2021-03-14 21:34:51 +01:00
Sylvia van Os
12df426dea Merge branch 'master' of github.com:TheLastProject/loyalty-card-locker 2021-03-14 17:58:36 +01:00
Sylvia van Os
9b4085e955 Show privacy policy dialog on first start 2021-03-14 17:58:20 +01:00
Sylvia van Os
a4f7d4e131 Merge pull request #163 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-13 17:09:01 +01:00
Sylvia van Os
70b313021c Fix incorrect escaping from Weblate 2021-03-13 17:05:20 +01:00
Schi Ri
d1bdab5c66 Translated using Weblate (German)
Currently translated at 100.0% (3 of 3 strings)

Translation: Catima/Fastlane
Translate-URL: https://hosted.weblate.org/projects/catima/fastlane/de/
2021-03-12 01:02:56 +01:00
Schi Ri
237405279f Translated using Weblate (German)
Currently translated at 100.0% (134 of 134 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/de/
2021-03-12 01:02:55 +01:00
Sylvia van Os
810fa5f621 Release 1.10 2021-03-07 14:38:38 +01:00
Sylvia van Os
64b709266b Merge pull request #162 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-07 14:22:02 +01:00
Heimen Stoffels
f9a66ba3a0 Translated using Weblate (Dutch)
Currently translated at 100.0% (134 of 134 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nl/
2021-03-07 14:21:20 +01:00
Allan Nordhøy
bfd36bae9f Translated using Weblate (Norwegian Bokmål)
Currently translated at 98.5% (132 of 134 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nb_NO/
2021-03-07 14:21:20 +01:00
BMN
15116ab673 Translated using Weblate (Italian)
Currently translated at 100.0% (134 of 134 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/it/
2021-03-07 14:21:20 +01:00
Sylvia van Os
d49d019f63 Merge branch 'master' of github.com:TheLastProject/loyalty-card-locker 2021-03-06 00:13:35 +01:00
Sylvia van Os
ba9d1f3891 Make Loyalty Card Keychain app name translatable
Because, well, the app itself uses different names in different
countries
2021-03-05 23:56:38 +01:00
Sylvia van Os
01596d5637 Merge pull request #160 from weblate/weblate-catima-catima
Translations update from Weblate
2021-03-05 23:50:21 +01:00
Heimen Stoffels
9bd71d5694 Translated using Weblate (Dutch)
Currently translated at 100.0% (129 of 129 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nl/
2021-03-05 23:47:01 +01:00
Allan Nordhøy
6d1e7ee3bb Translated using Weblate (Norwegian Bokmål)
Currently translated at 98.4% (127 of 129 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/nb_NO/
2021-03-05 23:47:01 +01:00
Sylvia van Os
0ce71039f1 Split into screen on and lockscreen bypass 2021-03-05 23:44:27 +01:00
Sylvia van Os
a03b89bc93 Merge branch 'master' into feature/keep-screen-on 2021-03-05 23:36:43 +01:00
Sylvia van Os
156b720102 Merge pull request #159 from TheLastProject/feature/voucherVaultImport
Create Voucher Vault import code and test
2021-03-05 09:50:23 +01:00
Sylvia van Os
c13b5dda18 Make Spotbugs happy 2021-03-04 23:45:03 +01:00
Sylvia van Os
ffa39000f7 Add Voucher Vault import to UI 2021-03-04 23:37:53 +01:00
Sylvia van Os
40de4a8dc4 Fix date parsing 2021-03-02 21:10:14 +01:00
Sylvia van Os
db22703ec0 Create Voucher Vault import code and test 2021-03-01 23:02:03 +01:00
Sylvia van Os
8b59ef152a Merge pull request #158 from weblate/weblate-catima-catima
Translations update from Weblate
2021-02-25 19:55:27 +01:00
Sylvia van Os
01bd91ff66 Fix Weblate incorrectly escaping XML 2021-02-25 19:54:46 +01:00
Simone Dotto
b558d2178a Translated using Weblate (Italian)
Currently translated at 100.0% (128 of 128 strings)

Translation: Catima/Catima
Translate-URL: https://hosted.weblate.org/projects/catima/catima/it/
2021-02-25 14:50:29 +01:00
Miha Frangež
bacb5b97ec Added ability to import a barcode from a local image 2021-02-14 19:09:33 +01:00
Miha Frange?
940be02851 Added option to keep the screen on 2021-02-14 17:29:51 +01:00
54 changed files with 1351 additions and 470 deletions

View File

@@ -1,5 +1,28 @@
# Changelog
## v1.12 (2021-03-30)
Changes:
- Support importing [Fidme](https://play.google.com/store/apps/details?id=fr.snapp.fidme) exports
- Allow importing a card from a picture stored in the user's Android gallery
- Fix multiline note cutoff
- Change "Thank you" text on privacy dialog to "Accept" because Huawei is overly pedantic
## v1.11 (2021-03-21)
Changes:
- Add privacy policy dialog on first start (required by Huawei)
## v1.10 (2021-03-07)
Changes:
- Support importing [Voucher Vault](https://github.com/tim-smart/vouchervault/) exports
- Option to keep the screen on while viewing a loyalty card
- Option to suspend the lock screen while viewing a loyalty card
## v1.9.2 (2021-02-24)
Changes:

View File

@@ -18,8 +18,8 @@ android {
applicationId "me.hackerchick.catima"
minSdkVersion 19
targetSdkVersion 29
versionCode 62
versionName "1.9.2"
versionCode 66
versionName "1.12"
vectorDrawables.useSupportLibrary true
}

View File

@@ -20,14 +20,14 @@ public class DBHelper extends SQLiteOpenHelper
public static final int ORIGINAL_DATABASE_VERSION = 1;
public static final int DATABASE_VERSION = 8;
static class LoyaltyCardDbGroups
public static class LoyaltyCardDbGroups
{
public static final String TABLE = "groups";
public static final String ID = "_id";
public static final String ORDER = "orderId";
}
static class LoyaltyCardDbIds
public static class LoyaltyCardDbIds
{
public static final String TABLE = "cards";
public static final String ID = "_id";
@@ -43,7 +43,7 @@ public class DBHelper extends SQLiteOpenHelper
public static final String STAR_STATUS = "starstatus";
}
static class LoyaltyCardDbIdsGroups
public static class LoyaltyCardDbIdsGroups
{
public static final String TABLE = "cardsGroups";
public static final String cardID = "cardId";
@@ -166,6 +166,27 @@ public class DBHelper extends SQLiteOpenHelper
return newId;
}
public boolean insertLoyaltyCard(final SQLiteDatabase db, final String store,
final String note, final Date expiry, final BigDecimal balance,
final Currency balanceType, final String cardId,
final String barcodeType, final Integer headerColor,
final int starStatus)
{
ContentValues contentValues = new ContentValues();
contentValues.put(LoyaltyCardDbIds.STORE, store);
contentValues.put(LoyaltyCardDbIds.NOTE, note);
contentValues.put(LoyaltyCardDbIds.EXPIRY, expiry != null ? expiry.getTime() : null);
contentValues.put(LoyaltyCardDbIds.BALANCE, balance.toString());
contentValues.put(LoyaltyCardDbIds.BALANCE_TYPE, balanceType != null ? balanceType.getCurrencyCode() : null);
contentValues.put(LoyaltyCardDbIds.CARD_ID, cardId);
contentValues.put(LoyaltyCardDbIds.BARCODE_TYPE, barcodeType);
contentValues.put(LoyaltyCardDbIds.HEADER_COLOR, headerColor);
contentValues.put(LoyaltyCardDbIds.HEADER_TEXT_COLOR, Color.WHITE);
contentValues.put(LoyaltyCardDbIds.STAR_STATUS,starStatus);
final long newId = db.insert(LoyaltyCardDbIds.TABLE, null, contentValues);
return (newId != -1);
}
public boolean 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,

View File

@@ -2,7 +2,8 @@ package protect.card_locker;
public enum DataFormat
{
CSV,
Catima,
Fidme,
VoucherVault
;
}

View File

@@ -1,19 +0,0 @@
package protect.card_locker;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Interface for a class which can import the contents of a stream
* into the database.
*/
public interface DatabaseImporter
{
/**
* Import data from the input stream in a given format into
* the database.
* @throws IOException
* @throws FormatException
*/
void importData(DBHelper db, InputStreamReader input) throws IOException, FormatException, InterruptedException;
}

View File

@@ -16,6 +16,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.provider.ContactsContract;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
@@ -28,6 +29,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
public class ImportExportActivity extends AppCompatActivity
{
@@ -35,10 +37,14 @@ public class ImportExportActivity extends AppCompatActivity
private static final int PERMISSIONS_EXTERNAL_STORAGE = 1;
private static final int CHOOSE_EXPORT_LOCATION = 2;
private static final int CHOOSE_EXPORTED_FILE = 3;
private static final int IMPORT = 3;
private ImportExportTask importExporter;
private String importAlertTitle;
private String importAlertMessage;
private DataFormat importDataFormat;
@Override
protected void onCreate(Bundle savedInstanceState)
{
@@ -93,7 +99,7 @@ public class ImportExportActivity extends AppCompatActivity
@Override
public void onClick(View v)
{
chooseFileWithIntent(intentGetContentAction, CHOOSE_EXPORTED_FILE);
chooseImportType(intentGetContentAction);
}
});
@@ -106,12 +112,60 @@ public class ImportExportActivity extends AppCompatActivity
@Override
public void onClick(View v)
{
chooseFileWithIntent(intentPickAction, CHOOSE_EXPORTED_FILE);
chooseImportType(intentPickAction);
}
});
}
private void startImport(final InputStream target, final Uri targetUri)
private void chooseImportType(Intent baseIntent) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.chooseImportType)
.setItems(R.array.import_types_array, (dialog, which) -> {
switch (which) {
// Catima
case 0:
importAlertTitle = getString(R.string.importCatima);
importAlertMessage = getString(R.string.importCatimaMessage);
importDataFormat = DataFormat.Catima;
break;
// Fidme
case 1:
importAlertTitle = getString(R.string.importFidme);
importAlertMessage = getString(R.string.importFidmeMessage);
importDataFormat = DataFormat.Fidme;
break;
// Loyalty Card Keychain
case 2:
importAlertTitle = getString(R.string.importLoyaltyCardKeychain);
importAlertMessage = getString(R.string.importLoyaltyCardKeychainMessage);
importDataFormat = DataFormat.Catima;
break;
// Voucher Vault
case 3:
importAlertTitle = getString(R.string.importVoucherVault);
importAlertMessage = getString(R.string.importVoucherVaultMessage);
importDataFormat = DataFormat.VoucherVault;
break;
default:
throw new IllegalArgumentException("Unknown DataFormat");
}
new AlertDialog.Builder(this)
.setTitle(importAlertTitle)
.setMessage(importAlertMessage)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
chooseFileWithIntent(baseIntent, IMPORT);
}
})
.setNegativeButton(R.string.cancel, null)
.show();
});
builder.show();
}
private void startImport(final InputStream target, final Uri targetUri, final DataFormat dataFormat)
{
ImportExportTask.TaskCompleteListener listener = new ImportExportTask.TaskCompleteListener()
{
@@ -123,7 +177,7 @@ public class ImportExportActivity extends AppCompatActivity
};
importExporter = new ImportExportTask(ImportExportActivity.this,
DataFormat.CSV, target, listener);
dataFormat, target, listener);
importExporter.execute();
}
@@ -139,7 +193,7 @@ public class ImportExportActivity extends AppCompatActivity
};
importExporter = new ImportExportTask(ImportExportActivity.this,
DataFormat.CSV, target, listener);
DataFormat.Catima, target, listener);
importExporter.execute();
}
@@ -294,7 +348,7 @@ public class ImportExportActivity extends AppCompatActivity
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != RESULT_OK || (requestCode != CHOOSE_EXPORT_LOCATION && requestCode != CHOOSE_EXPORTED_FILE))
if (resultCode != RESULT_OK)
{
Log.w(TAG, "Failed onActivityResult(), result=" + resultCode);
return;
@@ -336,8 +390,9 @@ public class ImportExportActivity extends AppCompatActivity
reader = new FileInputStream(new File(uri.toString()));
}
Log.e(TAG, "Starting file export with: " + uri.toString());
startImport(reader, uri);
Log.e(TAG, "Starting file import with: " + uri.toString());
startImport(reader, uri, importDataFormat);
}
}
catch(FileNotFoundException e)

View File

@@ -13,6 +13,9 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import protect.card_locker.importexport.MultiFormatExporter;
import protect.card_locker.importexport.MultiFormatImporter;
class ImportExportTask extends AsyncTask<Void, Void, Boolean>
{
private static final String TAG = "Catima";
@@ -58,16 +61,8 @@ class ImportExportTask extends AsyncTask<Void, Void, Boolean>
{
boolean result = false;
try
{
InputStreamReader reader = new InputStreamReader(stream, Charset.forName("UTF-8"));
result = MultiFormatImporter.importData(db, reader, format);
reader.close();
}
catch(IOException e)
{
Log.e(TAG, "Unable to import file", e);
}
result = MultiFormatImporter.importData(db, stream, format);
Log.i(TAG, "Import result: " + result);

View File

@@ -6,6 +6,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
@@ -76,6 +77,8 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
View barcodeImageLayout;
View barcodeCaptureLayout;
Button captureButton;
Button importImageButton;
Button enterButton;
int loyaltyCardId;
@@ -634,6 +637,7 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
}
}
class ColorSelectListener implements View.OnClickListener
{
final int defaultColor;
@@ -840,7 +844,7 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
{
super.onActivityResult(requestCode, resultCode, intent);
BarcodeValues barcodeValues = Utils.parseSetBarcodeActivityResult(requestCode, resultCode, intent);
BarcodeValues barcodeValues = Utils.parseSetBarcodeActivityResult(requestCode, resultCode, intent, this);
barcodeType = barcodeValues.format();
cardId = barcodeValues.content();

View File

@@ -236,10 +236,24 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
// '1' is the brightest. We attempt to maximize the brightness
// to help barcode readers scan the barcode.
Window window = getWindow();
if(window != null && settings.useMaxBrightnessDisplayingBarcode())
if(window != null)
{
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.screenBrightness = 1F;
if (settings.useMaxBrightnessDisplayingBarcode())
{
attributes.screenBrightness = 1F;
}
if (settings.getKeepScreenOn()) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
if (settings.getDisableLockscreenWhileViewingCard()) {
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
}
window.setAttributes(attributes);
}

View File

@@ -1,13 +1,16 @@
package protect.card_locker;
import android.app.AlertDialog;
import android.app.SearchManager;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
@@ -92,6 +95,29 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
helpText.setOnTouchListener(gestureTouchListener);
noMatchingCardsText.setOnTouchListener(gestureTouchListener);
list.setOnTouchListener(gestureTouchListener);
// Show privacy policy on first run
SharedPreferences privacyPolicyShownPref = getApplicationContext().getSharedPreferences(
getString(R.string.sharedpreference_privacy_policy_shown),
Context.MODE_PRIVATE);
if (privacyPolicyShownPref.getInt(getString(R.string.sharedpreference_privacy_policy_shown), 0) == 0) {
SharedPreferences.Editor privacyPolicyShownPrefEditor = privacyPolicyShownPref.edit();
privacyPolicyShownPrefEditor.putInt(getString(R.string.sharedpreference_privacy_policy_shown), 1);
privacyPolicyShownPrefEditor.apply();
new AlertDialog.Builder(this)
.setTitle(R.string.privacy_policy)
.setMessage(R.string.privacy_policy_popup_text)
.setPositiveButton(R.string.accept, null)
.setNegativeButton(R.string.privacy_policy, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
openPrivacyPolicy();
}
})
.setIcon(android.R.drawable.ic_dialog_info)
.show();
};
}
@Override
@@ -162,7 +188,7 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
return;
}
BarcodeValues barcodeValues = Utils.parseSetBarcodeActivityResult(requestCode, resultCode, intent);
BarcodeValues barcodeValues = Utils.parseSetBarcodeActivityResult(requestCode, resultCode, intent, this);
if(!barcodeValues.isEmpty()) {
Intent newIntent = new Intent(getApplicationContext(), LoyaltyCardEditActivity.class);
@@ -290,6 +316,14 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
groupsTabLayout.setVisibility(View.VISIBLE);
}
private void openPrivacyPolicy() {
Intent browserIntent = new Intent(
Intent.ACTION_VIEW,
Uri.parse("https://thelastproject.github.io/Catima/privacy-policy")
);
startActivity(browserIntent);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
{
@@ -402,6 +436,12 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
return true;
}
if(id == R.id.action_privacy_policy)
{
openPrivacyPolicy();
return true;
}
if(id == R.id.action_about)
{
Intent i = new Intent(getApplicationContext(), AboutActivity.class);

View File

@@ -132,7 +132,7 @@ public class ScanActivity extends AppCompatActivity {
{
super.onActivityResult(requestCode, resultCode, intent);
BarcodeValues barcodeValues = Utils.parseSetBarcodeActivityResult(requestCode, resultCode, intent);
BarcodeValues barcodeValues = Utils.parseSetBarcodeActivityResult(requestCode, resultCode, intent, this);
if (!barcodeValues.isEmpty()) {
Intent manualResult = new Intent();
@@ -154,4 +154,10 @@ public class ScanActivity extends AppCompatActivity {
}
startActivityForResult(i, Utils.SELECT_BARCODE_REQUEST);
}
public void addFromImage(View view) {
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, Utils.BARCODE_IMPORT_FROM_IMAGE_FILE);
}
}

View File

@@ -3,21 +3,31 @@ package protect.card_locker;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.provider.MediaStore;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import androidx.core.graphics.ColorUtils;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.NotFoundException;
import com.google.zxing.RGBLuminanceSource;
import com.google.zxing.Result;
import com.google.zxing.common.HybridBinarizer;
public class Utils {
private static final String TAG = "Catima";
@@ -25,6 +35,7 @@ public class Utils {
public static final int MAIN_REQUEST = 1;
public static final int SELECT_BARCODE_REQUEST = 2;
public static final int BARCODE_SCAN = 3;
public static final int BARCODE_IMPORT_FROM_IMAGE_FILE = 4;
static final double LUMINANCE_MIDPOINT = 0.5;
@@ -48,28 +59,75 @@ public class Utils {
return ColorUtils.calculateLuminance(backgroundColor) > LUMINANCE_MIDPOINT;
}
static public BarcodeValues parseSetBarcodeActivityResult(int requestCode, int resultCode, Intent intent) {
String contents = null;
String format = null;
static public BarcodeValues parseSetBarcodeActivityResult(int requestCode, int resultCode, Intent intent, Context context) {
String contents;
String format;
if (resultCode == Activity.RESULT_OK)
{
if (resultCode != Activity.RESULT_OK) {
return new BarcodeValues(null, null);
}
if (requestCode == Utils.BARCODE_IMPORT_FROM_IMAGE_FILE) {
Log.i(TAG, "Received image file with possible barcode");
Bitmap bitmap;
try {
bitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(), intent.getData());
} catch (IOException e) {
Log.e(TAG, "Error getting data from image file");
e.printStackTrace();
Toast.makeText(context, R.string.errorReadingImage, Toast.LENGTH_LONG).show();
return new BarcodeValues(null, null);
}
BarcodeValues barcodeFromBitmap = getBarcodeFromBitmap(bitmap);
if (barcodeFromBitmap.isEmpty()) {
Log.i(TAG, "No barcode found in image file");
Toast.makeText(context, R.string.noBarcodeFound, Toast.LENGTH_LONG).show();
}
Log.i(TAG, "Read barcode id: " + barcodeFromBitmap.content());
Log.i(TAG, "Read format: " + barcodeFromBitmap.format());
return barcodeFromBitmap;
}
if (requestCode == Utils.BARCODE_SCAN || requestCode == Utils.SELECT_BARCODE_REQUEST) {
if (requestCode == Utils.BARCODE_SCAN) {
Log.i(TAG, "Received barcode information from camera");
} else if (requestCode == Utils.SELECT_BARCODE_REQUEST) {
Log.i(TAG, "Received barcode information from typing it");
} else {
return new BarcodeValues(null, null);
}
contents = intent.getStringExtra(BarcodeSelectorActivity.BARCODE_CONTENTS);
format = intent.getStringExtra(BarcodeSelectorActivity.BARCODE_FORMAT);
Log.i(TAG, "Read barcode id: " + contents);
Log.i(TAG, "Read format: " + format);
return new BarcodeValues(format, contents);
}
Log.i(TAG, "Read barcode id: " + contents);
Log.i(TAG, "Read format: " + format);
throw new UnsupportedOperationException("Unknown request code for parseSetBarcodeActivityResult");
}
return new BarcodeValues(format, contents);
static public BarcodeValues getBarcodeFromBitmap(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());
// ...and then turned into a binary bitmap from its luminance
LuminanceSource source = new RGBLuminanceSource(bitmap.getWidth(), bitmap.getHeight(), intArray);
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
Result barcodeResult = new MultiFormatReader().decode(binaryBitmap);
return new BarcodeValues(barcodeResult.getBarcodeFormat().name(), barcodeResult.getText());
} catch (NotFoundException e) {
return new BarcodeValues(null, null);
}
}
static public Boolean hasExpired(Date expiryDate) {

View File

@@ -0,0 +1,93 @@
package protect.card_locker.importexport;
import org.apache.commons.csv.CSVRecord;
import protect.card_locker.FormatException;
public class CSVHelpers {
/**
* Extract a string from the items array. The index into the array
* is determined by looking up the index in the fields map using the
* "key" as the key. If no such key exists, defaultValue is returned
* if it is not null. Otherwise, a FormatException is thrown.
*/
static String extractString(String key, CSVRecord record, String defaultValue)
throws FormatException
{
String toReturn = defaultValue;
if(record.isMapped(key))
{
toReturn = record.get(key);
}
else
{
if(defaultValue == null)
{
throw new FormatException("Field not used but expected: " + key);
}
}
return toReturn;
}
/**
* Extract an integer from the items array. The index into the array
* is determined by looking up the index in the fields map using the
* "key" as the key. If no such key exists, or the data is not a valid
* int, a FormatException is thrown.
*/
static Integer extractInt(String key, CSVRecord record, boolean nullIsOk)
throws FormatException
{
if(record.isMapped(key) == false)
{
throw new FormatException("Field not used but expected: " + key);
}
String value = record.get(key);
if(value.isEmpty() && nullIsOk)
{
return null;
}
try
{
return Integer.parseInt(record.get(key));
}
catch(NumberFormatException e)
{
throw new FormatException("Failed to parse field: " + key, e);
}
}
/**
* Extract a long from the items array. The index into the array
* is determined by looking up the index in the fields map using the
* "key" as the key. If no such key exists, or the data is not a valid
* int, a FormatException is thrown.
*/
static Long extractLong(String key, CSVRecord record, boolean nullIsOk)
throws FormatException
{
if(record.isMapped(key) == false)
{
throw new FormatException("Field not used but expected: " + key);
}
String value = record.get(key);
if(value.isEmpty() && nullIsOk)
{
return null;
}
try
{
return Long.parseLong(record.get(key));
}
catch(NumberFormatException e)
{
throw new FormatException("Failed to parse field: " + key, e);
}
}
}

View File

@@ -1,4 +1,4 @@
package protect.card_locker;
package protect.card_locker.importexport;
import android.database.Cursor;
@@ -8,6 +8,10 @@ import org.apache.commons.csv.CSVPrinter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import protect.card_locker.DBHelper;
import protect.card_locker.Group;
import protect.card_locker.LoyaltyCard;
/**
* Class for exporting the database into CSV (Comma Separate Values)
* format.

View File

@@ -1,19 +1,31 @@
package protect.card_locker;
package protect.card_locker.importexport;
import android.database.sqlite.SQLiteDatabase;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.json.JSONException;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.math.BigDecimal;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.Currency;
import java.util.Date;
import java.util.List;
import java.util.zip.ZipFile;
import protect.card_locker.DBHelper;
import protect.card_locker.FormatException;
import protect.card_locker.Group;
/**
* Class for importing a database from CSV (Comma Separate Values)
@@ -24,9 +36,9 @@ import java.util.List;
*/
public class CsvDatabaseImporter implements DatabaseImporter
{
public void importData(DBHelper db, InputStreamReader input) throws IOException, FormatException, InterruptedException
public void importData(DBHelper db, InputStream input) throws IOException, FormatException, InterruptedException
{
BufferedReader bufferedReader = new BufferedReader(input);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
bufferedReader.mark(100);
@@ -196,92 +208,6 @@ public class CsvDatabaseImporter implements DatabaseImporter
}
}
/**
* Extract a string from the items array. The index into the array
* is determined by looking up the index in the fields map using the
* "key" as the key. If no such key exists, defaultValue is returned
* if it is not null. Otherwise, a FormatException is thrown.
*/
private String extractString(String key, CSVRecord record, String defaultValue)
throws FormatException
{
String toReturn = defaultValue;
if(record.isMapped(key))
{
toReturn = record.get(key);
}
else
{
if(defaultValue == null)
{
throw new FormatException("Field not used but expected: " + key);
}
}
return toReturn;
}
/**
* Extract an integer from the items array. The index into the array
* is determined by looking up the index in the fields map using the
* "key" as the key. If no such key exists, or the data is not a valid
* int, a FormatException is thrown.
*/
private Integer extractInt(String key, CSVRecord record, boolean nullIsOk)
throws FormatException
{
if(record.isMapped(key) == false)
{
throw new FormatException("Field not used but expected: " + key);
}
String value = record.get(key);
if(value.isEmpty() && nullIsOk)
{
return null;
}
try
{
return Integer.parseInt(record.get(key));
}
catch(NumberFormatException e)
{
throw new FormatException("Failed to parse field: " + key, e);
}
}
/**
* Extract a long from the items array. The index into the array
* is determined by looking up the index in the fields map using the
* "key" as the key. If no such key exists, or the data is not a valid
* int, a FormatException is thrown.
*/
private Long extractLong(String key, CSVRecord record, boolean nullIsOk)
throws FormatException
{
if(record.isMapped(key) == false)
{
throw new FormatException("Field not used but expected: " + key);
}
String value = record.get(key);
if(value.isEmpty() && nullIsOk)
{
return null;
}
try
{
return Long.parseLong(record.get(key));
}
catch(NumberFormatException e)
{
throw new FormatException("Failed to parse field: " + key, e);
}
}
/**
* Import a single loyalty card into the database using the given
* session.
@@ -289,23 +215,23 @@ public class CsvDatabaseImporter implements DatabaseImporter
private void importLoyaltyCard(SQLiteDatabase database, DBHelper helper, CSVRecord record)
throws IOException, FormatException
{
int id = extractInt(DBHelper.LoyaltyCardDbIds.ID, record, false);
int id = CSVHelpers.extractInt(DBHelper.LoyaltyCardDbIds.ID, record, false);
String store = extractString(DBHelper.LoyaltyCardDbIds.STORE, record, "");
String store = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.STORE, record, "");
if(store.isEmpty())
{
throw new FormatException("No store listed, but is required");
}
String note = extractString(DBHelper.LoyaltyCardDbIds.NOTE, record, "");
String note = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.NOTE, record, "");
Date expiry = null;
try {
expiry = new Date(extractLong(DBHelper.LoyaltyCardDbIds.EXPIRY, record, true));
expiry = new Date(CSVHelpers.extractLong(DBHelper.LoyaltyCardDbIds.EXPIRY, record, true));
} catch (NullPointerException | FormatException e) { }
BigDecimal balance;
try {
balance = new BigDecimal(extractString(DBHelper.LoyaltyCardDbIds.BALANCE, record, null));
balance = new BigDecimal(CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.BALANCE, record, null));
} catch (FormatException _e ) {
// These fields did not exist in versions 1.8.1 and before
// We catch this exception so we can still import old backups
@@ -313,29 +239,29 @@ public class CsvDatabaseImporter implements DatabaseImporter
}
Currency balanceType = null;
String unparsedBalanceType = extractString(DBHelper.LoyaltyCardDbIds.BALANCE_TYPE, record, "");
String unparsedBalanceType = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.BALANCE_TYPE, record, "");
if(!unparsedBalanceType.isEmpty()) {
balanceType = Currency.getInstance(unparsedBalanceType);
}
String cardId = extractString(DBHelper.LoyaltyCardDbIds.CARD_ID, record, "");
String cardId = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.CARD_ID, record, "");
if(cardId.isEmpty())
{
throw new FormatException("No card ID listed, but is required");
}
String barcodeType = extractString(DBHelper.LoyaltyCardDbIds.BARCODE_TYPE, record, "");
String barcodeType = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.BARCODE_TYPE, record, "");
Integer headerColor = null;
if(record.isMapped(DBHelper.LoyaltyCardDbIds.HEADER_COLOR))
{
headerColor = extractInt(DBHelper.LoyaltyCardDbIds.HEADER_COLOR, record, true);
headerColor = CSVHelpers.extractInt(DBHelper.LoyaltyCardDbIds.HEADER_COLOR, record, true);
}
int starStatus = 0;
try {
starStatus = extractInt(DBHelper.LoyaltyCardDbIds.STAR_STATUS, record, false);
starStatus = CSVHelpers.extractInt(DBHelper.LoyaltyCardDbIds.STAR_STATUS, record, false);
} 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
@@ -351,7 +277,7 @@ public class CsvDatabaseImporter implements DatabaseImporter
private void importGroup(SQLiteDatabase database, DBHelper helper, CSVRecord record)
throws IOException, FormatException
{
String id = extractString(DBHelper.LoyaltyCardDbGroups.ID, record, null);
String id = CSVHelpers.extractString(DBHelper.LoyaltyCardDbGroups.ID, record, null);
helper.insertGroup(database, id);
}
@@ -363,8 +289,8 @@ public class CsvDatabaseImporter implements DatabaseImporter
private void importCardGroupMapping(SQLiteDatabase database, DBHelper helper, CSVRecord record)
throws IOException, FormatException
{
Integer cardId = extractInt(DBHelper.LoyaltyCardDbIdsGroups.cardID, record, false);
String groupId = extractString(DBHelper.LoyaltyCardDbIdsGroups.groupID, record, null);
Integer cardId = CSVHelpers.extractInt(DBHelper.LoyaltyCardDbIdsGroups.cardID, record, false);
String groupId = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIdsGroups.groupID, record, null);
List<Group> cardGroups = helper.getLoyaltyCardGroups(cardId);
cardGroups.add(helper.getGroup(groupId));

View File

@@ -1,8 +1,10 @@
package protect.card_locker;
package protect.card_locker.importexport;
import java.io.IOException;
import java.io.OutputStreamWriter;
import protect.card_locker.DBHelper;
/**
* Interface for a class which can export the contents of the database
* in a given format.

View File

@@ -0,0 +1,27 @@
package protect.card_locker.importexport;
import org.json.JSONException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.ParseException;
import protect.card_locker.DBHelper;
import protect.card_locker.FormatException;
/**
* Interface for a class which can import the contents of a stream
* into the database.
*/
public interface DatabaseImporter
{
/**
* Import data from the input stream in a given format into
* the database.
* @throws IOException
* @throws FormatException
*/
void importData(DBHelper db, InputStream input) throws IOException, FormatException, InterruptedException, JSONException, ParseException;
}

View File

@@ -0,0 +1,147 @@
package protect.card_locker.importexport;
import android.annotation.SuppressLint;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import com.google.zxing.BarcodeFormat;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Currency;
import java.util.Date;
import java.util.TimeZone;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import protect.card_locker.DBHelper;
import protect.card_locker.FormatException;
/**
* Class for importing a database from CSV (Comma Separate Values)
* formatted data.
*
* The database's loyalty cards are expected to appear in the CSV data.
* A header is expected for the each table showing the names of the columns.
*/
public class FidmeImporter implements DatabaseImporter
{
public void importData(DBHelper db, InputStream input) throws IOException, FormatException, JSONException, ParseException {
// We actually retrieve a .zip file
ZipInputStream zipInputStream = new ZipInputStream(input);
StringBuilder loyaltyCards = new StringBuilder();
byte[] buffer = new byte[1024];
int read = 0;
ZipEntry zipEntry;
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
if (zipEntry.getName().equals("loyalty_programs.csv")) {
while ((read = zipInputStream.read(buffer, 0, 1024)) >= 0) {
loyaltyCards.append(new String(buffer, 0, read, StandardCharsets.UTF_8));
}
}
}
if (loyaltyCards.length() == 0) {
throw new FormatException("Couldn't find loyalty_programs.csv in zip file or it is empty");
}
SQLiteDatabase database = db.getWritableDatabase();
database.beginTransaction();
final CSVParser fidmeParser = new CSVParser(new StringReader(loyaltyCards.toString()), CSVFormat.RFC4180.withDelimiter(';').withHeader());
try {
for (CSVRecord record : fidmeParser) {
importLoyaltyCard(database, db, record);
if (Thread.currentThread().isInterrupted()) {
throw new InterruptedException();
}
}
} catch (IllegalArgumentException | IllegalStateException | InterruptedException e) {
throw new FormatException("Issue parsing CSV data", e);
} finally {
fidmeParser.close();
}
database.setTransactionSuccessful();
database.endTransaction();
database.close();
zipInputStream.close();
}
/**
* Import a single loyalty card into the database using the given
* session.
*/
private void importLoyaltyCard(SQLiteDatabase database, DBHelper helper, CSVRecord record)
throws IOException, FormatException
{
// A loyalty card export from Fidme contains the following fields:
// Retailer (store name)
// Program (program name)
// Added at (YYYY-MM-DD HH:MM:SS UTC)
// Reference (card ID)
// Firstname (card holder first name)
// Lastname (card holder last name)
// The store is called Retailer
String store = CSVHelpers.extractString("Retailer", record, "");
if (store.isEmpty())
{
throw new FormatException("No store listed, but is required");
}
// There seems to be no note field in the CSV? So let's combine other fields instead...
String program = CSVHelpers.extractString("Program", record, "");
String addedAt = CSVHelpers.extractString("Added At", record, "");
String firstName = CSVHelpers.extractString("Firstname", record, "");
String lastName = CSVHelpers.extractString("Lastname", record, "");
String combinedName = String.format("%s %s", firstName, lastName);
StringBuilder noteBuilder = new StringBuilder();
if (!program.isEmpty()) noteBuilder.append(program).append('\n');
if (!addedAt.isEmpty()) noteBuilder.append(addedAt).append('\n');
if (!combinedName.isEmpty()) noteBuilder.append(combinedName).append('\n');
String note = noteBuilder.toString();
// The ID is called reference
String cardId = CSVHelpers.extractString("Reference", record, "");
if(cardId.isEmpty())
{
throw new FormatException("No card ID listed, but is required");
}
// Sadly, Fidme exports don't contain the card type
// I guess they have an online DB of all the different companies and what type they use
// TODO: Hook this into our own loyalty card DB if we ever get one
String barcodeType = "";
// No favourite data in the export either
int starStatus = 0;
helper.insertLoyaltyCard(database, store, note, null, BigDecimal.valueOf(0), null, cardId, barcodeType, null, starStatus);
}
}

View File

@@ -1,10 +1,15 @@
package protect.card_locker;
package protect.card_locker.importexport;
import android.util.Log;
import java.io.IOException;
import java.io.OutputStreamWriter;
import protect.card_locker.DBHelper;
import protect.card_locker.DataFormat;
import protect.card_locker.importexport.CsvDatabaseExporter;
import protect.card_locker.importexport.DatabaseExporter;
public class MultiFormatExporter
{
private static final String TAG = "Catima";
@@ -25,9 +30,12 @@ public class MultiFormatExporter
switch(format)
{
case CSV:
case Catima:
exporter = new CsvDatabaseExporter();
break;
default:
Log.e(TAG, "Failed to export data, unknown format " + format.name());
break;
}
if(exporter != null)

View File

@@ -1,9 +1,19 @@
package protect.card_locker;
package protect.card_locker.importexport;
import android.util.Log;
import org.json.JSONException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.ParseException;
import protect.card_locker.DBHelper;
import protect.card_locker.DataFormat;
import protect.card_locker.FormatException;
import protect.card_locker.importexport.CsvDatabaseImporter;
import protect.card_locker.importexport.DatabaseImporter;
public class MultiFormatImporter
{
@@ -20,15 +30,21 @@ public class MultiFormatImporter
* false otherwise. If false, no data was written to
* the database.
*/
public static boolean importData(DBHelper db, InputStreamReader input, DataFormat format)
public static boolean importData(DBHelper db, InputStream input, DataFormat format)
{
DatabaseImporter importer = null;
switch(format)
{
case CSV:
case Catima:
importer = new CsvDatabaseImporter();
break;
case Fidme:
importer = new FidmeImporter();
break;
case VoucherVault:
importer = new VoucherVaultImporter();
break;
}
if (importer != null)
@@ -38,7 +54,7 @@ public class MultiFormatImporter
importer.importData(db, input);
return true;
}
catch(IOException | FormatException | InterruptedException e)
catch(IOException | FormatException | InterruptedException | JSONException | ParseException e)
{
Log.e(TAG, "Failed to import data", e);
}

View File

@@ -0,0 +1,134 @@
package protect.card_locker.importexport;
import android.annotation.SuppressLint;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import com.google.zxing.BarcodeFormat;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Currency;
import java.util.Date;
import java.util.TimeZone;
import protect.card_locker.DBHelper;
import protect.card_locker.FormatException;
/**
* Class for importing a database from CSV (Comma Separate Values)
* formatted data.
*
* The database's loyalty cards are expected to appear in the CSV data.
* A header is expected for the each table showing the names of the columns.
*/
public class VoucherVaultImporter implements DatabaseImporter
{
public void importData(DBHelper db, InputStream input) throws IOException, FormatException, JSONException, ParseException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
sb.append(line);
}
JSONArray jsonArray = new JSONArray(sb.toString());
SQLiteDatabase database = db.getWritableDatabase();
database.beginTransaction();
// See https://github.com/tim-smart/vouchervault/issues/4#issuecomment-788226503 for more info
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonCard = jsonArray.getJSONObject(i);
String store = jsonCard.getString("description");
Date expiry = null;
if (!jsonCard.isNull("expires")) {
@SuppressLint("SimpleDateFormat") SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
expiry = dateFormat.parse(jsonCard.getString("expires"));
}
BigDecimal balance;
if (!jsonCard.isNull("balance")) {
balance = new BigDecimal(String.valueOf(jsonCard.getDouble("balance")));
} else {
balance = new BigDecimal("0");
}
Currency balanceType = Currency.getInstance("USD");
String cardId = jsonCard.getString("code");
String barcodeType = null;
String codeTypeFromJSON = jsonCard.getString("codeType");
switch (codeTypeFromJSON) {
case "CODE128":
barcodeType = BarcodeFormat.CODE_128.name();
break;
case "CODE39":
barcodeType = BarcodeFormat.CODE_39.name();
break;
case "EAN13":
barcodeType = BarcodeFormat.EAN_13.name();
break;
case "QR":
barcodeType = BarcodeFormat.QR_CODE.name();
break;
case "TEXT":
break;
default:
throw new FormatException("Unknown barcode type found: " + codeTypeFromJSON);
}
int headerColor;
String colorFromJSON = jsonCard.getString("color");
switch (colorFromJSON) {
case "GREY":
headerColor = Color.GRAY;
break;
case "BLUE":
headerColor = Color.BLUE;
break;
case "GREEN":
headerColor = Color.GREEN;
break;
case "ORANGE":
headerColor = Color.rgb(255, 165, 0);
break;
case "PURPLE":
headerColor = Color.rgb(128, 0, 128);
break;
case "RED":
headerColor = Color.RED;
break;
case "YELLOW":
headerColor = Color.YELLOW;
break;
default:
throw new FormatException("Unknown colour type foun: " + colorFromJSON);
}
db.insertLoyaltyCard(store, "", expiry, balance, balanceType, cardId, barcodeType, headerColor, 0);
}
database.setTransactionSuccessful();
database.endTransaction();
database.close();
bufferedReader.close();
}
}

View File

@@ -90,4 +90,14 @@ public class Settings
{
return getBoolean(R.string.settings_key_lock_barcode_orientation, false);
}
public boolean getKeepScreenOn()
{
return getBoolean(R.string.settings_key_keep_screen_on, true);
}
public boolean getDisableLockscreenWhileViewingCard()
{
return getBoolean(R.string.settings_key_disable_lockscreen_while_viewing_card, true);
}
}

View File

@@ -19,11 +19,25 @@
app:zxing_viewfinder_laser="@color/zxing_custom_viewfinder_laser"
app:zxing_viewfinder_mask="@color/zxing_custom_viewfinder_mask"/>
<Button
android:id="@+id/add_manually"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/addManually"
android:layout_gravity="bottom|center_horizontal"
android:onClick="addManually"/>
android:gravity="center_horizontal"
android:orientation="vertical">
<Button
android:id="@+id/add_from_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="addFromImage"
android:text="@string/addFromImage" />
<Button
android:id="@+id/add_manually"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="addManually"
android:text="@string/addManually" />
</LinearLayout>
</merge>

View File

@@ -135,6 +135,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp"
android:visibility="gone"
app:behavior_hideable="false"
app:behavior_peekHeight="104dp"
@@ -155,46 +156,38 @@
<TextView
android:id="@+id/noteView"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="wrap_content"
android:background="@color/inputBackground"
android:gravity="center"
android:padding="20dp"
app:autoSizeMaxTextSize="@dimen/singleCardNoteTextSizeMax"
app:autoSizeMinTextSize="@dimen/singleCardNoteTextSizeMin"
app:autoSizeTextType="uniform" />
android:textSize="@dimen/singleCardNoteTextSizeMin" />
<TextView
android:id="@+id/groupsView"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="wrap_content"
android:background="@color/inputBackground"
android:gravity="center"
android:padding="20dp"
app:autoSizeMaxTextSize="@dimen/singleCardNoteTextSizeMax"
app:autoSizeMinTextSize="@dimen/singleCardNoteTextSizeMin"
app:autoSizeTextType="uniform" />
android:textSize="@dimen/singleCardNoteTextSizeMin" />
<TextView
android:id="@+id/balanceView"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="wrap_content"
android:background="@color/inputBackground"
android:gravity="center"
android:padding="20dp"
app:autoSizeMaxTextSize="@dimen/singleCardNoteTextSizeMax"
app:autoSizeMinTextSize="@dimen/singleCardNoteTextSizeMin"
app:autoSizeTextType="uniform" />
android:textSize="@dimen/singleCardNoteTextSizeMin" />
<TextView
android:id="@+id/expiryView"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="wrap_content"
android:background="@color/inputBackground"
android:gravity="center"
android:padding="20dp"
app:autoSizeMaxTextSize="@dimen/singleCardNoteTextSizeMax"
app:autoSizeMinTextSize="@dimen/singleCardNoteTextSizeMin"
app:autoSizeTextType="uniform" />
android:textSize="@dimen/singleCardNoteTextSizeMin" />
</LinearLayout>
<com.google.android.material.appbar.AppBarLayout

View File

@@ -22,6 +22,10 @@
android:id="@+id/action_settings"
android:title="@string/settings"
app:showAsAction="never"/>
<item
android:id="@+id/action_privacy_policy"
android:title="@string/privacy_policy"
app:showAsAction="never"/>
<item
android:id="@+id/action_about"
android:title="@string/about"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="action_search">Suche</string>
<string name="action_add">Neu</string>
<string name="action_search">Suchen</string>
<string name="action_add">Hinzufügen</string>
<string name="noGiftCards">Klicken Sie auf die Schaltfläche + (plus), um zuerst eine Karte hinzuzufügen.
\n
\nCatima trägt Ihre Karten auf dem Gerät, so dass sie immer in Reichweite sind.</string>
@@ -11,7 +11,6 @@
<string name="cardId">Kartennummer</string>
<string name="cancel">Abbrechen</string>
<string name="save">Speichern</string>
<string name="editCard">Karte bearbeiten</string>
<string name="edit">Bearbeiten</string>
<string name="delete">Löschen</string>
<string name="confirm">Bestätigen</string>
@@ -21,9 +20,9 @@
<string name="unstar">Aus der Favoritenliste entfernen</string>
<string name="deleteTitle">Karte entfernen</string>
<string name="deleteConfirmation">Bitte bestätigen Sie, dass diese Karte gelöscht werden soll.</string>
<string name="ok">Ok</string>
<string name="copy_to_clipboard">Kopiere die Nummer in die Zwischenablage</string>
<string name="sendLabel">Senden…</string>
<string name="ok">OK</string>
<string name="copy_to_clipboard">Nummer in die Zwischenablage kopieren</string>
<string name="sendLabel">Senden </string>
<string name="editCardTitle">Kundenkarte bearbeiten</string>
<string name="addCardTitle">Neue Kundenkarte</string>
<string name="scanCardBarcode">Strichcode scannen</string>
@@ -103,4 +102,47 @@
<item quantity="other"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%d</xliff:g> Karten</item>
</plurals>
<string name="groupsList">Gruppen: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
</resources>
<string name="app_loyalty_card_keychain">Loyalty Card Keychain</string>
<string name="chooseImportType">Aus welcher App Daten importieren\?</string>
<string name="parsingBalanceFailed"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g> scheint kein gültiges Guthaben zu sein.</string>
<string name="points">Punkte</string>
<string name="currency">Währung</string>
<string name="balance">Guthaben</string>
<string name="moveBarcodeToCenterOfScreen">Strichcode auf dem Bildschirm zentrieren</string>
<string name="moveBarcodeToTopOfScreen">Strichcode auf dem Bildschirm nach oben schieben</string>
<string name="chooseExpiryDate">Ablaufdatum wählen</string>
<string name="never">Nie</string>
<string name="expiryDate">Ablaufdatum</string>
<string name="editBarcode">Strichcode bearbeiten</string>
<string name="barcode">Strichcode</string>
<string name="card">Karte</string>
<string name="balancePoints"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g> Punkte</string>
<string name="balanceSentence">Guthaben: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="expiryStateSentenceExpired">Abgelaufen: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="expiryStateSentence">Läuft ab: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="settings_disable_lockscreen_while_viewing_card">Sperrbildschirm deaktivieren während eine Karte angesehen wird</string>
<string name="settings_keep_screen_on">Bildschirm anlassen während eine Karte angesehen wird</string>
<string name="privacy_policy_popup_text">Es wird oft verlangt, dass Anwendungen beim ersten Start ihre Datenschutzrichtlinien anzeigen. Hier ist unsere:
\n
\nWir sammeln KEINE DATEN und unsere Anwendung ist quelloffen, sodass jeder bestätigen kann, dass dies wahr ist.</string>
<string name="accept">Annehmen</string>
<string name="privacy_policy">Datenschutzrichtlinie</string>
<string name="importVoucherVaultMessage">Bitte wählen Sie Ihre Voucher Vault-Exportdatei aus. Es heißt höchstwahrscheinlich vouchervault.json.
\n
\nEine Voucher Vault-Exportdatei kann durch Drücken von Exportieren erstellt werden.</string>
<string name="importVoucherVault">Aus Voucher Vault importieren</string>
<string name="importLoyaltyCardKeychainMessage">Bitte wählen Sie Ihre Loyalty Card Keychain-Exportdatei aus. Es heißt höchstwahrscheinlich LoyaltyCardKeychain.csv.
\n
\nEine Loyalty Card Keychain-Exportdatei kann erstellt werden, indem Sie im Menü Import/Export auf Exportieren klicken.</string>
<string name="importLoyaltyCardKeychain">Aus Loyalty Card Keychain importieren</string>
<string name="importFidmeMessage">Bitte wählen Sie Ihre Fidme-Exportdatei aus. Es wird höchstwahrscheinlich so etwas wie fidme-export-request-xxxxxx.zip genannt.
\n
\nEine Fidme-Exportdatei kann in der Fidme-Anwendung erstellt werden, indem Sie zu Ihrem Profil gehen, Datenschutz auswählen und dann auf Meine Daten extrahieren klicken.
\n
\nBitte beachten Sie, dass Fidme den Strichcode-Typ nicht in den Exportdaten speichert, sodass Sie die importierten Karten manuell bearbeiten müssen.</string>
<string name="importFidme">Aus Fidme importieren</string>
<string name="importCatimaMessage">Bitte wählen Sie Ihre Catima-Exportdatei aus. Es heißt höchstwahrscheinlich Catima.csv.
\n
\nEine Catima-Exportdatei kann erstellt werden, indem Sie im Menü Import/Export auf Exportieren klicken.</string>
<string name="importCatima">Aus Catima importieren</string>
</resources>

View File

@@ -7,7 +7,6 @@
<string name="cardId">Κωδικός Κάρτας</string>
<string name="cancel">Άκυρο</string>
<string name="save">Αποθήκευση</string>
<string name="editCard">Επεξεργασία Κάρτας</string>
<string name="edit">Επεξεργασία</string>
<string name="delete">Διαγραφή</string>
<string name="confirm">Επιβεβαίωση</string>
@@ -64,4 +63,5 @@
<string name="settings_dark_theme">Σκοτεινό</string>
<string name="settings_light_theme">Φωτεινό</string>
<string name="settings_system_theme">Σύστημα</string>
<string name="barcode">Γραμμικός κώδικας</string>
</resources>

View File

@@ -1,4 +1,4 @@
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="barcode">Código de barras</string>
</resources>

View File

@@ -9,7 +9,6 @@
<string name="cardId">Id. de tarjeta</string>
<string name="cancel">Cancelar</string>
<string name="save">Guardar</string>
<string name="editCard">Editar tarjeta</string>
<string name="edit">Editar</string>
<string name="delete">Eliminar</string>
<string name="confirm">Confirmar</string>
@@ -113,4 +112,6 @@
<string name="barcode">Código de barras</string>
<string name="card">Tarjeta</string>
<string name="balancePoints"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g> puntos</string>
<string name="expiryStateSentenceExpired">Expirado: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="expiryStateSentence">Expira: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
</resources>

View File

@@ -4,12 +4,11 @@
<string name="noGiftCards">Appuyez d\'abord sur le bouton \"+\" (plus) pour ajouter une carte.
\n
\nCatima enregistre vos cartes sur votre appareil, pour toujours les avoir à portée de main.</string>
<string name="storeName">Nom du Magasin</string>
<string name="storeName">Magasin</string>
<string name="note">Notes</string>
<string name="cardId">Numéro</string>
<string name="cancel">Annuler</string>
<string name="save">Enregistrer</string>
<string name="editCard">Modifier</string>
<string name="edit">Modifier</string>
<string name="delete">Supprimer</string>
<string name="confirm">Confirmer</string>
@@ -20,7 +19,7 @@
<string name="ok">OK</string>
<string name="copy_to_clipboard">Copier le numéro dans le presse-papier</string>
<string name="sendLabel">Envoyer…</string>
<string name="editCardTitle">Modifier la carte de fidélité</string>
<string name="editCardTitle">Modifier la carte</string>
<string name="addCardTitle">Ajouter une carte de fidélité</string>
<string name="scanCardBarcode">Scanner le code-barres</string>
<string name="cardShortcut">Raccourci de carte</string>
@@ -103,4 +102,50 @@
<item quantity="other"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%d</xliff:g> cartes</item>
</plurals>
<string name="groupsList">Groupes : <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
</resources>
<string name="accept">Accepter</string>
<string name="privacy_policy_popup_text">De nombreux magasins d\'applications exigent que les applications affichent leur politique de confidentialité au premier démarrage. Voici la nôtre :
\n
\nNous ne collectons AUCUNE DONNÉE et le code source de notre application est ouvert afin que tout le monde puisse le confirmer.</string>
<string name="privacy_policy">Politique de confidentialité</string>
<string name="app_loyalty_card_keychain">Loyalty Card Keychain</string>
<string name="chooseImportType">Importer des données à partir de quelle application \?</string>
<string name="parsingBalanceFailed">&lt;xliff:g xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\"&gt;%s&lt;/xliff:g&gt; ne semble pas être un solde valide.</string>
<string name="points">Points</string>
<string name="currency">Monnaie</string>
<string name="balance">Solde</string>
<string name="moveBarcodeToCenterOfScreen">Centrer le code-barres sur l\'écran</string>
<string name="moveBarcodeToTopOfScreen">Déplacez le code-barres vers le haut de l\'écran</string>
<string name="chooseExpiryDate">Choisissez la date d\'expiration</string>
<string name="never">Jamais</string>
<string name="expiryDate">Date d\'expiration</string>
<string name="editBarcode">Modifier le code-barres</string>
<string name="barcode">Code-barres</string>
<string name="card">Carte</string>
<string name="balancePoints">&lt;xliff:g xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\"&gt;%s&lt;/xliff:g&gt; points</string>
<string name="balanceSentence">Solde : &lt;xliff:g xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\"&gt;%s&lt;/xliff:g&gt;</string>
<string name="expiryStateSentenceExpired">Expiré : &lt;xliff:g xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\"&gt;%s&lt;/xliff:g&gt;</string>
<string name="expiryStateSentence">Expire : &lt;xliff:g xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\"&gt;%s&lt;/xliff:g&gt;</string>
<string name="settings_disable_lockscreen_while_viewing_card">Désactiver l\'écran de verrouillage pendant l\'affichage d\'une carte</string>
<string name="settings_keep_screen_on">Garder l\'écran allumé pendant l\'affichage d\'une carte</string>
<string name="importVoucherVaultMessage">Veuillez sélectionner votre fichier d\'exportation Voucher Vault. Il est probablement nommé vouchervault.json.
\n
\nUn fichier d\'exportation Voucher Vault peut être créé en appuyant sur Exporter.</string>
<string name="importVoucherVault">Importer depuis Voucher Vault</string>
<string name="importLoyaltyCardKeychainMessage">Veuillez sélectionner votre fichier d\'exportation Loyalty Card Keychain . Il s\'appelle très probablement LoyaltyCardKeychain.csv.
\n
\nUn fichier d\'exportation Loyalty Card Keychain peut être créé en allant dans le menu Importer/Exporter et en appuyant sur Exporter.</string>
<string name="importLoyaltyCardKeychain">Importer depuis Loyalty Card Keychain</string>
<string name="importFidmeMessage">Veuillez sélectionner votre fichier d\'exportation Fidme. Il est très probablement nommé quelque chose comme fidme-export-request-xxxxxx.zip.
\n
\nUn fichier d\'exportation Fidme peut être créé dans l\'application Fidme en accédant à votre profil, en choisissant Protection des données, puis en appuyant sur Extraire mes données.
\n
\nVeuillez noter que Fidme ne stocke pas le type de code-barres dans les données d\'exportation, vous devrez donc éditer les cartes importées manuellement.</string>
<string name="importFidme">Importer depuis Fidme</string>
<string name="importCatimaMessage">Veuillez sélectionner votre fichier d\'exportation Catima. Il est probablement nommé Catima.csv.
\n
\nUn fichier d\'exportation Catima peut être créé en allant dans le menu Importer/Exporter et en appuyant sur Exporter.</string>
<string name="importCatima">Importer depuis Catima</string>
<string name="addFromImage">Sélectionner dans la galerie</string>
<string name="errorReadingImage">Erreur lors de la lecture de l\'image</string>
<string name="noBarcodeFound">Aucun code-barres n\'a été trouvé</string>
</resources>

View File

@@ -6,5 +6,4 @@
<string name="cardId">מזהה כרטיס</string>
<string name="cancel">ביטול</string>
<string name="save">שמור</string>
<string name="editCard">עריכת כרטיס</string>
</resources>
</resources>

View File

@@ -12,7 +12,6 @@
<string name="barcodeNoBarcode">Questa carta non ha un codice a barre</string>
<string name="cancel">Annulla</string>
<string name="save">Salva</string>
<string name="editCard">Modifica carta</string>
<string name="edit">Modifica</string>
<string name="delete">Elimina</string>
<string name="confirm">Conferma</string>
@@ -20,7 +19,7 @@
<string name="unlockScreen">Sblocca rotazione</string>
<string name="deleteTitle">Rimuovi carta fedeltà</string>
<string name="deleteConfirmation">Conferma di voler eliminare questa carta.</string>
<string name="ok">Ok</string>
<string name="ok">OK</string>
<string name="copy_to_clipboard">Copia ID negli appunti</string>
<string name="share">Condividi</string>
<string name="sendLabel">Invia…</string>
@@ -103,4 +102,47 @@
<item quantity="one"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%d</xliff:g> carta</item>
<item quantity="other"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%d</xliff:g> carte</item>
</plurals>
</resources>
<string name="parsingBalanceFailed">&lt;xliff:g xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\"&gt;%s&lt;/xliff:g&gt; non sembra un saldo corretto.</string>
<string name="points">Punti</string>
<string name="currency">Valuta</string>
<string name="balance">Saldo</string>
<string name="moveBarcodeToCenterOfScreen">Centra il codice a barre sullo schermo</string>
<string name="moveBarcodeToTopOfScreen">Sposta il codice a barre in cima allo schermo</string>
<string name="chooseExpiryDate">Scegli data di scadenza</string>
<string name="never">Mai</string>
<string name="expiryDate">Data di scadenza</string>
<string name="editBarcode">Modifica il codice a barre</string>
<string name="barcode">Codice a barre</string>
<string name="card">Carta</string>
<string name="balancePoints"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g> punti</string>
<string name="balanceSentence">Saldo: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="expiryStateSentenceExpired">Scaduta: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="expiryStateSentence">Scade: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="settings_keep_screen_on">Mantieni schermo acceso durante la visualizzazione di una carta</string>
<string name="app_loyalty_card_keychain">Loyalty Card Keychain</string>
<string name="chooseImportType">Da quale app vuoi importare i dati\?</string>
<string name="settings_disable_lockscreen_while_viewing_card">Mantieni schermo attivo mentre visualizzi una carta</string>
<string name="accept">Accetta</string>
<string name="privacy_policy_popup_text">È spesso richiesto alle applicazioni di mostrare la loro politica sulla riservatezza al primo avvio. Ecco la nostra:
\n
\nNon raccogliamo ALCUN DATO e il codice sorgente della nostra applicazione è aperto, quindi chiunque può confermare che ciò sia vero.</string>
<string name="privacy_policy">Informativa sulla riservatezza</string>
<string name="importVoucherVaultMessage">Seleziona il tuo file di esportazione Voucher Vault. Molto probabilmente si chiama vouchervault.json.
\n
\nÈ possibile creare un file di esportazione Voucher Vault premendo Esporta.</string>
<string name="importVoucherVault">Importa da Voucher Vault</string>
<string name="importLoyaltyCardKeychainMessage">Seleziona il file di esportazione Loyalty Card Keychain . Molto probabilmente si chiama LoyaltyCardKeychain.csv.
\n
\nÈ possibile creare un file di esportazione Loyalty Card Keychain accedendo al menu Importa / Esporta e premendo Esporta.</string>
<string name="importLoyaltyCardKeychain">Importa da Loyalty Card Keychain</string>
<string name="importFidmeMessage">Seleziona il tuo file di esportazione Fidme. Molto probabilmente si chiama qualcosa come fidme-export-request-xxxxxx.zip.
\n
\nUn file di esportazione Fidme può essere creato nell\'app Fidme andando sul tuo profilo, scegliendo Protezione dati e quindi premendo Estrai i miei dati.
\n
\nTieni presente che Fidme non memorizza il tipo di codice a barre nei dati di esportazione, quindi dovrai modificare manualmente le carte importate.</string>
<string name="importFidme">Importa da Fidme</string>
<string name="importCatimaMessage">Seleziona il tuo file di esportazione Catima. Molto probabilmente si chiama Catima.csv.
\n
\nÈ possibile creare un file di esportazione Catima andando nel menu Importa / Esporta e premendo Esporta.</string>
<string name="importCatima">Importa da Catima</string>
</resources>

View File

@@ -44,7 +44,6 @@
<string name="confirm">확인</string>
<string name="delete">삭제</string>
<string name="edit">편집</string>
<string name="editCard">카드 편집</string>
<string name="save">저장</string>
<string name="cancel">취소</string>
<string name="unstar">즐겨찾기에서 제거</string>
@@ -84,4 +83,5 @@
<string name="noStoreError">매장을 입력하지 않음</string>
<string name="starImage">즐겨찾기 별</string>
<string name="settings_display_barcode_max_brightness">바코드를 표시할 때 화면 밝기 높이기</string>
<string name="barcode">바코드</string>
</resources>

View File

@@ -10,7 +10,6 @@
<string name="barcodeType">Strekkodetype</string>
<string name="cancel">Avbryt</string>
<string name="save">Lagre</string>
<string name="editCard">Rediger kort</string>
<string name="edit">Rediger</string>
<string name="delete">Slett</string>
<string name="confirm">Bekreft</string>
@@ -119,4 +118,13 @@
<string name="balance">Saldo</string>
<string name="balancePoints"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g> poeng</string>
<string name="balanceSentence">Saldo: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
</resources>
<string name="chooseImportType">Hvilket program vil du importere data fra\?</string>
<string name="app_loyalty_card_keychain">Kundekortsknippe</string>
<string name="settings_disable_lockscreen_while_viewing_card">Skru av låseskjerm under kortvisning</string>
<string name="settings_keep_screen_on">Behold skjerm påslått under kortvisning</string>
<string name="privacy_policy_popup_text">Mange programbutikker krever at programmer viser personvernspraksisen sin ved første oppstart. Her er vår:
\n
\nVi SAMLER IKKE IN NOEN DATA overhodet, og programmet vårt er fri programvare, så alle kan bekrefte at dette stemmer.</string>
<string name="accept">Godta</string>
<string name="privacy_policy">Personvernspraksis</string>
</resources>

View File

@@ -13,7 +13,6 @@
<string name="barcodeNoBarcode">Deze kaart heeft geen barcode</string>
<string name="cancel">Annuleren</string>
<string name="save">Opslaan</string>
<string name="editCard">Kaart bewerken</string>
<string name="edit">Bewerken</string>
<string name="delete">Verwijderen</string>
<string name="confirm">Bevestigen</string>
@@ -119,4 +118,34 @@
<string name="balance">Saldo</string>
<string name="balancePoints"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g> punten</string>
<string name="balanceSentence">Saldo: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
</resources>
<string name="chooseImportType">Uit welke app wil je gegevens importeren\?</string>
<string name="app_loyalty_card_keychain">Klantenkaartkluis</string>
<string name="settings_disable_lockscreen_while_viewing_card">Vergrendelscherm uitschakelen tijdens tonen van kaart</string>
<string name="settings_keep_screen_on">Scherm niet uitschakelen tijdens tonen van kaart</string>
<string name="privacy_policy_popup_text">Veel appwinkels vereisen dat apps na de eerste keer opstarten hun privacybeleid tonen. Dat van ons is eenvoudig:
\n
\nWe verzamelen HELEMAAL NIKS. Bovendien is onze app open source, zodat een ieder met eigen ogen kan zien wat de app wel of niet doet.</string>
<string name="privacy_policy">Privacybeleid</string>
<string name="accept">Accepteren</string>
<string name="importVoucherVaultMessage">Kies het gewenste Voucher Vault-exportbestand - normaliter heet dit bestand \'vouchervault.json\'.
\n
\nGa naar het Exportmenu om een Voucher Vault-exportbestand samen te stellen.</string>
<string name="importVoucherVault">Importeren uit Voucher Vault</string>
<string name="importLoyaltyCardKeychainMessage">Kies het gewenste Klantenkaartkluis-exportbestand - normaliter heet dit bestand \'LoyaltyCardKeychain.csv\'.
\n
\nGa naar het Import-/Exportmenu om een Klantenkaartkluis-exportbestand samen te stellen.</string>
<string name="importLoyaltyCardKeychain">Importeren uit Klantenkaartkluis</string>
<string name="importFidmeMessage">Kies het gewenste Fidme-exportbestand - normaliter heet dit bestand \'fidme-export-request-xxxxxx.zip\'.
\n
\nOpen de Fidme-app, ga naar je profiel en druk op \'Gegevensbescherming\' om een exportbestand samen te stellen.
\n
\nLet op: Fidme slaat de soorten barcodes niet op in het exportbestand, dus dat moet je na achteraf nog instellen.</string>
<string name="importCatimaMessage">Kies het gewenste Catima-exportbestand - normaliter heet dit bestand \'Catima.csv\'.
\n
\nGa naar het Import-/Exportmenu om een Catima-exportbestand samen te stellen.</string>
<string name="importFidme">Importeren uit Fidme</string>
<string name="importCatima">Importeren uit Catima</string>
<string name="errorReadingImage">De afbeelding kan niet worden uitgelezen</string>
<string name="noBarcodeFound">Geen barcode aangetroffen</string>
<string name="addFromImage">Afbeelding kiezen uit galerij</string>
</resources>

View File

@@ -10,7 +10,6 @@
<string name="barcodeNoBarcode">Ta karta nie ma kodu kreskowego</string>
<string name="cancel">Anuluj</string>
<string name="save">Zapisz</string>
<string name="editCard">Edytuj kartę</string>
<string name="edit">Edytuj</string>
<string name="delete">Usuń</string>
<string name="confirm">Potwierdź</string>

View File

@@ -1,31 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="action_search">Поиск</string>
<string name="action_add">Добавить карту</string>
<string name="noGiftCards">Нажмите кнопку + (плюс), чтобы сначала добавить карту.
<string name="action_add">Добавить</string>
<string name="noGiftCards">Нажмите кнопку + (плюс), чтобы добавить карту.
\n
\nCatima хранит ваши карты на устройстве, поэтому они всегда под рукой.</string>
<string name="noMatchingGiftCards">"Ничего не найдено. Попробуйте изменить свой поиск."</string>
<string name="noMatchingGiftCards">Ничего не найдено. Попробуйте изменить поисковый запрос.</string>
<string name="storeName">Магазин</string>
<string name="note">Примечание</string>
<string name="cardId">Номер карты</string>
<string name="barcodeType">Тип штрихкода</string>
<string name="barcodeNoBarcode">Эта карта без штрихкода</string>
<string name="barcodeType">Тип штрих-кода</string>
<string name="barcodeNoBarcode">Эта карта без штрих-кода</string>
<string name="cancel">Отменить</string>
<string name="save">Сохранить</string>
<string name="editCard">Редактировать штрих-код</string>
<string name="edit">Редактировать</string>
<string name="edit">Изменить</string>
<string name="delete">Удалить карту</string>
<string name="confirm">Подтвердить</string>
<string name="lockScreen">Блокировать поворот экрана</string>
<string name="unlockScreen">Автоповорот экрана</string>
<string name="deleteTitle">Удаление карты</string>
<string name="deleteConfirmation">Пожалуйста подтвердите удаление карты.</string>
<string name="deleteConfirmation">Подтвердите удаление карты.</string>
<string name="ok">ОК</string>
<string name="copy_to_clipboard">Скопировать номер карты в буфер обмена</string>
<string name="copy_to_clipboard">Копировать номер карты</string>
<string name="share">Переслать</string>
<string name="sendLabel">Отправить…</string>
<string name="editCardTitle">Редактировать карту</string>
<string name="editCardTitle">Изменить карту</string>
<string name="addCardTitle">Добавить карту</string>
<string name="scanCardBarcode">Отсканируйте штрих-код</string>
<string name="cardShortcut">Ярлык карты</string>
@@ -34,16 +33,16 @@
<string name="noStoreError">Название магазина не указано</string>
<string name="noCardIdError">Номер карты не указан</string>
<string name="noCardExistsError">Карта не найдена</string>
<string name="failedParsingImportUriError">Не удалось разобрать импортируемый URI</string>
<string name="failedParsingImportUriError">Невозможно разобрать импортируемый URI</string>
<string name="importExport">Импорт/Экспорт</string>
<string name="exportName">Экспорт</string>
<string name="importExportHelp">Резервное копирование карт позволяет переместить их на другое устройство.</string>
<string name="importSuccessfulTitle">Импортировано</string>
<string name="importFailedTitle">Импорт не удался</string>
<string name="importFailed">Не удалось импортировать карты</string>
<string name="importFailedTitle">Импорт не выполнен</string>
<string name="importFailed">Невозможно импортировать карты</string>
<string name="exportSuccessfulTitle">Экспортировано</string>
<string name="exportFailedTitle">Экспорт не удался</string>
<string name="exportFailed">Не удалось экспортировать</string>
<string name="exportFailedTitle">Экспорт не выполнен</string>
<string name="exportFailed">Невозможно экспортировать карты</string>
<string name="importing">Импорт…</string>
<string name="exporting">Экспорт…</string>
<string name="noExternalStoragePermissionError">Импорт или экспорт невозможен без разрешения на доступ к хранилищу</string>
@@ -54,15 +53,15 @@
<string name="importOptionApplicationTitle">Использование другого приложения</string>
<string name="importOptionApplicationExplanation">Используйте любое приложение или ваш любимый файловый менеджер, чтобы открыть файл.</string>
<string name="importOptionApplicationButton">Использовать другое приложение</string>
<string name="about">О программе</string>
<string name="about">О приложении</string>
<string name="app_license">Авторское лево свободного программного обеспечения, лицензия GPLv3+.</string>
<string name="about_title_fmt">О программе <xliff:g id="app_name">%s</xliff:g></string>
<string name="about_title_fmt">О приложении <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" id="app_name">%s</xliff:g></string>
<string name="debug_version_fmt">Версия: <xliff:g id="version">%s</xliff:g></string>
<string name="app_revision_fmt">Информация о версиях: <xliff:g id="app_revision_url">%s</xliff:g></string>
<string name="app_revision_fmt">Информация о версиях: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" id="app_revision_url">%s</xliff:g></string>
<string name="app_libraries"><xliff:g id="app_name">%s</xliff:g> использует следующие сторонние библиотеки: <xliff:g id="app_libraries_list">%s</xliff:g></string>
<string name="app_resources"><xliff:g id="app_name">%s</xliff:g> использует следующие сторонние ресурсы: <xliff:g id="app_resources_list">%s</xliff:g></string>
<string name="selectBarcodeTitle">Выбор штрих-кода</string>
<string name="enterBarcodeInstructions">Введите ID карты и выберите тип штрих-кода.</string>
<string name="enterBarcodeInstructions">Введите номер карты и выберите тип штрих-кода.</string>
<string name="copy_to_clipboard_toast">Номер карты скопирован в буфер обмена</string>
<string name="thumbnailDescription">Логотип карты</string>
<string name="settings">Настройки</string>
@@ -71,22 +70,22 @@
<string name="settings_system_theme">Системная</string>
<string name="settings_light_theme">Светлая</string>
<string name="settings_dark_theme">Тёмная</string>
<string name="settings_card_title_list_font_size">Размер шрифта для названий карт</string>
<string name="settings_card_note_list_font_size">Размер шрифта примечания для списка</string>
<string name="settings_card_title_font_size">Размер шрифта названия карты</string>
<string name="settings_card_title_list_font_size">Размер шрифта названия карты (список)</string>
<string name="settings_card_note_list_font_size">Размер шрифта примечания (список)</string>
<string name="settings_card_title_font_size">Размер шрифта названия карты (просмотр)</string>
<string name="settings_card_id_font_size">Размер шрифта номера карты</string>
<string name="settings_display_barcode_max_brightness">Максимальная яркость при показе карты</string>
<string name="settings_lock_barcode_orientation">Портретная ориентация экрана при показе карты</string>
<string name="intent_import_card_from_url_share_text">Я хочу поделиться картой с вами</string>
<string name="exportSuccessful">Данные карты экспортированы</string>
<string name="exportSuccessful">Данные карт успешно экспортированы</string>
<string name="all">Все</string>
<string name="noGroups">Нажмите кнопку + (плюс), чтобы сначала добавить группы.
<string name="noGroups">Нажмите кнопку + (плюс), чтобы добавить группы.
\n
\nГруппы упрощают поиск.</string>
<string name="groups">Группы</string>
<string name="enter_group_name">Введите название группы</string>
<string name="importSuccessful">Данные карты лояльности успешно импортированы</string>
<string name="starImage">Любимая звезда</string>
<string name="importSuccessful">Данные карт успешно импортированы</string>
<string name="starImage">Звезда избранного</string>
<string name="app_copyright_old">На основе Loyalty Card Keychain, авторские права 20162020 Branden Archer.</string>
<string name="unstar">Удалить из избранного</string>
<string name="star">Добавить в избранное</string>
@@ -94,5 +93,61 @@
<string name="deleteConfirmationGroup">Подтвердите, что хотите удалить эту группу</string>
<string name="leaveWithoutSaveConfirmation">Вы уверены, что хотите покинуть этот экран\? Изменения не будут сохранены.</string>
<string name="leaveWithoutSaveTitle">Выйти без сохранения</string>
<string name="failedOpeningFileManager">Не удалось открыть файловый менеджер. Пожалуйста, убедитись, что он установлен.</string>
<string name="failedOpeningFileManager">Невозможно открыть файловый менеджер. Убедитесь, что он установлен.</string>
<string name="balancePoints"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g> баллов</string>
<string name="balanceSentence">Баланс: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="expiryStateSentenceExpired">Истёк срок действия: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="expiryStateSentence">Истекает срок действия: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="points">Баллы</string>
<string name="parsingBalanceFailed"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g> не похож на правильный баланс.</string>
<string name="addManually">Ручной ввод номера карты</string>
<string name="privacy_policy_popup_text">Многие магазины приложений требуют, чтобы приложение показывало свою политику конфиденциальности при первом запуске. Вот наша:
\n
\nМы НЕ собираем НИКАКИХ ДАННЫХ и наше приложение имеет открытый исходный код, так что любой может убедиться в том, что это правда.</string>
<string name="privacy_policy">Политика конфиденциальности</string>
<string name="app_loyalty_card_keychain">Loyalty Card Keychain</string>
<string name="chooseImportType">Из какого приложения импортировать данные\?</string>
<string name="balance">Баланс</string>
<string name="moveBarcodeToTopOfScreen">Переместить штрих-код в верхнюю часть экрана</string>
<string name="moveBarcodeToCenterOfScreen">Центрировать штрих-код на экране</string>
<string name="currency">Валюта</string>
<string name="chooseExpiryDate">Указать срок действия</string>
<string name="never">Никогда</string>
<string name="expiryDate">Окончание срока действия</string>
<string name="editBarcode">Изменить штрих-код</string>
<string name="barcode">Штрих-код</string>
<string name="card">Карта</string>
<string name="groupsList">Группы: <xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%s</xliff:g></string>
<string name="moveDown">Переместить ниже в вписке</string>
<string name="moveUp">Переместить выше в вписке</string>
<string name="settings_disable_lockscreen_while_viewing_card">Не блокировать экран при показе карты</string>
<string name="settings_keep_screen_on">Не отключать экран при показе карты</string>
<plurals name="groupCardCount">
<item quantity="one"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%d</xliff:g> карта</item>
<item quantity="few"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%d</xliff:g> карты</item>
<item quantity="many"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%d</xliff:g> карт</item>
<item quantity="other"><xliff:g xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">%d</xliff:g> карт</item>
</plurals>
<string name="accept">Принять</string>
<string name="importVoucherVaultMessage">Выберите файл экспорта Voucher Vault. Обычно он называется \"vouchervault.json\".
\n
\nФайл экспорта Voucher Vault можно создать, нажав кнопку \"Экспорт\".</string>
<string name="importVoucherVault">Импорт из Voucher Vault</string>
<string name="importFidmeMessage">Выберите файл экспорта Fidme. Обычно он называется как-то вроде \"fidme-export-request-xxxxxx.zip\".
\n
\nФайл экспорта Fidme можно создать в приложении Fidme, перейдя в свой профиль, выбрав функцию \"Защита данных\", и затем нажав кнопку \"Извлечь мои данные\".
\n
\nОбратите внимание, что Fidme не сохраняет тип штрих-кода в экспортированных данных, поэтому вам придётся редактировать импортированные данные карт вручную.</string>
<string name="importLoyaltyCardKeychainMessage">Выберите файл экспорта Loyalty Card Keychain. Обычно он называется \"LoyaltyCardKeychain.csv\".
\n
\nФайл экспорта Loyalty Card Keychain можно создать, перейдя в меню \"Импорт/Экспорт\" и нажав кнопку \"Экспорт\".</string>
<string name="importLoyaltyCardKeychain">Импорт из Loyalty Card Keychain</string>
<string name="importCatimaMessage">Выберите файл экспорта Catima. Обычно он называется \"Catima.csv\".
\n
\nФайл экспорта Catima можно создать, перейдя в меню \"Импорт/Экспорт\" и нажав кнопку \"Экспорт\".</string>
<string name="importFidme">Импорт из Fidme</string>
<string name="importCatima">Импорт из Catima</string>
<string name="errorReadingImage">Ошибка при чтении изображения</string>
<string name="noBarcodeFound">Штрих-код не найден</string>
<string name="addFromImage">Выбрать изображение из галереи</string>
</resources>

View File

@@ -9,7 +9,6 @@
<string name="cardId">ID karty</string>
<string name="cancel">Zrušiť</string>
<string name="save">Uložiť</string>
<string name="editCard">Úprava karty</string>
<string name="edit">Upraviť</string>
<string name="delete">Vymazať</string>
<string name="confirm">Potvrdiť</string>

View File

@@ -9,7 +9,6 @@
<string name="cardId">Št. kartice</string>
<string name="cancel">Prekliči</string>
<string name="save">Shrani</string>
<string name="editCard">Uredi kartico</string>
<string name="edit">Uredi</string>
<string name="delete">Izbriši</string>
<string name="confirm">Potrdi</string>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="import_types_array">
<item>Catima</item>
<item>Fidme</item>
<item>@string/app_loyalty_card_keychain</item>
<item>Voucher Vault</item>
</string-array>
</resources>

View File

@@ -20,7 +20,6 @@
<string name="cancel">Cancel</string>
<string name="save">Save</string>
<string name="editCard">Edit Card</string>
<string name="edit">Edit</string>
<string name="delete">Delete</string>
<string name="confirm">Confirm</string>
@@ -104,8 +103,13 @@
<string name="settings_key_display_barcode_max_brightness" translatable="false">pref_display_card_max_brightness</string>
<string name="settings_lock_barcode_orientation">Lock barcode orientation</string>
<string name="settings_key_lock_barcode_orientation" translatable="false">pref_lock_barcode_orientation</string>
<string name="settings_keep_screen_on">Keep screen on while viewing a card</string>
<string name="settings_key_keep_screen_on" translatable="false">pref_keep_screen_on</string>
<string name="settings_disable_lockscreen_while_viewing_card">Disable lock screen while viewing a card</string>
<string name="settings_key_disable_lockscreen_while_viewing_card" translatable="false">pref_disable_lockscreen_while_viewing_card</string>
<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="intent_import_card_from_url_share_text">I want to share a card with you</string>
<string name="intent_import_card_from_url_host" translatable="false">thelastproject.github.io</string>
@@ -131,6 +135,7 @@
<string name="leaveWithoutSaveTitle">Leave without saving</string>
<string name="leaveWithoutSaveConfirmation">Are you sure you want to leave this screen? Changed made will not be saved.</string>
<string name="addManually">Manually enter card ID</string>
<string name="addFromImage">Select image from gallery</string>
<string name="groupsList">Groups: <xliff:g>%s</xliff:g></string>
<string name="expiryStateSentence">Expires: <xliff:g>%s</xliff:g></string>
<string name="expiryStateSentenceExpired">Expired: <xliff:g>%s</xliff:g></string>
@@ -146,9 +151,26 @@
<string name="moveBarcodeToTopOfScreen">Move the barcode to the top of the screen</string>
<string name="moveBarcodeToCenterOfScreen">Center the barcode on the screen</string>
<string name="noBarcodeFound">No barcode was found</string>
<string name="errorReadingImage">Error reading image</string>
<string name="balance">Balance</string>
<string name="currency">Currency</string>
<string name="points">Points</string>
<string name="parsingBalanceFailed"><xliff:g>%s</xliff:g> does not seem to be a valid balance.</string>
<string name="chooseImportType">Import data from which app?</string>
<string name="app_loyalty_card_keychain">Loyalty Card Keychain</string>
<string name="privacy_policy">Privacy Policy</string>
<string name="privacy_policy_popup_text">Many app stores require apps to show their privacy policy on first start. Here is ours:\n\nWe collect NO DATA AT ALL and our app is Open Source so anyone can confirm this to be true.</string>
<string name="accept">Accept</string>
<string name="importCatima">Import from Catima</string>
<string name="importCatimaMessage">Please select your Catima export file. It is most likely named Catima.csv.\n\nA Catima export file can be created by going to the Import/Export menu and pressing "Export".</string>
<string name="importFidme">Import from Fidme</string>
<string name="importFidmeMessage">Please select your Fidme export file. It is most likely named something like fidme-export-request-xxxxxx.zip.\n\nA Fidme export file can be created in the Fidme app by going to your profile, choosing "Data Protection" and then pressing "Extract my data".\n\nPlease note that Fidme does not store the barcode type in the export data so you will have to edit the imported cards manually.</string>
<string name="importLoyaltyCardKeychain">Import from Loyalty Card Keychain</string>
<string name="importLoyaltyCardKeychainMessage">Please select your Loyalty Card Keychain export file. It is most likely named LoyaltyCardKeychain.csv.\n\nA Loyalty Card Keychain export file can be created by going to the Import/Export menu and pressing "Export".</string>
<string name="importVoucherVault">Import from Voucher Vault</string>
<string name="importVoucherVaultMessage">Please select your Voucher Vault export file. It is most likely named vouchervault.json.\n\nA Voucher Vault export file can be created by pressing "Export".</string>
</resources>

View File

@@ -58,6 +58,18 @@
android:key="@string/settings_key_lock_barcode_orientation"
android:title="@string/settings_lock_barcode_orientation"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/settings_key_keep_screen_on"
android:title="@string/settings_keep_screen_on"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/settings_key_disable_lockscreen_while_viewing_card"
android:title="@string/settings_disable_lockscreen_while_viewing_card"
app:iconSpaceReserved="false" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -3,10 +3,12 @@ package protect.card_locker;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.os.Environment;
import com.google.zxing.BarcodeFormat;
import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,11 +28,16 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.List;
import protect.card_locker.importexport.MultiFormatExporter;
import protect.card_locker.importexport.MultiFormatImporter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -112,20 +119,65 @@ public class ImportExportTest
boolean result = (id != -1);
assertTrue(result);
LoyaltyCard card = db.getLoyaltyCard((int) id);
assertEquals("No Expiry", card.store);
assertEquals("", card.note);
assertEquals(null, card.expiry);
assertEquals(new BigDecimal("0"), card.balance);
assertEquals(null, card.balanceType);
assertEquals(BARCODE_DATA, card.cardId);
assertEquals(BARCODE_TYPE, card.barcodeType);
assertEquals(Integer.valueOf(0), card.headerColor);
assertEquals(0, card.starStatus);
id = db.insertLoyaltyCard("Past", "", new Date((long) 1), new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, 0, 0);
result = (id != -1);
assertTrue(result);
card = db.getLoyaltyCard((int) id);
assertEquals("Past", card.store);
assertEquals("", card.note);
assertTrue(card.expiry.before(new Date()));
assertEquals(new BigDecimal("0"), card.balance);
assertEquals(null, card.balanceType);
assertEquals(BARCODE_DATA, card.cardId);
assertEquals(BARCODE_TYPE, card.barcodeType);
assertEquals(Integer.valueOf(0), card.headerColor);
assertEquals(0, card.starStatus);
id = db.insertLoyaltyCard("Today", "", new Date(), new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, 0, 0);
result = (id != -1);
assertTrue(result);
card = db.getLoyaltyCard((int) id);
assertEquals("Today", card.store);
assertEquals("", card.note);
assertTrue(card.expiry.before(new Date(new Date().getTime()+86400)));
assertTrue(card.expiry.after(new Date(new Date().getTime()-86400)));
assertEquals(new BigDecimal("0"), card.balance);
assertEquals(null, card.balanceType);
assertEquals(BARCODE_DATA, card.cardId);
assertEquals(BARCODE_TYPE, card.barcodeType);
assertEquals(Integer.valueOf(0), card.headerColor);
assertEquals(0, card.starStatus);
// 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(2147483648L), new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, 0, 0);
id = db.insertLoyaltyCard("Future", "", new Date(2147483648000L), new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, 0, 0);
result = (id != -1);
assertTrue(result);
card = db.getLoyaltyCard((int) id);
assertEquals("Future", card.store);
assertEquals("", card.note);
assertTrue(card.expiry.after(new Date(new Date().getTime()+86400)));
assertEquals(new BigDecimal("0"), card.balance);
assertEquals(null, card.balanceType);
assertEquals(BARCODE_DATA, card.cardId);
assertEquals(BARCODE_TYPE, card.barcodeType);
assertEquals(Integer.valueOf(0), card.headerColor);
assertEquals(0, card.starStatus);
assertEquals(4, db.getLoyaltyCardCount());
}
@@ -269,34 +321,30 @@ public class ImportExportTest
{
final int NUM_CARDS = 10;
for(DataFormat format : DataFormat.values())
{
addLoyaltyCards(NUM_CARDS);
addLoyaltyCards(NUM_CARDS);
ByteArrayOutputStream outData = new ByteArrayOutputStream();
OutputStreamWriter outStream = new OutputStreamWriter(outData);
ByteArrayOutputStream outData = new ByteArrayOutputStream();
OutputStreamWriter outStream = new OutputStreamWriter(outData);
// Export data to CSV format
boolean result = MultiFormatExporter.exportData(db, outStream, format);
assertTrue(result);
outStream.close();
// Export data to CSV format
boolean result = MultiFormatExporter.exportData(db, outStream, DataFormat.Catima);
assertTrue(result);
outStream.close();
clearDatabase();
clearDatabase();
ByteArrayInputStream inData = new ByteArrayInputStream(outData.toByteArray());
InputStreamReader inStream = new InputStreamReader(inData);
ByteArrayInputStream inData = new ByteArrayInputStream(outData.toByteArray());
// Import the CSV data
result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
assertTrue(result);
// Import the CSV data
result = MultiFormatImporter.importData(db, inData, DataFormat.Catima);
assertTrue(result);
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
checkLoyaltyCards();
checkLoyaltyCards();
// Clear the database for the next format under test
clearDatabase();
}
// Clear the database for the next format under test
clearDatabase();
}
@Test
@@ -304,34 +352,30 @@ public class ImportExportTest
{
final int NUM_CARDS = 9;
for(DataFormat format : DataFormat.values())
{
addLoyaltyCardsFiveStarred();
addLoyaltyCardsFiveStarred();
ByteArrayOutputStream outData = new ByteArrayOutputStream();
OutputStreamWriter outStream = new OutputStreamWriter(outData);
ByteArrayOutputStream outData = new ByteArrayOutputStream();
OutputStreamWriter outStream = new OutputStreamWriter(outData);
// Export data to CSV format
boolean result = MultiFormatExporter.exportData(db, outStream, format);
assertTrue(result);
outStream.close();
// Export data to CSV format
boolean result = MultiFormatExporter.exportData(db, outStream, DataFormat.Catima);
assertTrue(result);
outStream.close();
clearDatabase();
clearDatabase();
ByteArrayInputStream inData = new ByteArrayInputStream(outData.toByteArray());
InputStreamReader inStream = new InputStreamReader(inData);
ByteArrayInputStream inData = new ByteArrayInputStream(outData.toByteArray());
// Import the CSV data
result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
assertTrue(result);
// Import the CSV data
result = MultiFormatImporter.importData(db, inData, DataFormat.Catima);
assertTrue(result);
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
checkLoyaltyCardsFiveStarred();
checkLoyaltyCardsFiveStarred();
// Clear the database for the next format under test
clearDatabase();
}
// Clear the database for the next format under test
clearDatabase();
}
private List<String> groupsToGroupNames(List<Group> groups)
@@ -351,77 +395,73 @@ public class ImportExportTest
final int NUM_CARDS = 10;
final int NUM_GROUPS = 3;
for(DataFormat format : DataFormat.values())
{
addLoyaltyCards(NUM_CARDS);
addGroups(NUM_GROUPS);
addLoyaltyCards(NUM_CARDS);
addGroups(NUM_GROUPS);
List<Group> emptyGroup = new ArrayList<>();
List<Group> emptyGroup = new ArrayList<>();
List<Group> groupsForOne = new ArrayList<>();
groupsForOne.add(db.getGroup("group, \" 1"));
List<Group> groupsForOne = new ArrayList<>();
groupsForOne.add(db.getGroup("group, \" 1"));
List<Group> groupsForTwo = new ArrayList<>();
groupsForTwo.add(db.getGroup("group, \" 1"));
groupsForTwo.add(db.getGroup("group, \" 2"));
List<Group> groupsForTwo = new ArrayList<>();
groupsForTwo.add(db.getGroup("group, \" 1"));
groupsForTwo.add(db.getGroup("group, \" 2"));
List<Group> groupsForThree = new ArrayList<>();
groupsForThree.add(db.getGroup("group, \" 1"));
groupsForThree.add(db.getGroup("group, \" 2"));
groupsForThree.add(db.getGroup("group, \" 3"));
List<Group> groupsForThree = new ArrayList<>();
groupsForThree.add(db.getGroup("group, \" 1"));
groupsForThree.add(db.getGroup("group, \" 2"));
groupsForThree.add(db.getGroup("group, \" 3"));
List<Group> groupsForFour = new ArrayList<>();
groupsForFour.add(db.getGroup("group, \" 1"));
groupsForFour.add(db.getGroup("group, \" 2"));
groupsForFour.add(db.getGroup("group, \" 3"));
List<Group> groupsForFour = new ArrayList<>();
groupsForFour.add(db.getGroup("group, \" 1"));
groupsForFour.add(db.getGroup("group, \" 2"));
groupsForFour.add(db.getGroup("group, \" 3"));
List<Group> groupsForFive = new ArrayList<>();
groupsForFive.add(db.getGroup("group, \" 1"));
groupsForFive.add(db.getGroup("group, \" 3"));
List<Group> groupsForFive = new ArrayList<>();
groupsForFive.add(db.getGroup("group, \" 1"));
groupsForFive.add(db.getGroup("group, \" 3"));
db.setLoyaltyCardGroups(1, groupsForOne);
db.setLoyaltyCardGroups(2, groupsForTwo);
db.setLoyaltyCardGroups(3, groupsForThree);
db.setLoyaltyCardGroups(4, groupsForFour);
db.setLoyaltyCardGroups(5, groupsForFive);
db.setLoyaltyCardGroups(1, groupsForOne);
db.setLoyaltyCardGroups(2, groupsForTwo);
db.setLoyaltyCardGroups(3, groupsForThree);
db.setLoyaltyCardGroups(4, groupsForFour);
db.setLoyaltyCardGroups(5, groupsForFive);
ByteArrayOutputStream outData = new ByteArrayOutputStream();
OutputStreamWriter outStream = new OutputStreamWriter(outData);
ByteArrayOutputStream outData = new ByteArrayOutputStream();
OutputStreamWriter outStream = new OutputStreamWriter(outData);
// Export data to CSV format
boolean result = MultiFormatExporter.exportData(db, outStream, format);
assertTrue(result);
outStream.close();
// Export data to CSV format
boolean result = MultiFormatExporter.exportData(db, outStream, DataFormat.Catima);
assertTrue(result);
outStream.close();
clearDatabase();
clearDatabase();
ByteArrayInputStream inData = new ByteArrayInputStream(outData.toByteArray());
InputStreamReader inStream = new InputStreamReader(inData);
ByteArrayInputStream inData = new ByteArrayInputStream(outData.toByteArray());
// Import the CSV data
result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
assertTrue(result);
// Import the CSV data
result = MultiFormatImporter.importData(db, inData, DataFormat.Catima);
assertTrue(result);
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
assertEquals(NUM_GROUPS, db.getGroupCount());
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
assertEquals(NUM_GROUPS, db.getGroupCount());
checkLoyaltyCards();
checkGroups();
checkLoyaltyCards();
checkGroups();
assertEquals(groupsToGroupNames(groupsForOne), groupsToGroupNames(db.getLoyaltyCardGroups(1)));
assertEquals(groupsToGroupNames(groupsForTwo), groupsToGroupNames(db.getLoyaltyCardGroups(2)));
assertEquals(groupsToGroupNames(groupsForThree), groupsToGroupNames(db.getLoyaltyCardGroups(3)));
assertEquals(groupsToGroupNames(groupsForFour), groupsToGroupNames(db.getLoyaltyCardGroups(4)));
assertEquals(groupsToGroupNames(groupsForFive), groupsToGroupNames(db.getLoyaltyCardGroups(5)));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(6));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(7));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(8));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(9));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(10));
assertEquals(groupsToGroupNames(groupsForOne), groupsToGroupNames(db.getLoyaltyCardGroups(1)));
assertEquals(groupsToGroupNames(groupsForTwo), groupsToGroupNames(db.getLoyaltyCardGroups(2)));
assertEquals(groupsToGroupNames(groupsForThree), groupsToGroupNames(db.getLoyaltyCardGroups(3)));
assertEquals(groupsToGroupNames(groupsForFour), groupsToGroupNames(db.getLoyaltyCardGroups(4)));
assertEquals(groupsToGroupNames(groupsForFive), groupsToGroupNames(db.getLoyaltyCardGroups(5)));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(6));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(7));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(8));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(9));
assertEquals(emptyGroup, db.getLoyaltyCardGroups(10));
// Clear the database for the next format under test
clearDatabase();
}
// Clear the database for the next format under test
clearDatabase();
}
@Test
@@ -429,32 +469,28 @@ public class ImportExportTest
{
final int NUM_CARDS = 10;
for(DataFormat format : DataFormat.values())
{
addLoyaltyCards(NUM_CARDS);
addLoyaltyCards(NUM_CARDS);
ByteArrayOutputStream outData = new ByteArrayOutputStream();
OutputStreamWriter outStream = new OutputStreamWriter(outData);
ByteArrayOutputStream outData = new ByteArrayOutputStream();
OutputStreamWriter outStream = new OutputStreamWriter(outData);
// Export into CSV data
boolean result = MultiFormatExporter.exportData(db, outStream, format);
assertTrue(result);
outStream.close();
// Export into CSV data
boolean result = MultiFormatExporter.exportData(db, outStream, DataFormat.Catima);
assertTrue(result);
outStream.close();
ByteArrayInputStream inData = new ByteArrayInputStream(outData.toByteArray());
InputStreamReader inStream = new InputStreamReader(inData);
ByteArrayInputStream inData = new ByteArrayInputStream(outData.toByteArray());
// Import the CSV data on top of the existing database
result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
assertTrue(result);
// Import the CSV data on top of the existing database
result = MultiFormatImporter.importData(db, inData, DataFormat.Catima);
assertTrue(result);
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
checkLoyaltyCards();
checkLoyaltyCards();
// Clear the database for the next format under test
clearDatabase();
}
// Clear the database for the next format under test
clearDatabase();
}
@Test
@@ -470,7 +506,7 @@ public class ImportExportTest
OutputStreamWriter outStream = new OutputStreamWriter(outData);
// Export data to CSV format
boolean result = MultiFormatExporter.exportData(db, outStream, format);
boolean result = MultiFormatExporter.exportData(db, outStream, DataFormat.Catima);
assertTrue(result);
clearDatabase();
@@ -482,10 +518,9 @@ public class ImportExportTest
String corruptEntry = "ThisStringIsLikelyNotPartOfAnyFormat,\"\"a";
ByteArrayInputStream inData = new ByteArrayInputStream((outData.toString() + corruptEntry).getBytes());
InputStreamReader inStream = new InputStreamReader(inData);
// Attempt to import the CSV data
result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
// Attempt to import the data
result = MultiFormatImporter.importData(db, inData, format);
assertEquals(false, result);
assertEquals(0, db.getLoyaltyCardCount());
@@ -513,49 +548,46 @@ public class ImportExportTest
final File sdcardDir = Environment.getExternalStorageDirectory();
final File exportFile = new File(sdcardDir, "Catima.csv");
for(DataFormat format : DataFormat.values())
{
addLoyaltyCards(NUM_CARDS);
addLoyaltyCards(NUM_CARDS);
TestTaskCompleteListener listener = new TestTaskCompleteListener();
TestTaskCompleteListener listener = new TestTaskCompleteListener();
// Export to the file
FileOutputStream fileOutputStream = new FileOutputStream(exportFile);
ImportExportTask task = new ImportExportTask(activity, format, fileOutputStream, listener);
task.execute();
// Export to the file
FileOutputStream fileOutputStream = new FileOutputStream(exportFile);
ImportExportTask task = new ImportExportTask(activity, DataFormat.Catima, fileOutputStream, listener);
task.execute();
// Actually run the task to completion
Robolectric.flushBackgroundThreadScheduler();
// Actually run the task to completion
Robolectric.flushBackgroundThreadScheduler();
// Check that the listener was executed
assertNotNull(listener.success);
assertEquals(true, listener.success);
// Check that the listener was executed
assertNotNull(listener.success);
assertEquals(true, listener.success);
clearDatabase();
clearDatabase();
// Import everything back from the default location
// Import everything back from the default location
listener = new TestTaskCompleteListener();
listener = new TestTaskCompleteListener();
FileInputStream fileStream = new FileInputStream(exportFile);
FileInputStream fileStream = new FileInputStream(exportFile);
task = new ImportExportTask(activity, format, fileStream, listener);
task.execute();
task = new ImportExportTask(activity, DataFormat.Catima, fileStream, listener);
task.execute();
// Actually run the task to completion
Robolectric.flushBackgroundThreadScheduler();
// Actually run the task to completion
Robolectric.flushBackgroundThreadScheduler();
// Check that the listener was executed
assertNotNull(listener.success);
assertEquals(true, listener.success);
// Check that the listener was executed
assertNotNull(listener.success);
assertEquals(true, listener.success);
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
assertEquals(NUM_CARDS, db.getLoyaltyCardCount());
checkLoyaltyCards();
checkLoyaltyCards();
// Clear the database for the next format under test
clearDatabase();
}
// Clear the database for the next format under test
clearDatabase();
}
@Test
@@ -572,10 +604,9 @@ public class ImportExportTest
csvText += "1,store,note,12345,type,0";
ByteArrayInputStream inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
InputStreamReader inStream = new InputStreamReader(inputStream);
// Import the CSV data
boolean result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
boolean result = MultiFormatImporter.importData(db, inputStream, DataFormat.Catima);
assertTrue(result);
assertEquals(1, db.getLoyaltyCardCount());
@@ -610,10 +641,9 @@ public class ImportExportTest
csvText += "1,store,note,12345,type,,,0";
ByteArrayInputStream inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
InputStreamReader inStream = new InputStreamReader(inputStream);
// Import the CSV data
boolean result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
boolean result = MultiFormatImporter.importData(db, inputStream, DataFormat.Catima);
assertTrue(result);
assertEquals(1, db.getLoyaltyCardCount());
@@ -648,10 +678,9 @@ public class ImportExportTest
csvText += "1,store,note,12345,type,not a number,invalid,0";
ByteArrayInputStream inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
InputStreamReader inStream = new InputStreamReader(inputStream);
// Import the CSV data
boolean result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
boolean result = MultiFormatImporter.importData(db, inputStream, DataFormat.Catima);
assertEquals(false, result);
assertEquals(0, db.getLoyaltyCardCount());
@@ -674,10 +703,9 @@ public class ImportExportTest
csvText += "1,store,note,12345,,1,1,0";
ByteArrayInputStream inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
InputStreamReader inStream = new InputStreamReader(inputStream);
// Import the CSV data
boolean result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
boolean result = MultiFormatImporter.importData(db, inputStream, DataFormat.Catima);
assertEquals(true, result);
assertEquals(1, db.getLoyaltyCardCount());
@@ -712,10 +740,9 @@ public class ImportExportTest
csvText += "1,store,note,12345,type,1,1,1";
ByteArrayInputStream inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
InputStreamReader inStream = new InputStreamReader(inputStream);
// Import the CSV data
boolean result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
boolean result = MultiFormatImporter.importData(db, inputStream, DataFormat.Catima);
assertEquals(true, result);
assertEquals(1, db.getLoyaltyCardCount());
@@ -750,10 +777,9 @@ public class ImportExportTest
csvText += "1,store,note,12345,type,1,1,";
ByteArrayInputStream inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
InputStreamReader inStream = new InputStreamReader(inputStream);
// Import the CSV data
boolean result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
boolean result = MultiFormatImporter.importData(db, inputStream, DataFormat.Catima);
assertEquals(true, result);
assertEquals(1, db.getLoyaltyCardCount());
@@ -788,10 +814,9 @@ public class ImportExportTest
csvText += "1,store,note,12345,type,1,1,2";
ByteArrayInputStream inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
InputStreamReader inStream = new InputStreamReader(inputStream);
// Import the CSV data
boolean result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
boolean result = MultiFormatImporter.importData(db, inputStream, DataFormat.Catima);
assertTrue(result);
assertEquals(1, db.getLoyaltyCardCount());
@@ -808,10 +833,9 @@ public class ImportExportTest
csvText += "1,store,note,12345,type,1,1,text";
inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
inStream = new InputStreamReader(inputStream);
// Import the CSV data
result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
result = MultiFormatImporter.importData(db, inputStream, DataFormat.Catima);
assertTrue(result);
assertEquals(1, db.getLoyaltyCardCount());
@@ -830,59 +854,62 @@ public class ImportExportTest
clearDatabase();
}
@Test
public void importVoucherVault() throws IOException, FormatException, JSONException, ParseException {
String jsonText = "[\n" +
" {\n" +
" \"uuid\": \"ae1ae525-3f27-481e-853a-8c30b7fa12d8\",\n" +
" \"description\": \"Clothes Store\",\n" +
" \"code\": \"123456\",\n" +
" \"codeType\": \"CODE128\",\n" +
" \"expires\": null,\n" +
" \"removeOnceExpired\": true,\n" +
" \"balance\": null,\n" +
" \"color\": \"GREY\"\n" +
" },\n" +
" {\n" +
" \"uuid\": \"29a5d3b3-eace-4311-a15c-4c7e6a010531\",\n" +
" \"description\": \"Department Store\",\n" +
" \"code\": \"26846363\",\n" +
" \"codeType\": \"CODE39\",\n" +
" \"expires\": \"2021-03-26T00:00:00.000\",\n" +
" \"removeOnceExpired\": true,\n" +
" \"balance\": 3.5,\n" +
" \"color\": \"PURPLE\"\n" +
" }\n" +
"]";
private void checkLoyaltyCardsExpiry()
{
Cursor cursor = db.getLoyaltyCardCursor();
cursor.moveToNext();
LoyaltyCard card = LoyaltyCard.toLoyaltyCard(cursor);
assertEquals("Never", card.store);
ByteArrayInputStream inputStream = new ByteArrayInputStream(jsonText.getBytes(StandardCharsets.UTF_8));
// Import the Voucher Vault data
boolean result = MultiFormatImporter.importData(db, inputStream, DataFormat.VoucherVault);
assertTrue(result);
assertEquals(2, db.getLoyaltyCardCount());
LoyaltyCard card = db.getLoyaltyCard(1);
assertEquals("Clothes Store", card.store);
assertEquals("", card.note);
assertEquals(null, card.expiry);
assertEquals(new BigDecimal("0"), card.balance);
assertEquals(null, card.balanceType);
assertEquals(BARCODE_DATA, card.cardId);
assertEquals(BARCODE_TYPE, card.barcodeType);
assertEquals(Integer.valueOf(0), card.headerColor);
assertEquals(Currency.getInstance("USD"), card.balanceType);
assertEquals("123456", card.cardId);
assertEquals(BarcodeFormat.CODE_128.name(), card.barcodeType);
assertEquals(0, card.starStatus);
assertEquals(Color.GRAY, (long) card.headerColor);
cursor.moveToNext();
card = LoyaltyCard.toLoyaltyCard(cursor);
assertEquals("Past", card.store);
card = db.getLoyaltyCard(2);
assertEquals("Department Store", card.store);
assertEquals("", card.note);
assertTrue(card.expiry.before(new Date()));
assertEquals(new BigDecimal("0"), card.balance);
assertEquals(null, card.balanceType);
assertEquals(BARCODE_DATA, card.cardId);
assertEquals(BARCODE_TYPE, card.barcodeType);
assertEquals(Integer.valueOf(0), card.headerColor);
assertEquals(new Date(1616716800000L), card.expiry);
assertEquals(new BigDecimal("3.5"), card.balance);
assertEquals(Currency.getInstance("USD"), card.balanceType);
assertEquals("26846363", card.cardId);
assertEquals(BarcodeFormat.CODE_39.name(), card.barcodeType);
assertEquals(0, card.starStatus);
assertEquals(Color.rgb(128, 0, 128), (long) card.headerColor);
cursor.moveToNext();
card = LoyaltyCard.toLoyaltyCard(cursor);
assertEquals("Today", card.store);
assertEquals("", card.note);
assertTrue(card.expiry.before(new Date(new Date().getTime()+86400)));
assertTrue(card.expiry.after(new Date(new Date().getTime()-86400)));
assertEquals(new BigDecimal("0"), card.balance);
assertEquals(null, card.balanceType);
assertEquals(BARCODE_DATA, card.cardId);
assertEquals(BARCODE_TYPE, card.barcodeType);
assertEquals(Integer.valueOf(0), card.headerColor);
assertEquals(0, card.starStatus);
cursor.moveToNext();
card = LoyaltyCard.toLoyaltyCard(cursor);
assertEquals("Future", card.store);
assertEquals("", card.note);
assertTrue(card.expiry.after(new Date(new Date().getTime()+86400)));
assertEquals(new BigDecimal("0"), card.balance);
assertEquals(null, card.balanceType);
assertEquals(BARCODE_DATA, card.cardId);
assertEquals(BARCODE_TYPE, card.barcodeType);
assertEquals(Integer.valueOf(0), card.headerColor);
assertEquals(0, card.starStatus);
cursor.close();
clearDatabase();
}
}

View File

@@ -61,10 +61,11 @@ public class MainActivityTest
assertTrue(menu != null);
// The settings, import/export, groups, search and add button should be present
assertEquals(menu.size(), 5);
assertEquals(menu.size(), 6);
assertEquals("Search", menu.findItem(R.id.action_search).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());
assertEquals("About", menu.findItem(R.id.action_about).getTitle().toString());
assertEquals("Settings", menu.findItem(R.id.action_settings).getTitle().toString());
}

View File

@@ -1,4 +1,4 @@
# PRIVACY POLICY FOR LOYALTY CARD KEYCHAIN
# PRIVACY POLICY FOR CATIMA
This privacy policy governs your use of the software application Catima (“Application”) for mobile devices
that was created by Sylvia van Os. The Application is designed to store and display barcodes.

View File

@@ -1,7 +1,7 @@
Bist Du es auch leid, beim Bezahlen an der Kasse im Supermarkt jedes mal nach dieser Bonuskarte aus Plastik zu suchen? Genervt davon, dass die Brieftasche durch die ganzen Plastikkarten gefühlte fünf Meter dick ist? Wäre es nicht toll, eine <i>freie</i> Lösung für das Problem zu haben, die Deine Daten nicht noch zusätzlich mit weiteren Anbietern teilt?
Bist du es auch leid, beim Bezahlen an der Kasse im Supermarkt jedes mal nach dieser Bonuskarte aus Plastik zu suchen? Genervt davon, dass die Brieftasche durch die ganzen Plastikkarten gefühlte fünf Meter dick ist? Wäre es nicht toll, eine <i>freie</i> Lösung für das Problem zu haben, die deine Daten nicht noch zusätzlich mit weiteren Anbietern teilt?
<i>Catima</i> ist eine App, die Deine auf Barcodes basierenden Kundenkarten auf Deinem Smartphone verwaltet. <i>Catima</i> ist Open Source und kann eines richtig gut: Deine Karten verwalten!
<i>Catima</i> ist eine Anwendung, die deine auf Strichcodes basierenden Kundenkarten auf deinem Smartphone verwaltet. <i>Catima</i> ist quelloffen und kann eines richtig gut: Deine Karten verwalten!
Neue Karten können mit Leichtigkeit hinzugefügt werden. Entweder nutzt Du die Kamera Deines Smartphones, um den Barcode direkt einzulesen oder Du gibst die unter selbigem befindliche Ziffernfolge von Hand ein. An der Kasse zeigt <i>Catima</i> sodann den Barcode auf dem Display Deines Smartphones an, sodass er vom Scanner gelesen werden kann. Sollte der Scanner dabei doch einmal streiken (was selten vorkommt und wenn, dann meist nur bei älteren Scanner-Modellen), kann der Verkäufer die ebenfalls angezeigten Ziffern wiederum auch händisch erfassen.
Neue Karten können mit Leichtigkeit hinzugefügt werden. Entweder nutzt du die Kamera deines Smartphones, um den Strichcode direkt einzulesen oder du gibst die unter selbigem befindliche Ziffernfolge von Hand ein. An der Kasse zeigt <i>Catima</i> sodann den Strichcode auf dem Bildschirm deines Mobiltelefones an, sodass er vom Scanner gelesen werden kann. Sollte der Scanner dabei doch einmal streiken (was selten vorkommt und wenn, dann meist nur bei älteren Scanner-Modellen), kann der Verkäufer die ebenfalls angezeigten Ziffern wiederum auch händisch erfassen.
Die App benötigt nur wenige Berechtigungen und greift nie auf das Internet zu. <i>Catima</i> bietet auch die Möglichkeit, Deine Kartensammlung zu exportieren sowie zu importieren. Damit kannst Du die Daten z. B. auch auf ein anderes Gerät übertragen oder etwa nach einem Werksreset wieder neu einlesen.
Die Anwendung benötigt nur wenige Berechtigungen und greift nie auf das Internet zu. <i>Catima</i> bietet auch die Möglichkeit, deine Kartensammlung zu exportieren sowie zu importieren. Damit kannst du die Daten z. B. auch auf ein anderes Gerät übertragen oder etwa nach einem Werksreset wieder neu einlesen.

View File

@@ -1 +1 @@
Verwaltet barcode-basierte Kunden-/Treuekarten auf dem Handy
Verwaltet Strichcode-basierte Kunden-/Treuekarten auf dem Mobiltelefon

View File

@@ -1 +1 @@
Catima
Catima - Kundenkarten- und Ticketverwaltung

View File

@@ -1 +1 @@
Catima Cartes de fidélité
Catima Gestionnaire de cartes de fidélité

View File

@@ -0,0 +1,7 @@
Sei stanco di cercare la tua carta fedeltà durante i pagamenti in negozio? Cerchi una soluzione gratuita che non catture le tue informazioni?
Catima è un'applicazione che memorizzerà sul tuo telefono le tue carte fedeltà basate su codici a barre. L'applicazione è open source e cerca di fare bene una cosa: gestire le tue carte!
Nuove carte possono essere aggiunte in un attimo. Utilizza la fotocamera per acquisire il codice a barre o digita il numero. Quando il codice a barre viene caricato nel negozio e visualizzato, può essere scansionato con un moderno lettore di codici a barre. (Alcuni negozi utilizzano lettori di codici a barre meno recenti, come scanner piani, invece di scanner di immagini. Questi non possono leggere il display dello smartphone. In questi casi, devi chiedere all'impiegato di digitare il numero manualmente).
L'applicazione richiede pochissime autorizzazioni e non tenta mai di accedere a Internet. E' possibile eseguire il backup delle carte nella memoria locale. E da lì puoi conservare il backup da qualche parte al sicuro.

View File

@@ -0,0 +1 @@
Gestisce le carte fedeltà basate su codici a barre sul telefono

View File

@@ -0,0 +1 @@
Catima Gestore di carte fedeltà

View File

@@ -2,6 +2,6 @@ Ben jij het ook zo zat om tijdens het afrekenen steeds weer te moeten graaien na
Dan is Catima wat voor jou! Met deze app kun je je op barcode gebaseerde klantenkaarten opslaan op je telefoon. De app is open source en heeft maar één doel: het beheren en organiseren van je kaarten!
Je voegt nieuwe kaarten in een handomdraai toe, met je camera of door het nummer ervan in te voeren. In de winkel hoef je vervolgens alleen maar de kaart te openen zodat deze kan worden gescand door elke moderne barcodescanner. (Sommige winkels gebruiken nog ouderwetse barcodescanners, zoals flatbedscanners, welke je scherm niet kunnen aflezen. In dat geval moet de kassamedewerker het nummer handmatig invoeren.).
Je voegt nieuwe kaarten in een handomdraai toe, met je camera of door het nummer ervan in te voeren. In de winkel hoef je vervolgens alleen maar de kaart te openen zodat deze kan worden gescand door elke moderne barcodescanner. (Sommige winkels gebruiken nog ouderwetse barcodescanners, zoals scanners, welke je scherm niet kunnen aflezen. In dat geval moet de kassamedewerker het nummer handmatig invoeren.).
Catima vereist nauwelijks rechten en maakt geen contact met het internet. Je kunt je kaarten back-uppen naar je lokale opslag en de back-up vervolgens overzetten naar een veilig opslagmedium.

View File

@@ -0,0 +1,7 @@
Надоело искать свою пластиковую скидочную карту на кассе в магазине? Ищете бесплатное решение, которое не будет собирать вашу личную информацию?
Catima — это приложение, которое будет хранить карты лояльности на основе штрих-кодов на вашем смартфоне. Это приложение с открытым исходным кодом и пытается сделать хорошо только одну вещь : управлять вашими картами!
Новые карты можно добавить в одно мгновение. Либо используйте камеру, чтобы считать штрих-код, либо введите номер карты вручную. Добавленный в приложение штрих-код можно считать с экрана смартфона в магазине с современным сканером штрих-кода. (В некоторых магазинах вместо сканеров изображений используются старые сканеры штрих-кодов, например, планшетные сканеры. Они не могут считывать данные с экрана. Вместо этого попросите сотрудника ввести номер вручную.).
Приложению требуется очень мало разрешений и не нужен доступ в интернет. Есть возможность резервного копирования ваших карт в локальное хранилище. Оттуда вы сможете перенести данные резервной копии в надёжное место.