Commit 1a2bc510 authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

Add Location management

Add location
Config with location info
Optimization
parent 54b569b8
...@@ -24,24 +24,18 @@ ...@@ -24,24 +24,18 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="fr.utc.simde.jessy.BaseActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" />
<activity android:name="fr.utc.simde.jessy.FoundationsOptionsActivity" <activity android:name="fr.utc.simde.jessy.FoundationsOptionsActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity android:name="fr.utc.simde.jessy.ArticleKeyboardActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" />
<activity android:name="fr.utc.simde.jessy.ArticleCategoryActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" />
<activity android:name="fr.utc.simde.jessy.BuyerInfoActivity" <activity android:name="fr.utc.simde.jessy.BuyerInfoActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity android:name="fr.utc.simde.jessy.CardManagementActivity" <activity android:name="fr.utc.simde.jessy.CardManagementActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity android:name="fr.utc.simde.jessy.ArticleGroupActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -7,6 +7,7 @@ import android.support.v7.app.AlertDialog; ...@@ -7,6 +7,7 @@ import android.support.v7.app.AlertDialog;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.AdapterView;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ListView; import android.widget.ListView;
...@@ -19,11 +20,13 @@ import android.widget.Toast; ...@@ -19,11 +20,13 @@ import android.widget.Toast;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import fr.utc.simde.jessy.adapters.GroupAdapter; import fr.utc.simde.jessy.adapters.LocationsAdapter;
import fr.utc.simde.jessy.fragments.GroupFragment; import fr.utc.simde.jessy.fragments.GroupFragment;
import fr.utc.simde.jessy.tools.HTTPRequest; import fr.utc.simde.jessy.tools.HTTPRequest;
import fr.utc.simde.jessy.tools.Panier; import fr.utc.simde.jessy.tools.Panier;
...@@ -32,7 +35,7 @@ import fr.utc.simde.jessy.tools.Panier; ...@@ -32,7 +35,7 @@ import fr.utc.simde.jessy.tools.Panier;
* Created by Samy on 27/10/2017. * Created by Samy on 27/10/2017.
*/ */
public abstract class ArticleGroupActivity extends BaseActivity { public class ArticleGroupActivity extends BaseActivity {
private static final String LOG_TAG = "_ArticleGroupActivity"; private static final String LOG_TAG = "_ArticleGroupActivity";
protected ImageButton paramButton; protected ImageButton paramButton;
...@@ -60,7 +63,11 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -60,7 +63,11 @@ public abstract class ArticleGroupActivity extends BaseActivity {
this.nbrGroups = 0; this.nbrGroups = 0;
try { try {
createGroups(new ObjectMapper().readTree(getIntent().getExtras().getString("groupList")), new ObjectMapper().readTree(getIntent().getExtras().getString("articleList"))); if (getIntent().getExtras().getString("categoryList") != null)
createCategories(new ObjectMapper().readTree(getIntent().getExtras().getString("categoryList")), getIntent().getExtras().getIntegerArrayList("categoryListAuthorized"), new ObjectMapper().readTree(getIntent().getExtras().getString("articleList")));
if (getIntent().getExtras().getString("keyboardList") != null)
createKeyboards(new ObjectMapper().readTree(getIntent().getExtras().getString("keyboardList")), getIntent().getExtras().getIntegerArrayList("keyboardListAuthorized"), new ObjectMapper().readTree(getIntent().getExtras().getString("articleList")));
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "error: " + e.getMessage()); Log.e(LOG_TAG, "error: " + e.getMessage());
dialog.errorDialog(this, getResources().getString(R.string.information_collection), getResources().getString(R.string.error_view), new DialogInterface.OnClickListener() { dialog.errorDialog(this, getResources().getString(R.string.information_collection), getResources().getString(R.string.error_view), new DialogInterface.OnClickListener() {
...@@ -93,10 +100,10 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -93,10 +100,10 @@ public abstract class ArticleGroupActivity extends BaseActivity {
final Switch swtich18 = popupView.findViewById(R.id.swtich_18); final Switch swtich18 = popupView.findViewById(R.id.swtich_18);
final Button configButton = popupView.findViewById(R.id.button_config); final Button configButton = popupView.findViewById(R.id.button_config);
if (config.getInKeyboard()) if (config.getInCategory())
radioKeyboard.setChecked(true);
else
radioCategory.setChecked(true); radioCategory.setChecked(true);
else
radioKeyboard.setChecked(true);
if (config.getInGrid()) if (config.getInGrid())
radioGrid.setChecked(true); radioGrid.setChecked(true);
...@@ -128,7 +135,7 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -128,7 +135,7 @@ public abstract class ArticleGroupActivity extends BaseActivity {
.setCancelable(false) .setCancelable(false)
.setPositiveButton(R.string.reload, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.reload, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int id) { public void onClick(DialogInterface dialogInterface, int id) {
config.setInKeyboard(radioKeyboard.isChecked()); config.setInCategory(radioCategory.isChecked());
config.setInGrid(radioGrid.isChecked()); config.setInGrid(radioGrid.isChecked());
config.setPrintCotisant(switchCotisant.isChecked()); config.setPrintCotisant(switchCotisant.isChecked());
config.setPrint18(swtich18.isChecked()); config.setPrint18(swtich18.isChecked());
...@@ -159,7 +166,7 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -159,7 +166,7 @@ public abstract class ArticleGroupActivity extends BaseActivity {
@Override @Override
public void run() { public void run() {
config.setFoundation(-1, ""); config.setFoundation(-1, "");
config.setGroupList(new ObjectMapper().createObjectNode()); config.setLocation(-1, "");
config.setCanCancel(true); config.setCanCancel(true);
startMainActivity(ArticleGroupActivity.this); startMainActivity(ArticleGroupActivity.this);
...@@ -207,42 +214,109 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -207,42 +214,109 @@ public abstract class ArticleGroupActivity extends BaseActivity {
pay(badgeId); pay(badgeId);
} }
protected abstract void createGroups(final JsonNode groupList, final JsonNode articleList) throws Exception; protected void createCategories(final JsonNode categoryList, final List<Integer> authorizedList, final JsonNode articleList) throws Exception {
HashMap<Integer, ArrayNode> articlesPerCategory = new HashMap<Integer, ArrayNode>();
final int foundationId = nemopaySession.getFoundationId();
for (final JsonNode article : articleList) {
if (!article.has("id") || !article.has("price") || !article.has("name") || !article.has("active") || !article.has("cotisant") || !article.has("alcool") || !article.has("categorie_id") || !article.has("image_url") || !article.has("fundation_id") || article.get("fundation_id").intValue() != foundationId)
throw new Exception("Unexpected JSON");
if (!article.get("active").booleanValue())
continue;
if (articlesPerCategory.containsKey(article.get("categorie_id").intValue()))
articlesPerCategory.get(article.get("categorie_id").intValue()).add(article);
else
articlesPerCategory.put(article.get("categorie_id").intValue(), new ObjectMapper().createArrayNode().add(article));
}
for (JsonNode category : categoryList) {
if (!category.has("id") || !category.has("name") || !category.has("fundation_id") || category.get("fundation_id").intValue() != foundationId)
throw new Exception("Unexpected JSON");
ArrayNode articlesForThisCategory = articlesPerCategory.get(category.get("id").intValue());
if (config.getFoundationId() != -1) if (!authorizedList.contains(category.get("id").intValue()) || articlesForThisCategory == null)
continue;
else if (articlesForThisCategory == null || articlesForThisCategory.size() == 0)
continue;
createNewGroup(category.get("name").textValue(), articlesForThisCategory);
}
}
protected void createKeyboards(final JsonNode keyboardList, final List<Integer> authorizedList, final JsonNode articleList) throws Exception {
final int foundationId = nemopaySession.getFoundationId();
for (final JsonNode article : articleList) {
if (!article.has("id") || !article.has("price") || !article.has("name") || !article.has("active") || !article.has("cotisant") || !article.has("alcool") || !article.has("categorie_id") || !article.has("image_url") || !article.has("fundation_id") || article.get("fundation_id").intValue() != foundationId)
throw new Exception("Unexpected JSON");
}
for (JsonNode keyboard : keyboardList) {
ArrayNode articlesForThisKeyboard = new ObjectMapper().createArrayNode();
if (!keyboard.has("id") || !keyboard.has("name") || !keyboard.has("fun_id") || keyboard.get("fun_id").intValue() != foundationId || !keyboard.has("data") || !keyboard.get("data").has("items") || !keyboard.get("data").get("items").isArray() || !keyboard.get("data").has("nbColumns"))
throw new Exception("Unexpected JSON");
if (config.getFoundationId() != -1) if (!authorizedList.contains(keyboard.get("id").intValue()) || articlesForThisKeyboard == null)
continue;
else if (keyboard.get("data").get("items") == null || keyboard.get("data").get("items").size() == 0)
continue;
for (JsonNode article : keyboard.get("data").get("items")) {
if (article.has("itm_id")) {
boolean in = false;
for (JsonNode articleInList : articleList) {
if (articleInList.get("id").intValue() == article.get("itm_id").intValue()) {
articlesForThisKeyboard.add(articleInList);
in = true;
break;
}
}
if (!in && config.getInGrid())
articlesForThisKeyboard.add(new ObjectMapper().createObjectNode());
}
else if (config.getInGrid())
articlesForThisKeyboard.add(new ObjectMapper().createObjectNode());
}
createNewGroup(keyboard.get("name").textValue(), articlesForThisKeyboard, keyboard.get("data").get("nbColumns").isInt() ? keyboard.get("data").get("nbColumns").intValue() : Integer.valueOf(keyboard.get("data").get("nbColumns").textValue()));
}
}
protected void configDialog() { protected void configDialog() {
dialog.startLoading(ArticleGroupActivity.this, getResources().getString(R.string.information_collection), getString(config.getInKeyboard() ? R.string.keyboard_list_collecting : R.string.category_list_collecting)); dialog.startLoading(ArticleGroupActivity.this, getResources().getString(R.string.information_collection), getString(config.getInCategory() ? R.string.category_list_collecting : R.string.keyboard_list_collecting));
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
try { try {
if (config.getInKeyboard()) nemopaySession.getLocations();
nemopaySession.getKeyboards();
else
nemopaySession.getCategories();
Thread.sleep(100); Thread.sleep(100);
final HTTPRequest request = nemopaySession.getRequest(); final HTTPRequest request = nemopaySession.getRequest();
final JsonNode groupList = request.getJSONResponse(); final JsonNode locationList = request.getJSONResponse();
if (!groupList.isArray()) if (!locationList.isArray())
throw new Exception("Malformed JSON"); throw new Exception("Malformed JSON");
if (groupList == null || groupList.size() == 0) { if (locationList == null || locationList.size() == 0) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
dialog.stopLoading(); dialog.stopLoading();
dialog.errorDialog(ArticleGroupActivity.this, getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(config.getInKeyboard() ? R.string.keyboard_error_0 : R.string.category_error_0)); dialog.errorDialog(ArticleGroupActivity.this, getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(R.string.location_error_0));
} }
}); });
return; return;
} }
for (final JsonNode group : groupList) { for (final JsonNode location : locationList) {
if (!group.has("id") || !group.has("name")) if (!location.has("id") || !location.has("name") || !location.has("enabled") || !location.has("categories") || !location.has("sales_keyboards"))
throw new Exception("Unexpected JSON"); throw new Exception("Unexpected JSON");
} }
} catch (final Exception e) { } catch (final Exception e) {
...@@ -251,7 +325,7 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -251,7 +325,7 @@ public abstract class ArticleGroupActivity extends BaseActivity {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
fatal(ArticleGroupActivity.this, getString(config.getInKeyboard() ? R.string.keyboard_list_collecting : R.string.category_list_collecting), e.getMessage()); fatal(ArticleGroupActivity.this, getString(config.getInCategory() ? R.string.category_list_collecting : R.string.keyboard_list_collecting), e.getMessage());
} }
}); });
} }
...@@ -262,49 +336,42 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -262,49 +336,42 @@ public abstract class ArticleGroupActivity extends BaseActivity {
dialog.stopLoading(); dialog.stopLoading();
final LayoutInflater layoutInflater = LayoutInflater.from(ArticleGroupActivity.this); final LayoutInflater layoutInflater = LayoutInflater.from(ArticleGroupActivity.this);
final View popupView = layoutInflater.inflate(R.layout.dialog_group, null); final View popupView = layoutInflater.inflate(R.layout.dialog_group, null);
final ListView listView = popupView.findViewById(R.id.list_groups); final ListView listView = popupView.findViewById(R.id.list_groups);
final Switch canCancelSwitch = popupView.findViewById(R.id.switch_cancel); final Switch canCancelSwitch = popupView.findViewById(R.id.switch_cancel);
canCancelSwitch.setChecked(config.getCanCancel()); canCancelSwitch.setChecked(config.getCanCancel());
if (config.getInKeyboard()) ArrayNode locationList = new ObjectMapper().createArrayNode();
((TextView) popupView.findViewById(R.id.text_to_print)).setText(R.string.keyboard_list); final LocationsAdapter locationAdapter;
JsonNode groupList;
GroupAdapter groupAdapter = null;
try { try {
groupList = nemopaySession.getRequest().getJSONResponse(); for (JsonNode location : nemopaySession.getRequest().getJSONResponse()) {
groupAdapter = new GroupAdapter(ArticleGroupActivity.this, groupList); if (location.get("enabled").booleanValue())
locationList.add(location);
}
locationAdapter = new LocationsAdapter(ArticleGroupActivity.this, locationList);
listView.setAdapter(groupAdapter); listView.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
config.setFoundation(nemopaySession.getFoundationId(), nemopaySession.getFoundationName());
config.setLocation(locationAdapter.getLocationId(position), locationAdapter.getLocationName(position));
startMainActivity(ArticleGroupActivity.this);
}
});
listView.setAdapter(locationAdapter);
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "error: " + e.getMessage()); Log.e(LOG_TAG, "error: " + e.getMessage());
fatal(ArticleGroupActivity.this, getString(config.getInKeyboard() ? R.string.keyboard_list_collecting : R.string.category_list_collecting), e.getMessage()); fatal(ArticleGroupActivity.this, getString(config.getInCategory() ? R.string.category_list_collecting : R.string.keyboard_list_collecting), e.getMessage());
} }
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ArticleGroupActivity.this); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ArticleGroupActivity.this);
final GroupAdapter finalGroupAdapter = groupAdapter;
alertDialogBuilder alertDialogBuilder
.setTitle(R.string.configuration) .setTitle(R.string.configuration)
.setView(popupView) .setView(popupView)
.setCancelable(false) .setCancelable(false)
.setPositiveButton(R.string.applicate, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int id) {
config.setCanCancel(canCancelSwitch.isChecked());
JsonNode groupList = finalGroupAdapter.getList();
if (groupList == null || groupList.size() == 0) {
Toast.makeText(ArticleGroupActivity.this, getString(config.getInKeyboard() ? R.string.keyboard_0_selected : R.string.category_0_selected), Toast.LENGTH_LONG).show();
configDialog();
}
else {
config.setFoundation(nemopaySession.getFoundationId(), nemopaySession.getFoundationName());
config.setGroupList(finalGroupAdapter.getList());
startMainActivity(ArticleGroupActivity.this);
}
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int id) { public void onClick(DialogInterface dialogInterface, int id) {
config.setCanCancel(true); config.setCanCancel(true);
...@@ -364,7 +431,7 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -364,7 +431,7 @@ public abstract class ArticleGroupActivity extends BaseActivity {
dialog.stopLoading(); dialog.stopLoading();
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(ArticleCategoryActivity.VIBRATOR_SERVICE)).vibrate(250); ((Vibrator) getSystemService(ArticleGroupActivity.VIBRATOR_SERVICE)).vibrate(250);
clearPanier(); clearPanier();
} }
}); });
...@@ -381,7 +448,7 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -381,7 +448,7 @@ public abstract class ArticleGroupActivity extends BaseActivity {
dialog.stopLoading(); dialog.stopLoading();
dialog.errorDialog(ArticleGroupActivity.this, getString(R.string.paiement), response.get("error").get("message").textValue()); dialog.errorDialog(ArticleGroupActivity.this, getString(R.string.paiement), response.get("error").get("message").textValue());
setBackgroundColor(getResources().getColor(R.color.error)); setBackgroundColor(getResources().getColor(R.color.error));
((Vibrator) getSystemService(ArticleCategoryActivity.VIBRATOR_SERVICE)).vibrate(500); ((Vibrator) getSystemService(ArticleGroupActivity.VIBRATOR_SERVICE)).vibrate(500);
} }
}); });
} }
...@@ -394,7 +461,7 @@ public abstract class ArticleGroupActivity extends BaseActivity { ...@@ -394,7 +461,7 @@ public abstract class ArticleGroupActivity extends BaseActivity {
dialog.stopLoading(); dialog.stopLoading();
dialog.errorDialog(ArticleGroupActivity.this, getString(R.string.paiement), e.getMessage()); dialog.errorDialog(ArticleGroupActivity.this, getString(R.string.paiement), e.getMessage());
setBackgroundColor(getResources().getColor(R.color.error)); setBackgroundColor(getResources().getColor(R.color.error));
((Vibrator) getSystemService(ArticleCategoryActivity.VIBRATOR_SERVICE)).vibrate(500); ((Vibrator) getSystemService(ArticleGroupActivity.VIBRATOR_SERVICE)).vibrate(500);
} }
}); });
} }
......
...@@ -154,7 +154,7 @@ public abstract class BaseActivity extends NFCActivity { ...@@ -154,7 +154,7 @@ public abstract class BaseActivity extends NFCActivity {
@Override @Override
public void run() { public void run() {
try { try {
int responseCode = nemopaySession.getFoundations(); nemopaySession.getFoundations();
Thread.sleep(100); Thread.sleep(100);
// Toute une série de vérifications avant de lancer l'activité // Toute une série de vérifications avant de lancer l'activité
...@@ -220,17 +220,82 @@ public abstract class BaseActivity extends NFCActivity { ...@@ -220,17 +220,82 @@ public abstract class BaseActivity extends NFCActivity {
} }
protected void startArticleGroupActivity(final Activity activity) { protected void startArticleGroupActivity(final Activity activity) {
dialog.startLoading(activity, activity.getResources().getString(R.string.information_collection), activity.getResources().getString(config.getInKeyboard() ? R.string.keyboard_list_collecting : R.string.category_list_collecting)); dialog.startLoading(activity, activity.getResources().getString(R.string.information_collection), getString(R.string.location_list_collecting));
final Intent intent = new Intent(activity, config.getInKeyboard() ? ArticleKeyboardActivity.class : ArticleCategoryActivity.class); final Intent intent = new Intent(activity, ArticleGroupActivity.class);
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
try { try {
if (config.getInKeyboard()) if (config.getLocationId() == -1) {
nemopaySession.getKeyboards(); intent.putExtra("categoryListAuthorized", new ArrayList<Integer>());
else intent.putExtra("keyboardListAuthorized", new ArrayList<Integer>());
}
else {
nemopaySession.getLocations();
Thread.sleep(100);
// Toute une série de vérifications avant de lancer l'activité
final HTTPRequest request = nemopaySession.getRequest();
final JsonNode locationList = request.getJSONResponse();
if (locationList == null || locationList.size() == 0) {
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.stopLoading();
fatal(activity, getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(R.string.location_error_0));
}
});
return;
}
if (!locationList.isArray())
throw new Exception("Malformed JSON");
ArrayList<Integer> categoryListAuthorized = new ArrayList<Integer>();
ArrayList<Integer> keyboardListAuthorized = new ArrayList<Integer>();
for (final JsonNode location : locationList) {
if (!location.has("id") || !location.has("name") || !location.has("enabled") || !location.has("categories") || !location.has("sales_keyboards"))
throw new Exception("Unexpected JSON");
if (location.get("id").intValue() == config.getLocationId()) {
for (JsonNode category : location.get("categories"))
categoryListAuthorized.add(category.intValue());
for (JsonNode keyboard : location.get("sales_keyboards"))
keyboardListAuthorized.add(keyboard.intValue());
}
}
intent.putIntegerArrayListExtra("categoryListAuthorized", categoryListAuthorized);
intent.putIntegerArrayListExtra("keyboardListAuthorized", keyboardListAuthorized);
}
} catch (final Exception e) {
Log.e(LOG_TAG, "error: " + e.getMessage());
runOnUiThread(new Runnable() {
@Override
public void run() {
fatal(activity, getString(config.getInCategory() ? R.string.category_list_collecting : R.string.keyboard_list_collecting), e.getMessage());
}
});
}
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.changeLoading(getString(config.getInCategory() ? R.string.category_list_collecting : R.string.keyboard_list_collecting));
}
});
try {
if (config.getInCategory())
nemopaySession.getCategories(); nemopaySession.getCategories();
else
nemopaySession.getKeyboards();
Thread.sleep(100); Thread.sleep(100);
// Toute une série de vérifications avant de lancer l'activité // Toute une série de vérifications avant de lancer l'activité
...@@ -246,21 +311,21 @@ public abstract class BaseActivity extends NFCActivity { ...@@ -246,21 +311,21 @@ public abstract class BaseActivity extends NFCActivity {
public void run() { public void run() {
dialog.stopLoading(); dialog.stopLoading();
dialog.errorDialog(activity, getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(config.getInKeyboard() ? R.string.keyboard_error_0 : R.string.category_error_0)); dialog.errorDialog(activity, getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(config.getInCategory() ? R.string.category_error_0 : R.string.keyboard_error_0));
} }
}); });