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
fb7e115c
Commit
fb7e115c
authored
Nov 19, 2017
by
Nastuzzi Samy
Browse files
Merge branch 'release/v0.10.0'
parents
56bc4e7e
f97da0f3
Changes
15
Hide whitespace changes
Inline
Side-by-side
PayUTC 0.
9.5
.apk
→
PayUTC 0.
10.0
.apk
View file @
fb7e115c
No preview for this file type
app/build.gradle
View file @
fb7e115c
...
...
@@ -30,4 +30,5 @@ dependencies {
compile
files
(
'libs/jackson-core-2.9.2.jar'
)
compile
files
(
'libs/jackson-databind-2.9.2.jar'
)
compile
files
(
'libs/jackson-annotations-2.9.2.jar'
)
compile
'me.dm7.barcodescanner:zxing:1.9'
}
app/src/main/AndroidManifest.xml
View file @
fb7e115c
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"fr.utc.simde.jessy"
android:versionCode=
"
29
"
android:versionName=
"0.
9.5
"
>
android:versionCode=
"
30
"
android:versionName=
"0.
10.0
"
>
<uses-permission
android:name=
"android.permission.NFC"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.VIBRATE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<application
android:allowBackup=
"true"
...
...
@@ -41,6 +42,9 @@
<activity
android:name=
"fr.utc.simde.jessy.ArticleGroupActivity"
android:configChanges=
"orientation"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"fr.utc.simde.jessy.QRCodeReaderActivity"
android:configChanges=
"orientation"
android:screenOrientation=
"portrait"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/fr/utc/simde/jessy/BaseActivity.java
View file @
fb7e115c
...
...
@@ -602,6 +602,19 @@ public abstract class BaseActivity extends InternetActivity {
return
true
;
}
protected
boolean
haveCameraPermission
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
if
(
checkSelfPermission
(
Manifest
.
permission
.
CAMERA
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
return
true
;
}
else
{
ActivityCompat
.
requestPermissions
(
this
,
new
String
[]{
Manifest
.
permission
.
CAMERA
},
1
);
return
false
;
}
}
else
return
true
;
}
protected
void
checkUpdate
()
{
checkUpdate
(
true
);
}
protected
void
checkUpdate
(
final
boolean
popupIfNot
)
{
final
Dialog
updateDialog
=
new
Dialog
(
BaseActivity
.
this
);
...
...
@@ -667,6 +680,13 @@ public abstract class BaseActivity extends InternetActivity {
}.
start
();
}
protected
void
startQRCodeReaderActivity
(
final
Activity
activity
)
{
if
(
haveCameraPermission
())
startActivity
(
new
Intent
(
activity
,
QRCodeReaderActivity
.
class
));
else
dialog
.
errorDialog
(
BaseActivity
.
this
,
getString
(
R
.
string
.
qrcode
),
getString
(
R
.
string
.
need_camera_permission
));
}
protected
boolean
update
(
final
String
version
)
{
final
String
destination
=
this
.
downloadLocation
+
getString
(
R
.
string
.
app_name
)
+
" "
+
version
+
".apk"
;
final
String
url
=
this
.
gitUrl
+
getString
(
R
.
string
.
app_name
)
+
" "
+
version
+
".apk"
;
...
...
app/src/main/java/fr/utc/simde/jessy/BuyerInfoActivity.java
View file @
fb7e115c
...
...
@@ -50,6 +50,11 @@ public class BuyerInfoActivity extends BaseActivity {
this
.
textSolde
=
findViewById
(
R
.
id
.
text_solde
);
this
.
linearLayout
=
findViewById
(
R
.
id
.
layout_articles
);
if
(
getIntent
().
getExtras
()
==
null
||
getIntent
().
getExtras
().
getString
(
"buyerInfo"
)
==
null
)
{
generateNoPurchase
(
getString
(
R
.
string
.
badge_waiting
));
return
;
}
try
{
JsonNode
buyerInfo
=
new
ObjectMapper
().
readTree
(
getIntent
().
getExtras
().
getString
(
"buyerInfo"
));
this
.
badgeId
=
getIntent
().
getExtras
().
getString
(
"badgeId"
);
...
...
@@ -73,21 +78,27 @@ public class BuyerInfoActivity extends BaseActivity {
}
@Override
protected
void
onIdentification
(
final
String
badgeId
)
{
}
protected
void
onIdentification
(
final
String
badgeId
)
{
startBuyerInfoActivity
(
BuyerInfoActivity
.
this
,
badgeId
);
}
protected
void
generateNoPurchase
(
final
String
text
)
{
TextView
noPurchase
=
new
TextView
(
this
);
noPurchase
.
setText
(
text
);
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
);
}
protected
void
generatePurchases
()
throws
Exception
{
if
(
this
.
lastPurchaseList
.
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
);
generateNoPurchase
(
getString
(
R
.
string
.
no_purchases
)
+
(
foundationName
.
equals
(
""
)
?
""
:
"\n("
+
foundationName
+
")"
));
}
else
{
generateArticleList
();
...
...
@@ -106,83 +117,86 @@ public class BuyerInfoActivity extends BaseActivity {
return
;
}
if
(
article
.
get
(
"fundation_id"
).
intValue
()
==
-
1
)
{
dialog
.
infoDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
getString
(
R
.
string
.
cant_cancel_other
));
return
;
}
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
BuyerInfoActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
cancel_transaction
)
.
setMessage
(
getString
(
R
.
string
.
ask_cancel_transaction
)
+
" "
+
Integer
.
toString
(
article
.
get
(
"quantity"
).
intValue
())
+
"x "
+
article
.
get
(
"name"
).
textValue
()
+
" (total: "
+
String
.
format
(
"%.2f"
,
new
Float
(
article
.
get
(
"price"
).
intValue
())
/
100.00f
)
+
"€) ?"
)
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
cancel
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
new
Thread
()
{
@Override
public
void
run
()
{
if
(
nemopaySession
.
getFoundationId
()
!=
-
1
)
{
try
{
nemopaySession
.
cancelTransaction
(
nemopaySession
.
getFoundationId
(),
article
.
get
(
"purchase_id"
).
intValue
());
Thread
.
sleep
(
100
);
.
setTitle
(
R
.
string
.
cancel_transaction
)
.
setMessage
(
getString
(
R
.
string
.
ask_cancel_transaction
)
+
" "
+
Integer
.
toString
(
article
.
get
(
"quantity"
).
intValue
())
+
"x "
+
article
.
get
(
"name"
).
textValue
()
+
" (total: "
+
String
.
format
(
"%.2f"
,
new
Float
(
article
.
get
(
"price"
).
intValue
())
/
100.00f
)
+
"€) ?"
)
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
cancel
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
new
Thread
()
{
@Override
public
void
run
()
{
try
{
nemopaySession
.
cancelTransaction
(
article
.
get
(
"fundation_id"
).
intValue
(),
article
.
get
(
"purchase_id"
).
intValue
());
Thread
.
sleep
(
100
);
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
BuyerInfoActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
cancel_transaction
)
.
setMessage
(
getString
(
R
.
string
.
transaction_canceled
))
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
try
{
startBuyerInfoActivity
(
BuyerInfoActivity
.
this
,
badgeId
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
dialog
.
errorDialog
(
BuyerInfoActivity
.
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
();
}
});
}
}
});
dialog
.
createDialog
(
alertDialogBuilder
);
}
});
}
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
();
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
BuyerInfoActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
cancel_transaction
)
.
setMessage
(
getString
(
R
.
string
.
transaction_canceled
))
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
try
{
startBuyerInfoActivity
(
BuyerInfoActivity
.
this
,
badgeId
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
dialog
.
errorDialog
(
BuyerInfoActivity
.
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
();
}
});
}
}
});
dialog
.
createDialog
(
alertDialogBuilder
);
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
response
.
get
(
"error"
).
get
(
"message"
).
textValue
());
}
});
}
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
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
response
.
get
(
"error"
).
get
(
"message"
).
textValue
());
}
});
}
else
throw
new
Exception
(
""
);
}
catch
(
Exception
e1
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
e
.
getMessage
());
}
});
}
else
throw
new
Exception
(
""
);
}
catch
(
Exception
e1
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
e
.
getMessage
());
}
}
}
);
}
}
}.
start
();
}
})
.
setNegativeButton
(
R
.
string
.
do_nothing
,
null
);
}
}.
start
();
}
})
.
setNegativeButton
(
R
.
string
.
do_nothing
,
null
);
dialog
.
createDialog
(
alertDialogBuilder
);
}
...
...
@@ -216,30 +230,28 @@ public class BuyerInfoActivity extends BaseActivity {
@Override
public
void
run
()
{
ArrayNode
articleFoundationList
=
new
ObjectMapper
().
createArrayNode
();
if
(
nemopaySession
.
getFoundationId
()
!=
-
1
)
{
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
();
articleFoundationList
=
(
ArrayNode
)
request
.
getJSONResponse
();
for
(
final
JsonNode
article
:
articleFoundationList
)
{
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
()
!=
nemopaySession
.
getFoundationId
())
throw
new
Exception
(
"Unexpected JSON"
);
}
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
article_list_collecting
),
e
.
getMessage
());
}
});
try
{
nemopaySession
.
getArticles
();
Thread
.
sleep
(
100
);
// Toute une série de vérifications avant de lancer l'activité
final
HTTPRequest
request
=
nemopaySession
.
getRequest
();
articleFoundationList
=
(
ArrayNode
)
request
.
getJSONResponse
();
for
(
final
JsonNode
article
:
articleFoundationList
)
{
if
(!
article
.
has
(
"id"
)
||
!
article
.
has
(
"price"
)
||
!
article
.
has
(
"name"
)
||
!
article
.
has
(
"cotisant"
)
||
!
article
.
has
(
"alcool"
)
||
!
article
.
has
(
"categorie_id"
)
||
!
article
.
has
(
"image_url"
)
||
!
article
.
has
(
"fundation_id"
))
throw
new
Exception
(
"Unexpected JSON"
);
}
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
article_list_collecting
),
e
.
getMessage
());
}
});
}
final
ArrayNode
articleList
=
new
ObjectMapper
().
createArrayNode
();
...
...
@@ -270,6 +282,7 @@ public class BuyerInfoActivity extends BaseActivity {
"\"price\":"
+
Integer
.
toString
(
purchase
.
get
(
"pur_price"
).
intValue
())
+
", "
+
"\"quantity\":"
+
Math
.
round
(
purchase
.
get
(
"pur_qte"
).
floatValue
())
+
", "
+
"\"purchase_id\":"
+
purchase
.
get
(
"pur_id"
).
intValue
()
+
", "
+
"\"fundation_id\":-1, "
+
"\"info\":\""
+
getString
(
R
.
string
.
realized_by_other
)
+
"\", "
+
"\"canceled\":\""
+
Boolean
.
toString
(
purchase
.
get
(
"pur_removed"
).
booleanValue
())
+
"\", "
+
"\"image_url\":\"\"}"
...
...
app/src/main/java/fr/utc/simde/jessy/CardManagementActivity.java
View file @
fb7e115c
...
...
@@ -77,96 +77,89 @@ public class CardManagementActivity extends BaseActivity {
this
.
textCotisantGinger
=
findViewById
(
R
.
id
.
text_cotisant_ginger
);
this
.
textTagGinger
=
findViewById
(
R
.
id
.
text_tag_ginger
);
findViewById
(
R
.
id
.
read_new_card
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
dialog
.
infoDialog
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
badge_read
),
getString
(
R
.
string
.
badge_waiting
),
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
toRun
=
null
;
}
});
toRun
=
1
;
}
});
findViewById
(
R
.
id
.
contribute
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
dialog
.
infoDialog
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
contribute
),
getString
(
R
.
string
.
badge_waiting
),
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
toRun
=
null
;
toRun
=
0
;
}
});
toRun
=
2
;
}
});
this
.
toRun
=
0
;
}
@Override
protected
void
onIdentification
(
final
String
badgeId
)
{
if
(
this
.
toRun
!
=
null
)
{
this
.
badgeId
=
badgeId
;
if
(
this
.
toRun
=
=
null
)
return
;
if
(
toRun
==
1
)
{
dialog
.
startLoading
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
buyer_info_collecting
));
new
Thread
(){
@Override
public
void
run
()
{
readCard
();
}
}.
start
();
}
else
if
(
toRun
==
2
)
{
hasRights
(
getString
(
R
.
string
.
contribute
),
new
String
[]{
"GESUSERS"
},
true
,
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
dismiss
();
final
View
view
=
getLayoutInflater
().
inflate
(
R
.
layout
.
dialog_contribute
,
null
);
final
RadioGroup
radioGroup
=
view
.
findViewById
(
R
.
id
.
radio_type
);
final
RadioButton
radioButton
=
view
.
findViewById
(
R
.
id
.
radio_student
);
final
EditText
editText
=
view
.
findViewById
(
R
.
id
.
nbr_days
);
radioButton
.
setChecked
(
true
);
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
CardManagementActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
contribute
)
.
setView
(
view
)
.
setCancelable
(
false
)
.
setPositiveButton
(
R
.
string
.
contribute
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
dialog
.
startLoading
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
buyer_info_collecting
));
new
Thread
(){
@Override
public
void
run
()
{
int
id
=
radioGroup
.
indexOfChild
(
radioGroup
.
findViewById
(
radioGroup
.
getCheckedRadioButtonId
()));
if
(
contributeCard
(
id
==
3
?
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
(
new
Date
().
getTime
()
+
(
Long
.
parseLong
(
String
.
valueOf
(
editText
.
getText
()))
*
86400000L
)))
:
(
Integer
.
parseInt
(
new
SimpleDateFormat
(
"MM"
).
format
(
new
Date
()))
>
8
?
Integer
.
toString
(
Integer
.
parseInt
(
new
SimpleDateFormat
(
"yyyy"
).
format
(
new
Date
()))
+
1
)
:
new
SimpleDateFormat
(
"yyyy"
).
format
(
new
Date
()))
+
"-08-31"
,
id
<
2
?
20
:
1
))
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Toast
.
makeText
(
CardManagementActivity
.
this
,
R
.
string
.
contribute_now
,
Toast
.
LENGTH_LONG
).
show
();
}
});
readCard
();
}
}.
start
();
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
null
);
dialog
.
createDialog
(
alertDialogBuilder
,
editText
);
}
});
}
this
.
badgeId
=
badgeId
;
if
(
this
.
toRun
==
0
)
{
dialog
.
startLoading
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
buyer_info_collecting
));
new
Thread
(){
@Override
public
void
run
()
{
readCard
();
}
}.
start
();
}
else
if
(
this
.
toRun
==
1
)
dialog
.
infoDialog
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
"Pas encore fait"
);
else
if
(
this
.
toRun
==
2
)
{
this
.
toRun
=
null
;
hasRights
(
getString
(
R
.
string
.
contribute
),
new
String
[]{
"GESUSERS"
},
true
,
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
dismiss
();
final
View
view
=
getLayoutInflater
().
inflate
(
R
.
layout
.
dialog_contribute
,
null
);
final
RadioGroup
radioGroup
=
view
.
findViewById
(
R
.
id
.
radio_type
);
final
RadioButton
radioButton
=
view
.
findViewById
(
R
.
id
.
radio_student
);
final
EditText
editText
=
view
.
findViewById
(
R
.
id
.
nbr_days
);
radioButton
.
setChecked
(
true
);
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
CardManagementActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
contribute
)
.
setView
(
view
)
.
setCancelable
(
false
)
.
setPositiveButton
(
R
.
string
.
contribute
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
dialog
.
startLoading
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
buyer_info_collecting
));
new
Thread
(){
@Override
public
void
run
()
{
int
id
=
radioGroup
.
indexOfChild
(
radioGroup
.
findViewById
(
radioGroup
.
getCheckedRadioButtonId
()));
if
(
contributeCard
(
id
==
3
?
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
(
new
Date
().
getTime
()
+
(
Long
.
parseLong
(
String
.
valueOf
(
editText
.
getText
()))
*
86400000L
)))
:
(
Integer
.
parseInt
(
new
SimpleDateFormat
(
"MM"
).
format
(
new
Date
()))
>
8
?
Integer
.
toString
(
Integer
.
parseInt
(
new
SimpleDateFormat
(
"yyyy"
).
format
(
new
Date
()))
+
1
)
:
new
SimpleDateFormat
(
"yyyy"
).
format
(
new
Date
()))
+
"-08-31"
,
id
<
2
?
20
:
1
))
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Toast
.
makeText
(
CardManagementActivity
.
this
,
R
.
string
.
contribute_now
,
Toast
.
LENGTH_LONG
).
show
();
}
});
readCard
();
}
}.
start
();
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
toRun
=
0
;
}});
dialog
.
createDialog
(
alertDialogBuilder
,
editText
);
}
});
}
}
...
...
@@ -269,6 +262,7 @@ public class CardManagementActivity extends BaseActivity {
@Override
public
void
run
()
{
dialog
.
errorDialog
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
badge_error_not_recognized
));
toRun
=
0
;
}
});
...
...
@@ -317,6 +311,7 @@ public class CardManagementActivity extends BaseActivity {
@Override
public
void
run
()
{
dialog
.
errorDialog
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
user_not_recognized
));
toRun
=
0
;
}
});
else
...
...
@@ -352,6 +347,7 @@ public class CardManagementActivity extends BaseActivity {
@Override
public
void
run
()
{
dialog
.
errorDialog
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
user_not_recognized
));
toRun
=
0
;
}
});
else
...
...
@@ -396,6 +392,7 @@ public class CardManagementActivity extends BaseActivity {
public
void
run
()
{
setUserInfo
(
userInfo
.
get
(
"user"
),
userInfo
.
get
(
"tag"
),
gingerInfo
);
dialog
.
stopLoading
();
toRun
=
0
;
}
});
}
catch
(
final
Exception
e
)
{
...
...
@@ -407,6 +404,7 @@ public class CardManagementActivity extends BaseActivity {
@Override
public
void
run
()
{
dialog
.
errorDialog
(
CardManagementActivity
.
this
,
getString
(
R
.
string
.
information_collection
),
getString
(
R
.
string
.
user_error_collecting
));
toRun
=
0
;
}
});
else
...
...
app/src/main/java/fr/utc/simde/jessy/FoundationsOptionsActivity.java
View file @
fb7e115c
package
fr.utc.simde.jessy
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.StrictMode
;
import
android.support.v7.app.AlertDialog
;
...
...
@@ -114,8 +115,10 @@ public class FoundationsOptionsActivity extends BaseActivity {
this
.
optionList
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
final
int
position
,
long
id
)
{
if
(
isOption
(
position
,
0
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.10"
);
if
(
isOption
(
position
,
0
))
{
nemopaySession
.
setFoundation
(-
1
,
""
,
-
1
);
startActivity
(
new
Intent
(
FoundationsOptionsActivity
.
this
,
BuyerInfoActivity
.
class
));
}
else
if
(
isOption
(
position
,
1
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.11"
);
else
if
(
isOption
(
position
,
2
))
...
...
@@ -123,7 +126,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
else
if
(
isOption
(
position
,
3
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.12"
);
else
if
(
isOption
(
position
,
4
))
dialog
.
infoDialog
(
FoundationsOptionsActivity
.
this
,
"Non encore fait"
,
"Pour la version 0.10"
);
startQRCodeReaderActivity
(
FoundationsOptionsActivity
.
this
);
else
if
(
isOption
(
position
,
5
))