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

Commit

Permalink
3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienPoupa committed Dec 15, 2020
1 parent dbef0cb commit 7dce641
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 180 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## [Non sorti]

## [3.5.0] - 2020-12-15
### Changé
- Mise à jour du formulaire: couvre-feu
- Ajout de la traduction anglaise
- Affichage des raisons au centre
- Boutons plus proches du texte (profils)

## [3.4.0] - 2020-11-29
### Changé
- Mise à jour du formulaire
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 24
versionName "3.4.0"
versionCode 25
versionName "3.5.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true

Expand Down
Binary file modified app/src/main/assets/attestation.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.poupa.attestationdeplacement;

import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -118,8 +117,8 @@ private void initFields(boolean initDate) {

setDate();

ImageView reasonsInfos = findViewById(R.id.reasonInfoImageView);
reasonsInfos.setOnClickListener(v -> getReasonsDialog());
ImageView reasonsInfo = findViewById(R.id.reasonInfoImageView);
reasonsInfo.setOnClickListener(v -> getReasonsDialog());

ConstraintSet constraintSet = new ConstraintSet();
ConstraintLayout constraintLayout = findViewById(R.id.constraint_layout);
Expand All @@ -141,10 +140,13 @@ private void initFields(boolean initDate) {
private void setReasonsCheckboxes() {
SharedPreferences userDetails = getSharedPreferences("userDetails", MODE_PRIVATE);

for(int i = 1; i < 10; i++) {
int resId = getResources().getIdentifier("reason" + i, "id", getPackageName());
List<Reason> reasons = attestation.getReasons();
for(int i = 0; i < reasons.size(); i++) {
String reasonKey = "reason" + (i + 1);

((CheckBox) findViewById(resId)).setChecked(userDetails.getBoolean("reason" + i, false));
int resId = getResources().getIdentifier(reasonKey, "id", getPackageName());

((CheckBox) findViewById(resId)).setChecked(userDetails.getBoolean(reasonKey, false));
}
}

Expand Down Expand Up @@ -234,8 +236,11 @@ public boolean checkFields() {
return false;
}

for(int i = 1; i < 10; i++) {
int resId = getResources().getIdentifier("reason" + i, "id", getPackageName());
List<Reason> reasons = attestation.getReasons();
for(int i = 0; i < reasons.size(); i++) {
String reasonKey = "reason" + (i + 1);

int resId = getResources().getIdentifier(reasonKey, "id", getPackageName());

boolean isReasonEnabled = ((CheckBox) findViewById(resId)).isChecked();

Expand All @@ -254,16 +259,8 @@ private void displayAlertDialog(String text) {
new MaterialAlertDialogBuilder(this)
.setTitle(R.string.warning)
.setMessage(text)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.setPositiveButton(android.R.string.yes, (dialog, which) -> dialog.dismiss())
.setNegativeButton(android.R.string.no, (dialog, which) -> dialog.dismiss())
.show();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.poupa.attestationdeplacement;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
Expand All @@ -18,11 +19,18 @@
import com.google.android.material.tabs.TabLayout;
import com.poupa.attestationdeplacement.ui.ViewPagerAdapter;

import java.lang.ref.WeakReference;

public class MainActivity extends AppCompatActivity {

private static WeakReference<Context> context;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

context = new WeakReference<>(this);

setContentView(R.layout.activity_main);

Toolbar toolbar = findViewById(R.id.toolbar);
Expand Down Expand Up @@ -139,4 +147,8 @@ public boolean onOptionsItemSelected(MenuItem item) {

return super.onOptionsItemSelected(item);
}

public static Context getContext() {
return context.get();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.poupa.attestationdeplacement.dto;

import android.content.Context;

import com.poupa.attestationdeplacement.MainActivity;
import com.poupa.attestationdeplacement.R;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -28,16 +33,17 @@ public Attestation() {
}

private void setupReasons() {
Context context = MainActivity.getContext();

this.reasons = new ArrayList<>();
this.reasons.add(new Reason("Travail", "travail", 47, 553));
this.reasons.add(new Reason("Achats et courses", "achats_culturel_cultuel", 47, 482));
this.reasons.add(new Reason("Santé", "sante", 47, 434));
this.reasons.add(new Reason("Famille", "famille", 47, 410));
this.reasons.add(new Reason("Handicap", "handicap", 47, 373));
this.reasons.add(new Reason("Plein air, sport et animaux", "sport_animaux", 47, 349));
this.reasons.add(new Reason("Convocation", "convocation", 47, 276));
this.reasons.add(new Reason("Missions", "missions", 47, 252));
this.reasons.add(new Reason("Enfants", "enfants", 47, 228));
this.reasons.add(new Reason(context.getString(R.string.reason1_smalltext), "travail", 73, 540));
this.reasons.add(new Reason(context.getString(R.string.reason2_smalltext), "sante", 73, 508));
this.reasons.add(new Reason(context.getString(R.string.reason3_smalltext), "famille", 73, 474));
this.reasons.add(new Reason(context.getString(R.string.reason4_smalltext), "handicap", 73, 441));
this.reasons.add(new Reason(context.getString(R.string.reason5_smalltext), "convocation", 73, 418));
this.reasons.add(new Reason(context.getString(R.string.reason6_smalltext), "missions", 73, 397));
this.reasons.add(new Reason(context.getString(R.string.reason7_smalltext), "transits", 73, 363));
this.reasons.add(new Reason(context.getString(R.string.reason8_smalltext), "animaux", 73, 330));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void addQrCodes() throws DocumentException, IOException, WriterException

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

addImage(smallQrCode, 1, 440, 15);
addImage(smallQrCode, 1, 440, 122);

// Insert page 2
stamper.insertPage(reader.getNumberOfPages() + 1,
Expand Down Expand Up @@ -202,15 +202,15 @@ protected void fillMotives() {
protected void fillForm() {
String fullName = attestation.getSurname() + " " + attestation.getLastName();

addText(fullName, 92, 702, 11);
addText(attestation.getBirthDate(), 92, 684, 11);
addText(attestation.getBirthPlace(), 214, 684, 11);
addText(attestation.getFullAddress(), 104, 665, 11);
addText(fullName, 119, 665, 11);
addText(attestation.getBirthDate(), 119, 645, 11);
addText(attestation.getBirthPlace(), 312, 645, 11);
addText(attestation.getFullAddress(), 133, 625, 11);

addText(attestation.getHour() + ':' + attestation.getMinute(), 227, 58, 11);
addText(attestation.getHour() + ':' + attestation.getMinute(), 312, 267, 11);

addText(attestation.getCity(), 78, 76, 11);
addText(attestation.getTravelDate(), 63, 58, 11);
addText(attestation.getCity(), 105, 286, 11);
addText(attestation.getTravelDate(), 91, 267, 11);
}

/**
Expand Down
22 changes: 1 addition & 21 deletions app/src/main/res/layout/content_create_attestation.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
Expand Down Expand Up @@ -420,24 +418,6 @@
android:text="@string/reason8_smalltext" />
</LinearLayout>

<LinearLayout
android:id="@+id/reasons_line5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center">

<CheckBox
android:id="@+id/reason9"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/reason9_smalltext" />
</LinearLayout>

</LinearLayout>

<Button
Expand Down
16 changes: 0 additions & 16 deletions app/src/main/res/layout/dialog_reasons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,5 @@
android:layout_marginBottom="16dp"
android:text="@string/reason8"/>

<TextView
android:id="@+id/reasons9_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/reason9_smalltext"
android:textStyle="bold"/>

<TextView
android:id="@+id/reasons9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginBottom="16dp"
android:text="@string/reason9"/>

</LinearLayout>
</ScrollView>
31 changes: 14 additions & 17 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
<string name="reasons">Reasons for going out</string>
<string name="generate">Generate</string>
<string name="reason1">Commuting to and from work or university and training places; for a competition or an exam ; business trips that cannot be delayed</string>
<string name="reason2">Running necessary errands to purchase items for professional activity, or basic commodities available in the businesses allowed to provide service, order withdrawal or home deliveries</string>
<string name="reason3">Consults and provision of care that cannot be done remotely; medication purchase</string>
<string name="reason4">Imperative family reasons, assisting vulnerable persons, persons in a precarious situation or taking care of children.</string>
<string name="reason5">Persons with a disability and their accompanying person</string>
<string name="reason6">Outdoor activities to practice sport individually or for leisure (collective physical activity and proximity to others are not allowed), with no change in the place of residence, walking out with only the people living in the same household or walking out a pet, within 20km of one’s place of residence and for three hours per day</string>
<string name="reason7">Judicial or administrative summons; appointment to public service offices</string>
<string name="reason8">Participating in a mission of general interest upon request from an administrative authority</string>
<string name="reason9">Taking children to and picking them up from school or after-school activity</string>
<string name="reason2">Consults and provision of care that cannot be done remotely or delayed</string>
<string name="reason3">Imperative family reasons, assisting vulnerable persons, persons in a precarious situation or taking care of children.</string>
<string name="reason4">Persons with a disability and their accompanying person</string>
<string name="reason5">Judicial or administrative summons</string>
<string name="reason6">Participating in a mission of general interest upon request from an administrative authority</string>
<string name="reason7">Air or rail transit related to long distance journeys</string>
<string name="reason8">Walking a pet outdoors within 1km of one’s place of residence and for a brief amount of time</string>
<string name="information">This application isn\'t official. You\'ll have to present the QR code or print the generated file in case of control.</string>
<string name="disclaimer_text">You\'ll have to print the QR code or print the generated file in case of control. Keep pressing to send the file.</string>
<string name="generate_attestation">Generate a certificate</string>
Expand All @@ -38,16 +37,15 @@
<string name="about">About</string>
<string name="version_number__1p">Version %s</string>
<string name="reason1_smalltext">Work</string>
<string name="reason2_smalltext">Purchases / Shopping</string>
<string name="reason3_smalltext">Health</string>
<string name="reason4_smalltext">Family</string>
<string name="reason5_smalltext">Disability</string>
<string name="reason7_smalltext">Convocation</string>
<string name="reason8_smalltext">Mission I.G.</string>
<string name="reason2_smalltext">Health</string>
<string name="reason3_smalltext">Family</string>
<string name="reason4_smalltext">Disability</string>
<string name="reason5_smalltext">Convocation</string>
<string name="reason6_smalltext">Mission I.G.</string>
<string name="reason7_smalltext">Transit</string>
<string name="reason8_smalltext">Pets</string>
<string name="see_pdf">See the PDF</string>
<string name="reason9_smalltext">Children</string>
<string name="see_attestation">See the certifications</string>
<string name="reason6_smalltext" translatable="false">Outside / Sports / Animals</string>
<string name="share">Share</string>
<string name="attestation_generated">Certificate generated!</string>
<string name="surname_missing">Please enter your first name</string>
Expand All @@ -64,7 +62,6 @@
<string name="view_profiles_btn">See profiles</string>
<string name="about_tv_version_txt">Version 0.0.0 (build 0)</string>
<string name="profile_hint">Profile</string>
<string name="attestations">Certifications</string>
<string name="travel_date">Date</string>
<string name="travel_hour">Time</string>
<string name="birthPlace">Birth place</string>
Expand Down
Loading

0 comments on commit 7dce641

Please sign in to comment.