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
bdb40b71
Commit
bdb40b71
authored
Oct 29, 2017
by
Nastuzzi Samy
Browse files
Purchases
Print all purchases Optimization Bug fix Creation of the list view Reorganisation
parent
e08db2bd
Changes
15
Hide whitespace changes
Inline
Side-by-side
app/src/main/AndroidManifest.xml
View file @
bdb40b71
...
...
@@ -22,6 +22,7 @@
<activity
android:name=
".BaseActivity"
/>
<activity
android:name=
".FoundationListActivity"
/>
<activity
android:name=
".ArticleCategoryActivity"
/>
<activity
android:name=
".BuyerInfoActivity"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/fr/utc/simde/payutc/ArticleCategoryActivity.java
View file @
bdb40b71
...
...
@@ -7,6 +7,7 @@ import android.view.View;
import
android.widget.ImageButton
;
import
android.widget.TabHost
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
...
@@ -15,7 +16,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.List
;
import
fr.utc.simde.payutc.articles.
Article
GroupFragment
;
import
fr.utc.simde.payutc.articles.GroupFragment
;
/**
* Created by Samy on 27/10/2017.
...
...
@@ -30,7 +31,7 @@ public class ArticleCategoryActivity extends BaseActivity {
private
Panier
panier
;
private
List
<
Article
GroupFragment
>
articleG
roupFragmentList
;
private
List
<
GroupFragment
>
g
roupFragmentList
;
private
int
nbrCategories
;
public
class
Panier
{
...
...
@@ -47,12 +48,14 @@ public class ArticleCategoryActivity extends BaseActivity {
}
public
void
setText
()
{
if
(
this
.
totalPrice
==
0
)
if
(
this
.
articleList
.
size
()
==
0
)
this
.
textView
.
setText
(
"Panier vide"
);
else
this
.
textView
.
setText
(
"Total: "
+
String
.
format
(
"%.2f"
,
new
Float
(
totalPrice
)
/
100.00f
)
+
"€"
);
}
public
List
<
Integer
>
getArticleList
()
{
return
this
.
articleList
;
}
public
void
addArticle
(
final
int
id
,
final
int
price
)
{
this
.
articleList
.
add
(
id
);
this
.
totalPrice
+=
price
;
...
...
@@ -66,6 +69,10 @@ public class ArticleCategoryActivity extends BaseActivity {
this
.
totalPrice
=
0
;
setText
();
}
public
Boolean
isEmpty
()
{
return
this
.
articleList
.
isEmpty
();
}
}
@Override
...
...
@@ -80,7 +87,7 @@ public class ArticleCategoryActivity extends BaseActivity {
this
.
tabHost
=
findViewById
(
R
.
id
.
tab_categories
);
this
.
tabHost
.
setup
();
this
.
articleG
roupFragmentList
=
new
ArrayList
<
Article
GroupFragment
>();
this
.
g
roupFragmentList
=
new
ArrayList
<
GroupFragment
>();
this
.
nbrCategories
=
0
;
try
{
...
...
@@ -107,8 +114,8 @@ public class ArticleCategoryActivity extends BaseActivity {
this
.
deleteButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
for
(
Article
GroupFragment
articleG
roupFragment
:
articleG
roupFragmentList
)
articleG
roupFragment
.
clear
();
for
(
GroupFragment
g
roupFragment
:
g
roupFragmentList
)
g
roupFragment
.
clear
();
panier
.
clear
();
}
...
...
@@ -116,7 +123,16 @@ public class ArticleCategoryActivity extends BaseActivity {
}
@Override
protected
void
onIdentification
(
String
idBadge
)
{}
protected
void
onIdentification
(
final
String
badgeId
)
{
if
(
this
.
panier
.
isEmpty
())
startBuyerInfoActivity
(
ArticleCategoryActivity
.
this
,
badgeId
);
else
pay
(
badgeId
);
}
protected
void
pay
(
final
String
badgeId
)
{
Toast
.
makeText
(
this
,
"A faire payer"
,
Toast
.
LENGTH_LONG
).
show
();
}
protected
void
createCategories
(
final
JsonNode
categoryList
,
final
JsonNode
articleList
)
throws
Exception
{
HashMap
<
Integer
,
ArrayList
<
JsonNode
>>
articlesPerCategory
=
new
HashMap
<
Integer
,
ArrayList
<
JsonNode
>>();
...
...
@@ -148,13 +164,13 @@ public class ArticleCategoryActivity extends BaseActivity {
}
protected
void
createNewCategory
(
final
String
name
,
final
JsonNode
articleList
)
throws
Exception
{
Article
GroupFragment
articleGroupFragment
=
new
Article
GroupFragment
(
ArticleCategoryActivity
.
this
,
articleList
,
this
.
panier
);
GroupFragment
articleGroupFragment
=
new
GroupFragment
(
ArticleCategoryActivity
.
this
,
articleList
,
this
.
panier
);
TabHost
.
TabSpec
newTabSpec
=
this
.
tabHost
.
newTabSpec
(
name
);
newTabSpec
.
setIndicator
(
name
);
newTabSpec
.
setContent
(
articleGroupFragment
);
this
.
articleG
roupFragmentList
.
add
(
articleGroupFragment
);
this
.
g
roupFragmentList
.
add
(
articleGroupFragment
);
this
.
tabHost
.
addTab
(
newTabSpec
);
nbrCategories
++;
...
...
app/src/main/java/fr/utc/simde/payutc/BaseActivity.java
View file @
bdb40b71
...
...
@@ -54,11 +54,11 @@ public abstract class BaseActivity extends NFCActivity {
new
Thread
()
{
@Override
public
void
run
()
{
try
{
// Toute une série de vérifications avant de lancer l'activité
if
(
nemopaySession
.
getFoundations
()
!=
200
)
throw
new
Exception
(
"HTTP Error: "
+
Integer
.
toString
(
nemopaySession
.
getRequest
().
getResponseCode
()));
try
{
int
responseCode
=
nemopaySession
.
getFoundations
();
Thread
.
sleep
(
100
);
// Toute une série de vérifications avant de lancer l'activité
final
HTTPRequest
request
=
nemopaySession
.
getRequest
();
final
JsonNode
foundationList
=
request
.
getJSONResponse
();
...
...
@@ -102,17 +102,16 @@ public abstract class BaseActivity extends NFCActivity {
activity
.
startActivity
(
intent
);
}
});
}
catch
(
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
inform
ation_collecti
o
n
),
get
String
(
R
.
string
.
foundation_error_get_list
));
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
found
ation_
list_
collectin
g
),
e
.
get
Message
(
));
}
});
}
}
}.
start
();
}
...
...
@@ -124,12 +123,11 @@ public abstract class BaseActivity extends NFCActivity {
new
Thread
()
{
@Override
public
void
run
()
{
try
{
// Toute une série de vérifications avant de lancer l'activité
if
(
nemopaySession
.
getCategories
()
!=
200
)
throw
new
Exception
(
"HTTP Error: "
+
Integer
.
toString
(
nemopaySession
.
getRequest
().
getResponseCode
()));
try
{
int
responseCode
=
nemopaySession
.
getCategories
();
Thread
.
sleep
(
100
);
// Toute une série de vérifications avant de lancer l'activité
final
HTTPRequest
request
=
nemopaySession
.
getRequest
();
final
JsonNode
categoryList
=
request
.
getJSONResponse
();
...
...
@@ -155,17 +153,15 @@ public abstract class BaseActivity extends NFCActivity {
}
intent
.
putExtra
(
"categoryList"
,
request
.
getResponse
());
}
catch
(
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
information
_collecti
o
n
),
get
String
(
R
.
string
.
category_error_get_list
));
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
category_list
_collectin
g
),
e
.
get
Message
(
));
}
});
return
;
}
runOnUiThread
(
new
Runnable
()
{
...
...
@@ -175,11 +171,11 @@ public abstract class BaseActivity extends NFCActivity {
}
});
try
{
// Toute une série de vérifications avant de lancer l'activité
if
(
nemopaySession
.
getArticles
()
!=
200
)
throw
new
Exception
(
"HTTP Error: "
+
Integer
.
toString
(
nemopaySession
.
getRequest
().
getResponseCode
()));
try
{
int
responseCode
=
nemopaySession
.
getArticles
();
Thread
.
sleep
(
100
);
// Toute une série de vérifications avant de lancer l'activité
final
HTTPRequest
request
=
nemopaySession
.
getRequest
();
final
JsonNode
articleList
=
request
.
getJSONResponse
();
...
...
@@ -211,17 +207,16 @@ public abstract class BaseActivity extends NFCActivity {
activity
.
startActivity
(
intent
);
}
});
}
catch
(
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
information
_collecti
o
n
),
get
String
(
R
.
string
.
article_error_get_list
));
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
article_list
_collectin
g
),
e
.
get
Message
(
));
}
});
}
}
}.
start
();
}
...
...
@@ -233,4 +228,59 @@ public abstract class BaseActivity extends NFCActivity {
// Plus tard, on pourra choisir quelle activité lancer
startCategoryArticlesActivity
(
activity
);
}
protected
void
startBuyerInfoActivity
(
final
Activity
activity
,
final
String
badgeId
)
{
dialog
.
startLoading
(
activity
,
activity
.
getResources
().
getString
(
R
.
string
.
information_collection
),
activity
.
getResources
().
getString
(
R
.
string
.
buyer_info_collecting
));
final
Intent
intent
=
new
Intent
(
activity
,
BuyerInfoActivity
.
class
);
new
Thread
()
{
@Override
public
void
run
()
{
try
{
nemopaySession
.
getBuyerInfo
(
badgeId
);
Thread
.
sleep
(
100
);
// Toute une série de vérifications avant de lancer l'activité
final
HTTPRequest
request
=
nemopaySession
.
getRequest
();
final
JsonNode
buyerInfo
=
request
.
getJSONResponse
();
if
(!
request
.
isJSONResponse
())
throw
new
Exception
(
"Malformed JSON"
);
if
(!
buyerInfo
.
has
(
"lastname"
)
||
!
buyerInfo
.
has
(
"username"
)
||
!
buyerInfo
.
has
(
"firstname"
)
||
!
buyerInfo
.
has
(
"solde"
)
||
!
buyerInfo
.
has
(
"last_purchases"
)
||
!
buyerInfo
.
get
(
"last_purchases"
).
isArray
())
throw
new
Exception
(
"Unexpected JSON"
);
intent
.
putExtra
(
"buyerInfo"
,
request
.
getResponse
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
activity
.
startActivity
(
intent
);
}
});
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
try
{
if
(
nemopaySession
.
getRequest
().
getResponseCode
()
==
404
)
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
badge_error_not_recognized
));
}
});
else
throw
new
Exception
(
""
);
}
catch
(
Exception
e1
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
errorDialog
(
activity
,
getString
(
R
.
string
.
information_collection
),
e
.
getMessage
());
}
});
}
}
}
}.
start
();
}
}
app/src/main/java/fr/utc/simde/payutc/BuyerInfoActivity.java
0 → 100644
View file @
bdb40b71
package
fr.utc.simde.payutc
;
import
android.app.Activity
;
import
android.content.DialogInterface
;
import
android.os.Bundle
;
import
android.support.v7.app.AlertDialog
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.LinearLayout
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
org.w3c.dom.Text
;
import
java.io.IOException
;
import
fr.utc.simde.payutc.articles.GridAdapter
;
import
fr.utc.simde.payutc.articles.ListAdapater
;
import
fr.utc.simde.payutc.tools.HTTPRequest
;
/**
* Created by Samy on 29/10/2017.
*/
public
class
BuyerInfoActivity
extends
BaseActivity
{
private
static
final
String
LOG_TAG
=
"_BuyerInfoActivity"
;
private
String
lastname
;
private
String
username
;
private
String
firstname
;
private
JsonNode
lastPurchases
;
private
TextView
textBuyerName
;
private
TextView
textSolde
;
private
LinearLayout
linearLayout
;
private
ListView
listView
;
private
ListAdapater
listAdapater
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_buyer_info
);
this
.
textBuyerName
=
findViewById
(
R
.
id
.
text_buyer_name
);
this
.
textSolde
=
findViewById
(
R
.
id
.
text_solde
);
this
.
linearLayout
=
findViewById
(
R
.
id
.
layout_articles
);
try
{
JsonNode
buyerInfo
=
new
ObjectMapper
().
readTree
(
getIntent
().
getExtras
().
getString
(
"buyerInfo"
));
if
(!
buyerInfo
.
has
(
"lastname"
)
||
!
buyerInfo
.
has
(
"username"
)
||
!
buyerInfo
.
has
(
"firstname"
)
||
!
buyerInfo
.
has
(
"solde"
)
||
!
buyerInfo
.
has
(
"last_purchases"
)
||
!
buyerInfo
.
get
(
"last_purchases"
).
isArray
())
throw
new
Exception
(
"Unexpected JSON"
);
this
.
textBuyerName
.
setText
(
buyerInfo
.
get
(
"firstname"
).
textValue
()
+
" "
+
buyerInfo
.
get
(
"lastname"
).
textValue
());
this
.
textSolde
.
setText
(
"Solde: "
+
String
.
format
(
"%.2f"
,
new
Float
(
buyerInfo
.
get
(
"solde"
).
intValue
())
/
100.00f
)
+
"€"
);
generatePurchases
(
buyerInfo
.
get
(
"last_purchases"
));
}
catch
(
Exception
e
)
{
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
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
finish
();
}
});
}
}
@Override
protected
void
onIdentification
(
final
String
badgeId
)
{
}
protected
void
generatePurchases
(
final
JsonNode
purchaseList
)
throws
Exception
{
if
(
purchaseList
.
size
()
==
0
)
{
String
foundationName
=
nemopaySession
.
getFoundationName
();
TextView
noPurchase
=
new
TextView
(
this
);
noPurchase
.
setText
(
getString
(
R
.
string
.
no_purchases
)
+
(
foundationName
.
equals
(
""
)
?
""
:
"\n("
+
foundationName
+
")"
));
noPurchase
.
setTextSize
(
24
);
noPurchase
.
setGravity
(
Gravity
.
CENTER
);
LinearLayout
.
LayoutParams
layoutParams
=
new
LinearLayout
.
LayoutParams
(
LinearLayout
.
LayoutParams
.
MATCH_PARENT
,
LinearLayout
.
LayoutParams
.
MATCH_PARENT
);
layoutParams
.
setMargins
(
100
,
100
,
100
,
100
);
noPurchase
.
setLayoutParams
(
layoutParams
);
this
.
linearLayout
.
addView
(
noPurchase
);
}
else
{
ArrayNode
articleList
=
new
ObjectMapper
().
createArrayNode
();
Log
.
d
(
LOG_TAG
,
purchaseList
.
toString
());
for
(
JsonNode
purchase
:
purchaseList
)
{
articleList
.
add
(
new
ObjectMapper
().
readTree
(
"{\"name\":\""
+
Integer
.
toString
(
purchase
.
get
(
"obj_id"
).
intValue
())
+
"\", "
+
"\"price\":"
+
Integer
.
toString
(
purchase
.
get
(
"pur_price"
).
intValue
())
+
", "
+
"\"image_url\":\"\"}"
));
}
Log
.
d
(
LOG_TAG
,
articleList
.
toString
());
this
.
listAdapater
=
new
ListAdapater
(
BuyerInfoActivity
.
this
,
articleList
);
this
.
listView
=
new
ListView
(
this
);
this
.
listView
.
setAdapter
(
this
.
listAdapater
);
this
.
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
parent
,
View
view
,
int
position
,
long
id
){
JsonNode
article
=
((
JsonNode
)
listAdapater
.
getArticle
(
position
));
/*
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(BuyerInfoActivity.this);
alertDialogBuilder
.setTitle(R.string.username_dialog)
.setView(usernameView)
.setCancelable(false)
.setPositiveButton(R.string.connexion, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int id) {
if (usernameInput.getText().toString().equals("") || passwordInput.getText().toString().equals("")) {
if (!usernameInput.getText().toString().equals(""))
casConnexion.setUsername(usernameInput.getText().toString());
Toast.makeText(MainActivity.this, R.string.username_and_password_required, Toast.LENGTH_SHORT).show();
dialogInterface.cancel();
casDialog();
}
else {
try {
connectWithCAS(usernameInput.getText().toString(), passwordInput.getText().toString());
} catch (Exception e) {
Log.e(LOG_TAG, "error: " + e.getMessage());
}
dialogInterface.cancel();
}
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int id) {
dialogInterface.cancel();
}
});
dialog.createDialog(alertDialogBuilder, usernameInput.getText().toString().isEmpty() ? usernameInput : passwordInput);*/
}
});
this
.
listView
.
setOnItemLongClickListener
(
new
AdapterView
.
OnItemLongClickListener
()
{
@Override
public
boolean
onItemLongClick
(
AdapterView
<
?
>
adapterView
,
View
view
,
int
position
,
long
id
){
listAdapater
.
toast
(
position
,
Toast
.
LENGTH_LONG
);
return
true
;
}
});
this
.
linearLayout
.
addView
(
listView
);
}
}
}
app/src/main/java/fr/utc/simde/payutc/articles/A
r
ticleAdapter.java
→
app/src/main/java/fr/utc/simde/payutc/articles/A
c
ticle
s
Adapter.java
View file @
bdb40b71
...
...
@@ -9,6 +9,7 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.GridView
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
...
...
@@ -20,6 +21,7 @@ import java.io.InputStream;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
fr.utc.simde.payutc.ArticleCategoryActivity
;
import
fr.utc.simde.payutc.R
;
import
fr.utc.simde.payutc.tools.HTTPRequest
;
...
...
@@ -27,42 +29,24 @@ import fr.utc.simde.payutc.tools.HTTPRequest;
* Created by Samy on 28/10/2017.
*/
public
class
ArticleAdapter
extends
BaseAdapter
{
private
static
final
String
LOG_TAG
=
"_ArticleAdapter"
;
abstract
class
Article
s
Adapter
extends
BaseAdapter
{
private
static
final
String
LOG_TAG
=
"_Article
s
Adapter"
;
private
Activity
activity
;
private
JsonNode
articleList
;
private
Bitmap
[]
imageList
;
private
Integer
[]
nbrClicksList
;
private
TextView
[]
clickViewList
;
private
int
size
;
protected
Activity
activity
;
public
ArticleAdapter
(
final
Activity
activity
,
final
JsonNode
articleList
,
final
int
nbrColumns
)
throws
Exception
{
protected
Bitmap
[]
imageList
;
protected
Integer
[]
nbrClicksList
;
protected
TextView
[]
clickViewList
;
protected
JsonNode
articleList
;
public
ArticlesAdapter
(
final
Activity
activity
,
final
JsonNode
articleList
)
throws
Exception
{
this
.
activity
=
activity
;
this
.
articleList
=
articleList
;
this
.
imageList
=
new
Bitmap
[
articleList
.
size
()];
this
.
nbrClicksList
=
new
Integer
[
articleList
.
size
()];
this
.
clickViewList
=
new
TextView
[
articleList
.
size
()];
switch
(
nbrColumns
)
{
case
1
:
this
.
size
=
250
;
break
;
case
2
:
this
.
size
=
200
;
break
;
case
3
:
this
.
size
=
150
;
break
;
case
4
:
this
.
size
=
125
;
break
;
case
5
:
default
:
this
.
size
=
100
;
break
;
}
for
(
int
i
=
0
;
i
<
this
.
nbrClicksList
.
length
;
i
++)
this
.
nbrClicksList
[
i
]
=
0
;
}
...
...
@@ -83,32 +67,7 @@ public class ArticleAdapter extends BaseAdapter {
}
@Override
public
View
getView
(
int
position
,
View
view
,
ViewGroup
viewGroup
)
{
JsonNode
article
=
this
.
articleList
.
get
(
position
);
if
(
view
==
null
)
{
LayoutInflater
layoutInflater
=
LayoutInflater
.
from
(
this
.
activity
);
view
=
layoutInflater
.
inflate
(
R
.
layout
.
fragment_article
,
null
);
}
ImageView
imageView
=
view
.
findViewById
(
R
.
id
.
image_article
);
if
(
clickViewList
[
position
]
==
null
)
clickViewList
[
position
]
=
view
.
findViewById
(
R
.
id
.
text_nbr_clicks
);
TextView
textView
=
view
.
findViewById
(
R
.
id
.
text_article
);
int
imageSize
=
this
.
size
;
RelativeLayout
.
LayoutParams
parms
=
new
RelativeLayout
.
LayoutParams
(
imageSize
,
imageSize
);
imageView
.
setLayoutParams
(
parms
);
setImage
(
imageView
,
article
.
get
(
"image_url"
).
textValue
(),
position
);
setClickView
(
position
);
textView
.
setText
(
article
.
get
(
"name"
).
textValue
());
return
view
;
}
public
View
getView
(
int
position
,
View
view
,
ViewGroup
viewGroup
)
{
return
view
;
}
public
void
setClickView
(
final
int
position
)
{
if
(
this
.
clickViewList
[
position
]
!=
null
)
{
...
...
app/src/main/java/fr/utc/simde/payutc/articles/GridAdapter.java
0 → 100644
View file @
bdb40b71
package
fr.utc.simde.payutc.articles
;
import
android.app.Activity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
fr.utc.simde.payutc.R
;
/**
* Created by Samy on 29/10/2017.
*/
public
class
GridAdapter
extends
ArticlesAdapter
{
private
static
final
String
LOG_TAG
=
"_GridAdapter"
;
private
int
size
;
public
GridAdapter
(
final
Activity
activity
,
final
JsonNode
articleList
,
final
int
nbrColumns
)
throws
Exception
{
super
(
activity
,
articleList
);
switch
(
nbrColumns
)
{
case
1
:
this
.
size
=
250
;
break
;
case
2
:
this
.
size
=
200
;