Commit 1cb7d36a authored by Nastuzzi Samy's avatar Nastuzzi Samy

Merge branch 'release/v0.12.0'

parents 68ef471f e0bc6872
......@@ -13,4 +13,5 @@ app/src/main/java/fr/utc/simde/payutc/admin rights
app/src/main/java/fr/utc/simde/payutc/full rights
app/src/main/java/fr/utc/simde/payutc/no rights
.gitignore
\ No newline at end of file
.gitignore
*.jks
......@@ -24,7 +24,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" 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" />
</component>
<component name="ProjectType">
......
......@@ -2,7 +2,6 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/PayUTC.iml" filepath="$PROJECT_DIR$/PayUTC.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/jessy.iml" filepath="$PROJECT_DIR$/jessy.iml" />
</modules>
......
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'jessy'
keyPassword 'payutc'
storeFile file('D:/cloud/Git/jessy/app/simde.jks')
storePassword 'simde-utc'
}
}
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
......@@ -13,6 +21,12 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile '/root'
signingConfig signingConfigs.config
}
debug {
proguardFile '/root'
signingConfig signingConfigs.config
}
}
packagingOptions {
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.utc.simde.jessy"
android:versionCode="42"
android:versionName="0.11.9">
android:versionCode="43"
android:versionName="0.12.0">
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" />
......@@ -46,7 +46,7 @@
<activity android:name="fr.utc.simde.jessy.EditActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" />
<activity android:name="fr.utc.simde.jessy.QRCodeReaderActivity"
<activity android:name="fr.utc.simde.jessy.APIActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" />
</application>
......
package fr.utc.simde.jessy;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Vibrator;
import android.support.v7.app.AlertDialog;
import android.text.format.DateUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
......@@ -28,19 +26,19 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.zxing.Result;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import fr.utc.simde.jessy.adapters.ListAdapater;
import fr.utc.simde.jessy.adapters.LocationsAdapter;
import fr.utc.simde.jessy.responses.APICommand;
import fr.utc.simde.jessy.responses.APIResponse;
import fr.utc.simde.jessy.responses.ArticleResponse;
import fr.utc.simde.jessy.responses.BottomatikResponse;
import fr.utc.simde.jessy.responses.ReservationResponse;
import fr.utc.simde.jessy.responses.GingerResponse;
import fr.utc.simde.jessy.responses.QRCodeResponse;
import fr.utc.simde.jessy.tools.API;
import fr.utc.simde.jessy.tools.ExtendedScannerView;
import fr.utc.simde.jessy.tools.HTTPRequest;
import me.dm7.barcodescanner.core.IViewFinder;
import me.dm7.barcodescanner.zxing.ZXingScannerView;
......@@ -50,96 +48,59 @@ import static android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
* Created by Samy on 18/11/2017.
*/
public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerView.ResultHandler {
private static final String LOG_TAG = "_QRCodeReaderActivity";
public class APIActivity extends BaseActivity implements ZXingScannerView.ResultHandler {
private static final String LOG_TAG = "_APIActivity";
protected ZXingScannerView scannerView;
protected SharedPreferences sharedPreferences;
protected String badgeId;
protected Runnable onIdentification;
protected List<String> apiName;
protected List<String> apiUrl;
protected List<Boolean> apiNeedKey;
protected List<Boolean> apiNeedGinger;
protected List<Class> apiResponseClass;
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.sharedPreferences = getSharedPreferences("payutc", Activity.MODE_PRIVATE);
this.apiName = new ArrayList<String>() {{
add("bottomatik");
add("comedmus");
add("reservations");
add("fetedespartiels");
}};
this.apiUrl = new ArrayList<String>() {{
add("https://picasso.bottomatik.com/bot/transactions/");
add("https://www.lacomutc.fr/qr/" + sharedPreferences.getString("key_" + apiName.get(1), "no_key") + "/");
add("https://assos.utc.fr/simde/reservations/");
add("http://assos.utc.fr/fetedespartiels/api/");
}};
this.apiNeedKey = new ArrayList<Boolean>() {{
add(true);
add(false);
add(true);
add(true);
}};
this.apiNeedGinger = new ArrayList<Boolean>() {{
add(true);
add(false);
add(true);
add(true);
}};
this.apiResponseClass = new ArrayList<Class>() {{
add(BottomatikResponse.class);
add(ReservationResponse.class);
add(ReservationResponse.class);
add(APIResponse.class);
}};
this.scannerView = new ZXingScannerView(QRCodeReaderActivity.this) {
this.scannerView = new ZXingScannerView(APIActivity.this) {
@Override
protected IViewFinder createViewFinderView(Context context) {
return new ExtendedScannerView(context);
}
};
this.scannerView.setResultHandler(QRCodeReaderActivity.this);
this.scannerView.setResultHandler(APIActivity.this);
this.scannerView.startCamera(CAMERA_FACING_BACK);
this.scannerView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
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 EditText inputApi = popupView.findViewById(R.id.input_api);
final EditText inputInfo = popupView.findViewById(R.id.input_info);
final RadioButton buttonTag = popupView.findViewById(R.id.radio_tag);
inputApi.setText(config.getCurrentApi());
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(QRCodeReaderActivity.this);
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(APIActivity.this);
alertDialogBuilder
.setTitle(R.string.getting_informations_from)
.setView(popupView)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new Thread(new Runnable() {
@Override
public void run() {
handleAPI(inputInfo.getText().toString(), 3, null, buttonTag.isChecked());
}
}).start();
}
})
.setCancelable(true);
.setTitle(R.string.getting_informations_from)
.setView(popupView)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new Thread(new Runnable() {
@Override
public void run() {
Map<String, String> apiInfo = config.getApi(inputApi.getText().toString());
if (apiInfo == null) {
Log.e(LOG_TAG, getString(R.string.api_not_recognized));
dialog.infoDialog(APIActivity.this, getString(R.string.badge_read), getString(R.string.api_not_recognized));
} else
handleAPI(buttonTag.isChecked() ? inputInfo.getText().toString().toUpperCase() : inputInfo.getText().toString(), apiInfo, null, null, buttonTag.isChecked());
}
}).start();
}
})
.setCancelable(true);
dialog.createDialog(alertDialogBuilder, inputInfo);
......@@ -160,53 +121,51 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override
public void onIdentification(final String badgeId) {
if (this.onIdentification == null) {
this.scannerView.stopCamera();
final Map<String, String> apiInfo = config.getApi(config.getCurrentApi());
new Thread() {
if (apiInfo == null) {
dialog.infoDialog(APIActivity.this, getString(R.string.badge_read), getString(R.string.no_api), new DialogInterface.OnClickListener() {
@Override
public void run() {
Integer apiIndex = 2;
GingerResponse gingerResponse = null;
if (apiNeedGinger.get(apiIndex)) {
try {
ginger.getInfoFromBadge(badgeId);
Thread.sleep(100);
gingerResponse = new ObjectMapper().readValue(ginger.getRequest().getResponse(), GingerResponse.class);
}
catch (final Exception e) {
Log.e(LOG_TAG, e.getMessage());
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
});
runOnUiThread(new Runnable() {
return;
}
new Thread() {
@Override
public void run() {
try {
ginger.getInfoFromBadge(badgeId);
Thread.sleep(100);
GingerResponse gingerResponse = new ObjectMapper().readValue(ginger.getRequest().getResponse(), GingerResponse.class);
handleAPI(gingerResponse.getLogin(), apiInfo, gingerResponse, null, false);
} catch (final Exception e) {
Log.e(LOG_TAG, e.getMessage());
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.infoDialog(APIActivity.this, getString(R.string.badge_error_not_recognized), e.getMessage(), new DialogInterface.OnClickListener() {
@Override
public void run() {
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
});
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
});
return;
}
}
});
handleAPI(gingerResponse.getLogin(), apiIndex, gingerResponse, false);
return;
}
}.start();
}
else {
this.badgeId = badgeId;
this.onIdentification.run();
this.onIdentification = null;
}
}
}.start();
}
protected void resumeReading() {
scannerView.resumeCameraPreview(QRCodeReaderActivity.this);
scannerView.resumeCameraPreview(APIActivity.this);
}
public void handleResult(final Result result) {
......@@ -214,54 +173,52 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
try {
Log.d(LOG_TAG, result.getText());
QRCodeResponse qrCodeResponse = new ObjectMapper().readValue(result.getText(), QRCodeResponse.class);
final Map<String, String> apiInfo = config.getApi(qrCodeResponse.getSystem());
if (!this.apiName.contains(qrCodeResponse.getSystem())) {
dialog.infoDialog(QRCodeReaderActivity.this, result.getBarcodeFormat().toString() + ": " + getString(R.string.not_understood), result.getText(), new DialogInterface.OnClickListener() {
if (apiInfo == null)
dialog.infoDialog(APIActivity.this, result.getBarcodeFormat().toString() + ": " + getString(R.string.not_understood), result.getText(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
});
}
else
handleQRCode(qrCodeResponse, this.apiName.indexOf(qrCodeResponse.getSystem()));
handleQRCode(qrCodeResponse, apiInfo);
} catch (Exception e) {
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
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
}
}
else
} else
resumeReading();
}
protected void handleQRCode(final QRCodeResponse qrCodeResponse, final Integer apiIndex) {
dialog.startLoading(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), getString(R.string.user_ginger_info_collecting));
protected void handleQRCode(final QRCodeResponse qrCodeResponse, final Map<String, String> apiInfo) {
dialog.startLoading(APIActivity.this, getString(R.string.qrcode_reading), getString(R.string.user_ginger_info_collecting));
new Thread() {
@Override
public void run() {
GingerResponse gingerResponse = null;
if (apiNeedGinger.get(apiIndex)) {
if (qrCodeResponse.getUsername() != null && !qrCodeResponse.getUsername().isEmpty()) {
try {
ginger.getInfo(qrCodeResponse.getUsername());
Thread.sleep(100);
gingerResponse = new ObjectMapper().readValue(ginger.getRequest().getResponse(), GingerResponse.class);
}
catch (final Exception e) {
} catch (final Exception e) {
Log.e(LOG_TAG, e.getMessage());
if (ginger.getRequest().getResponseCode() != 404) {
runOnUiThread(new Runnable() {
@Override
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
public void onClick(DialogInterface dialog, int which) {
resumeReading();
......@@ -275,54 +232,79 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
}
}
handleAPI(qrCodeResponse.getId(), apiIndex, gingerResponse, true);
handleAPI(qrCodeResponse.getId(), apiInfo, gingerResponse, qrCodeResponse, true);
}
}.start();
}
protected void handleAPI(final String info, final Integer apiIndex, final GingerResponse gingerResponse, final boolean byQRCode) {
protected void handleAPI(final String info, final Map<String, String> apiInfo, final GingerResponse gingerResponse, final QRCodeResponse qrCodeResponse, final boolean byTag) {
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.changeLoading(getString(R.string.getting_informations_from) + " " + apiName.get(apiIndex));
dialog.changeLoading(getString(R.string.getting_informations_from) + " " + apiInfo.get("name"));
}
});
final API api = new API(QRCodeReaderActivity.this, apiName.get(apiIndex), apiUrl.get(apiIndex));
if (apiNeedKey.get(apiIndex))
api.setKey(sharedPreferences.getString("key_" + apiName.get(apiIndex), ""));
final API api = new API(APIActivity.this, apiInfo.get("name"), apiInfo.get("url"));
api.setKey(apiInfo.get("key"));
Object apiResponse;
APIResponse apiResponse;
try {
if (byQRCode)
if (byTag)
api.getInfosFromId(info);
else
api.getInfosFromUsername(info);
Thread.sleep(100);
apiResponse = new ObjectMapper().readValue(api.getRequest().getResponse(), apiResponseClass.get(apiIndex));
apiResponse = new ObjectMapper().readValue(api.getRequest().getResponse(), apiInfo.get("api").equals("bottomatik") ? BottomatikResponse.class : APIResponse.class);
if (api.getRequest().getJSONResponse().has("type") && api.getRequest().getJSONResponse().get("type").textValue().equals("error") && api.getRequest().getJSONResponse().has("message"))
if (api.getRequest().getJSONResponse().has("status") && api.getRequest().getJSONResponse().has("message"))
throw new Exception(api.getRequest().getJSONResponse().get("message").textValue());
}
catch (final Exception e) {
} catch (final Exception e) {
Log.e(LOG_TAG, e.getMessage());
if (api.getRequest().getResponseCode() == 410) {
try {
apiResponse = new ObjectMapper().readValue(api.getRequest().getResponse(), apiResponseClass.get(apiIndex));
apiResponse = new ObjectMapper().readValue(api.getRequest().getResponse(), apiInfo.get("api").equals("bottomatik") ? BottomatikResponse.class : APIResponse.class);
if (api.getRequest().getJSONResponse().has("type") && api.getRequest().getJSONResponse().get("type").textValue().equals("error") && api.getRequest().getJSONResponse().has("message"))
if (api.getRequest().getJSONResponse().has("message"))
throw new Exception(api.getRequest().getJSONResponse().get("message").textValue());
}
catch (final Exception e1) {
final APIResponse finalApiResponse = apiResponse;
runOnUiThread(new Runnable() {
@Override
public void run() {
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(APIActivity.this);
alertDialogBuilder
.setTitle(getString(R.string.reservation_number) + finalApiResponse.getId())
.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)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
})
.setNeutralButton(R.string.more, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finalApiResponse.removeExpirationDate();
checkResult(api, finalApiResponse, apiInfo, gingerResponse, qrCodeResponse);
}
});
dialog.createDialog(alertDialogBuilder);
((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(500);
}
});
} catch (final Exception e1) {
Log.e(LOG_TAG, e.getMessage());
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() {
dialog.infoDialog(APIActivity.this, getString(R.string.getting_informations_from) + " " + apiInfo.get("name"), e.getMessage(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
......@@ -330,42 +312,12 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
});
}
});
return;
}
final APIResponse finalApiResponse = (APIResponse) apiResponse;
runOnUiThread(new Runnable() {
@Override
public void run() {
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(QRCodeReaderActivity.this);
alertDialogBuilder
.setTitle(getString(R.string.reservation_number) + finalApiResponse.getId())
.setMessage(getString(R.string.ticket_validated))
.setCancelable(false)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
})
.setNeutralButton(R.string.more, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
seeInfo(api, (APIResponse) finalApiResponse, gingerResponse);
}
});
dialog.createDialog(alertDialogBuilder);
((Vibrator) getSystemService(QRCodeReaderActivity.VIBRATOR_SERVICE)).vibrate(500);
}
});
}
else
} else
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.infoDialog(QRCodeReaderActivity.this, getString(R.string.qrcode_reading), e.getMessage(), new DialogInterface.OnClickListener() {
dialog.infoDialog(APIActivity.this, getString(R.string.getting_informations_from) + " " + apiInfo.get("name"), e.getMessage(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
......@@ -377,19 +329,50 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
return;
}
switch (apiIndex) {
case 0:
payWithBottomatik(api, (BottomatikResponse) apiResponse, gingerResponse);
break;
case 1:
case 2:
checkReservation(api, (ReservationResponse) apiResponse, gingerResponse);
break;
case 3:
seeInfo(api, (APIResponse) apiResponse, gingerResponse);
break;
checkResult(api, apiResponse, apiInfo, gingerResponse, qrCodeResponse);
}
protected void checkResult(final API api, final APIResponse apiResponse, final Map<String, String> apiInfo, final GingerResponse gingerResponse, final QRCodeResponse qrCodeResponse) {
if (qrCodeResponse != null && (!apiResponse.getId().equals(qrCodeResponse.getId()) || !apiResponse.getUsername().equals(qrCodeResponse.getUsername()))) {
runOnUiThread(new Runnable() {
@Override
public void run() {
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(APIActivity.this);
alertDialogBuilder
.setTitle(getString(R.string.reservation_number) + apiResponse.getId())
.setMessage(getString(R.string.ticket_maybe_falsified) + "\n" +
"QRCode:\n" +
" id: " + qrCodeResponse.getId() + "\n" +
" username: " + qrCodeResponse.getUsername() + "\n\n" +
"API:\n" +
" id: " + apiResponse.getId() + "\n" +
" username: " + apiResponse.getUsername())
.setCancelable(false)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
})
.setNeutralButton(R.string.more, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
checkResult(api, apiResponse, apiInfo, gingerResponse, null);
}
});
dialog.createDialog(alertDialogBuilder);
((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(500);
}
});
return;
}
if (apiInfo.get("api").equals("bottomatik"))
payWithBottomatik(api, (BottomatikResponse) apiResponse, gingerResponse);
else
checkInfo(api, apiResponse, gingerResponse);
}
public void payWithBottomatik(final API api, final BottomatikResponse bottomatikResponse, final GingerResponse gingerResponse) {
......@@ -404,7 +387,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
List<List<Integer>> articleIdList = bottomatikResponse.getArticleList();
final ArrayNode purchaseList = new ObjectMapper().createArrayNode();
try {
if (nemopaySession.getFoundationId() != -1 && bottomatikResponse.getFun_id() != nemopaySession.getFoundationId())
if (nemopaySession.getFoundationId() != -1 && bottomatikResponse.getFunId() != nemopaySession.getFoundationId())
throw new Exception(getString(R.string.can_not_sell_other_foundation));
if (bottomatikResponse.isValidated())
......@@ -413,7 +396,8 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
nemopaySession.getArticles();
Thread.sleep(100);
TypeReference<List<ArticleResponse>> articleListType = new TypeReference<List<ArticleResponse>>(){};
TypeReference<List<ArticleResponse>> articleListType = new TypeReference<List<ArticleResponse>>() {
};
articleResponseList = new ObjectMapper().readValue(nemopaySession.getRequest().getResponse(), articleListType);
JsonNode articleList = nemopaySession.getRequest().getJSONResponse();
......@@ -434,14 +418,13 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
if (articleIdList.size() != 0)
throw new Exception(getString(R.string.article_not_available));
}
catch (final Exception e) {
} catch (final Exception e) {
Log.e(LOG_TAG, e.getMessage());
runOnUiThread(new Runnable() {
@Override
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
public void onClick(DialogInterface dialog, int which) {
resumeReading();
......@@ -462,7 +445,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
try {
if (!bottomatikResponse.isPaid()) {
nemopaySession.setTransaction(gingerResponse.getBadge_uid(), bottomatikResponse.getArticleList(), bottomatikResponse.getFun_id());
nemopaySession.setTransaction(gingerResponse.getBadge_uid(), bottomatikResponse.getArticleList(), bottomatikResponse.getFunId());
Thread.sleep(100);
}
......@@ -470,22 +453,22 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override
public void run() {
dialog.stopLoading();
Toast.makeText(QRCodeReaderActivity.this, getString(R.string.ticket_realized), Toast.LENGTH_LONG).show();
((Vibrator) getSystemService(QRCodeReaderActivity.VIBRATOR_SERVICE)).vibrate(250);
Toast.makeText(APIActivity.this, getString(R.string.ticket_realized), Toast.LENGTH_LONG).show();
((Vibrator) getSystemService(APIActivity.VIBRATOR_SERVICE)).vibrate(250);
final LayoutInflater layoutInflater