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
cc1b1898
Commit
cc1b1898
authored
Dec 07, 2017
by
Nastuzzi Samy
Browse files
Merge branch 'release/v0.11.0'
parents
2605ea09
14a64220
Changes
42
Expand all
Hide whitespace changes
Inline
Side-by-side
PayUTC 0.1
0.2
.apk
→
PayUTC 0.1
1.0
.apk
View file @
cc1b1898
No preview for this file type
app/src/main/AndroidManifest.xml
View file @
cc1b1898
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"fr.utc.simde.jessy"
android:versionCode=
"3
2
"
android:versionName=
"0.1
0.2
"
>
android:versionCode=
"3
3
"
android:versionName=
"0.1
1.0
"
>
<uses-permission
android:name=
"android.permission.NFC"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
...
...
@@ -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 @
cc1b1898
...
...
@@ -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
param
Button
;
protected
ImageButton
option
Button
;
protected
ImageButton
deleteButton
;
protected
TabHost
tabHost
;
protected
Panier
panier
;
protected
List
<
GroupFragment
>
groupFragmentList
;
protected
List
<
ArticleGroupFragment
>
groupFragmentList
;
protected
int
nbrGroups
;
@Override
...
...
@@ -52,16 +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
.
optionButton
=
findViewById
(
R
.
id
.
image_param
);
this
.
deleteButton
=
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
)
createCategories
(
new
ObjectMapper
().
readTree
(
getIntent
().
getExtras
().
getString
(
"categoryList"
)),
getIntent
().
getExtras
().
getIntegerArrayList
(
"categoryListAuthorized"
),
new
ObjectMapper
().
readTree
(
getIntent
().
getExtras
().
getString
(
"articleList"
)));
...
...
@@ -92,132 +86,12 @@ public class ArticleGroupActivity extends BaseActivity {
});
}
this
.
paramButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
config
.
getFoundationId
()
==
-
1
)
{
final
View
popupView
=
LayoutInflater
.
from
(
ArticleGroupActivity
.
this
).
inflate
(
R
.
layout
.
dialog_config
,
null
,
false
);
final
RadioButton
radioKeyboard
=
popupView
.
findViewById
(
R
.
id
.
radio_keyboard
);
final
RadioButton
radioCategory
=
popupView
.
findViewById
(
R
.
id
.
radio_category
);
final
RadioButton
radioGrid
=
popupView
.
findViewById
(
R
.
id
.
radio_grid
);
final
RadioButton
radioList
=
popupView
.
findViewById
(
R
.
id
.
radio_list
);
final
Switch
switchCotisant
=
popupView
.
findViewById
(
R
.
id
.
swtich_cotisant
);
final
Switch
swtich18
=
popupView
.
findViewById
(
R
.
id
.
swtich_18
);
final
Button
configButton
=
popupView
.
findViewById
(
R
.
id
.
button_config
);
if
(
config
.
getInCategory
())
radioCategory
.
setChecked
(
true
);
else
radioKeyboard
.
setChecked
(
true
);
if
(
config
.
getInGrid
())
radioGrid
.
setChecked
(
true
);
else
radioList
.
setChecked
(
true
);
switchCotisant
.
setChecked
(
config
.
getPrintCotisant
());
swtich18
.
setChecked
(
config
.
getPrint18
());
configButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
final
View
view
)
{
hasRights
(
getString
(
R
.
string
.
configurate_by_default
),
new
String
[]{
"STAFF"
,
"GESAPPLICATIONS"
},
new
Runnable
()
{
@Override
public
void
run
()
{
configDialog
();
}
});
}
});
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
ArticleGroupActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
configuration
)
.
setView
(
popupView
)
.
setCancelable
(
false
)
.
setPositiveButton
(
R
.
string
.
reload
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
config
.
setInCategory
(
radioCategory
.
isChecked
());
config
.
setInGrid
(
radioGrid
.
isChecked
());
config
.
setPrintCotisant
(
switchCotisant
.
isChecked
());
config
.
setPrint18
(
swtich18
.
isChecked
());
startArticleGroupActivity
(
ArticleGroupActivity
.
this
);
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
null
);
dialog
.
createDialog
(
alertDialogBuilder
);
}
else
{
final
View
popupView
=
LayoutInflater
.
from
(
ArticleGroupActivity
.
this
).
inflate
(
R
.
layout
.
dialog_config_restore
,
null
,
false
);
final
Switch
switchCotisant
=
popupView
.
findViewById
(
R
.
id
.
swtich_cotisant
);
final
Switch
swtich18
=
popupView
.
findViewById
(
R
.
id
.
swtich_18
);
final
Button
configButton
=
popupView
.
findViewById
(
R
.
id
.
button_config
);
switchCotisant
.
setChecked
(
config
.
getPrintCotisant
());
swtich18
.
setChecked
(
config
.
getPrint18
());
configButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
hasRights
(
getString
(
R
.
string
.
configurate_by_default
),
new
String
[]{
"STAFF"
,
"GESAPPLICATIONS"
},
new
Runnable
()
{
@Override
public
void
run
()
{
config
.
setFoundation
(-
1
,
""
);
config
.
setLocation
(-
1
,
""
);
config
.
setCanCancel
(
true
);
startMainActivity
(
ArticleGroupActivity
.
this
);
}
});
}
});
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
ArticleGroupActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
configuration
)
.
setView
(
popupView
)
.
setCancelable
(
false
)
.
setPositiveButton
(
R
.
string
.
reload
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
config
.
setPrintCotisant
(
switchCotisant
.
isChecked
());
config
.
setPrint18
(
swtich18
.
isChecked
());
startArticleGroupActivity
(
ArticleGroupActivity
.
this
);
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
null
);
dialog
.
createDialog
(
alertDialogBuilder
);
}
}
});
this
.
deleteButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
clearPanier
();
}
});
setOptionButton
();
setDeleteButton
();
}
@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
abstract
void
setDeleteButton
();
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 +193,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
();
...
...
@@ -431,13 +217,11 @@ public class ArticleGroupActivity extends BaseActivity {
ArrayNode
articlesForThisCategory
=
articlesPerCategory
.
get
(
category
.
get
(
"id"
).
intValue
());
if
(
config
.
getFoundationId
()
!=
-
1
)
if
(!
authorizedList
.
contains
(
category
.
get
(
"id"
).
intValue
()))
continue
;
else
if
(
articlesForThisCategory
.
size
()
==
0
)
continue
;
if
(
articlesForThisCategory
==
null
)
continue
;
articlesForThisCategory
=
new
ObjectMapper
().
createArrayNode
()
;
createNewGroup
(
category
.
get
(
"name"
).
textValue
(),
articlesForThisCategory
);
createNewGroup
(
category
.
get
(
"name"
).
textValue
(),
category
.
get
(
"id"
).
intValue
(),
articlesForThisCategory
);
}
}
...
...
@@ -481,24 +265,10 @@ public class ArticleGroupActivity extends BaseActivity {
articlesForThisKeyboard
.
add
(
new
ObjectMapper
().
createObjectNode
());
}
if
(
articlesForThisKeyboard
.
size
()
==
0
)
continue
;
createNewGroup
(
keyboard
.
get
(
"name"
).
textValue
(),
articlesForThisKeyboard
,
keyboard
.
get
(
"data"
).
get
(
"nbColumns"
).
isInt
()
?
keyboard
.
get
(
"data"
).
get
(
"nbColumns"
).
intValue
()
:
Integer
.
valueOf
(
keyboard
.
get
(
"data"
).
get
(
"nbColumns"
).
textValue
()));
createNewGroup
(
keyboard
.
get
(
"name"
).
textValue
(),
keyboard
.
get
(
"id"
).
intValue
(),
articlesForThisKeyboard
,
keyboard
.
get
(
"data"
).
get
(
"nbColumns"
).
isInt
()
?
keyboard
.
get
(
"data"
).
get
(
"nbColumns"
).
intValue
()
:
Integer
.
valueOf
(
keyboard
.
get
(
"data"
).
get
(
"nbColumns"
).
textValue
()));
}
}
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
Integer
id
,
final
ArrayNode
articleList
)
throws
Exception
;
protected
abstract
void
createNewGroup
(
final
String
name
,
final
Integer
id
,
final
ArrayNode
articleList
,
int
gridColumns
)
throws
Exception
;
}
app/src/main/java/fr/utc/simde/jessy/BaseActivity.java
View file @
cc1b1898
...
...
@@ -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,11 +20,10 @@ 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
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -35,6 +32,8 @@ import java.util.List;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
fr.utc.simde.jessy.responses.BottomatikResponse
;
import
fr.utc.simde.jessy.tools.Bottomatik
;
import
fr.utc.simde.jessy.tools.CASConnexion
;
import
fr.utc.simde.jessy.tools.Config
;
import
fr.utc.simde.jessy.tools.Dialog
;
...
...
@@ -196,7 +195,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 +247,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
...
...
@@ -511,6 +517,8 @@ public abstract class BaseActivity extends InternetActivity {
});
else
throw
new
Exception
(
""
);
return
;
}
catch
(
Exception
e1
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
...
...
@@ -549,6 +557,9 @@ public abstract class BaseActivity extends InternetActivity {
}
protected
void
setNemopayKey
(
final
String
key
)
{
if
(
key
.
equals
(
""
))
return
;
dialog
.
startLoading
(
BaseActivity
.
this
,
getString
(
R
.
string
.
nemopay_connection
),
getString
(
R
.
string
.
nemopay_authentification
));
new
Thread
()
{
...
...
@@ -590,12 +601,16 @@ public abstract class BaseActivity extends InternetActivity {
}.
start
();
}
protected
void
setGingerKey
(
final
String
key
)
{
protected
void
setKey
(
final
String
name
,
final
String
key
)
{
if
(
name
.
equals
(
""
)
||
key
.
equals
(
""
))
return
;
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putString
(
"key_
ginger"
,
key
);
editor
.
putString
(
"key_
"
+
name
,
key
);
editor
.
apply
();
ginger
.
setKey
(
key
);
if
(
name
.
equals
(
"ginger"
))
ginger
.
setKey
(
key
);
}
protected
boolean
haveStoragePermission
()
{
...
...
@@ -661,7 +676,19 @@ public abstract class BaseActivity extends InternetActivity {
}
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
null
);
.
setNegativeButton
(
R
.
string
.
cancel
,
null
)
.
setNeutralButton
(
R
.
string
.
set_download
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
if
(!
haveStoragePermission
())
{
updateDialog
.
stopLoading
();
updateDialog
.
errorDialog
(
BaseActivity
.
this
,
getString
(
R
.
string
.
update
),
getString
(
R
.
string
.
need_storage_permission
));
}
else
if
(!
update
(
matcher
.
group
(
2
),
true
))
{
updateDialog
.
stopLoading
();
updateDialog
.
errorDialog
(
BaseActivity
.
this
,
getString
(
R
.
string
.
download
),
getString
(
R
.
string
.
can_not_download
));
}
}
});
updateDialog
.
createDialog
(
alertDialogBuilder
);
}
...
...
@@ -689,7 +716,8 @@ public abstract class BaseActivity extends InternetActivity {
}.
start
();
}
protected
boolean
update
(
final
String
version
)
{
protected
boolean
update
(
final
String
version
)
{
return
update
(
version
,
false
);
}
protected
boolean
update
(
final
String
version
,
final
boolean
downloadOnly
)
{
final
String
destination
=
this
.
downloadLocation
+
getString
(
R
.
string
.
app_name
)
+
" "
+
version
+
".apk"
;
final
String
url
=
this
.
gitUrl
+
getString
(
R
.
string
.
app_name
)
+
" "
+
version
+
".apk"
;
final
Uri
uri
=
Uri
.
parse
(
"file://"
+
destination
);
...
...
@@ -706,16 +734,28 @@ public abstract class BaseActivity extends InternetActivity {
final
DownloadManager
manager
=
(
DownloadManager
)
getSystemService
(
DOWNLOAD_SERVICE
);
final
long
downloadId
=
manager
.
enqueue
(
request
);
BroadcastReceiver
onComplete
=
new
BroadcastReceiver
()
{
public
void
onReceive
(
Context
ctx
,
Intent
intent
)
{
Intent
install
=
new
Intent
(
Intent
.
ACTION_VIEW
);
install
.
setDataAndType
(
uri
,
"application/vnd.android.package-archive"
);
install
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
install
);
BroadcastReceiver
onComplete
;
if
(
downloadOnly
)
{
onComplete
=
new
BroadcastReceiver
()
{
public
void
onReceive
(
Context
ctx
,
Intent
intent
)
{
new
Dialog
(
BaseActivity
.
this
).
infoDialog
(
BaseActivity
.
this
,
getString
(
R
.
string
.
download
),
getString
(
R
.
string
.
download_successful
));
unregisterReceiver
(
this
);
}
};
unregisterReceiver
(
this
);
}
};
}
else
{
onComplete
=
new
BroadcastReceiver
()
{
public
void
onReceive
(
Context
ctx
,
Intent
intent
)
{
Intent
install
=
new
Intent
(
Intent
.
ACTION_VIEW
);
install
.
setDataAndType
(
uri
,
"application/vnd.android.package-archive"
);
install
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
install
);
unregisterReceiver
(
this
);
}
};
}
registerReceiver
(
onComplete
,
new
IntentFilter
(
DownloadManager
.
ACTION_DOWNLOAD_COMPLETE
));
...
...
app/src/main/java/fr/utc/simde/jessy/BuyerInfoActivity.java
View file @
cc1b1898
...
...
@@ -124,9 +124,14 @@ public class BuyerInfoActivity extends BaseActivity {
}
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
BuyerInfoActivity
.
this
);
if
(
article
.
get
(
"variable_price"
).
booleanValue
())
alertDialogBuilder
.
setMessage
(
getString
(
R
.
string
.
ask_cancel_transaction
)
+
" "
+
article
.
get
(
"name"
).
textValue
()
+
" (total: "
+
String
.
format
(
"%.2f"
,
new
Float
(
article
.
get
(
"price"
).
intValue
())
*
article
.
get
(
"quantity"
).
intValue
()
/
100.00f
)
+
"€) ?"
);
else
alertDialogBuilder
.
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
)
+
"€) ?"
);
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
)
{
...
...
app/src/main/java/fr/utc/simde/jessy/EditActivity.java
0 → 100644
View file @
cc1b1898
This diff is collapsed.
Click to expand it.
app/src/main/java/fr/utc/simde/jessy/FoundationsOptionsActivity.java
View file @
cc1b1898
...
...
@@ -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
;
...
...
@@ -87,7 +88,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 +121,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
))
...
...
@@ -132,7 +133,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
else
if
(
isOption
(
position
,
6
))