Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
363cde93
authored
Sep 05, 2017
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
PCB v1.3 beta
parent
ab62fca5
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
137 additions
and
26 deletions
android/Pictogram/commonlibrary/build.gradle
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/PCBDBHelper.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/NetService.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/tools/PCBcontext.java
android/Pictogram/commonlibrary/src/main/res/values-en/strings.xml
android/Pictogram/commonlibrary/src/main/res/values-es/strings.xml
android/Pictogram/commonlibrary/src/main/res/values/strings.xml
android/Pictogram/supervisor_tablet/src/main/java/com/yottacode/pictogram/supervisor_tablet/net/VersionManager.java
android/Pictogram/supervisor_tablet/src/main/res/values-en/strings.xml
android/Pictogram/supervisor_tablet/src/main/res/values-es/strings.xml
android/Pictogram/supervisor_tablet/src/main/res/values/strings.xml
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/VocabularyManager.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/net/NetServiceTablet.java
android/Pictogram/watch/src/main/java/com/yottacode/pictogram/watch/net/NetServiceWatch.java
android/Pictogram/yotta_tablet/src/main/java/com/yottacode/pictogram/yotta_tablet/net/VersionManager.java
android/Pictogram/yotta_tablet/src/main/java/com/yottacode/pictogram/yotta_tablet/net/com/yottacode/pictogram/yotta_tablet/net/VersionManager.java
android/Pictogram/yotta_tablet/src/main/res/values-en/strings.xml
android/Pictogram/yotta_tablet/src/main/res/values-es/strings.xml
android/Pictogram/yotta_tablet/src/main/res/values/strings.xml
android/Pictogram/commonlibrary/build.gradle
View file @
363cde93
...
@@ -8,7 +8,7 @@ android {
...
@@ -8,7 +8,7 @@ android {
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
21
targetSdkVersion
21
versionCode
1
versionCode
1
versionName
"1.
2
"
versionName
"1.
3
"
resValue
"string"
,
"db_name"
,
"PCB.db"
resValue
"string"
,
"db_name"
,
"PCB.db"
resValue
"integer"
,
"db_version"
,
"8"
resValue
"integer"
,
"db_version"
,
"8"
//resValue "string", "app_version", "1.1"
//resValue "string", "app_version", "1.1"
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/PCBDBHelper.java
View file @
363cde93
...
@@ -31,7 +31,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
...
@@ -31,7 +31,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
final
String
LOG_TAG
=
this
.
getClass
().
getCanonicalName
();
final
String
LOG_TAG
=
this
.
getClass
().
getCanonicalName
();
User
currentUser
;
User
currentUser
;
boolean
user_online
;
//true if the given user logged into the server
boolean
user_online
;
//true if the given user logged into the server
boolean
user_valid
;
//true if the given user has a valid license
/**
/**
* Create a helper object to create, open, and/or manage a database.
* Create a helper object to create, open, and/or manage a database.
*
*
...
@@ -42,12 +42,16 @@ public class PCBDBHelper extends SQLiteOpenHelper {
...
@@ -42,12 +42,16 @@ public class PCBDBHelper extends SQLiteOpenHelper {
public
PCBDBHelper
(
CursorFactory
factory
,
int
version
,
User
user
)
{
public
PCBDBHelper
(
CursorFactory
factory
,
int
version
,
User
user
)
{
super
(
PCBcontext
.
getContext
(),
DeviceHelper
.
getDBName
(
PCBcontext
.
getContext
()),
factory
,
DeviceHelper
.
getDBVersion
(
PCBcontext
.
getContext
()));
super
(
PCBcontext
.
getContext
(),
DeviceHelper
.
getDBName
(
PCBcontext
.
getContext
()),
factory
,
DeviceHelper
.
getDBVersion
(
PCBcontext
.
getContext
()));
this
.
user_online
=
false
;
this
.
user_online
=
false
;
this
.
user_valid
=
true
;
this
.
setCurrentUser
(
user
==
null
?
this
.
getCurrentUser
()
:
user
);
this
.
setCurrentUser
(
user
==
null
?
this
.
getCurrentUser
()
:
user
);
}
}
public
boolean
isUser_online
()
{
return
this
.
user_online
;}
public
boolean
isUser_online
()
{
return
this
.
user_online
;}
public
void
user_online
(
boolean
user_online
)
{
this
.
user_online
=
user_online
;}
public
void
user_online
(
boolean
user_online
)
{
this
.
user_online
=
user_online
;}
public
boolean
isUser_valid
()
{
return
this
.
user_valid
;}
public
void
user_valid
(
boolean
user_valid
)
{
this
.
user_valid
=
user_valid
;}
/**
/**
* Save the current user of the PCB. It is required to retrieve the last user.
* Save the current user of the PCB. It is required to retrieve the last user.
*
*
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/NetService.java
View file @
363cde93
package
com
.
yottacode
.
pictogram
.
net
;
package
com
.
yottacode
.
pictogram
.
net
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.util.Log
;
import
android.util.Log
;
import
com.yottacode.net.RestapiWrapper
;
import
com.yottacode.net.RestapiWrapper
;
...
@@ -154,7 +155,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
...
@@ -154,7 +155,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
@Override
@Override
public
void
result
(
JSONObject
result
)
{
public
void
result
(
JSONObject
result
)
{
try
{
try
{
final
float
version
=
Float
.
valueOf
(
result
.
getString
(
"version"
))
;
final
float
version
=
((
float
)(
Float
.
valueOf
(
result
.
getString
(
"version"
)).
intValue
()*
10
))/
10
;
if
(
PCBcontext
.
getActivityContext
()
!=
null
&&
version
>
DeviceHelper
.
getAppVersion
()
&&
newVersionContext
!=
PCBcontext
.
getActivityContext
())
{
if
(
PCBcontext
.
getActivityContext
()
!=
null
&&
version
>
DeviceHelper
.
getAppVersion
()
&&
newVersionContext
!=
PCBcontext
.
getActivityContext
())
{
newVersionContext
=
PCBcontext
.
getActivityContext
();
// prevent from showing several times the alert
newVersionContext
=
PCBcontext
.
getActivityContext
();
// prevent from showing several times the alert
...
@@ -292,7 +293,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
...
@@ -292,7 +293,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
void
build
();
void
build
();
void
closeNotifyStatus
();
void
closeNotifyStatus
();
void
restart_app
(
boolean
direct_login
);
void
restart_app
(
boolean
direct_login
);
void
updateUserConfig
(
User
user
);
void
updateUserConfig
(
User
user
,
boolean
valid_license
);
}
}
}
}
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/tools/PCBcontext.java
View file @
363cde93
...
@@ -81,7 +81,9 @@ public final class PCBcontext {
...
@@ -81,7 +81,9 @@ public final class PCBcontext {
studentTalk
=
new
StudentTalk
(
room
,
new
StudentTalk
.
iStudentListener
[]
{
new
StudentTalk
.
iStudentListener
()
{
studentTalk
=
new
StudentTalk
(
room
,
new
StudentTalk
.
iStudentListener
[]
{
new
StudentTalk
.
iStudentListener
()
{
@Override
@Override
public
void
change
(
User
updatedStudent
,
JSONObject
license
)
{
public
void
change
(
User
updatedStudent
,
JSONObject
license
)
{
boolean
valid_license
;
try
{
try
{
valid_license
=
license
.
getBoolean
(
"isValid"
);
if
(!
license
.
getBoolean
(
"isValid"
)
&&
license
.
getBoolean
(
"isTrial"
))
{
if
(!
license
.
getBoolean
(
"isValid"
)
&&
license
.
getBoolean
(
"isTrial"
))
{
AlertDialog
.
Builder
builder1
=
new
AlertDialog
.
Builder
(
activityContext
);
AlertDialog
.
Builder
builder1
=
new
AlertDialog
.
Builder
(
activityContext
);
builder1
.
setMessage
(
R
.
string
.
loginNoLicenseMsg
);
builder1
.
setMessage
(
R
.
string
.
loginNoLicenseMsg
);
...
@@ -100,6 +102,7 @@ public final class PCBcontext {
...
@@ -100,6 +102,7 @@ public final class PCBcontext {
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"No license attr! "
+
license
.
toString
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"No license attr! "
+
license
.
toString
());
valid_license
=
true
;
}
}
PCBcontext
.
getDevice
().
insertUser
(
updatedStudent
);
PCBcontext
.
getDevice
().
insertUser
(
updatedStudent
);
...
@@ -108,7 +111,7 @@ public final class PCBcontext {
...
@@ -108,7 +111,7 @@ public final class PCBcontext {
PCBcontext
.
getNetService
().
restart_app
(
false
);
PCBcontext
.
getNetService
().
restart_app
(
false
);
else
{
else
{
PCBcontext
.
getPcbdb
().
setCurrentUser
(
updatedStudent
);
PCBcontext
.
getPcbdb
().
setCurrentUser
(
updatedStudent
);
PCBcontext
.
getNetService
().
getNetServiceDevice
().
updateUserConfig
(
updatedStudent
);
PCBcontext
.
getNetService
().
getNetServiceDevice
().
updateUserConfig
(
updatedStudent
,
valid_license
);
}
}
}
}
...
@@ -144,11 +147,7 @@ public final class PCBcontext {
...
@@ -144,11 +147,7 @@ public final class PCBcontext {
* logged
* logged
*/
*/
public
static
boolean
is_user_offline
()
{
public
static
boolean
is_user_offline
()
{
if
(
pcbdb
==
null
)
{
return
pcbdb
==
null
?
false
:
!
getPcbdb
().
isUser_online
();
return
false
;
}
else
{
return
!
getPcbdb
().
isUser_online
();
}
}
}
public
static
boolean
is_user_online
()
{
public
static
boolean
is_user_online
()
{
...
...
android/Pictogram/commonlibrary/src/main/res/values-en/strings.xml
View file @
363cde93
...
@@ -79,4 +79,12 @@
...
@@ -79,4 +79,12 @@
<string
name=
"titleCropper"
>
New pictogram
</string>
<string
name=
"titleCropper"
>
New pictogram
</string>
<string
name=
"uploadingImage"
>
Uploading image
</string>
<string
name=
"uploadingImage"
>
Uploading image
</string>
<string
name=
"toStudentList"
>
Student list
</string>
<string
name=
"toStudentList"
>
Student list
</string>
<string
name=
"fa_certificate"
>

</string>
<string
name=
"fa_flask"
>

</string>
<string
name=
"fa_exclamation_triangle"
>

</string>
<string
name=
"fa_user_plus"
>

</string>
<string
name=
"google_play_student_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.yotta_tablet
</string>
<string
name=
"google_play_supervisor_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.supervisor_tablet
</string>
</resources>
</resources>
android/Pictogram/commonlibrary/src/main/res/values-es/strings.xml
View file @
363cde93
...
@@ -75,7 +75,11 @@
...
@@ -75,7 +75,11 @@
<string
name=
"default_tts_voice_male"
>
es-es-x-ana#male_1-local
</string>
<string
name=
"default_tts_voice_male"
>
es-es-x-ana#male_1-local
</string>
<string
name=
"default_tts_voice_female"
>
es-es-x-ana#female_2-local
</string>
<string
name=
"default_tts_voice_female"
>
es-es-x-ana#female_2-local
</string>
<string
name=
"toStudentList"
>
Lista de estudiantes
</string>
<string
name=
"toStudentList"
>
Lista de estudiantes
</string>
<string
name=
"fa_certificate"
>

</string>
<string
name=
"fa_flask"
>

</string>
<string
name=
"fa_exclamation_triangle"
>

</string>
<string
name=
"fa_user_plus"
>

</string>
<string
name=
"google_play_student_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.yotta_tablet
</string>
<string
name=
"google_play_supervisor_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.supervisor_tablet
</string>
</resources>
</resources>
android/Pictogram/commonlibrary/src/main/res/values/strings.xml
View file @
363cde93
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<string
name=
"app_name"
>
Pictogram Tablet
</string>
<string
name=
"app_name"
>
Pictogram Tablet
</string>
<string
name=
"action_settings"
>
Parámetros
</string>
<string
name=
"action_settings"
>
Parámetros
</string>
<string
name=
"title_activity_login"
>
Entrada de usuarios
</string>
<string
name=
"title_activity_login"
>
Entrada de usuarios
</string>
...
@@ -85,5 +84,6 @@
...
@@ -85,5 +84,6 @@
<string
name=
"fa_flask"
>

</string>
<string
name=
"fa_flask"
>

</string>
<string
name=
"fa_exclamation_triangle"
>

</string>
<string
name=
"fa_exclamation_triangle"
>

</string>
<string
name=
"fa_user_plus"
>

</string>
<string
name=
"fa_user_plus"
>

</string>
<string
name=
"google_play_student_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.yotta_tablet
</string>
<string
name=
"google_play_supervisor_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.supervisor_tablet
</string>
</resources>
</resources>
android/Pictogram/supervisor_tablet/src/main/java/com/yottacode/pictogram/supervisor_tablet/net/VersionManager.java
View file @
363cde93
...
@@ -26,7 +26,7 @@ public class VersionManager implements iVersionManager {
...
@@ -26,7 +26,7 @@ public class VersionManager implements iVersionManager {
public
void
newVersionAlert
(
final
float
version
,
final
Context
context
,
final
float
vnew
)
{
public
void
newVersionAlert
(
final
float
version
,
final
Context
context
,
final
float
vnew
)
{
final
SpannableString
s
=
new
SpannableString
(
context
.
getResources
().
getString
(
R
.
string
.
google_play_apk
));
final
SpannableString
s
=
new
SpannableString
(
context
.
getResources
().
getString
(
R
.
string
.
google_play_
supervisor_
apk
));
final
TextView
tx1
=
new
TextView
(
context
);
final
TextView
tx1
=
new
TextView
(
context
);
tx1
.
setText
(
"\t"
+
context
.
getResources
().
getString
(
R
.
string
.
new_version_detail
)
+
tx1
.
setText
(
"\t"
+
context
.
getResources
().
getString
(
R
.
string
.
new_version_detail
)
+
...
...
android/Pictogram/supervisor_tablet/src/main/res/values-en/strings.xml
View file @
363cde93
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
<resources>
<resources>
<string
name=
"app_name"
>
Pictogram Tablet Supervisor
</string>
<string
name=
"app_name"
>
Pictogram Tablet Supervisor
</string>
<string
name=
"new_version_detail"
>
Please, go to Google Play to download the new version
</string>
<string
name=
"new_version_detail"
>
Please, go to Google Play to download the new version
</string>
https://play.google.com/store/apps/details?id=com.yottacode.supervisor_tablet
</resources>
</resources>
android/Pictogram/supervisor_tablet/src/main/res/values-es/strings.xml
View file @
363cde93
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
<resources>
<resources>
<string
name=
"app_name"
>
Pictogram Tablet Supervisor
</string>
<string
name=
"app_name"
>
Pictogram Tablet Supervisor
</string>
<string
name=
"new_version_detail"
>
Por favor, descargue la nueva versión en Google Play
</string>
<string
name=
"new_version_detail"
>
Por favor, descargue la nueva versión en Google Play
</string>
</resources>
</resources>
android/Pictogram/supervisor_tablet/src/main/res/values/strings.xml
View file @
363cde93
...
@@ -2,4 +2,5 @@
...
@@ -2,4 +2,5 @@
<resources>
<resources>
<string
name=
"app_name"
>
Pictogram Tablet Supervisor
</string>
<string
name=
"app_name"
>
Pictogram Tablet Supervisor
</string>
<string
name=
"new_version_detail"
>
Please, go to Google Play to download the new version
</string>
<string
name=
"new_version_detail"
>
Please, go to Google Play to download the new version
</string>
</resources>
</resources>
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/VocabularyManager.java
View file @
363cde93
...
@@ -777,9 +777,11 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
...
@@ -777,9 +777,11 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
}
else
if
(
firstTouchX
>
event
.
getX
()
+
150
)
{
//derecha a izquierda
}
else
if
(
firstTouchX
>
event
.
getX
()
+
150
)
{
//derecha a izquierda
// Pasa de VocabularyManager a SessionActivity
// Pasa de VocabularyManager a SessionActivity
if
(!
PCBcontext
.
getNetService
().
online
())
{
if
(!
PCBcontext
.
getNetService
().
online
())
GUITools
.
show_alert
(
VocabularyManager
.
this
,
R
.
string
.
session_noinet
);
GUITools
.
show_alert
(
VocabularyManager
.
this
,
R
.
string
.
session_noinet
);
}
else
{
else
if
(!
PCBcontext
.
getPcbdb
().
isUser_valid
())
GUITools
.
show_alert
(
VocabularyManager
.
this
,
R
.
string
.
loginExpiredLicenseMsg
);
else
{
nextActivity
=
new
Intent
(
this
,
SessionActivity
.
class
);
nextActivity
=
new
Intent
(
this
,
SessionActivity
.
class
);
in
=
R
.
anim
.
leftin
;
in
=
R
.
anim
.
leftin
;
out
=
R
.
anim
.
leftout
;
out
=
R
.
anim
.
leftout
;
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/net/NetServiceTablet.java
View file @
363cde93
...
@@ -97,7 +97,8 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
...
@@ -97,7 +97,8 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
}
}
public
void
setVOCA
(
VOCA
VOCA
)
{
this
.
VOCA
=
VOCA
;}
public
void
setVOCA
(
VOCA
VOCA
)
{
this
.
VOCA
=
VOCA
;}
public
void
updateUserConfig
(
User
user
)
{
public
void
updateUserConfig
(
User
user
,
boolean
valid_license
)
{
if
(
this
.
VOCA
!=
null
)
this
.
VOCA
.
setConfig
();
if
(
this
.
VOCA
!=
null
)
this
.
VOCA
.
setConfig
();
PCBcontext
.
getPcbdb
().
user_valid
(
valid_license
);
}
}
}
}
android/Pictogram/watch/src/main/java/com/yottacode/pictogram/watch/net/NetServiceWatch.java
View file @
363cde93
...
@@ -53,7 +53,7 @@ public class NetServiceWatch implements NetService.iNetServiceDevice {
...
@@ -53,7 +53,7 @@ public class NetServiceWatch implements NetService.iNetServiceDevice {
}
}
@Override
@Override
public
void
updateUserConfig
(
User
user
)
{
public
void
updateUserConfig
(
User
user
,
boolean
valid_license
)
{
}
}
...
...
android/Pictogram/yotta_tablet/src/main/java/com/yottacode/pictogram/yotta_tablet/net/VersionManager.java
View file @
363cde93
package
com
.
yottacode
.
pictogram
.
yotta_tablet
.
net
;
package
com
.
yottacode
.
pictogram
.
yotta_tablet
.
net
;
import
android.app.AlertDialog
;
import
android.app.DownloadManager
;
import
android.app.DownloadManager
;
import
android.app.ProgressDialog
;
import
android.app.ProgressDialog
;
import
android.content.BroadcastReceiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.IntentFilter
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.text.SpannableString
;
import
android.text.method.LinkMovementMethod
;
import
android.text.util.Linkify
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.widget.TextView
;
import
com.yottacode.pictogram.dao.DeviceHelper
;
import
com.yottacode.pictogram.dao.DeviceHelper
;
import
com.yottacode.pictogram.net.iVersionManager
;
import
com.yottacode.pictogram.net.iVersionManager
;
...
@@ -18,6 +25,8 @@ import com.yottacode.tools.GUITools;
...
@@ -18,6 +25,8 @@ import com.yottacode.tools.GUITools;
import
java.io.File
;
import
java.io.File
;
import
static
android
.
app
.
Activity
.
RESULT_OK
;
/**
/**
* Created by Fernando on 10/03/2017.
* Created by Fernando on 10/03/2017.
*/
*/
...
@@ -26,6 +35,42 @@ public class VersionManager implements iVersionManager {
...
@@ -26,6 +35,42 @@ public class VersionManager implements iVersionManager {
static
final
String
LOG_TAG
=
VersionManager
.
class
.
getCanonicalName
();
static
final
String
LOG_TAG
=
VersionManager
.
class
.
getCanonicalName
();
public
void
newVersionAlert
(
final
float
version
,
final
Context
context
,
final
float
vnew
)
{
public
void
newVersionAlert
(
final
float
version
,
final
Context
context
,
final
float
vnew
)
{
final
SpannableString
s
=
new
SpannableString
(
context
.
getResources
().
getString
(
R
.
string
.
google_play_student_apk
));
final
TextView
tx1
=
new
TextView
(
context
);
tx1
.
setText
(
"\t"
+
context
.
getResources
().
getString
(
R
.
string
.
new_version_detail
)
+
"\n\t\t"
+
s
);
tx1
.
setTextSize
(
16
);
tx1
.
setAutoLinkMask
(
RESULT_OK
);
tx1
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
Linkify
.
addLinks
(
s
,
Linkify
.
WEB_URLS
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
);
builder
.
setTitle
(
context
.
getResources
().
getString
(
R
.
string
.
app_name
)+
": "
+
context
.
getResources
().
getString
(
R
.
string
.
new_version_title
)+
" v"
+
vnew
)
.
setCancelable
(
false
)
.
setPositiveButton
(
"OK"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
DeviceHelper
.
setAppVersion
(
vnew
);
}
})
.
setView
(
tx1
).
setOnKeyListener
(
new
DialogInterface
.
OnKeyListener
()
{
@Override
public
boolean
onKey
(
DialogInterface
dialog
,
int
keyCode
,
KeyEvent
event
)
{
return
false
;
}
}).
show
();
PCBcontext
.
setActivityContext
(
null
);
}
/*
public void newVersionAlert(final float version, final Context context, final float vnew) {
GUITools.show_alert(
GUITools.show_alert(
PCBcontext.getActivityContext(), R.string.new_version_title,
PCBcontext.getActivityContext(), R.string.new_version_title,
PCBcontext.getContext().getResources().getString(R.string.new_version_detail)+" v" + version, new GUITools.iOKListener() {
PCBcontext.getContext().getResources().getString(R.string.new_version_detail)+" v" + version, new GUITools.iOKListener() {
...
@@ -78,5 +123,5 @@ public class VersionManager implements iVersionManager {
...
@@ -78,5 +123,5 @@ public class VersionManager implements iVersionManager {
}
}
}
}
, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
}
*/
}
}
android/Pictogram/yotta_tablet/src/main/java/com/yottacode/pictogram/yotta_tablet/net/com/yottacode/pictogram/yotta_tablet/net/VersionManager.java
View file @
363cde93
package
com
.
yottacode
.
pictogram
.
yotta_tablet
.
net
.
com
.
yottacode
.
pictogram
.
yotta_tablet
.
net
;
package
com
.
yottacode
.
pictogram
.
yotta_tablet
.
net
.
com
.
yottacode
.
pictogram
.
yotta_tablet
.
net
;
import
android.app.AlertDialog
;
import
android.app.DownloadManager
;
import
android.app.DownloadManager
;
import
android.app.ProgressDialog
;
import
android.app.ProgressDialog
;
import
android.content.BroadcastReceiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.IntentFilter
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.text.SpannableString
;
import
android.text.method.LinkMovementMethod
;
import
android.text.util.Linkify
;
import
android.view.KeyEvent
;
import
android.widget.TextView
;
import
com.yottacode.pictogram.dao.DeviceHelper
;
import
com.yottacode.pictogram.dao.DeviceHelper
;
import
com.yottacode.pictogram.net.iVersionManager
;
import
com.yottacode.pictogram.net.iVersionManager
;
...
@@ -17,13 +24,15 @@ import com.yottacode.tools.GUITools;
...
@@ -17,13 +24,15 @@ import com.yottacode.tools.GUITools;
import
java.io.File
;
import
java.io.File
;
import
static
android
.
app
.
Activity
.
RESULT_OK
;
/**
/**
* Created by Fernando on 10/03/2017.
* Created by Fernando on 10/03/2017.
*/
*/
public
class
VersionManager
implements
iVersionManager
{
public
class
VersionManager
implements
iVersionManager
{
static
final
String
LOG_TAG
=
VersionManager
.
class
.
getCanonicalName
();
static
final
String
LOG_TAG
=
VersionManager
.
class
.
getCanonicalName
();
/*
public void newVersionAlert(final float version, final Context context, final float vnew) {
public void newVersionAlert(final float version, final Context context, final float vnew) {
GUITools.show_alert(
GUITools.show_alert(
PCBcontext.getActivityContext(), R.string.new_version_title,
PCBcontext.getActivityContext(), R.string.new_version_title,
...
@@ -76,5 +85,41 @@ public class VersionManager implements iVersionManager {
...
@@ -76,5 +85,41 @@ public class VersionManager implements iVersionManager {
}
}
}
}
, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}*/
public
void
newVersionAlert
(
final
float
version
,
final
Context
context
,
final
float
vnew
)
{
final
SpannableString
s
=
new
SpannableString
(
context
.
getResources
().
getString
(
R
.
string
.
google_play_student_apk
));
final
TextView
tx1
=
new
TextView
(
context
);
tx1
.
setText
(
"\t"
+
context
.
getResources
().
getString
(
R
.
string
.
new_version_detail
)
+
"\n\t\t"
+
s
);
tx1
.
setTextSize
(
16
);
tx1
.
setAutoLinkMask
(
RESULT_OK
);
tx1
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
Linkify
.
addLinks
(
s
,
Linkify
.
WEB_URLS
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
);
builder
.
setTitle
(
context
.
getResources
().
getString
(
R
.
string
.
app_name
)+
": "
+
context
.
getResources
().
getString
(
R
.
string
.
new_version_title
)+
" v"
+
vnew
)
.
setCancelable
(
false
)
.
setPositiveButton
(
"OK"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
DeviceHelper
.
setAppVersion
(
vnew
);
}
})
.
setView
(
tx1
).
setOnKeyListener
(
new
DialogInterface
.
OnKeyListener
()
{
@Override
public
boolean
onKey
(
DialogInterface
dialog
,
int
keyCode
,
KeyEvent
event
)
{
return
false
;
}
}).
show
();
PCBcontext
.
setActivityContext
(
null
);
}
}
}
}
android/Pictogram/yotta_tablet/src/main/res/values-en/strings.xml
View file @
363cde93
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<string
name=
"app_name"
>
Pictogram Tablet
</string>
<string
name=
"app_name"
>
Pictogram Tablet
</string>
<string
name=
"ilegal_user"
>
There is not any supervisor named
</string>
<string
name=
"ilegal_user"
>
There is not any supervisor named
</string>
<string
name=
"new_version_detail"
>
Pulse OK para proceder con la instalación
</string>
<string
name=
"new_version_detail"
>
Pulse OK para proceder con la instalación
</string>
<
string
name=
"new_version_downloading"
>
Please wait, downloading new version
</string
>
<
!-- <string name="new_version_downloading">Please wait, downloading new version </string> --
>
</resources>
</resources>
android/Pictogram/yotta_tablet/src/main/res/values-es/strings.xml
View file @
363cde93
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<string
name=
"app_name"
>
Pictogram Tablet
</string>
<string
name=
"app_name"
>
Pictogram Tablet
</string>
<string
name=
"ilegal_user"
>
No existe ningún supervisor
</string>
<string
name=
"ilegal_user"
>
No existe ningún supervisor
</string>
<string
name=
"new_version_detail"
>
Pulse OK para proceder con la instalación
</string>
<string
name=
"new_version_detail"
>
Pulse OK para proceder con la instalación
</string>
<string
name=
"new_version_downloading"
>
Por favor espere, descargando nueva versión
</string
>
<!-- <string name="new_version_downloading">Por favor espere, descargando nueva versión </string> --
>
</resources>
</resources>
android/Pictogram/yotta_tablet/src/main/res/values/strings.xml
View file @
363cde93
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
<resources>
<resources>
<string
name=
"app_name"
>
Pictogram Tablet
</string>
<string
name=
"app_name"
>
Pictogram Tablet
</string>
<string
name=
"ilegal_user"
>
There is not any supervisor named
</string>
<string
name=
"ilegal_user"
>
There is not any supervisor named
</string>
<string
name=
"new_version_detail"
>
Pulse OK para proceder con la instalación
</string>
<string
name=
"new_version_detail"
>
Por favor, visite Google Play para instalar la nueva versión
</string>
<string
name=
"new_version_downloading"
>
Por favor espere, descargando nueva versión
</string>
<!-- <string name="new_version_downloading">Por favor espere, descargando nueva versión </string> -->
</resources>
</resources>
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