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
f41d992f
Commit
f41d992f
authored
Nov 12, 2017
by
Nastuzzi Samy
Browse files
Remove useless files
parent
1a2bc510
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/fr/utc/simde/jessy/ArticleCategoryActivity.java
deleted
100644 → 0
View file @
1a2bc510
package
fr.utc.simde.jessy
;
import
android.os.Bundle
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
java.util.HashMap
;
/**
* Created by Samy on 27/10/2017.
*/
public
class
ArticleCategoryActivity
extends
ArticleGroupActivity
{
private
static
final
String
LOG_TAG
=
"_ArticleCategoryActivit"
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
}
protected
void
createGroups
(
final
JsonNode
categoryList
,
final
JsonNode
articleList
)
throws
Exception
{
HashMap
<
Integer
,
ArrayNode
>
articlesPerCategory
=
new
HashMap
<
Integer
,
ArrayNode
>();
final
int
foundationId
=
nemopaySession
.
getFoundationId
();
final
JsonNode
authorizedList
=
config
.
getGroupList
();
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
.
has
(
Integer
.
toString
(
category
.
get
(
"id"
).
intValue
()))
||
articlesForThisCategory
==
null
)
continue
;
}
else
if
(
articlesForThisCategory
==
null
||
articlesForThisCategory
.
size
()
==
0
)
continue
;
createNewGroup
(
category
.
get
(
"name"
).
textValue
(),
articlesForThisCategory
);
}
}
}
app/src/main/java/fr/utc/simde/jessy/ArticleKeyboardActivity.java
deleted
100644 → 0
View file @
1a2bc510
package
fr.utc.simde.jessy
;
import
android.os.Bundle
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
/**
* Created by Samy on 27/10/2017.
*/
public
class
ArticleKeyboardActivity
extends
ArticleGroupActivity
{
private
static
final
String
LOG_TAG
=
"_ArticleKeyboardActivit"
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
}
protected
void
createGroups
(
final
JsonNode
keyboardList
,
final
JsonNode
articleList
)
throws
Exception
{
final
int
foundationId
=
nemopaySession
.
getFoundationId
();
final
JsonNode
authorizedList
=
config
.
getGroupList
();
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
.
has
(
Integer
.
toString
(
keyboard
.
get
(
"id"
).
intValue
())))
continue
;
else
if
(
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
()));
}
}
}
app/src/main/java/fr/utc/simde/jessy/adapters/AllOptionsAdapter.java
deleted
100644 → 0
View file @
1a2bc510
package
fr.utc.simde.jessy.adapters
;
import
android.app.Activity
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.CheckBox
;
import
android.widget.LinearLayout
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
/**
* Created by Samy on 29/10/2017.
*/
public
class
AllOptionsAdapter
extends
BaseAdapter
{
private
static
final
String
LOG_TAG
=
"_AllOptionsAdapter"
;
protected
Activity
activity
;
protected
ArrayNode
optionList
;
protected
CheckBox
[]
checkBoxList
;
public
AllOptionsAdapter
(
final
Activity
activity
,
final
ArrayNode
optionList
)
throws
Exception
{
this
.
activity
=
activity
;
this
.
optionList
=
optionList
;
this
.
checkBoxList
=
new
CheckBox
[
optionList
.
size
()];
}
@Override
public
View
getView
(
int
position
,
View
view
,
ViewGroup
viewGroup
)
{
if
(
view
==
null
)
{
view
=
new
LinearLayout
(
this
.
activity
);
CheckBox
checkBox
=
new
CheckBox
(
this
.
activity
);
checkBox
.
setText
(
this
.
optionList
.
get
(
position
).
textValue
());
((
LinearLayout
)
view
).
addView
(
checkBox
);
if
(
this
.
checkBoxList
[
position
]
==
null
)
this
.
checkBoxList
[
position
]
=
checkBox
;
}
return
view
;
}
@Override
public
int
getCount
()
{
return
this
.
optionList
.
size
();
}
@Override
public
Object
getItem
(
int
position
)
{
return
0
;
}
@Override
public
long
getItemId
(
int
position
)
{
return
position
;
}
public
ArrayNode
getList
()
{
ArrayNode
optionList
=
new
ObjectMapper
().
createArrayNode
();
int
i
=
0
;
for
(
CheckBox
checkBox
:
this
.
checkBoxList
)
{
if
(
checkBox
.
isChecked
())
optionList
.
add
(
this
.
optionList
.
get
(
i
).
textValue
());
i
++;
}
return
optionList
;
}
}
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