Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ziadOUA committed Mar 8, 2024
2 parents 4e16a4c + 03a5a38 commit bfb40c8
Show file tree
Hide file tree
Showing 208 changed files with 990 additions and 338 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/[email protected]
- name: Fail on bad translations
run: if grep -ri "<xliff" app/src/main/res/values*/strings.xml; then echo "Invalidly escaped translations found"; exit 1; fi
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/wrapper-validation-action@v2
- name: set up OpenJDK 17
run: |
sudo apt-get update
Expand All @@ -48,7 +48,7 @@ jobs:
run: ./gradlew spotbugsRelease
- name: Archive test results
if: always()
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
name: test-results
path: app/build/reports
2 changes: 1 addition & 1 deletion .github/workflows/changelog-to-fastlane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Run converter script
run: python .scripts/changelog_to_fastlane.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
uses: peter-evans/create-pull-request@v6.0.1
with:
title: "Update Fastlane changelogs"
commit-message: "Update Fastlane changelogs"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/contributors-to-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
file_in_repo: app/src/main/res/raw/contributors.txt
min_commit_count: 5
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
uses: peter-evans/create-pull-request@v6.0.1
with:
title: "Update contributors"
commit-message: "Update contributors"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-feature-graphic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Generate featureGraphic.png for each language
run: .scripts/generate_feature_graphic/generate_feature_graphic.sh
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
uses: peter-evans/create-pull-request@v6.0.1
with:
title: "Update feature graphic"
commit-message: "Update feature graphic"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
- uses: actions/[email protected]
- uses: obfusk/[email protected]
id: gradle-update
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/wrapper-validation-action@v2
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
uses: peter-evans/create-pull-request@v6.0.1
with:
title: "Update Gradle to ${{ steps.gradle-update.outputs.version }}"
commit-message: "Update Gradle to ${{ steps.gradle-update.outputs.version }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-locales.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Update locales
run: .scripts/locales.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
uses: peter-evans/create-pull-request@v6.0.1
with:
title: "Update locales"
commit-message: "Update locales"
Expand Down
14 changes: 11 additions & 3 deletions .scripts/generate_feature_graphic/generate_feature_graphic.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ for lang in "$script_location/../../fastlane/metadata/android/"*; do
if grep -q — title.txt; then
# Try splitting title.txt on — (em dash)
IFS='' read -r appname subtext < title.txt
else
elif grep -q – title.txt; then
# No result, try splitting title.txt on – (en dash)
IFS='' read -r appname subtext < title.txt
elif grep -q - title.txt; then
# No result, try splitting on - (dash)
IFS='-' read -r appname subtext < title.txt
else
# No result, use the full title as app name and default subtext
appname=$(< title.txt)
subtext="Loyalty Card Wallet"
fi
export appname=${appname%% }
export subtext=${subtext## }
# If there is subtext, change the .svg accordingly
if [ -n "$subtext" ]; then
# If the appname isn't Catima or there is subtext, change the .svg accordingly
if [ "$appname" != "Catima" ] || [ -n "$subtext" ]; then
perl -pi -e 's/Catima/$ENV{appname}/' featureGraphic.svg
perl -pi -e 's/Loyalty Card Wallet/$ENV{subtext}/' featureGraphic.svg
# Set correct font or font size for language if needed
# (Lexend Deca has limited support and some characters are big)
# We specifically need the Serif version because of the 200 weight
case "$(basename "$lang")" in
bg|el-GR|ru-RU|uk) sed -i "s/Lexend Deca/Noto Serif/" featureGraphic.svg ;;
hi-IN) sed -i -e "s/Yesteryear/Noto Serif Devanagari/" -e "s/Lexend Deca/Noto Serif Devanagari/" featureGraphic.svg ;;
ja-JP) sed -i "s/Lexend Deca/Noto Serif CJK JP/" featureGraphic.svg ;;
ko) sed -i "s/Lexend Deca/Noto Serif CJK KR/" featureGraphic.svg ;;
kn-IN) sed -i -e 's/font-size="150"/font-size="100"/' -e 's/y="285.511"/y="235.511"/' featureGraphic.svg ;;
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v2.28.0 - 133 (2024-03-08)

- Target Android 14
- Open card icon in gallery on touch
- Improve design of Photos tab in edit view
- Update spending screen to also support receiving

## v2.27.0 - 132 (2024-01-30)

