Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
QR-code-reader
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
QR-code-reader
Commits
b1052491
Commit
b1052491
authored
Oct 06, 2016
by
djamel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gestion des places pour mineur
parent
3d8e3ed7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
105 additions
and
64 deletions
+105
-64
Development/.idea/vcs.xml
Development/.idea/vcs.xml
+1
-1
Development/app/build/outputs/apk/app-debug.apk
Development/app/build/outputs/apk/app-debug.apk
+0
-0
Development/app/src/main/java/djamelfel/gala/Key_List.java
Development/app/src/main/java/djamelfel/gala/Key_List.java
+11
-3
Development/app/src/main/java/djamelfel/gala/Login.java
Development/app/src/main/java/djamelfel/gala/Login.java
+1
-1
Development/app/src/main/java/djamelfel/gala/Read_QR_Code.java
...opment/app/src/main/java/djamelfel/gala/Read_QR_Code.java
+80
-54
Development/app/src/main/res/values/strings.xml
Development/app/src/main/res/values/strings.xml
+4
-1
Server/README.md
Server/README.md
+4
-2
Server/data/keys.json.example
Server/data/keys.json.example
+4
-2
No files found.
Development/.idea/vcs.xml
View file @
b1052491
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$
/..
"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
Development/app/build/outputs/apk/app-debug.apk
View file @
b1052491
No preview for this file type
Development/app/src/main/java/djamelfel/gala/Key_List.java
View file @
b1052491
...
...
@@ -9,17 +9,20 @@ import java.io.Serializable;
* Created by djamel on 17/10/15.
*/
public
class
Key_List
implements
Parcelable
,
Serializable
{
int
id
;
String
key
;
private
int
id
;
private
String
key
;
private
boolean
is_child
;
public
Key_List
(
int
id
,
String
key
)
{
public
Key_List
(
int
id
,
String
key
,
boolean
is_child
)
{
this
.
id
=
id
;
this
.
key
=
key
;
this
.
is_child
=
is_child
;
}
protected
Key_List
(
Parcel
in
)
{
this
.
id
=
in
.
readInt
();
this
.
key
=
in
.
readString
();
this
.
is_child
=
in
.
readByte
()
!=
0
;
}
public
int
getId
()
{
...
...
@@ -30,6 +33,10 @@ public class Key_List implements Parcelable, Serializable {
return
this
.
key
;
}
public
boolean
getIs_child
()
{
return
this
.
is_child
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
@@ -39,6 +46,7 @@ public class Key_List implements Parcelable, Serializable {
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeInt
(
this
.
id
);
dest
.
writeString
(
this
.
key
);
dest
.
writeByte
((
byte
)
(
this
.
is_child
?
1
:
0
));
}
...
...
Development/app/src/main/java/djamelfel/gala/Login.java
View file @
b1052491
...
...
@@ -76,7 +76,7 @@ public class Login extends ActionBarActivity implements View.OnClickListener {
for
(
int
index
=
0
;
index
<
response
.
length
();
index
++)
{
element
=
response
.
getJSONObject
(
index
);
Key_List
key
=
new
Key_List
(
element
.
getInt
(
"id"
),
element
.
getString
(
"key"
));
(
"key"
)
,
element
.
getBoolean
(
"is_child"
)
);
key_list
.
add
(
key
);
}
}
catch
(
JSONException
e
)
{
...
...
Development/app/src/main/java/djamelfel/gala/Read_QR_Code.java
View file @
b1052491
...
...
@@ -38,7 +38,7 @@ import cz.msebera.android.httpclient.entity.StringEntity;
public
class
Read_QR_Code
extends
ActionBarActivity
implements
View
.
OnClickListener
{
static
final
String
ACTION_SCAN
=
"com.google.zxing.client.android.SCAN"
;
private
static
final
String
ACTION_SCAN
=
"com.google.zxing.client.android.SCAN"
;
private
ArrayList
<
Key_List
>
key_list
=
null
;
private
String
server
;
private
EditText
_nbrPlace
;
...
...
@@ -153,69 +153,95 @@ public class Read_QR_Code extends ActionBarActivity implements View.OnClickListe
// Ticket is valid
idFound
=
true
;
JSONObject
jsonParams
=
new
JSONObject
();
StringEntity
entity
=
null
;
if
(
key
.
getIs_child
())
{
showChildDialog
(
Read_QR_Code
.
this
,
str
[
3
],
nbrPlaceTot
,
nbrPlaceSelect
);
}
else
{
sendRequest
(
str
[
3
],
nbrPlaceTot
,
nbrPlaceSelect
);
}
}
}
}
if
(!
idFound
)
{
display
(
getString
(
R
.
string
.
ebillet_false
),
false
);
}
}
try
{
// Set parameters in JSON structure
jsonParams
.
put
(
"verif"
,
str
[
3
]);
jsonParams
.
put
(
"nb"
,
nbrPlaceTot
);
jsonParams
.
put
(
"qt"
,
nbrPlaceSelect
);
private
AlertDialog
showChildDialog
(
final
Activity
act
,
final
String
hash
,
final
int
nbrPlaceTot
,
final
int
nbrPlaceSelect
)
{
AlertDialog
.
Builder
childDialog
=
new
AlertDialog
.
Builder
(
act
);
childDialog
.
setMessage
(
R
.
string
.
ebillet_mineur
);
childDialog
.
setPositiveButton
(
R
.
string
.
check
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
sendRequest
(
hash
,
nbrPlaceTot
,
nbrPlaceSelect
);
}
});
childDialog
.
setNegativeButton
(
R
.
string
.
cancel
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
display
(
getString
(
R
.
string
.
cancelled
),
true
);
}
});
return
childDialog
.
show
();
}
private
void
sendRequest
(
String
hash
,
int
nbrPlaceTot
,
int
nbrPlaceSelect
)
{
JSONObject
jsonParams
=
new
JSONObject
();
StringEntity
entity
=
null
;
// Set JSON parameters for Post request
entity
=
new
StringEntity
(
jsonParams
.
toString
());
try
{
// Set parameters in JSON structure
jsonParams
.
put
(
"verif"
,
hash
);
jsonParams
.
put
(
"nb"
,
nbrPlaceTot
);
jsonParams
.
put
(
"qt"
,
nbrPlaceSelect
);
// Set JSON parameters for Post request
entity
=
new
StringEntity
(
jsonParams
.
toString
());
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
// Send Post Request
AsyncHttpClient
client
=
new
AsyncHttpClient
();
client
.
setTimeout
(
5000
);
client
.
post
(
this
,
server
+
"/validate"
,
entity
,
"application/json"
,
new
JsonHttpResponseHandler
()
{
@Override
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
JSONObject
response
)
{
try
{
if
(
response
.
getBoolean
(
"valid"
))
{
display
(
getString
(
R
.
string
.
ebillet_true
)
+
String
.
valueOf
(
response
.
getInt
(
"available"
)),
true
);
}
else
if
(
response
.
getInt
(
"available"
)
<
0
)
{
display
(
getString
(
R
.
string
.
ebillet_sizeOff
),
false
);
}
else
{
display
(
getString
(
R
.
string
.
ebillet_false
),
false
);
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
// Send Post Request
AsyncHttpClient
client
=
new
AsyncHttpClient
();
client
.
setTimeout
(
5000
);
client
.
post
(
this
,
server
+
"/validate"
,
entity
,
"application/json"
,
new
JsonHttpResponseHandler
()
{
@Override
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
JSONObject
response
)
{
try
{
if
(
response
.
getBoolean
(
"valid"
))
{
display
(
getString
(
R
.
string
.
ebillet_true
)
+
String
.
valueOf
(
response
.
getInt
(
"available"
)),
true
);
}
else
if
(
response
.
getInt
(
"available"
)
<
0
)
{
display
(
getString
(
R
.
string
.
ebillet_sizeOff
),
false
);
}
else
{
display
(
getString
(
R
.
string
.
ebillet_false
),
false
);
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
String
responseString
,
Throwable
throwable
)
{
display
(
getString
(
R
.
string
.
serverError
),
false
);
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
String
responseString
,
Throwable
throwable
)
{
display
(
getString
(
R
.
string
.
serverError
),
false
);
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
Throwable
throwable
,
JSONObject
errorResponse
)
{
display
(
getString
(
R
.
string
.
serverError
),
false
);
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
Throwable
throwable
,
JSONObject
errorResponse
)
{
display
(
getString
(
R
.
string
.
serverError
),
false
);
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
Throwable
throwable
,
JSONArray
errorResponse
)
{
display
(
getString
(
R
.
string
.
serverError
),
false
);
}
});
}
}
}
if
(!
idFound
)
{
display
(
getString
(
R
.
string
.
ebillet_false
),
false
);
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
Throwable
throwable
,
JSONArray
errorResponse
)
{
display
(
getString
(
R
.
string
.
serverError
),
false
);
}
});
}
/**
...
...
Development/app/src/main/res/values/strings.xml
View file @
b1052491
...
...
@@ -13,7 +13,7 @@
<string
name=
"label_ipAddress"
>
Adresse IP
</string>
<string
name=
"label_port"
>
Numéro de Port
</string>
<string
name=
"connect"
>
Se connecter
</string>
<string
name=
"connecting"
>
Connection en cours
...
</string>
<string
name=
"connecting"
>
Connection en cours
…
</string>
<string
name=
"nbPlace"
>
Nombre de place
</string>
<string
name=
"nbPlaceOversize"
>
Le nombre de place selectionné excéde le nombre de place
disponible pour ce billet
</string>
...
...
@@ -24,4 +24,7 @@
\'192.168.0.1\'
</string>
<string
name=
"errorPORT"
>
Erreur: Vérifiez le numéro de port
</string>
<string
name=
"ex_3"
>
ex: 3
</string>
<string
name=
"ebillet_mineur"
>
Cette place est une place pour mineur !
</string>
<string
name=
"cancel"
>
Annuler
</string>
<string
name=
"cancelled"
>
L\'opération a été annulé
</string>
</resources>
Server/README.md
View file @
b1052491
...
...
@@ -57,11 +57,13 @@ data/keys.json.example
[
{
"id"
:
1120
,
"key"
:
"VDLV7897IEetisuare"
"key"
:
"VDLV7897IEetisuare"
,
"is_child"
:
true
},
{
"id"
:
7988
,
"key"
:
"TISEdodp7897tesiuaV8V"
"key"
:
"TISEdodp7897tesiuaV8V"
,
"is_child"
:
false
}
]
```
...
...
Server/data/keys.json.example
View file @
b1052491
[
{
"id": 1120,
"key": "VDLV7897IEetisuare"
"key": "VDLV7897IEetisuare",
"is_child": true
},
{
"id": 7988,
"key": "TISEdodp7897tesiuaV8V"
"key": "TISEdodp7897tesiuaV8V",
"is_child", false
}
]
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