Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hds
flexin
android-app
Commits
20cc0f2e
Commit
20cc0f2e
authored
Nov 14, 2017
by
Nastuzzi Samy
Browse files
Merge branch 'hotfix/locationbug'
parents
363b5b07
963b13bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/fr/utc/simde/jessy/ArticleGroupActivity.java
View file @
20cc0f2e
...
...
@@ -78,7 +78,12 @@ public class ArticleGroupActivity extends BaseActivity {
}
if
(
this
.
nbrGroups
==
0
)
{
dialog
.
errorDialog
(
this
,
getResources
().
getString
(
R
.
string
.
information_collection
),
getResources
().
getString
(
R
.
string
.
article_error_0_categorie_not_0
),
new
DialogInterface
.
OnClickListener
()
{
if
(
config
.
getLocationId
()
!=
-
1
)
{
config
.
setLocation
(-
1
,
""
);
config
.
setCanCancel
(
true
);
}
dialog
.
errorDialog
(
this
,
getResources
().
getString
(
R
.
string
.
information_collection
),
nemopaySession
.
getFoundationName
()
+
" "
+
getString
(
R
.
string
.
article_error_0
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
finish
();
...
...
@@ -444,16 +449,11 @@ public class ArticleGroupActivity extends BaseActivity {
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
()))
continue
;
else
if
(
articlesForThisKeyboard
.
size
()
==
0
)
continue
;
if
(
articlesForThisKeyboard
==
null
)
continue
;
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"
)
;
for
(
JsonNode
article
:
keyboard
.
get
(
"data"
).
get
(
"items"
))
{
if
(
article
.
has
(
"itm_id"
))
{
...
...
@@ -473,6 +473,9 @@ public class ArticleGroupActivity extends BaseActivity {
articlesForThisKeyboard
.
add
(
new
ObjectMapper
().
createObjectNode
());
}
if
(
articlesForThisKeyboard
.
size
()
==
0
)
continue
;
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
()));
}
}
...
...
app/src/main/java/fr/utc/simde/jessy/BaseActivity.java
View file @
20cc0f2e
...
...
@@ -258,55 +258,99 @@ public abstract class BaseActivity extends NFCActivity {
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
fatal
(
activity
,
getString
(
config
.
getInCategory
()
?
R
.
string
.
cat
egory_list_collecting
:
R
.
string
.
keyboard
_list_collecting
),
e
.
getMessage
());
fatal
(
activity
,
getString
(
R
.
string
.
lo
cat
ion
_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
));
}
});
if
(
config
.
getLocationId
()
!=
-
1
||
config
.
getInCategory
())
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
changeLoading
(
getString
(
R
.
string
.
category_list_collecting
));
}
});
try
{
if
(
config
.
getInCategory
())
try
{
nemopaySession
.
getCategories
();
else
nemopaySession
.
getKeyboards
();
Thread
.
sleep
(
100
);
Thread
.
sleep
(
100
);
// Toute une série de vérifications avant de lancer l'activité
final
HTTPRequest
request
=
nemopaySession
.
getRequest
();
final
JsonNode
groupList
=
request
.
getJSONResponse
();
// Toute une série de vérifications avant de lancer l'activité
final
HTTPRequest
request
=
nemopaySession
.
getRequest
();
final
JsonNode
groupList
=
request
.
getJSONResponse
();
if
(!
groupList
.
isArray
())
throw
new
Exception
(
"Malformed JSON"
);
if
(!
groupList
.
isArray
())
throw
new
Exception
(
"Malformed JSON"
);
if
(
config
.
getLocationId
()
==
-
1
&&
groupList
.
size
()
==
0
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
information_collection
),
nemopaySession
.
getFoundationName
()
+
" "
+
getString
(
R
.
string
.
category_error_0
));
}
});
return
;
}
intent
.
putExtra
(
"categoryList"
,
request
.
getResponse
());
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
if
(
groupList
.
size
()
==
0
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
information_collection
),
nemopaySession
.
getFoundationName
()
+
" "
+
getString
(
config
.
getInCategory
()
?
R
.
string
.
category_error_0
:
R
.
string
.
keyboard_error_0
));
fatal
(
activity
,
getString
(
R
.
string
.
category_list_collecting
),
e
.
getMessage
());
}
});
return
;
}
}
intent
.
putExtra
(
config
.
getInCategory
()
?
"categoryList"
:
"keyboardList"
,
request
.
getResponse
());
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
if
(
config
.
getLocationId
()
!=
-
1
||
!
config
.
getInCategory
())
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
fatal
(
activity
,
getString
(
config
.
getInCategory
()
?
R
.
string
.
category_list_collecting
:
R
.
string
.
keyboard_list_collecting
)
,
e
.
getMessage
()
);
dialog
.
changeLoading
(
getString
(
R
.
string
.
keyboard_list_collecting
));
}
});
try
{
nemopaySession
.
getKeyboards
();
Thread
.
sleep
(
100
);
// Toute une série de vérifications avant de lancer l'activité
final
HTTPRequest
request
=
nemopaySession
.
getRequest
();
final
JsonNode
groupList
=
request
.
getJSONResponse
();
if
(!
groupList
.
isArray
())
throw
new
Exception
(
"Malformed JSON"
);
if
(
config
.
getLocationId
()
==
-
1
&&
groupList
.
size
()
==
0
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
information_collection
),
nemopaySession
.
getFoundationName
()
+
" "
+
getString
(
R
.
string
.
keyboard_error_0
));
}
});
return
;
}
intent
.
putExtra
(
"keyboardList"
,
request
.
getResponse
());
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
fatal
(
activity
,
getString
(
R
.
string
.
keyboard_list_collecting
),
e
.
getMessage
());
}
});
}
}
runOnUiThread
(
new
Runnable
()
{
...
...
app/src/main/java/fr/utc/simde/jessy/FoundationsOptionsActivity.java
View file @
20cc0f2e
...
...
@@ -114,14 +114,18 @@ public class FoundationsOptionsActivity extends BaseActivity {
if
(
isOption
(
position
,
0
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.9"
);
else
if
(
isOption
(
position
,
1
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.9"
);
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.11"
);
else
if
(
isOption
(
position
,
2
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.12"
);
else
if
(
isOption
(
position
,
1
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.12"
);
else
if
(
isOption
(
position
,
2
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.10"
);
else
if
(
isOption
(
position
,
3
))
else
if
(
isOption
(
position
,
5
))
startCardManagementActivity
(
FoundationsOptionsActivity
.
this
);
else
if
(
isOption
(
position
,
4
))
else
if
(
isOption
(
position
,
6
))
keyNemopayDialog
();
else
if
(
isOption
(
position
,
5
))
else
if
(
isOption
(
position
,
7
))
keyGingerDialog
();
else
configDialog
();
...
...
app/src/main/res/values/options.xml
View file @
20cc0f2e
...
...
@@ -3,6 +3,8 @@
<string-array
name=
"options"
>
<item>
Mode annulation
</item>
<item>
Modifier les articles
</item>
<item>
Effectuer un rechargement
</item>
<item>
Effectuer un transfert
</item>
<item>
Lire un QR Code
</item>
<item>
Gestion des cartes/cotisations
</item>
<item>
Modifier la clé Nemopay
</item>
...
...
app/src/main/res/values/strings.xml
View file @
20cc0f2e
...
...
@@ -115,7 +115,6 @@
<string
name=
"keyboard_error_0"
>
n\'a aucun clavier de caisse
</string>
<string
name=
"category_error_0"
>
n\'a aucune catégorie
</string>
<string
name=
"article_error_0"
>
n\'a aucun article à vendre
</string>
<string
name=
"article_error_0_categorie_not_0"
>
Toutes les catégories sont vides
</string>
<string
name=
"buyer_info_collecting"
>
Récupération des informations de la personne
</string>
<string
name=
"user_searching"
>
Identification de la personne
</string>
<string
name=
"user_nemopay_info_collecting"
>
Identification de la personne auprès de Nemopay
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment