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

Merge branch 'release/v0.9.3'

parents ac1690f1 4244a649
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.utc.simde.jessy" package="fr.utc.simde.jessy"
android:versionCode="26" android:versionCode="27"
android:versionName="0.9.2"> android:versionName="0.9.3">
<uses-permission android:name="android.permission.NFC" /> <uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
......
...@@ -351,11 +351,14 @@ public class ArticleGroupActivity extends BaseActivity { ...@@ -351,11 +351,14 @@ public class ArticleGroupActivity extends BaseActivity {
protected void pay(final String badgeId) { protected void pay(final String badgeId) {
dialog.startLoading(this, getResources().getString(R.string.paiement), getResources().getString(R.string.transaction_in_progress)); dialog.startLoading(this, getResources().getString(R.string.paiement), getResources().getString(R.string.transaction_in_progress));
final List<Integer> articleList = new ArrayList<Integer>(panier.getArticleList());
clearPanier();
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
try { try {
nemopaySession.setTransaction(badgeId, panier.getArticleList()); nemopaySession.setTransaction(badgeId, articleList);
Thread.sleep(100); Thread.sleep(100);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
...@@ -365,7 +368,6 @@ public class ArticleGroupActivity extends BaseActivity { ...@@ -365,7 +368,6 @@ public class ArticleGroupActivity extends BaseActivity {
Toast.makeText(ArticleGroupActivity.this, "Paiement effectué", Toast.LENGTH_LONG).show(); Toast.makeText(ArticleGroupActivity.this, "Paiement effectué", Toast.LENGTH_LONG).show();
setBackgroundColor(getResources().getColor(R.color.success)); setBackgroundColor(getResources().getColor(R.color.success));
((Vibrator) getSystemService(ArticleGroupActivity.VIBRATOR_SERVICE)).vibrate(250); ((Vibrator) getSystemService(ArticleGroupActivity.VIBRATOR_SERVICE)).vibrate(250);
clearPanier();
} }
}); });
} catch (final Exception e) { } catch (final Exception e) {
......
...@@ -96,7 +96,7 @@ public abstract class BaseActivity extends InternetActivity { ...@@ -96,7 +96,7 @@ public abstract class BaseActivity extends InternetActivity {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
unregister(activity); unregister(activity);
startMainActivity(activity); restartApp(activity);
} }
}); });
} }
......
...@@ -144,7 +144,7 @@ public class FoundationsOptionsActivity extends BaseActivity { ...@@ -144,7 +144,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
hasRights(getString(R.string.nemopay), new String[]{}, new Runnable(){ hasRights(getString(R.string.nemopay), new String[]{}, new Runnable(){
@Override @Override
public void run() { public void run() {
final View keyView = getLayoutInflater().inflate(R.layout.dialog_main, null); final View keyView = getLayoutInflater().inflate(R.layout.dialog_key_force, null);
final EditText keyInput = keyView.findViewById(R.id.input_key); final EditText keyInput = keyView.findViewById(R.id.input_key);
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FoundationsOptionsActivity.this); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FoundationsOptionsActivity.this);
...@@ -169,7 +169,7 @@ public class FoundationsOptionsActivity extends BaseActivity { ...@@ -169,7 +169,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
hasRights(getString(R.string.ginger), new String[]{}, new Runnable(){ hasRights(getString(R.string.ginger), new String[]{}, new Runnable(){
@Override @Override
public void run() { public void run() {
final View keyView = getLayoutInflater().inflate(R.layout.dialog_main, null); final View keyView = getLayoutInflater().inflate(R.layout.dialog_key_force, null);
final EditText keyInput = keyView.findViewById(R.id.input_key); final EditText keyInput = keyView.findViewById(R.id.input_key);
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FoundationsOptionsActivity.this); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FoundationsOptionsActivity.this);
......
...@@ -6,6 +6,7 @@ import android.content.DialogInterface; ...@@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.media.Image;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
...@@ -14,6 +15,7 @@ import android.view.KeyEvent; ...@@ -14,6 +15,7 @@ import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
...@@ -37,11 +39,14 @@ public class MainActivity extends BaseActivity { ...@@ -37,11 +39,14 @@ public class MainActivity extends BaseActivity {
private static final String LOG_TAG = "_MainActivity"; private static final String LOG_TAG = "_MainActivity";
private static final String service = "https://assos.utc.fr"; private static final String service = "https://assos.utc.fr";
private static ImageView appImg;
private static TextView appNameText; private static TextView appNameText;
private static TextView appConfigText; private static TextView appConfigText;
private static TextView appRegisteredText; private static TextView appRegisteredText;
private static Button usernameButton; private static Button usernameButton;
private boolean casConnexionDialog;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -62,11 +67,23 @@ public class MainActivity extends BaseActivity { ...@@ -62,11 +67,23 @@ public class MainActivity extends BaseActivity {
if (!key.equals("")) if (!key.equals(""))
setGingerKey(key); setGingerKey(key);
appImg = findViewById(R.id.img_payutc);
appNameText = findViewById(R.id.text_app_name); appNameText = findViewById(R.id.text_app_name);
appConfigText = findViewById(R.id.text_app_config); appConfigText = findViewById(R.id.text_app_config);
appRegisteredText = findViewById(R.id.text_app_registered); appRegisteredText = findViewById(R.id.text_app_registered);
usernameButton = findViewById(R.id.button_username); usernameButton = findViewById(R.id.button_username);
casConnexionDialog = false;
appImg.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
config.reset();
restartApp(MainActivity.this);
return false;
}
});
appRegisteredText.setOnLongClickListener(new View.OnLongClickListener() { appRegisteredText.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
...@@ -109,8 +126,10 @@ public class MainActivity extends BaseActivity { ...@@ -109,8 +126,10 @@ public class MainActivity extends BaseActivity {
@Override @Override
protected void onIdentification(final String badgeId) { protected void onIdentification(final String badgeId) {
if (!dialog.isShowing()) if (!dialog.isShowing() || casConnexionDialog)
badgeDialog(badgeId); badgeDialog(badgeId);
casConnexionDialog = false;
} }
@Override @Override
...@@ -168,6 +187,8 @@ public class MainActivity extends BaseActivity { ...@@ -168,6 +187,8 @@ public class MainActivity extends BaseActivity {
protected void connectWithCAS(final String username, final String password) throws InterruptedException { protected void connectWithCAS(final String username, final String password) throws InterruptedException {
dialog.startLoading(MainActivity.this, getString(R.string.cas_connection), getString(R.string.cas_in_url)); dialog.startLoading(MainActivity.this, getString(R.string.cas_connection), getString(R.string.cas_in_url));
casConnexionDialog = false;
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
...@@ -369,6 +390,8 @@ public class MainActivity extends BaseActivity { ...@@ -369,6 +390,8 @@ public class MainActivity extends BaseActivity {
return; return;
} }
casConnexionDialog = true;
final View usernameView = getLayoutInflater().inflate(R.layout.dialog_login, null); final View usernameView = getLayoutInflater().inflate(R.layout.dialog_login, null);
final EditText usernameInput = usernameView.findViewById(R.id.input_username); final EditText usernameInput = usernameView.findViewById(R.id.input_username);
final EditText passwordInput = usernameView.findViewById(R.id.input_password); final EditText passwordInput = usernameView.findViewById(R.id.input_password);
...@@ -465,25 +488,8 @@ public class MainActivity extends BaseActivity { ...@@ -465,25 +488,8 @@ public class MainActivity extends BaseActivity {
} }
protected void optionDialog() { protected void optionDialog() {
final View view = getLayoutInflater().inflate(R.layout.dialog_main, null); final View view = getLayoutInflater().inflate(R.layout.dialog_key_force, null);
final EditText keyInput = view.findViewById(R.id.input_key); final EditText keyInput = view.findViewById(R.id.input_key);
final Button reloadButton = view.findViewById(R.id.button_reload);
final Button configButton = view.findViewById(R.id.button_config);
reloadButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
restartApp(MainActivity.this);
}
});
configButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
config.reset();
restartApp(MainActivity.this);
}
});
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);
alertDialogBuilder alertDialogBuilder
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_key_explication"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="@string/key_add_explication"
android:layout_marginBottom="10dp" />
<EditText
android:id="@+id/input_key"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:inputType="text|textEmailAddress"
android:hint="@string/key" />
<Button
android:id="@+id/button_reload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="@string/reload" />
<Button
android:id="@+id/button_config"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="@string/configurate_by_default" />
</LinearLayout>
\ No newline at end of file
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<string name="cancel_transaction">Annuler une transaction</string> <string name="cancel_transaction">Annuler une transaction</string>
<string name="ask_cancel_transaction">Annuler la transaction suivante:</string> <string name="ask_cancel_transaction">Annuler la transaction suivante:</string>
<string name="transaction_canceled">L\'annulation a bien été effective</string> <string name="transaction_canceled">L\'annulation a bien été effective</string>
<string name="no_longer_connected">L\'application nécessite d\'être reconnectée. Retour à la page d\'accueil</string> <string name="no_longer_connected">L\'application nécessite d\'être reconnectée. Appuyer sur ok pour relancer l\'application</string>
<string name="location_choice">Choisir un lieu de vente</string> <string name="location_choice">Choisir un lieu de vente</string>
<string name="option_list">Liste des options à afficher</string> <string name="option_list">Liste des options à afficher</string>
<string name="category_0_selected">Aucune catégorie n\'a été sélectionnée</string> <string name="category_0_selected">Aucune catégorie n\'a été sélectionnée</string>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment