Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienPoupa committed Apr 7, 2021
1 parent 953900a commit b308444
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 288 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Non sorti]

## [3.7.0] - 2021-04-07
### Changé
- Ajout des nouveaux formulaires de couvre feu et de confinement

## [3.6.0] - 2021-03-26
### Changé
- Ajout des nouveaux formulaires de couvre feu et de confinement
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.poupa.attestationdeplacement"
minSdkVersion 16
targetSdkVersion 29
versionCode 27
versionName "3.6.0"
versionCode 28
versionName "3.7.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true

Expand Down
Binary file modified app/src/main/assets/curfew-certificate.pdf
Binary file not shown.
Binary file modified app/src/main/assets/quarantine-certificate.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import com.poupa.attestationdeplacement.dto.QuarantineAttestation;
import com.poupa.attestationdeplacement.dto.Reason;
import com.poupa.attestationdeplacement.generator.AttestationGenerator;
import com.poupa.attestationdeplacement.generator.CurfewAttestationGenerator;
import com.poupa.attestationdeplacement.generator.QuarantineAttestationGenerator;
import com.poupa.attestationdeplacement.tasks.GeneratePdfTask;
import com.poupa.attestationdeplacement.tasks.LoadProfilesCreateAttestationTask;
import com.poupa.attestationdeplacement.ui.DateTextWatcher;
Expand Down Expand Up @@ -81,23 +79,23 @@ public void onResume() {
*/
private void initFields(boolean initDate) {
attestation = new QuarantineAttestation();
attestationGenerator = new QuarantineAttestationGenerator(this, (QuarantineAttestation) attestation);
attestationGenerator = new AttestationGenerator(this, attestation);

LinearLayout curfewLayout = (LinearLayout) findViewById(R.id.reasons_curfew_layout);
LinearLayout quarantineLayout = (LinearLayout) findViewById(R.id.reasons_quarantine_layout);
LinearLayout curfewLayout = findViewById(R.id.reasons_curfew_layout);
LinearLayout quarantineLayout = findViewById(R.id.reasons_quarantine_layout);

AutoCompleteTextView autoCompleteAttestation = findViewById(R.id.attestation_type_dropdown);
autoCompleteAttestation.setOnItemClickListener((parent, view, position, id) -> {
attestation = (Attestation) parent.getItemAtPosition(position);

if (attestation instanceof CurfewAttestation) {
CurfewAttestation curfewAttestation = (CurfewAttestation) attestation;
attestationGenerator = new CurfewAttestationGenerator(this, curfewAttestation);
attestationGenerator = new AttestationGenerator(this, curfewAttestation);
curfewLayout.setVisibility(View.VISIBLE);
quarantineLayout.setVisibility(View.INVISIBLE);
} else {
QuarantineAttestation quarantineAttestation = (QuarantineAttestation) attestation;
attestationGenerator = new QuarantineAttestationGenerator(this, quarantineAttestation);
attestationGenerator = new AttestationGenerator(this, quarantineAttestation);
curfewLayout.setVisibility(View.INVISIBLE);
quarantineLayout.setVisibility(View.VISIBLE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ protected void setupReasons() {
Context context = MainActivity.getContext();

this.reasons = new ArrayList<>();
this.reasons.add(new Reason(context.getString(R.string.reason1_curfew_smalltext), "travail", 73, 579));
this.reasons.add(new Reason(context.getString(R.string.reason2_curfew_smalltext), "sante", 73, 546));
this.reasons.add(new Reason(context.getString(R.string.reason3_curfew_smalltext), "famille", 73, 512));
this.reasons.add(new Reason(context.getString(R.string.reason4_curfew_smalltext), "handicap", 73, 478));
this.reasons.add(new Reason(context.getString(R.string.reason5_curfew_smalltext), "convocation", 73, 458));
this.reasons.add(new Reason(context.getString(R.string.reason6_curfew_smalltext), "missions", 73, 412));
this.reasons.add(new Reason(context.getString(R.string.reason7_curfew_smalltext), "transits", 73, 379));
this.reasons.add(new Reason(context.getString(R.string.reason8_curfew_smalltext), "animaux", 73, 345));
this.reasons.add(new Reason(context.getString(R.string.reason1_curfew_db_text), "travail", 31, 589));
this.reasons.add(new Reason(context.getString(R.string.reason2_curfew_db_text), "sante", 31, 511));
this.reasons.add(new Reason(context.getString(R.string.reason3_curfew_db_text), "famille", 31, 459));
this.reasons.add(new Reason(context.getString(R.string.reason4_curfew_db_text), "convocation_demarches", 31, 394));
this.reasons.add(new Reason(context.getString(R.string.reason5_curfew_db_text), "animaux", 31, 328));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@ protected void setupReasons() {
Context context = MainActivity.getContext();

this.reasons = new ArrayList<>();
this.reasons.add(new Reason(context.getString(R.string.reason1_quarantine_smalltext), "sport", 60, 367));
this.reasons.add(new Reason(context.getString(R.string.reason2_quarantine_smalltext), "achats", 60, 244));
this.reasons.add(new Reason(context.getString(R.string.reason3_quarantine_smalltext), "enfants", 60, 161));
this.reasons.add(new Reason(context.getString(R.string.reason4_quarantine_smalltext), "culte_culturel", 60, 781, 2));
this.reasons.add(new Reason(context.getString(R.string.reason5_quarantine_smalltext), "demarche", 60, 726, 2));
this.reasons.add(new Reason(context.getString(R.string.reason6_quarantine_smalltext), "travail", 60, 629, 2));
this.reasons.add(new Reason(context.getString(R.string.reason7_quarantine_smalltext), "sante", 60, 533, 2));
this.reasons.add(new Reason(context.getString(R.string.reason8_quarantine_smalltext), "famille", 60, 477, 2));
this.reasons.add(new Reason(context.getString(R.string.reason9_quarantine_smalltext), "handicap", 60, 422, 2));
this.reasons.add(new Reason(context.getString(R.string.reason10_quarantine_smalltext), "judiciaire", 60, 380, 2));
this.reasons.add(new Reason(context.getString(R.string.reason11_quarantine_smalltext), "demenagement", 60, 311, 2));
this.reasons.add(new Reason(context.getString(R.string.reason12_quarantine_smalltext), "transits", 60, 243, 2));
this.reasons.add(new Reason(context.getString(R.string.reason1_quarantine_db_text), "travail", 31, 589));
this.reasons.add(new Reason(context.getString(R.string.reason2_quarantine_db_text), "sante", 31, 511));
this.reasons.add(new Reason(context.getString(R.string.reason3_quarantine_db_text), "famille", 31, 459));
this.reasons.add(new Reason(context.getString(R.string.reason4_quarantine_db_text), "convocation_demarches", 31, 394));
this.reasons.add(new Reason(context.getString(R.string.reason5_quarantine_db_text), "demenagement", 31, 328));
this.reasons.add(new Reason(context.getString(R.string.reason6_quarantine_db_text), "achats_culte_culturel", 31, 264));
this.reasons.add(new Reason(context.getString(R.string.reason7_quarantine_db_text), "sport", 31, 175));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.io.IOException;
import java.io.InputStream;

public abstract class AttestationGenerator {
public class AttestationGenerator {
protected final Context context;
Attestation attestation;

Expand Down Expand Up @@ -120,12 +120,12 @@ protected void addQrCodes() throws DocumentException, IOException, WriterExcepti
*/
protected void addSmallQrCode() throws DocumentException, IOException, WriterException {
// Small QR Code
addText(qrTitle1, 440, 140, 6, 1, BaseColor.WHITE);
addText(qrTitle2, 440, 130, 6, 1, BaseColor.WHITE);
addText(qrTitle1, 490, 140, 6, 1, BaseColor.WHITE);
addText(qrTitle2, 490, 130, 6, 1, BaseColor.WHITE);

Image smallQrCode = Image.getInstance(qrCodeGenerator.generateSmallQrCode(getQrCodeText(), smallQrCodeSize));

addImage(smallQrCode, originalPageNumber, 440, 122);
addImage(smallQrCode, originalPageNumber, 440, 20);
}

/**
Expand Down Expand Up @@ -223,23 +223,29 @@ protected void addImage(Image image, int page, float x, float y) throws Document
*/
protected void fillReasons() {
for (Reason reason: attestation.getEnabledReasons()) {
addText("x", reason.getX(), reason.getY(), 12, reason.getPage());
Phrase phrase = new Phrase("x", FontFactory.getFont(FontFactory.HELVETICA_BOLD, 13, BaseColor.BLACK));
ColumnText.showTextAligned(stamper.getOverContent(reason.getPage()), Element.ALIGN_LEFT, phrase, reason.getX(), reason.getY(), 0);
}
}

/**
* Fill the PDF form
*/
protected abstract void fillForm();
protected void fillForm() {
String fullName = attestation.getSurname() + " " + attestation.getLastName();

addText(fullName, 110, 677);
addText(attestation.getBirthDate(), 120, 667);
addText(attestation.getFullAddress(), 128, 657);
}

/**
* Add the footer
*/
protected void addFooter() {
addText("Fait à " + attestation.getCity(), 72, 109, 11, originalPageNumber);
addText("Le " + attestation.getTravelDate(), 72, 93, 11, originalPageNumber);
addText("à " + attestation.getHour() + ':' + attestation.getMinute(), 310, 93, 11, originalPageNumber);
addText("(Date et heure de début de sortie à mentionner obligatoirement)", 72, 77, 11, originalPageNumber);
String text = "Fait le " + attestation.getTravelDate() + " à " + attestation.getHour() + ':' + attestation.getMinute();
Phrase phrase = new Phrase(text, FontFactory.getFont(FontFactory.HELVETICA_BOLD, 12, BaseColor.BLACK));
ColumnText.showTextAligned(stamper.getOverContent(1), Element.ALIGN_LEFT, phrase, 30, 60, 0);
}

/**
Expand All @@ -250,7 +256,7 @@ protected String getQrCodeText() {
return "Cree le: " + attestation.getTravelDate() + " a " + attestation.getHour() + "h" + attestation.getMinute() + ";\n" +
"Nom: " + attestation.getLastName() + ";\n" +
"Prenom: " + attestation.getSurname() + ";\n" +
"Naissance: " + attestation.getBirthDate() + " a " + attestation.getBirthPlace() + ";\n" +
"Naissance: " + attestation.getBirthDate() + ";\n" +
"Adresse: " + attestation.getFullAddress() + ";\n" +
"Sortie: " + attestation.getTravelDate() + " a " + attestation.getHour() + ":" + attestation.getMinute() + ";\n" +
"Motifs: " + attestation.getReasonsQrCode() + ";";
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit b308444

Please sign in to comment.