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

Better restart management

parent 2f5009ed
......@@ -351,7 +351,7 @@ public class ArticleGroupActivity extends BaseActivity {
protected void pay(final String badgeId) {
dialog.startLoading(this, getResources().getString(R.string.paiement), getResources().getString(R.string.transaction_in_progress));
final List<Integer> articleList = panier.getArticleList();
final List<Integer> articleList = new ArrayList<Integer>(panier.getArticleList());
clearPanier();
new Thread() {
......
......@@ -96,7 +96,7 @@ public abstract class BaseActivity extends InternetActivity {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
unregister(activity);
startMainActivity(activity);
restartApp(activity);
}
});
}
......
......@@ -144,7 +144,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
hasRights(getString(R.string.nemopay), new String[]{}, new Runnable(){
@Override
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 AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FoundationsOptionsActivity.this);
......@@ -169,7 +169,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
hasRights(getString(R.string.ginger), new String[]{}, new Runnable(){
@Override
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 AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FoundationsOptionsActivity.this);
......
......@@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.media.Image;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
......@@ -14,6 +15,7 @@ import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
......@@ -37,6 +39,7 @@ public class MainActivity extends BaseActivity {
private static final String LOG_TAG = "_MainActivity";
private static final String service = "https://assos.utc.fr";
private static ImageView appImg;
private static TextView appNameText;
private static TextView appConfigText;
private static TextView appRegisteredText;
......@@ -62,11 +65,21 @@ public class MainActivity extends BaseActivity {
if (!key.equals(""))
setGingerKey(key);
appImg = findViewById(R.id.img_payutc);
appNameText = findViewById(R.id.text_app_name);
appConfigText = findViewById(R.id.text_app_config);
appRegisteredText = findViewById(R.id.text_app_registered);
usernameButton = findViewById(R.id.button_username);
appImg.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
config.reset();
restartApp(MainActivity.this);
return false;
}
});
appRegisteredText.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
......@@ -465,25 +478,8 @@ public class MainActivity extends BaseActivity {
}
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 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);
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 @@
<string name="cancel_transaction">Annuler une transaction</string>
<string name="ask_cancel_transaction">Annuler la transaction suivante:</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="option_list">Liste des options à afficher</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