- Refine "Add card" workflow
Expand Down
12 changes: 6 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ spotbugs {

android {
namespace = "com.ziadoua.zcard"
compileSdk = 33
compileSdk = 34

defaultConfig {
applicationId = "com.ziadoua.zcard"
minSdk = 21
targetSdk = 33
versionCode = 132
versionName = "2.27.0"
targetSdk = 34
versionCode = 133
versionName = "2.28.0"

vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
Expand Down Expand Up @@ -94,8 +94,8 @@ dependencies {
implementation("androidx.exifinterface:exifinterface:1.3.7")
implementation("androidx.palette:palette:1.0.0")
implementation("androidx.preference:preference:1.2.1")
implementation("com.google.android.material:material:1.10.0")
implementation("com.github.yalantis:ucrop:2.2.8-native")
implementation("com.google.android.material:material:1.11.0")
implementation("com.github.yalantis:ucrop:2.2.8")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")

// Splash Screen
Expand Down
2 changes: 1 addition & 1 deletion app/src/debug/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">Catima Debug</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@
android:name=".preferences.SettingsActivity"
android:label="@string/settings"
android:theme="@style/AppTheme.NoActionBar" />
<!-- FIXME: locked screenOrientation is a workaround for https://github.com/CatimaLoyalty/Android/issues/1715, remove when https://github.com/CatimaLoyalty/Android/issues/513 is fixed -->
<activity
android:name=".ImportExportActivity"
android:label="@string/importExport"
android:exported="true"
android:screenOrientation="locked"
android:theme="@style/AppTheme.NoActionBar">

<!-- ZIP Intent Filter -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import android.widget.ListView;
import android.widget.Toast;

import androidx.appcompat.widget.Toolbar;

import com.google.zxing.BarcodeFormat;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import android.service.controls.templates.StatelessTemplate;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

import java.util.List;
import java.util.concurrent.Flow;
import java.util.function.Consumer;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

@RequiresApi(Build.VERSION_CODES.R)
public class CardsOnPowerScreenService extends ControlsProviderService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import androidx.annotation.NonNull;
Expand Down
42 changes: 32 additions & 10 deletions app/src/main/java/com/ziadoua/zcard/ImportExportActivity.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.ziadoua.zcard;

import android.Manifest;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
Expand All @@ -16,8 +14,18 @@
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.Toast;

import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.textfield.TextInputLayout;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand Down Expand Up @@ -133,16 +141,19 @@ protected void onCreate(Bundle savedInstanceState) {
builder.setTitle(R.string.exportPassword);

FrameLayout container = new FrameLayout(ImportExportActivity.this);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = 50;
params.rightMargin = 50;

final TextInputLayout textInputLayout = new TextInputLayout(ImportExportActivity.this);
textInputLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(50, 10, 50, 0);
textInputLayout.setLayoutParams(params);

final EditText input = new EditText(ImportExportActivity.this);
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
input.setLayoutParams(params);
input.setHint(R.string.exportPasswordHint);

container.addView(input);
textInputLayout.addView(input);
container.addView(textInputLayout);
builder.setView(container);
builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> {
exportPassword = input.getText().toString();
Expand All @@ -155,7 +166,6 @@ protected void onCreate(Bundle savedInstanceState) {
});
builder.setNegativeButton(R.string.cancel, (dialogInterface, i) -> dialogInterface.cancel());
builder.show();

});

// Check that there is a file manager available
Expand Down Expand Up @@ -327,9 +337,21 @@ private void retryWithPassword(DataFormat dataFormat, Uri uri) {
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.passwordRequired);

final EditText input = new EditText(this);
FrameLayout container = new FrameLayout(ImportExportActivity.this);

final TextInputLayout textInputLayout = new TextInputLayout(ImportExportActivity.this);
textInputLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(50, 10, 50, 0);
textInputLayout.setLayoutParams(params);

final EditText input = new EditText(ImportExportActivity.this);
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
builder.setView(input);
input.setHint(R.string.exportPasswordHint);

textInputLayout.addView(input);
container.addView(textInputLayout);
builder.setView(container);

builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> {
openFileForImport(uri, input.getText().toString().toCharArray());
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/ziadoua/zcard/LoyaltyCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.math.BigDecimal;
import java.util.Currency;
import java.util.Date;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class LoyaltyCard implements Parcelable {
public final int id;
public final String store;
Expand Down
22 changes: 8 additions & 14 deletions app/src/main/java/com/ziadoua/zcard/LoyaltyCardCursorAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
import android.widget.ImageView;
import android.widget.TextView;

import com.google.android.material.card.MaterialCardView;
import com.google.android.material.color.MaterialColors;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.util.ArrayList;

import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
Expand All @@ -32,6 +25,13 @@
import com.ziadoua.zcard.databinding.LoyaltyCardLayoutBinding;
import com.ziadoua.zcard.preferences.Settings;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.util.ArrayList;

import com.google.android.material.card.MaterialCardView;
import com.google.android.material.color.MaterialColors;

public class LoyaltyCardCursorAdapter extends BaseCursorAdapter<LoyaltyCardCursorAdapter.LoyaltyCardListItemViewHolder> {
private int mCurrentSelectedIndex = -1;
boolean mDarkModeEnabled;
Expand Down Expand Up @@ -124,8 +124,7 @@ public void onBindViewHolder(LoyaltyCardListItemViewHolder inputHolder, Cursor i
}

inputHolder.mCardIcon.setContentDescription(loyaltyCard.store);
Utils.setIconOrTextWithBackground(mContext, loyaltyCard, icon, inputHolder.mCardIcon, inputHolder.mCardText);
inputHolder.setIconBackgroundColor(Utils.getHeaderColor(mContext, loyaltyCard));
inputHolder.mIconBackgroundColor = Utils.setIconOrTextWithBackground(mContext, loyaltyCard, icon, inputHolder.mCardIcon, inputHolder.mCardText);

inputHolder.toggleCardStateIcon(loyaltyCard.starStatus != 0, loyaltyCard.archiveStatus != 0, itemSelected(inputCursor.getPosition()));

Expand Down Expand Up @@ -330,11 +329,6 @@ public void toggleCardStateIcon(boolean enableStar, boolean enableArchive, boole
mArchivedBackground.invalidate();

}

public void setIconBackgroundColor(int color) {
mIconBackgroundColor = color;
mCardIcon.setBackgroundColor(color);
}
}

}
Loading

0 comments on commit bfb40c8

Please sign in to comment.