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
1319d374
Commit
1319d374
authored
Nov 21, 2017
by
Nastuzzi Samy
Browse files
Add edit articles management
Reorganisation of multiple files
parent
2605ea09
Changes
12
Hide whitespace changes
Inline
Side-by-side
app/src/main/AndroidManifest.xml
View file @
1319d374
...
...
@@ -40,7 +40,10 @@
<activity
android:name=
"fr.utc.simde.jessy.CardManagementActivity"
android:configChanges=
"orientation"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"fr.utc.simde.jessy.ArticleGroupActivity"
<activity
android:name=
"fr.utc.simde.jessy.SellActivity"
android:configChanges=
"orientation"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"fr.utc.simde.jessy.EditActivity"
android:configChanges=
"orientation"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"fr.utc.simde.jessy.QRCodeReaderActivity"
...
...
app/src/main/java/fr/utc/simde/jessy/ArticleGroupActivity.java
View file @
1319d374
...
...
@@ -2,7 +2,6 @@ package fr.utc.simde.jessy;
import
android.content.DialogInterface
;
import
android.os.Bundle
;
import
android.os.Vibrator
;
import
android.support.v7.app.AlertDialog
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
...
...
@@ -14,8 +13,6 @@ import android.widget.ListView;
import
android.widget.RadioButton
;
import
android.widget.Switch
;
import
android.widget.TabHost
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
...
@@ -27,24 +24,21 @@ import java.util.HashMap;
import
java.util.List
;
import
fr.utc.simde.jessy.adapters.LocationsAdapter
;
import
fr.utc.simde.jessy.fragments.GroupFragment
;
import
fr.utc.simde.jessy.fragments.
Article
GroupFragment
;
import
fr.utc.simde.jessy.tools.HTTPRequest
;
import
fr.utc.simde.jessy.tools.Panier
;
/**
* Created by Samy on 27/10/2017.
*/
public
class
ArticleGroupActivity
extends
BaseActivity
{
public
abstract
class
ArticleGroupActivity
extends
BaseActivity
{
private
static
final
String
LOG_TAG
=
"_ArticleGroupActivity"
;
protected
ImageButton
paramButton
;
protected
ImageButton
delete
Button
;
protected
ImageButton
option
Button
;
protected
TabHost
tabHost
;
protected
Panier
panier
;
protected
List
<
GroupFragment
>
groupFragmentList
;
protected
List
<
ArticleGroupFragment
>
groupFragmentList
;
protected
int
nbrGroups
;
@Override
...
...
@@ -52,15 +46,16 @@ public class ArticleGroupActivity extends BaseActivity {
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_article_group
);
TextView
textView
=
findViewById
(
R
.
id
.
text_price
);
this
.
panier
=
new
Panier
(
textView
);
this
.
paramButton
=
findViewById
(
R
.
id
.
image_param
);
this
.
delete
Button
=
findViewById
(
R
.
id
.
image_delete
);
this
.
option
Button
=
findViewById
(
R
.
id
.
image_delete
);
this
.
tabHost
=
findViewById
(
R
.
id
.
tab_categories
);
this
.
tabHost
.
setup
();
this
.
groupFragmentList
=
new
ArrayList
<
GroupFragment
>();
this
.
groupFragmentList
=
new
ArrayList
<
Article
GroupFragment
>();
this
.
nbrGroups
=
0
;
}
protected
void
generate
()
{
try
{
if
(
getIntent
().
getExtras
().
getString
(
"categoryList"
)
!=
null
)
...
...
@@ -145,7 +140,7 @@ public class ArticleGroupActivity extends BaseActivity {
config
.
setPrintCotisant
(
switchCotisant
.
isChecked
());
config
.
setPrint18
(
swtich18
.
isChecked
());
start
ArticleGroup
Activity
(
ArticleGroupActivity
.
this
);
start
Sell
Activity
(
ArticleGroupActivity
.
this
);
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
null
);
...
...
@@ -165,8 +160,8 @@ public class ArticleGroupActivity extends BaseActivity {
@Override
public
void
onClick
(
View
view
)
{
hasRights
(
getString
(
R
.
string
.
configurate_by_default
),
new
String
[]{
"STAFF"
,
"GESAPPLICATIONS"
"STAFF"
,
"GESAPPLICATIONS"
},
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
@@ -190,7 +185,7 @@ public class ArticleGroupActivity extends BaseActivity {
config
.
setPrintCotisant
(
switchCotisant
.
isChecked
());
config
.
setPrint18
(
swtich18
.
isChecked
());
start
ArticleGroup
Activity
(
ArticleGroupActivity
.
this
);
start
Sell
Activity
(
ArticleGroupActivity
.
this
);
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
null
);
...
...
@@ -200,24 +195,10 @@ public class ArticleGroupActivity extends BaseActivity {
}
});
this
.
deleteButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
clearPanier
();
}
});
setOptionButton
();
}
@Override
protected
void
onIdentification
(
final
String
badgeId
)
{
if
(
dialog
.
isShowing
())
return
;
if
(
this
.
panier
.
isEmpty
())
startBuyerInfoActivity
(
ArticleGroupActivity
.
this
,
badgeId
);
else
pay
(
badgeId
);
}
protected
abstract
void
setOptionButton
();
protected
void
configDialog
()
{
dialog
.
startLoading
(
ArticleGroupActivity
.
this
,
getResources
().
getString
(
R
.
string
.
information_collection
),
getString
(
config
.
getInCategory
()
?
R
.
string
.
category_list_collecting
:
R
.
string
.
keyboard_list_collecting
));
...
...
@@ -319,94 +300,6 @@ public class ArticleGroupActivity extends BaseActivity {
}.
start
();
}
public
void
clearPanier
()
{
for
(
GroupFragment
groupFragment
:
groupFragmentList
)
groupFragment
.
clear
();
panier
.
clear
();
}
public
void
setBackgroundColor
(
int
color
)
{
this
.
tabHost
.
setBackgroundColor
(
color
);
new
Thread
(){
@Override
public
void
run
()
{
try
{
Thread
.
sleep
(
2500
);
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
tabHost
.
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
white
));
}
});
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
}
}
}.
start
();
}
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
=
new
ArrayList
<
Integer
>(
panier
.
getArticleList
());
clearPanier
();
new
Thread
()
{
@Override
public
void
run
()
{
try
{
nemopaySession
.
setTransaction
(
badgeId
,
articleList
);
Thread
.
sleep
(
100
);
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
Toast
.
makeText
(
ArticleGroupActivity
.
this
,
"Paiement effectué"
,
Toast
.
LENGTH_LONG
).
show
();
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
success
));
((
Vibrator
)
getSystemService
(
ArticleGroupActivity
.
VIBRATOR_SERVICE
)).
vibrate
(
250
);
}
});
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
try
{
final
JsonNode
response
=
nemopaySession
.
getRequest
().
getJSONResponse
();
if
(
response
.
has
(
"error"
)
&&
response
.
get
(
"error"
).
has
(
"message"
))
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
ArticleGroupActivity
.
this
,
getString
(
R
.
string
.
paiement
),
response
.
get
(
"error"
).
get
(
"message"
).
textValue
());
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
error
));
((
Vibrator
)
getSystemService
(
ArticleGroupActivity
.
VIBRATOR_SERVICE
)).
vibrate
(
500
);
}
});
}
else
throw
new
Exception
(
""
);
}
catch
(
Exception
e1
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
ArticleGroupActivity
.
this
,
getString
(
R
.
string
.
paiement
),
e
.
getMessage
());
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
error
));
((
Vibrator
)
getSystemService
(
ArticleGroupActivity
.
VIBRATOR_SERVICE
)).
vibrate
(
500
);
}
});
}
}
}
}.
start
();
}
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
();
...
...
@@ -488,17 +381,6 @@ public class ArticleGroupActivity extends BaseActivity {
}
}
protected
void
createNewGroup
(
final
String
name
,
final
ArrayNode
articleList
)
throws
Exception
{
createNewGroup
(
name
,
articleList
,
3
);
}
protected
void
createNewGroup
(
final
String
name
,
final
ArrayNode
articleList
,
int
gridColumns
)
throws
Exception
{
GroupFragment
articleGroupFragment
=
new
GroupFragment
(
ArticleGroupActivity
.
this
,
articleList
,
this
.
panier
,
this
.
config
,
gridColumns
);
TabHost
.
TabSpec
newTabSpec
=
this
.
tabHost
.
newTabSpec
(
name
);
newTabSpec
.
setIndicator
(
name
);
newTabSpec
.
setContent
(
articleGroupFragment
);
this
.
groupFragmentList
.
add
(
articleGroupFragment
);
this
.
tabHost
.
addTab
(
newTabSpec
);
nbrGroups
++;
}
protected
abstract
void
createNewGroup
(
final
String
name
,
final
ArrayNode
articleList
)
throws
Exception
;
protected
abstract
void
createNewGroup
(
final
String
name
,
final
ArrayNode
articleList
,
int
gridColumns
)
throws
Exception
;
}
app/src/main/java/fr/utc/simde/jessy/BaseActivity.java
View file @
1319d374
...
...
@@ -12,8 +12,6 @@ import android.content.Intent;
import
android.content.IntentFilter
;
import
android.content.SharedPreferences
;
import
android.content.pm.PackageManager
;
import
android.net.ConnectivityManager
;
import
android.net.NetworkInfo
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
...
...
@@ -22,9 +20,7 @@ import android.os.StrictMode;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v7.app.AlertDialog
;
import
android.util.Log
;
import
android.widget.BaseAdapter
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
@@ -196,7 +192,7 @@ public abstract class BaseActivity extends InternetActivity {
protected
void
startFoundationListActivity
(
final
Activity
activity
)
{
if
(
config
.
getFoundationId
()
!=
-
1
)
{
start
ArticleGroup
Activity
(
activity
);
start
Sell
Activity
(
activity
);
return
;
}
...
...
@@ -248,9 +244,16 @@ public abstract class BaseActivity extends InternetActivity {
}.
start
();
}
protected
void
startArticleGroupActivity
(
final
Activity
activity
)
{
public
void
startSellActivity
(
final
Activity
activity
)
{
startArticleGroupActivity
(
activity
,
new
Intent
(
activity
,
SellActivity
.
class
));
}
public
void
startEditActivity
(
final
Activity
activity
)
{
startArticleGroupActivity
(
activity
,
new
Intent
(
activity
,
EditActivity
.
class
));
}
public
void
startArticleGroupActivity
(
final
Activity
activity
,
final
Intent
intent
)
{
dialog
.
startLoading
(
activity
,
activity
.
getResources
().
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
location_list_collecting
));
final
Intent
intent
=
new
Intent
(
activity
,
ArticleGroupActivity
.
class
);
new
Thread
()
{
@Override
...
...
app/src/main/java/fr/utc/simde/jessy/EditActivity.java
0 → 100644
View file @
1319d374
package
fr.utc.simde.jessy
;
import
android.os.Bundle
;
import
android.os.Vibrator
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.TabHost
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
java.util.ArrayList
;
import
java.util.List
;
import
fr.utc.simde.jessy.fragments.ArticleGroupFragment
;
import
fr.utc.simde.jessy.fragments.EditFragment
;
import
fr.utc.simde.jessy.fragments.SellFragment
;
import
fr.utc.simde.jessy.tools.Panier
;
/**
* Created by Samy on 20/11/2017.
*/
public
class
EditActivity
extends
ArticleGroupActivity
{
private
static
final
String
LOG_TAG
=
"_EditActivity"
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
generate
();
}
@Override
protected
void
setOptionButton
()
{
this
.
optionButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
}
});
}
@Override
protected
void
createNewGroup
(
final
String
name
,
final
ArrayNode
articleList
)
throws
Exception
{
createNewGroup
(
name
,
articleList
,
3
);
}
protected
void
createNewGroup
(
final
String
name
,
final
ArrayNode
articleList
,
int
gridColumns
)
throws
Exception
{
ArticleGroupFragment
articleGroupFragment
=
new
EditFragment
(
EditActivity
.
this
,
articleList
,
this
.
dialog
,
this
.
config
,
gridColumns
);
TabHost
.
TabSpec
newTabSpec
=
this
.
tabHost
.
newTabSpec
(
name
);
newTabSpec
.
setIndicator
(
name
);
newTabSpec
.
setContent
(
articleGroupFragment
);
this
.
groupFragmentList
.
add
(
articleGroupFragment
);
this
.
tabHost
.
addTab
(
newTabSpec
);
nbrGroups
++;
}
}
app/src/main/java/fr/utc/simde/jessy/FoundationsOptionsActivity.java
View file @
1319d374
...
...
@@ -18,6 +18,7 @@ import android.widget.TabHost;
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
;
...
...
@@ -25,6 +26,7 @@ import java.util.Arrays;
import
java.util.List
;
import
fr.utc.simde.jessy.adapters.FoundationsAdapter
;
import
fr.utc.simde.jessy.adapters.LocationsAdapter
;
import
fr.utc.simde.jessy.adapters.OptionChoicesAdapter
;
import
fr.utc.simde.jessy.adapters.OptionsAdapter
;
...
...
@@ -87,7 +89,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
@Override
public
void
onItemClick
(
AdapterView
parent
,
View
view
,
int
position
,
long
id
)
{
nemopaySession
.
setFoundation
(
foundationsAdapter
.
getFoundationId
(
position
),
foundationsAdapter
.
getFoundationName
(
position
),
-
1
);
start
ArticleGroup
Activity
(
FoundationsOptionsActivity
.
this
);
start
Sell
Activity
(
FoundationsOptionsActivity
.
this
);
}
});
...
...
@@ -120,7 +122,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
startActivity
(
new
Intent
(
FoundationsOptionsActivity
.
this
,
BuyerInfoActivity
.
class
));
}
else
if
(
isOption
(
position
,
1
))
di
alog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.11"
);
e
di
tDialog
(
);
else
if
(
isOption
(
position
,
2
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.12"
);
else
if
(
isOption
(
position
,
3
))
...
...
@@ -337,7 +339,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
config
.
setPrintCotisant
(
switchCotisant
.
isChecked
());
config
.
setPrint18
(
swtich18
.
isChecked
());
start
ArticleGroup
Activity
(
FoundationsOptionsActivity
.
this
);
start
Sell
Activity
(
FoundationsOptionsActivity
.
this
);
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
null
);
...
...
@@ -345,4 +347,121 @@ public class FoundationsOptionsActivity extends BaseActivity {
dialog
.
createDialog
(
alertDialogBuilder
);
}
}
protected
void
editDialog
()
{
dialog
.
startLoading
(
FoundationsOptionsActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
user_rights_list_collecting
));
new
Thread
()
{
@Override
public
void
run
()
{
try
{
nemopaySession
.
getAllMyRights
();
Thread
.
sleep
(
100
);
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
fatal
(
FoundationsOptionsActivity
.
this
,
getString
(
R
.
string
.
foundation_list_collecting
),
e
.
getMessage
());
}
});
}
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
changeLoading
(
getString
(
R
.
string
.
foundation_list_collecting
));
}
});
try
{
final
JsonNode
rightList
=
nemopaySession
.
getRequest
().
getJSONResponse
();
nemopaySession
.
getFoundations
();
Thread
.
sleep
(
100
);
final
JsonNode
foundationList
=
nemopaySession
.
getRequest
().
getJSONResponse
();
ArrayNode
foundationListWithRights
=
new
ObjectMapper
().
createArrayNode
();
if
(
rightList
.
has
(
"0"
))
{
for
(
JsonNode
element
:
rightList
.
get
(
"0"
))
{
if
(
element
.
textValue
().
equals
(
"GESARTICLE"
))
{
foundationListWithRights
=
(
ArrayNode
)
foundationList
;
break
;
}
}
}
if
(
foundationListWithRights
.
size
()
==
0
)
{
for
(
final
JsonNode
foundation
:
foundationList
)
{
if
(!
foundation
.
has
(
"name"
)
||
!
foundation
.
has
(
"fun_id"
))
throw
new
Exception
(
"Unexpected JSON"
);
if
(
rightList
.
has
(
Integer
.
toString
(
foundation
.
get
(
"fun_id"
).
intValue
())))
{
for
(
JsonNode
element
:
rightList
.
get
(
Integer
.
toString
(
foundation
.
get
(
"fun_id"
).
intValue
())))
{
if
(
element
.
textValue
().
equals
(
"GESARTICLE"
))
{
foundationListWithRights
.
add
(
foundation
);
break
;
}
}
}
}
}
final
ArrayNode
finalFoundationListWithRights
=
foundationListWithRights
;
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
if
(
finalFoundationListWithRights
.
size
()
==
0
)
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
getString
(
R
.
string
.
user_rights_list_collecting
),
nemopaySession
.
forbidden
(
new
String
[]{
"GESARTICLE"
},
false
));
else
{
final
LayoutInflater
layoutInflater
=
LayoutInflater
.
from
(
FoundationsOptionsActivity
.
this
);
final
View
popupView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_list
,
null
);
final
ListView
listView
=
popupView
.
findViewById
(
R
.
id
.
list_groups
);
try
{
final
FoundationsAdapter
foundationsAdapter
=
new
FoundationsAdapter
(
FoundationsOptionsActivity
.
this
,
finalFoundationListWithRights
);
listView
.
setOnItemClickListener
(
new
ListView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
nemopaySession
.
setFoundation
(
foundationsAdapter
.
getFoundationId
(
position
),
foundationsAdapter
.
getFoundationName
(
position
),
-
1
);
startEditActivity
(
FoundationsOptionsActivity
.
this
);
}
});
listView
.
setAdapter
(
foundationsAdapter
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
fatal
(
FoundationsOptionsActivity
.
this
,
getString
(
R
.
string
.
foundation_list_collecting
),
e
.
getMessage
());
}
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
FoundationsOptionsActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
article
)
.
setView
(
popupView
)
.
setCancelable
(
false
)
.
setNegativeButton
(
R
.
string
.
cancel
,
null
);
dialog
.
createDialog
(
alertDialogBuilder
);
}
}
});
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
fatal
(
FoundationsOptionsActivity
.
this
,
getString
(
R
.
string
.
foundation_list_collecting
),
e
.
getMessage
());
}
});
}
}
}.
start
();
}
}
app/src/main/java/fr/utc/simde/jessy/SellActivity.java
0 → 100644
View file @
1319d374
package
fr.utc.simde.jessy
;
import
android.os.Bundle
;
import
android.os.Vibrator
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.TabHost
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
java.util.ArrayList
;
import
java.util.List
;
import
fr.utc.simde.jessy.fragments.ArticleGroupFragment
;
import
fr.utc.simde.jessy.fragments.SellFragment
;
import
fr.utc.simde.jessy.tools.Panier
;
/**
* Created by Samy on 20/11/2017.
*/
public
class
SellActivity
extends
ArticleGroupActivity
{
private
static
final
String
LOG_TAG
=
"_SellActivity"
;
protected
Panier
panier
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
TextView
textView
=
findViewById
(
R
.
id
.
text_price
);
this
.
panier
=
new
Panier
(
textView
);
generate
();
}
@Override
protected
void
onIdentification
(
final
String
badgeId
)
{
if
(
dialog
.
isShowing
())
return
;
if
(
this
.
panier
.
isEmpty
())
startBuyerInfoActivity
(
SellActivity
.
this
,
badgeId
);
else
pay
(
badgeId
);
}
public
void
clearPanier
()
{
for
(
ArticleGroupFragment
groupFragment
:
groupFragmentList
)
groupFragment
.
clear
();
panier
.
clear
();
}
public
void
setBackgroundColor
(
int
color
)
{
this
.
tabHost
.
setBackgroundColor
(
color
);
new
Thread
(){
@Override
public
void
run
()
{
try
{
Thread
.
sleep
(
2500
);