Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
android-app
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hds
flexin
android-app
Commits
d93cb221
Commit
d93cb221
authored
Dec 19, 2017
by
Nastuzzi Samy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/v0.11.6'
parents
a6cd1616
b03b312c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
27 deletions
+92
-27
app/src/main/java/fr/utc/simde/jessy/QRCodeReaderActivity.java
...rc/main/java/fr/utc/simde/jessy/QRCodeReaderActivity.java
+35
-21
app/src/main/java/fr/utc/simde/jessy/tools/API.java
app/src/main/java/fr/utc/simde/jessy/tools/API.java
+9
-6
app/src/main/res/layout/dialog_reservation_info.xml
app/src/main/res/layout/dialog_reservation_info.xml
+47
-0
app/src/main/res/values/rights.xml
app/src/main/res/values/rights.xml
+1
-0
No files found.
app/src/main/java/fr/utc/simde/jessy/QRCodeReaderActivity.java
View file @
d93cb221
...
@@ -4,12 +4,14 @@ import android.app.Activity;
...
@@ -4,12 +4,14 @@ import android.app.Activity;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Vibrator
;
import
android.os.Vibrator
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AlertDialog
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.ListView
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -113,14 +115,6 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -113,14 +115,6 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
@Override
@Override
public
void
onIdentification
(
final
String
badgeId
)
{
public
void
onIdentification
(
final
String
badgeId
)
{
this
.
scannerView
.
stopCamera
();
this
.
scannerView
.
stopCamera
();
/*
dialog.infoDialog(QRCodeReaderActivity.this, "Badge", badgeId, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
resumeReading();
}
});
*/
new
Thread
()
{
new
Thread
()
{
@Override
@Override
...
@@ -153,7 +147,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -153,7 +147,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
}
}
}
}
handleAPI
(
gingerResponse
.
getLogin
(),
apiIndex
,
gingerResponse
.
getBadge_uid
()
,
false
);
handleAPI
(
gingerResponse
.
getLogin
(),
apiIndex
,
gingerResponse
,
false
);
}
}
}.
start
();
}.
start
();
}
}
...
@@ -226,12 +220,12 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -226,12 +220,12 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
}
}
}
}
handleAPI
(
qrCodeResponse
.
getId
(),
apiIndex
,
gingerResponse
==
null
?
null
:
gingerResponse
.
getBadge_uid
()
,
true
);
handleAPI
(
qrCodeResponse
.
getId
(),
apiIndex
,
gingerResponse
,
true
);
}
}
}.
start
();
}.
start
();
}
}
protected
void
handleAPI
(
final
String
info
,
final
Integer
apiIndex
,
final
String
badgeId
,
final
boolean
byQRCode
)
{
protected
void
handleAPI
(
final
String
info
,
final
Integer
apiIndex
,
final
GingerResponse
gingerResponse
,
final
boolean
byQRCode
)
{
runOnUiThread
(
new
Runnable
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -277,17 +271,17 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -277,17 +271,17 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
switch
(
apiIndex
)
{
switch
(
apiIndex
)
{
case
0
:
case
0
:
payWithBottomatik
(
api
,
(
BottomatikResponse
)
apiResponse
,
badgeId
);
payWithBottomatik
(
api
,
(
BottomatikResponse
)
apiResponse
,
gingerResponse
);
break
;
break
;
case
1
:
case
1
:
case
2
:
case
2
:
checkReservation
(
api
,
(
ReservationResponse
)
apiResponse
);
checkReservation
(
api
,
(
ReservationResponse
)
apiResponse
,
gingerResponse
);
break
;
break
;
}
}
}
}
public
void
payWithBottomatik
(
final
API
api
,
final
BottomatikResponse
bottomatikResponse
,
final
String
badgeId
)
{
public
void
payWithBottomatik
(
final
API
api
,
final
BottomatikResponse
bottomatikResponse
,
final
GingerResponse
gingerResponse
)
{
runOnUiThread
(
new
Runnable
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -357,7 +351,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -357,7 +351,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
try
{
try
{
if
(!
bottomatikResponse
.
isPaid
())
{
if
(!
bottomatikResponse
.
isPaid
())
{
nemopaySession
.
setTransaction
(
badgeId
,
bottomatikResponse
.
getArticleList
(),
bottomatikResponse
.
getFun_id
());
nemopaySession
.
setTransaction
(
gingerResponse
.
getBadge_uid
()
,
bottomatikResponse
.
getArticleList
(),
bottomatikResponse
.
getFun_id
());
Thread
.
sleep
(
100
);
Thread
.
sleep
(
100
);
}
}
...
@@ -525,7 +519,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -525,7 +519,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
}
}
}
}
protected
void
checkReservation
(
final
API
api
,
final
ReservationResponse
reservationResponse
)
{
protected
void
checkReservation
(
final
API
api
,
final
ReservationResponse
reservationResponse
,
final
GingerResponse
gingerResponse
)
{
long
currentTimestamp
=
(
System
.
currentTimeMillis
()
/
1000
);
long
currentTimestamp
=
(
System
.
currentTimeMillis
()
/
1000
);
Log
.
d
(
LOG_TAG
,
"Current time: "
+
currentTimestamp
);
Log
.
d
(
LOG_TAG
,
"Current time: "
+
currentTimestamp
);
...
@@ -547,7 +541,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -547,7 +541,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
.
setNeutralButton
(
R
.
string
.
more
,
new
DialogInterface
.
OnClickListener
()
{
.
setNeutralButton
(
R
.
string
.
more
,
new
DialogInterface
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
seeReservation
(
api
,
reservationResponse
);
seeReservation
(
api
,
reservationResponse
,
gingerResponse
);
}
}
});
});
...
@@ -577,7 +571,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -577,7 +571,7 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
.
setNeutralButton
(
R
.
string
.
more
,
new
DialogInterface
.
OnClickListener
()
{
.
setNeutralButton
(
R
.
string
.
more
,
new
DialogInterface
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
seeReservation
(
api
,
reservationResponse
);
seeReservation
(
api
,
reservationResponse
,
gingerResponse
);
}
}
});
});
...
@@ -592,27 +586,47 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
...
@@ -592,27 +586,47 @@ public class QRCodeReaderActivity extends BaseActivity implements ZXingScannerVi
runOnUiThread
(
new
Runnable
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
seeReservation
(
api
,
reservationResponse
);
seeReservation
(
api
,
reservationResponse
,
gingerResponse
);
}
}
});
});
}
}
protected
void
seeReservation
(
final
API
api
,
final
ReservationResponse
reservationResponse
)
{
protected
void
seeReservation
(
final
API
api
,
final
ReservationResponse
reservationResponse
,
final
GingerResponse
gingerResponse
)
{
final
View
keyView
=
getLayoutInflater
().
inflate
(
R
.
layout
.
dialog_reservation_info
,
null
);
final
View
keyView
=
getLayoutInflater
().
inflate
(
R
.
layout
.
dialog_reservation_info
,
null
);
final
TextView
nameText
=
keyView
.
findViewById
(
R
.
id
.
text_name
);
final
TextView
nameText
=
keyView
.
findViewById
(
R
.
id
.
text_name
);
final
TextView
seanceText
=
keyView
.
findViewById
(
R
.
id
.
text_seance
);
final
TextView
seanceText
=
keyView
.
findViewById
(
R
.
id
.
text_seance
);
final
TextView
priceText
=
keyView
.
findViewById
(
R
.
id
.
text_price
);
final
TextView
priceText
=
keyView
.
findViewById
(
R
.
id
.
text_price
);
final
TextView
adultText
=
keyView
.
findViewById
(
R
.
id
.
text_adult
);
final
TextView
contributerText
=
keyView
.
findViewById
(
R
.
id
.
text_cotisant
);
nameText
.
setText
(
reservationResponse
.
getUsername
());
nameText
.
setText
(
reservationResponse
.
getUsername
());
seanceText
.
setText
(
reservationResponse
.
getSeance
());
seanceText
.
setText
(
reservationResponse
.
getSeance
());
priceText
.
setText
(
reservationResponse
.
getType
());
priceText
.
setText
(
reservationResponse
.
getType
());
if
(
gingerResponse
==
null
)
((
LinearLayout
)
keyView
.
findViewById
(
R
.
id
.
more_info
)).
setVisibility
(
View
.
GONE
);
else
{
if
(
gingerResponse
.
getIs_adulte
())
adultText
.
setText
(
getString
(
R
.
string
.
yes
));
else
{
adultText
.
setText
(
getString
(
R
.
string
.
no
));
adultText
.
setTextColor
(
Color
.
RED
);
}
if
(
gingerResponse
.
getIs_adulte
())
contributerText
.
setText
(
getString
(
R
.
string
.
yes
));
else
{
contributerText
.
setText
(
getString
(
R
.
string
.
no
));
contributerText
.
setTextColor
(
Color
.
RED
);
}
}
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
QRCodeReaderActivity
.
this
);
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
QRCodeReaderActivity
.
this
);
alertDialogBuilder
alertDialogBuilder
.
setTitle
(
getString
(
R
.
string
.
reservation_number
)
+
reservationResponse
.
getReservation_id
())
.
setTitle
(
getString
(
R
.
string
.
reservation_number
)
+
reservationResponse
.
getReservation_id
())
.
setView
(
keyView
)
.
setView
(
keyView
)
.
setCancelable
(
false
)
.
setCancelable
(
false
)
.
setPositiveButton
(
R
.
string
.
register
,
new
DialogInterface
.
OnClickListener
()
{
.
setPositiveButton
(
R
.
string
.
validate
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
dialog
.
startLoading
(
QRCodeReaderActivity
.
this
,
getResources
().
getString
(
R
.
string
.
paiement
),
getResources
().
getString
(
R
.
string
.
ticket_in_validation
));
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
dialog
.
startLoading
(
QRCodeReaderActivity
.
this
,
getResources
().
getString
(
R
.
string
.
paiement
),
getResources
().
getString
(
R
.
string
.
ticket_in_validation
));
new
Thread
()
{
new
Thread
()
{
@Override
@Override
...
...
app/src/main/java/fr/utc/simde/jessy/tools/API.java
View file @
d93cb221
...
@@ -26,6 +26,7 @@ public class API {
...
@@ -26,6 +26,7 @@ public class API {
private
String
notFound
;
private
String
notFound
;
private
String
badRequest
;
private
String
badRequest
;
private
String
internalError
;
private
String
internalError
;
private
String
goneRequest
;
private
String
errorRequest
;
private
String
errorRequest
;
public
API
(
final
Activity
activity
,
final
String
name
,
final
String
url
)
{
public
API
(
final
Activity
activity
,
final
String
name
,
final
String
url
)
{
...
@@ -40,6 +41,7 @@ public class API {
...
@@ -40,6 +41,7 @@ public class API {
this
.
badRequest
=
activity
.
getString
(
R
.
string
.
bad_request
);
this
.
badRequest
=
activity
.
getString
(
R
.
string
.
bad_request
);
this
.
internalError
=
activity
.
getString
(
R
.
string
.
internal_error
);
this
.
internalError
=
activity
.
getString
(
R
.
string
.
internal_error
);
this
.
errorRequest
=
activity
.
getString
(
R
.
string
.
error_request
);
this
.
errorRequest
=
activity
.
getString
(
R
.
string
.
error_request
);
this
.
goneRequest
=
activity
.
getString
(
R
.
string
.
gone_request
);
}
}
public
void
setKey
(
final
String
key
)
{
this
.
key
=
key
;
}
public
void
setKey
(
final
String
key
)
{
this
.
key
=
key
;
}
...
@@ -96,13 +98,14 @@ public class API {
...
@@ -96,13 +98,14 @@ public class API {
else
if
(
responseCode
==
403
)
else
if
(
responseCode
==
403
)
throw
new
Exception
(
this
.
noRight
);
throw
new
Exception
(
this
.
noRight
);
else
if
(
responseCode
==
404
)
else
if
(
responseCode
==
404
)
throw
new
Exception
(
this
.
name
+
" "
+
this
.
notFound
);
throw
new
Exception
(
this
.
serviceText
+
" "
+
this
.
name
+
" "
+
this
.
notFound
);
else
if
(
responseCode
==
400
)
else
if
(
responseCode
==
400
)
throw
new
Exception
(
this
.
name
+
" "
+
this
.
badRequest
);
throw
new
Exception
(
this
.
serviceText
+
" "
+
this
.
name
+
" "
+
this
.
badRequest
);
else
if
(
responseCode
==
500
||
responseCode
==
503
)
{
else
if
(
responseCode
==
500
||
responseCode
==
503
)
throw
new
Exception
(
this
.
name
+
" "
+
this
.
internalError
);
throw
new
Exception
(
this
.
serviceText
+
" "
+
this
.
name
+
" "
+
this
.
internalError
);
}
else
if
(
responseCode
==
410
)
throw
new
Exception
(
this
.
serviceText
+
" "
+
this
.
name
+
" "
+
this
.
goneRequest
);
else
else
throw
new
Exception
(
this
.
name
+
" "
+
this
.
errorRequest
+
" "
+
responseCode
);
throw
new
Exception
(
this
.
serviceText
+
" "
+
this
.
name
+
" "
+
this
.
errorRequest
+
" "
+
responseCode
);
}
}
}
}
app/src/main/res/layout/dialog_reservation_info.xml
View file @
d93cb221
...
@@ -63,4 +63,51 @@
...
@@ -63,4 +63,51 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id=
"@+id/more_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"25dp"
android:layout_marginRight=
"25dp"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"100dp"
android:textColor=
"#000000"
android:layout_height=
"wrap_content"
android:text=
"@string/adult"
/>
<TextView
android:id=
"@+id/text_adult"
android:textColor=
"#000000"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"25dp"
android:layout_marginRight=
"25dp"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"100dp"
android:textColor=
"#000000"
android:layout_height=
"wrap_content"
android:text=
"@string/cotisant"
/>
<TextView
android:id=
"@+id/text_cotisant"
android:textColor=
"#000000"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/rights.xml
View file @
d93cb221
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<string
name=
"not_found"
>
n\'a pas réussi à trouver l\'élement souhaité
</string>
<string
name=
"not_found"
>
n\'a pas réussi à trouver l\'élement souhaité
</string>
<string
name=
"bad_request"
>
n\'a pas compris la requête reçue
</string>
<string
name=
"bad_request"
>
n\'a pas compris la requête reçue
</string>
<string
name=
"internal_error"
>
a renvoyé une erreur interne (contacter un adminstrateur si cela se reproduit)
</string>
<string
name=
"internal_error"
>
a renvoyé une erreur interne (contacter un adminstrateur si cela se reproduit)
</string>
<string
name=
"gone_request"
>
a indiqué que le ticket n\'était plus valide
</string>
<string
name=
"error_request"
>
a renvoyé l\'erreur HTTP suivante:
</string>
<string
name=
"error_request"
>
a renvoyé l\'erreur HTTP suivante:
</string>
<string-array
name=
"rights_keys"
>
<string-array
name=
"rights_keys"
>
<item>
SALESKEYBOARD
</item>
<item>
SALESKEYBOARD
</item>
...
...
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