Commit cbf4be9a authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

API can now ask to pay

Print all articles to pay
Print a text to prevent a future paiement
parent 3cb1c8ce
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
......
...@@ -4,9 +4,9 @@ android { ...@@ -4,9 +4,9 @@ android {
signingConfigs { signingConfigs {
config { config {
keyAlias 'jessy' keyAlias 'jessy'
keyPassword 'kVg6ikc+(lTkre8//m%f1' keyPassword 'payutc'
storeFile file('/root/jessy.jks') storeFile file('D:/cloud/Git/jessy/app/simde.jks')
storePassword 'kVg6ikc+(lTkre8//m%f1' storePassword 'simde-utc'
} }
} }
compileSdkVersion 26 compileSdkVersion 26
...@@ -22,9 +22,11 @@ android { ...@@ -22,9 +22,11 @@ android {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile '/root' proguardFile '/root'
signingConfig signingConfigs.config
} }
debug { debug {
proguardFile '/root' proguardFile '/root'
signingConfig signingConfigs.config
} }
} }
packagingOptions { packagingOptions {
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<activity android:name="fr.utc.simde.jessy.EditActivity" <activity android:name="fr.utc.simde.jessy.EditActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity android:name="fr.utc.simde.jessy.QRCodeReaderActivity" <activity android:name="fr.utc.simde.jessy.APIActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
</application> </application>
......
...@@ -2,8 +2,6 @@ package fr.utc.simde.jessy; ...@@ -2,8 +2,6 @@ package fr.utc.simde.jessy;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.os.Vibrator; import android.os.Vibrator;
...@@ -27,15 +25,13 @@ import com.fasterxml.jackson.databind.node.ArrayNode; ...@@ -27,15 +25,13 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.zxing.Result; import com.google.zxing.Result;
import java.io.IOException;
import java.text.DateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import fr.utc.simde.jessy.adapters.ListAdapater; import fr.utc.simde.jessy.adapters.ListAdapater;
import fr.utc.simde.jessy.responses.APICommand;
import fr.utc.simde.jessy.responses.APIResponse; import fr.utc.simde.jessy.responses.APIResponse;
import fr.utc.simde.jessy.responses.ArticleResponse; import fr.utc.simde.jessy.responses.ArticleResponse;
import fr.utc.simde.jessy.responses.BottomatikResponse; import fr.utc.simde.jessy.responses.BottomatikResponse;
...@@ -46,15 +42,14 @@ import fr.utc.simde.jessy.tools.ExtendedScannerView; ...@@ -46,15 +42,14 @@ import fr.utc.simde.jessy.tools.ExtendedScannerView;
import me.dm7.barcodescanner.core.IViewFinder; import me.dm7.barcodescanner.core.IViewFinder;
import me.dm7.barcodescanner.zxing.ZXingScannerView; import me.dm7.barcodescanner.zxing.ZXingScannerView;
import static android.graphics.Typeface.BOLD;
import static android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK; import static android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
/** /**
* Created by Samy on 18/11/2017. * Created by Samy on 18/11/2017.
*/ */
public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerView.ResultHandler { public class APIActivity extends BaseActivity implements ZXingScannerView.ResultHandler {
private static final String LOG_TAG = "_QRCodeReaderActivity"; private static final String LOG_TAG = "_APIActivity";
protected ZXingScannerView scannerView; protected ZXingScannerView scannerView;
...@@ -64,26 +59,26 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -64,26 +59,26 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
public void onCreate(final Bundle savedInstanceState) { public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.scannerView = new ZXingScannerView(QRCodeReaderActivity.this) { this.scannerView = new ZXingScannerView(APIActivity.this) {
@Override @Override
protected IViewFinder createViewFinderView(Context context) { protected IViewFinder createViewFinderView(Context context) {
return new ExtendedScannerView(context); return new ExtendedScannerView(context);
} }
}; };
this.scannerView.setResultHandler(QRCodeReaderActivity.this); this.scannerView.setResultHandler(APIActivity.this);
this.scannerView.startCamera(CAMERA_FACING_BACK); this.scannerView.startCamera(CAMERA_FACING_BACK);
this.scannerView.setOnLongClickListener(new View.OnLongClickListener() { this.scannerView.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View view) { public boolean onLongClick(View view) {
final LayoutInflater layoutInflater = LayoutInflater.from(QRCodeReaderActivity.this); final LayoutInflater layoutInflater = LayoutInflater.from(APIActivity.this);
final View popupView = layoutInflater.inflate(R.layout.dialog_tag, null); final View popupView = layoutInflater.inflate(R.layout.dialog_tag, null);
final EditText inputApi = popupView.findViewById(R.id.input_api); final EditText inputApi = popupView.findViewById(R.id.input_api);
final EditText inputInfo = popupView.findViewById(R.id.input_info); final EditText inputInfo = popupView.findViewById(R.id.input_info);
final RadioButton buttonTag = popupView.findViewById(R.id.radio_tag); final RadioButton buttonTag = popupView.findViewById(R.id.radio_tag);
inputApi.setText(config.getCurrentApi()); inputApi.setText(config.getCurrentApi());
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(QRCodeReaderActivity.this); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(APIActivity.this);
alertDialogBuilder alertDialogBuilder
.setTitle(R.string.getting_informations_from) .setTitle(R.string.getting_informations_from)
.setView(popupView) .setView(popupView)
...@@ -98,7 +93,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -98,7 +93,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
if (apiInfo == null) { if (apiInfo == null) {
Log.e(LOG_TAG, getString(R.string.api_not_recognized)); Log.e(LOG_TAG, getString(R.string.api_not_recognized));
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.badge_read), getString(R.string.api_not_recognized)); dialog.infoDialog(APIActivity.this, getString(R.string.badge_read), getString(R.string.api_not_recognized));
} else } else
handleAPI(buttonTag.isChecked() ? inputInfo.getText().toString().toUpperCase() : inputInfo.getText().toString(), apiInfo, null, null, buttonTag.isChecked()); handleAPI(buttonTag.isChecked() ? inputInfo.getText().toString().toUpperCase() : inputInfo.getText().toString(), apiInfo, null, null, buttonTag.isChecked());
} }
...@@ -128,6 +123,17 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -128,6 +123,17 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
public void onIdentification(final String badgeId) { public void onIdentification(final String badgeId) {
final Map<String, String> apiInfo = config.getApi(config.getCurrentApi()); final Map<String, String> apiInfo = config.getApi(config.getCurrentApi());
if (apiInfo == null) {
dialog.infoDialog(APIActivity.this, getString(R.string.badge_read), getString(R.string.no_api), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
});
return;
}
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
...@@ -143,7 +149,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -143,7 +149,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.badge_error_not_recognized), e.getMessage(), new DialogInterface.OnClickListener() { dialog.infoDialog(APIActivity.this, getString(R.string.badge_error_not_recognized), e.getMessage(), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
resumeReading(); resumeReading();
...@@ -159,7 +165,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -159,7 +165,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
} }
protected void resumeReading() { protected void resumeReading() {
scannerView.resumeCameraPreview(QRCodeReaderActivity.this); scannerView.resumeCameraPreview(APIActivity.this);
} }
public void handleResult(final Result result) { public void handleResult(final Result result) {
...@@ -170,7 +176,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -170,7 +176,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
final Map<String, String> apiInfo = config.getApi(qrCodeResponse.getSystem()); final Map<String, String> apiInfo = config.getApi(qrCodeResponse.getSystem());
if (apiInfo == null) if (apiInfo == null)
dialog.infoDialog(QRCodeReaderActivity.this, result.getBarcodeFormat().toString() + ": " + getString(R.string.not_understood), result.getText(), new DialogInterface.OnClickListener() { dialog.infoDialog(APIActivity.this, result.getBarcodeFormat().toString() + ": " + getString(R.string.not_understood), result.getText(), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
resumeReading(); resumeReading();
...@@ -181,7 +187,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -181,7 +187,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, e.getMessage()); Log.e(LOG_TAG, e.getMessage());
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() { dialog.infoDialog(APIActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
finish(); finish();
...@@ -193,7 +199,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -193,7 +199,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
} }
protected void handleQRCode(final QRCodeResponse qrCodeResponse, final Map<String, String> apiInfo) { protected void handleQRCode(final QRCodeResponse qrCodeResponse, final Map<String, String> apiInfo) {
dialog.startLoading(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), getString(R.string.user_ginger_info_collecting)); dialog.startLoading(APIActivity.this, getString(R.string.qrcode_reading), getString(R.string.user_ginger_info_collecting));
new Thread() { new Thread() {
@Override @Override
...@@ -212,7 +218,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -212,7 +218,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() { dialog.infoDialog(APIActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
resumeReading(); resumeReading();
...@@ -239,7 +245,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -239,7 +245,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
} }
}); });
final API api = new API(QRCodeReaderActivity.this, apiInfo.get("name"), apiInfo.get("url")); final API api = new API(APIActivity.this, apiInfo.get("name"), apiInfo.get("url"));
api.setKey(apiInfo.get("key")); api.setKey(apiInfo.get("key"));
APIResponse apiResponse; APIResponse apiResponse;
...@@ -269,10 +275,10 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -269,10 +275,10 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override @Override
public void run() { public void run() {
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(QRCodeReaderActivity.this); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(APIActivity.this);
alertDialogBuilder alertDialogBuilder
.setTitle(getString(R.string.reservation_number) + finalApiResponse.getId()) .setTitle(getString(R.string.reservation_number) + finalApiResponse.getId())
.setMessage(getString(R.string.ticket_validated) + " (" + DateUtils.formatDateTime(QRCodeReaderActivity.this, finalApiResponse.getExpirationDate() * 1000, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME) + ")") .setMessage(getString(R.string.ticket_validated) + " (" + DateUtils.formatDateTime(APIActivity.this, finalApiResponse.getExpirationDate() * 1000, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME) + ")")
.setCancelable(false) .setCancelable(false)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
...@@ -289,7 +295,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -289,7 +295,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
}); });
dialog.createDialog(alertDialogBuilder); dialog.createDialog(alertDialogBuilder);
((Vibrator) getSystemService(QRCodeReaderActivity.VIBRATOR_SERVICE)).vibrate(500); ((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(500);
} }
}); });
} catch (final Exception e1) { } catch (final Exception e1) {
...@@ -298,7 +304,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -298,7 +304,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.getting_informations_from) + " " + apiInfo.get("name"), e.getMessage(), new DialogInterface.OnClickListener() { dialog.infoDialog(APIActivity.this, getString(R.string.getting_informations_from) + " " + apiInfo.get("name"), e.getMessage(), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
resumeReading(); resumeReading();
...@@ -311,7 +317,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -311,7 +317,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.getting_informations_from) + " " + apiInfo.get("name"), e.getMessage(), new DialogInterface.OnClickListener() { dialog.infoDialog(APIActivity.this, getString(R.string.getting_informations_from) + " " + apiInfo.get("name"), e.getMessage(), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
resumeReading(); resumeReading();
...@@ -331,7 +337,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -331,7 +337,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(QRCodeReaderActivity.this); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(APIActivity.this);
alertDialogBuilder alertDialogBuilder
.setTitle(getString(R.string.reservation_number) + apiResponse.getId()) .setTitle(getString(R.string.reservation_number) + apiResponse.getId())
.setMessage(getString(R.string.ticket_maybe_falsified) + "\n" + .setMessage(getString(R.string.ticket_maybe_falsified) + "\n" +
...@@ -356,7 +362,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -356,7 +362,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
}); });
dialog.createDialog(alertDialogBuilder); dialog.createDialog(alertDialogBuilder);
((Vibrator) getSystemService(QRCodeReaderActivity.VIBRATOR_SERVICE)).vibrate(500); ((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(500);
} }
}); });
...@@ -418,7 +424,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -418,7 +424,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() { dialog.infoDialog(APIActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
resumeReading(); resumeReading();
...@@ -447,22 +453,22 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -447,22 +453,22 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override @Override
public void run() { public void run() {
dialog.stopLoading(); dialog.stopLoading();
Toast.makeText(QRCodeReaderActivity.this, getString(R.string.ticket_realized), Toast.LENGTH_LONG).show(); Toast.makeText(APIActivity.this, getString(R.string.ticket_realized), Toast.LENGTH_LONG).show();
((Vibrator) getSystemService(QRCodeReaderActivity.VIBRATOR_SERVICE)).vibrate(250); ((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(250);
final LayoutInflater layoutInflater = LayoutInflater.from(QRCodeReaderActivity.this); final LayoutInflater layoutInflater = LayoutInflater.from(APIActivity.this);
final View popupView = layoutInflater.inflate(R.layout.dialog_list, null); final View popupView = layoutInflater.inflate(R.layout.dialog_list, null);
final ListView listView = popupView.findViewById(R.id.list_groups); final ListView listView = popupView.findViewById(R.id.list_groups);
try { try {
listView.setAdapter(new ListAdapater(QRCodeReaderActivity.this, purchaseList, config.getPrintCotisant(), config.getPrint18())); listView.setAdapter(new ListAdapater(APIActivity.this, purchaseList, config.getPrintCotisant(), config.getPrint18()));
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "error: " + e.getMessage()); Log.e(LOG_TAG, "error: " + e.getMessage());
fatal(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage()); fatal(APIActivity.this, getString(R.string.qrcode_reading), e.getMessage());
} }
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(QRCodeReaderActivity.this); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(APIActivity.this);
alertDialogBuilder alertDialogBuilder
.setTitle(R.string.panier) .setTitle(R.string.panier)
.setView(popupView) .setView(popupView)
...@@ -470,7 +476,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -470,7 +476,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int which) { public void onClick(DialogInterface dialogInterface, int which) {
dialog.startLoading(QRCodeReaderActivity.this, getResources().getString(R.string.paiement), getResources().getString(R.string.ticket_in_validation)); dialog.startLoading(APIActivity.this, getResources().getString(R.string.paiement), getResources().getString(R.string.ticket_in_validation));
new Thread() { new Thread() {
@Override @Override
...@@ -486,7 +492,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -486,7 +492,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override @Override
public void run() { public void run() {
dialog.stopLoading(); dialog.stopLoading();
Toast.makeText(QRCodeReaderActivity.this, getString(R.string.ticket_validated), Toast.LENGTH_LONG).show(); Toast.makeText(APIActivity.this, getString(R.string.ticket_validated), Toast.LENGTH_LONG).show();
resumeReading(); resumeReading();
} }
...@@ -496,7 +502,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -496,7 +502,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override @Override
public void run() { public void run() {
Log.e(LOG_TAG, "error: " + e.getMessage()); Log.e(LOG_TAG, "error: " + e.getMessage());
dialog.errorDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage()); dialog.errorDialog(APIActivity.this, getString(R.string.qrcode_reading), e.getMessage());
resumeReading(); resumeReading();
} }
...@@ -509,7 +515,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -509,7 +515,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int which) { public void onClick(DialogInterface dialogInterface, int which) {
dialog.startLoading(QRCodeReaderActivity.this, getResources().getString(R.string.qrcode_reading), getResources().getString(R.string.ticket_in_cancelation)); dialog.startLoading(APIActivity.this, getResources().getString(R.string.qrcode_reading), getResources().getString(R.string.ticket_in_cancelation));
new Thread() { new Thread() {
@Override @Override
...@@ -522,8 +528,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -522,8 +528,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override @Override
public void run() { public void run() {
dialog.stopLoading(); dialog.stopLoading();
Toast.makeText(QRCodeReaderActivity.this, getString(R.string.ticket_refunded), Toast.LENGTH_LONG).show(); Toast.makeText(APIActivity.this, getString(R.string.ticket_refunded), Toast.LENGTH_LONG).show();
((Vibrator) getSystemService(QRCodeReaderActivity.VIBRATOR_SERVICE)).vibrate(250); ((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(250);
resumeReading(); resumeReading();
} }
...@@ -539,8 +545,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -539,8 +545,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override @Override
public void run() { public void run() {
dialog.stopLoading(); dialog.stopLoading();
dialog.errorDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), response.get("error").get("message").textValue()); dialog.errorDialog(APIActivity.this, getString(R.string.qrcode_reading), response.get("error").get("message").textValue());
((Vibrator) getSystemService(QRCodeReaderActivity.VIBRATOR_SERVICE)).vibrate(500); ((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(500);
resumeReading(); resumeReading();
} }
...@@ -552,8 +558,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -552,8 +558,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override @Override
public void run() { public void run() {
dialog.stopLoading(); dialog.stopLoading();
dialog.errorDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage()); dialog.errorDialog(APIActivity.this, getString(R.string.qrcode_reading), e.getMessage());
((Vibrator) getSystemService(QRCodeReaderActivity.VIBRATOR_SERVICE)).vibrate(500); ((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(500);
resumeReading(); resumeReading();
} }
...@@ -580,8 +586,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi ...@@ -580,8 +586,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
public void run() { public void run() {
<